query
stringlengths
10
3.85k
ru_query
stringlengths
9
3.76k
document
stringlengths
17
430k
metadata
dict
negatives
listlengths
97
100
negative_scores
listlengths
97
100
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Get retrieves the RolloutBlock from the indexer for a given namespace and name.
Get получает RolloutBlock из индексера для заданного пространства имен и имени.
func (s rolloutBlockNamespaceLister) Get(name string) (*v1alpha1.RolloutBlock, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { return nil, errors.NewNotFound(v1alpha1.Resource("rolloutblock"), name) } return obj.(*v1alpha1.RolloutBlock), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s beeNamespaceLister) Get(name string) (*v1beta1.Bee, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"bee\"), name)\n\t}\n\treturn obj.(*v1beta1.Bee), nil\n}", "func (s bundleNamespaceLister) Get(name string) (*v1alpha1.Bundle, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"bundle\"), name)\n\t}\n\treturn obj.(*v1alpha1.Bundle), nil\n}", "func (s sMBNamespaceLister) Get(name string) (*v1.SMB, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"smb\"), name)\n\t}\n\treturn obj.(*v1.SMB), nil\n}", "func (s hookNamespaceLister) Get(name string) (*v1alpha1.Hook, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"hook\"), name)\n\t}\n\treturn obj.(*v1alpha1.Hook), nil\n}", "func (s logicalNetworkNamespaceLister) Get(name string) (*v1.LogicalNetwork, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(r.Resource(\"logicalnetwork\"), name)\n\t}\n\treturn obj.(*v1.LogicalNetwork), nil\n}", "func (nsi namespaceIndex) Get(name string) *namespaceData {\n\tdata := nsi[name]\n\tif data != nil {\n\t\treturn data\n\t}\n\tdata = &namespaceData{}\n\tnsi[name] = data\n\treturn data\n}", "func (api *APIClient) GetBlockByRepoName(repoPieces RepoPieces) (Block, error) {\n\tu, err := url.Parse(fmt.Sprintf(\"%s/api/v1/blocks\", api.baseURL))\n\tif err != nil {\n\t\treturn Block{}, errors.New(\"unable to parse Learn remote\")\n\t}\n\tv := url.Values{}\n\tv.Set(\"repo_name\", repoPieces.RepoName)\n\tv.Set(\"org\", repoPieces.Org)\n\tv.Set(\"origin\", repoPieces.Origin)\n\tu.RawQuery = v.Encode()\n\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Source\", \"gLearn_cli\")\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", api.Credentials.token))\n\n\tres, err := api.client.Do(req)\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn Block{}, fmt.Errorf(\"Error: response status: %d\", res.StatusCode)\n\t}\n\n\tvar blockResp blockResponse\n\terr = json.NewDecoder(res.Body).Decode(&blockResp)\n\tif err != nil {\n\t\treturn Block{}, err\n\t}\n\n\tif len(blockResp.Blocks) == 1 {\n\t\treturn blockResp.Blocks[0], nil\n\t}\n\treturn Block{}, nil\n}", "func (s wafregionalRuleNamespaceLister) Get(name string) (*v1alpha1.WafregionalRule, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"wafregionalrule\"), name)\n\t}\n\treturn obj.(*v1alpha1.WafregionalRule), nil\n}", "func (s volumeCloneSourceNamespaceLister) Get(name string) (*v1beta1.VolumeCloneSource, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"volumeclonesource\"), name)\n\t}\n\treturn obj.(*v1beta1.VolumeCloneSource), nil\n}", "func (s rolloutBlockNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.RolloutBlock, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.RolloutBlock))\n\t})\n\treturn ret, err\n}", "func (s rabbitmqSourceNamespaceLister) Get(name string) (*v1alpha1.RabbitmqSource, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"rabbitmqsource\"), name)\n\t}\n\treturn obj.(*v1alpha1.RabbitmqSource), nil\n}", "func (s monitorMetricAlertruleNamespaceLister) Get(name string) (*v1alpha1.MonitorMetricAlertrule, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"monitormetricalertrule\"), name)\n\t}\n\treturn obj.(*v1alpha1.MonitorMetricAlertrule), nil\n}", "func (s *fsStore) Get(typ namespace.Type, name string) (*namespace.Namespace, error) {\n\tif !s.Exists(typ, name) {\n\t\treturn nil, store.ErrNotExists\n\t}\n\ttrgt := s.targetPath(name, typ)\n\treturn namespace.FromPath(trgt)\n}", "func (s genericNamespaceLister) Get(name string) (*v1alpha1.Generic, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"generic\"), name)\n\t}\n\treturn obj.(*v1alpha1.Generic), nil\n}", "func (s bindingTemplateNamespaceLister) Get(name string) (*experimental.BindingTemplate, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(experimental.Resource(\"bindingtemplate\"), name)\n\t}\n\treturn obj.(*experimental.BindingTemplate), nil\n}", "func (s kogitoSourceNamespaceLister) Get(name string) (*v1alpha1.KogitoSource, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"kogitosource\"), name)\n\t}\n\treturn obj.(*v1alpha1.KogitoSource), nil\n}", "func (c *MultiClusterController) Get(clusterName, namespace, name string) (interface{}, error) {\n\tcluster := c.GetCluster(clusterName)\n\tif cluster == nil {\n\t\treturn nil, errors.NewClusterNotFound(clusterName)\n\t}\n\tinstance := utilscheme.Scheme.NewObject(c.objectType)\n\tdelegatingClient, err := cluster.GetDelegatingClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = delegatingClient.Get(context.TODO(), client.ObjectKey{\n\t\tNamespace: namespace,\n\t\tName: name,\n\t}, instance)\n\treturn instance, err\n}", "func (s targetNamespaceLister) Get(name string) (*v1alpha1.Target, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"target\"), name)\n\t}\n\treturn obj.(*v1alpha1.Target), nil\n}", "func (client Client) Get(resourceGroupName string, name string) (result ResourceType, err error) {\n\treq, err := client.GetPreparer(resourceGroupName, name)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"redis.Client\", \"Get\", nil, \"Failure preparing request\")\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\treturn result, autorest.NewErrorWithError(err, \"redis.Client\", \"Get\", resp, \"Failure sending request\")\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"redis.Client\", \"Get\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (bp RPCBlockProvider) GetBlock(index int) SignedBlockData {\r\n\tvar block SignedBlockData\r\n\terr := bp.Client.Call(\"BlockPropagationHandler.GetBlock\", index, &block)\r\n\tif err != nil {\r\n\t\tlog.Print(err)\r\n\t}\r\n\treturn block\r\n}", "func (s kylinNodeNamespaceLister) Get(name string) (*v1.KylinNode, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"kylinnode\"), name)\n\t}\n\treturn obj.(*v1.KylinNode), nil\n}", "func (s sealedSecretNamespaceLister) Get(name string) (*v1alpha1.SealedSecret, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"sealedsecret\"), name)\n\t}\n\treturn obj.(*v1alpha1.SealedSecret), nil\n}", "func (s elasticDLJobNamespaceLister) Get(name string) (*v1alpha1.ElasticDLJob, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"elasticdljob\"), name)\n\t}\n\treturn obj.(*v1alpha1.ElasticDLJob), nil\n}", "func (s seaOtterNamespaceLister) Get(name string) (*v1alpha1.SeaOtter, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"seaotter\"), name)\n\t}\n\treturn obj.(*v1alpha1.SeaOtter), nil\n}", "func NewRolloutBlockLister(indexer cache.Indexer) RolloutBlockLister {\n\treturn &rolloutBlockLister{indexer: indexer}\n}", "func (s Store) GetBlock (hash string) (*types.FullSignedBlock, error) {\r\n\t// Open badger\r\n\tstor, err := badger.Open(badger.DefaultOptions(s.StorFileLocation))\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tdefer stor.Close()\r\n\r\n\tvar block types.FullSignedBlock\r\n\terr = stor.Update(func(txn *badger.Txn) error {\r\n\t\tbytes, err := readStringIndex (txn, hash, HashKeyPrefix)\r\n\t\tif err != nil{\r\n\t\t\treturn err\r\n\t\t}\r\n\t\terr = json.Unmarshal(bytes, &block)\r\n\r\n\t\treturn err\r\n\t})\r\n\r\n\treturn &block, err\r\n}", "func (s sensuAssetNamespaceLister) Get(name string) (*v1beta1.SensuAsset, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"sensuasset\"), name)\n\t}\n\treturn obj.(*v1beta1.SensuAsset), nil\n}", "func (s cloudformationNamespaceLister) Get(name string) (*v1alpha1.Cloudformation, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"cloudformation\"), name)\n\t}\n\treturn obj.(*v1alpha1.Cloudformation), nil\n}", "func (s knativeEventingNamespaceLister) Get(name string) (*v1beta1.KnativeEventing, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"knativeeventing\"), name)\n\t}\n\treturn obj.(*v1beta1.KnativeEventing), nil\n}", "func (s routeClaimNamespaceLister) Get(name string) (*v1alpha1.RouteClaim, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"routeclaim\"), name)\n\t}\n\treturn obj.(*v1alpha1.RouteClaim), nil\n}", "func (s vulnerabilityNamespaceLister) Get(name string) (*v1alpha1.Vulnerability, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"vulnerability\"), name)\n\t}\n\treturn obj.(*v1alpha1.Vulnerability), nil\n}", "func (s podUnavailableBudgetNamespaceLister) Get(name string) (*v1alpha1.PodUnavailableBudget, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"podunavailablebudget\"), name)\n\t}\n\treturn obj.(*v1alpha1.PodUnavailableBudget), nil\n}", "func (s elasticacheClusterNamespaceLister) Get(name string) (*v1alpha1.ElasticacheCluster, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"elasticachecluster\"), name)\n\t}\n\treturn obj.(*v1alpha1.ElasticacheCluster), nil\n}", "func (b *Bucket) Get(ctx context.Context, name string) (io.ReadCloser, error) {\n\treturn b.getRange(ctx, b.name, name, 0, -1)\n}", "func (s eCRRepositoryNamespaceLister) Get(name string) (*v1alpha1.ECRRepository, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"ecrrepository\"), name)\n\t}\n\treturn obj.(*v1alpha1.ECRRepository), nil\n}", "func (s testRunNamespaceLister) Get(name string) (*v1alpha1.TestRun, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"testrun\"), name)\n\t}\n\treturn obj.(*v1alpha1.TestRun), nil\n}", "func (s computeTargetSSLProxyNamespaceLister) Get(name string) (*v1alpha1.ComputeTargetSSLProxy, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"computetargetsslproxy\"), name)\n\t}\n\treturn obj.(*v1alpha1.ComputeTargetSSLProxy), nil\n}", "func (s *podDisruptionBudgetNamespaceLister) Get(name string) (*policyv1.PodDisruptionBudget, error) {\n\tkey := kcpcache.ToClusterAwareKey(s.clusterName.String(), s.namespace, name)\n\tobj, exists, err := s.indexer.GetByKey(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(policyv1.Resource(\"PodDisruptionBudget\"), name)\n\t}\n\treturn obj.(*policyv1.PodDisruptionBudget), nil\n}", "func (s gameliftFleetNamespaceLister) Get(name string) (*v1alpha1.GameliftFleet, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"gameliftfleet\"), name)\n\t}\n\treturn obj.(*v1alpha1.GameliftFleet), nil\n}", "func (e *offlineExchange) GetBlock(_ context.Context, k u.Key) (*blocks.Block, error) {\n\treturn e.bs.Get(k)\n}", "func (s democrdNamespaceLister) Get(name string) (*v1.Democrd, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"democrd\"), name)\n\t}\n\treturn obj.(*v1.Democrd), nil\n}", "func (s icecreamNamespaceLister) Get(name string) (*v1alpha1.Icecream, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"icecream\"), name)\n\t}\n\treturn obj.(*v1alpha1.Icecream), nil\n}", "func (s trainingNamespaceLister) Get(name string) (*v1.Training, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"training\"), name)\n\t}\n\treturn obj.(*v1.Training), nil\n}", "func (s keyVaultKeyNamespaceLister) Get(name string) (*v1alpha1.KeyVaultKey, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"keyvaultkey\"), name)\n\t}\n\treturn obj.(*v1alpha1.KeyVaultKey), nil\n}", "func (b *Block) Get(input *BlockInput) (*Block, error) {\n\tresp, err := b.c.Request(http.MethodGet, fmt.Sprintf(\"/blocks/%s\", input.ID), new(bytes.Buffer), nil)\n\tif err != nil {\n\t\treturn &Block{}, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar block *Block\n\terr = json.NewDecoder(resp.Body).Decode(&block)\n\tif err != nil {\n\t\treturn &Block{}, err\n\t}\n\treturn block, nil\n}", "func (itr *BlocksItr) Get() (ledger.QueryResult, error) {\n\tif itr.err != nil {\n\t\treturn nil, itr.err\n\t}\n\treturn &BlockHolder{itr.nextBlockBytes}, nil\n}", "func (s *NamespaceStorage) Get(ctx context.Context, name string) (*types.Namespace, error) {\n\n\tlog.V(logLevel).Debugf(\"storage:etcd:namespace:> get by name: %s\", name)\n\n\tconst filter = `\\b.+` + namespaceStorage + `\\/.+\\/(meta|spec)\\b`\n\n\tif len(name) == 0 {\n\t\terr := errors.New(\"name can not be empty\")\n\t\tlog.V(logLevel).Errorf(\"storage:etcd:namespace:> get by name err: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\tclient, destroy, err := getClient(ctx)\n\tif err != nil {\n\t\tlog.V(logLevel).Errorf(\"storage:etcd:namespace:> get by name err: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tdefer destroy()\n\n\tnamespace := new(types.Namespace)\n\tkey := keyDirCreate(namespaceStorage, name)\n\n\tif err := client.Map(ctx, key, filter, namespace); err != nil {\n\t\tlog.V(logLevel).Errorf(\"storage:etcd:namespace:> get by name err: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn namespace, nil\n}", "func (s crdExampleNamespaceLister) Get(name string) (*v1.CrdExample, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"crdexample\"), name)\n\t}\n\treturn obj.(*v1.CrdExample), nil\n}", "func (s awsIamPolicyAttachmentNamespaceLister) Get(name string) (*v1.AwsIamPolicyAttachment, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"awsiampolicyattachment\"), name)\n\t}\n\treturn obj.(*v1.AwsIamPolicyAttachment), nil\n}", "func (s scyllaDBMonitoringNamespaceLister) Get(name string) (*v1alpha1.ScyllaDBMonitoring, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"scylladbmonitoring\"), name)\n\t}\n\treturn obj.(*v1alpha1.ScyllaDBMonitoring), nil\n}", "func (s tagRouteNamespaceLister) Get(name string) (*v1alpha1.TagRoute, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"tagroute\"), name)\n\t}\n\treturn obj.(*v1alpha1.TagRoute), nil\n}", "func (sc *LoanDocContract) Get(ctx contractapi.TransactionContextInterface, key string) (*LoanDocObj, error) {\n\t\n existingObj, err := ctx.GetStub().GetState(key)\n if err != nil {\n return nil, err\n }\n\n if existingObj == nil {\n return nil, fmt.Errorf(\"Cannot read world state pair with key %s. Does not exist\", key)\n }\n\n\tloanDocObj := new(LoanDocObj)\n\tif err := json.Unmarshal(existingObj, loanDocObj); err != nil {\n\t\treturn nil, fmt.Errorf(\"Data retrieved from world state for key %s was not of type LoanDocObj\", key)\n\t}\n return loanDocObj, nil\n}", "func (s dataFactoryDatasetMysqlNamespaceLister) Get(name string) (*v1alpha1.DataFactoryDatasetMysql, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"datafactorydatasetmysql\"), name)\n\t}\n\treturn obj.(*v1alpha1.DataFactoryDatasetMysql), nil\n}", "func (s consumerNamespaceLister) Get(name string) (*arbv1.Consumer, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(arbv1.Resource(\"queue\"), name)\n\t}\n\treturn obj.(*arbv1.Consumer), nil\n}", "func (m *Manager) Get(base int64) *TimestampBuffering {\n\t// m.mutex.Lock()\n\t// defer m.mutex.Unlock()\n\n\t// get now\n\tindex := m.GetCurrentIndex(base)\n\tfmt.Printf(\"get current index :%d\\n\",index)\n\n\n\treturn m.targets[index]\n\n\t// return nil\n}", "func (s bucketRequestNamespaceLister) Get(name string) (*v1alpha1.BucketRequest, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"bucketrequest\"), name)\n\t}\n\treturn obj.(*v1alpha1.BucketRequest), nil\n}", "func (c *BlockCache) Get(height int) *walletrpc.CompactBlock {\n\tc.mutex.RLock()\n\tdefer c.mutex.RUnlock()\n\n\tif height < c.firstBlock || height >= c.nextBlock {\n\t\treturn nil\n\t}\n\tblock := c.readBlock(height)\n\tif block == nil {\n\t\tgo func() {\n\t\t\t// We hold only the read lock, need the exclusive lock.\n\t\t\tc.mutex.Lock()\n\t\t\tc.recoverFromCorruption(height - 10000)\n\t\t\tc.mutex.Unlock()\n\t\t}()\n\t\treturn nil\n\t}\n\treturn block\n}", "func (s hTTPCheckNamespaceLister) Get(name string) (*v1alpha1.HTTPCheck, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"httpcheck\"), name)\n\t}\n\treturn obj.(*v1alpha1.HTTPCheck), nil\n}", "func (s cognitoResourceServerNamespaceLister) Get(name string) (*v1alpha1.CognitoResourceServer, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"cognitoresourceserver\"), name)\n\t}\n\treturn obj.(*v1alpha1.CognitoResourceServer), nil\n}", "func (s tektonListenerNamespaceLister) Get(name string) (*v1alpha1.TektonListener, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"tektonlistener\"), name)\n\t}\n\treturn obj.(*v1alpha1.TektonListener), nil\n}", "func (s oAuthClientNamespaceLister) Get(name string) (*api.OAuthClient, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(api.Resource(\"oauthclient\"), name)\n\t}\n\treturn obj.(*api.OAuthClient), nil\n}", "func (s recoveryServicesProtectionContainerNamespaceLister) Get(name string) (*v1alpha1.RecoveryServicesProtectionContainer, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"recoveryservicesprotectioncontainer\"), name)\n\t}\n\treturn obj.(*v1alpha1.RecoveryServicesProtectionContainer), nil\n}", "func (s salesforceSourceNamespaceLister) Get(name string) (*v1alpha1.SalesforceSource, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"salesforcesource\"), name)\n\t}\n\treturn obj.(*v1alpha1.SalesforceSource), nil\n}", "func (s pipelineResourceNamespaceLister) Get(name string) (*v1alpha1.PipelineResource, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"pipelineresource\"), name)\n\t}\n\treturn obj.(*v1alpha1.PipelineResource), nil\n}", "func (s messagingInfrastructureNamespaceLister) Get(name string) (*v1.MessagingInfrastructure, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"messaginginfrastructure\"), name)\n\t}\n\treturn obj.(*v1.MessagingInfrastructure), nil\n}", "func (s trialNamespaceLister) Get(name string) (*v1beta1.Trial, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"trial\"), name)\n\t}\n\treturn obj.(*v1beta1.Trial), nil\n}", "func (s clientViewNamespaceLister) Get(name string) (*v1alpha.ClientView, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha.Resource(\"clientview\"), name)\n\t}\n\treturn obj.(*v1alpha.ClientView), nil\n}", "func (c *Cache) GetBlock(k Key) Block {\n\tidx := uint64(0)\n\tif len(c.shards) > 1 {\n\t\th := k.hashUint64()\n\t\tidx = h % uint64(len(c.shards))\n\t}\n\tshard := c.shards[idx]\n\treturn shard.GetBlock(k)\n}", "func (s storageBucketNamespaceLister) Get(name string) (*v1beta1.StorageBucket, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"storagebucket\"), name)\n\t}\n\treturn obj.(*v1beta1.StorageBucket), nil\n}", "func (s proxyRouteNamespaceLister) Get(name string) (*v1alpha1.ProxyRoute, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"proxyroute\"), name)\n\t}\n\treturn obj.(*v1alpha1.ProxyRoute), nil\n}", "func (sbc *SyncBlockChain) Get(Height int32) []Block {\n\tsbc.Mux.Lock()\n\tdefer sbc.Mux.Unlock()\n\tif val, ok := sbc.BC.Chain[Height]; ok {\n\t\treturn val\n\t}\n\treturn nil\n}", "func (s baremetalMachineProviderConfigNamespaceLister) Get(name string) (*v1alpha1.BaremetalMachineProviderConfig, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"baremetalmachineproviderconfig\"), name)\n\t}\n\treturn obj.(*v1alpha1.BaremetalMachineProviderConfig), nil\n}", "func (h *Handler) GetByName(name string) (*corev1.Namespace, error) {\n\treturn h.clientset.CoreV1().Namespaces().Get(h.ctx, name, h.Options.GetOptions)\n}", "func (s dynamoDBNamespaceLister) Get(name string) (*v1alpha1.DynamoDB, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"dynamodb\"), name)\n\t}\n\treturn obj.(*v1alpha1.DynamoDB), nil\n}", "func (s eventProviderNamespaceLister) Get(name string) (*v1alpha1.EventProvider, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"eventprovider\"), name)\n\t}\n\treturn obj.(*v1alpha1.EventProvider), nil\n}", "func (b *AbstractBaseEntity) GetBlock(parent string) (string, error) {\n\tparent = `(?m)^` + parent + `$`\n\treturn b.node.GetSection(parent, \"running-config\")\n}", "func (s computeSSLCertificateNamespaceLister) Get(name string) (*v1alpha1.ComputeSSLCertificate, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"computesslcertificate\"), name)\n\t}\n\treturn obj.(*v1alpha1.ComputeSSLCertificate), nil\n}", "func (s *customResourceDefinitionLister) Get(name string) (*v1.CustomResourceDefinition, error) {\n\tobj, exists, err := s.indexer.GetByKey(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"customresourcedefinition\"), name)\n\t}\n\treturn obj.(*v1.CustomResourceDefinition), nil\n}", "func (s iotPolicyNamespaceLister) Get(name string) (*v1alpha1.IotPolicy, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"iotpolicy\"), name)\n\t}\n\treturn obj.(*v1alpha1.IotPolicy), nil\n}", "func (b *Bucket) Get(ctx context.Context, name string) (io.ReadCloser, error) {\n\treturn b.bkt.Object(name).NewReader(ctx)\n}", "func (s elasticBeanstalkConfigurationTemplateNamespaceLister) Get(name string) (*v1alpha1.ElasticBeanstalkConfigurationTemplate, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"elasticbeanstalkconfigurationtemplate\"), name)\n\t}\n\treturn obj.(*v1alpha1.ElasticBeanstalkConfigurationTemplate), nil\n}", "func (s databaseClusterNamespaceLister) Get(name string) (*v1alpha1.DatabaseCluster, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"databasecluster\"), name)\n\t}\n\treturn obj.(*v1alpha1.DatabaseCluster), nil\n}", "func (s awsApiGatewayBasePathMappingNamespaceLister) Get(name string) (*v1.AwsApiGatewayBasePathMapping, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"awsapigatewaybasepathmapping\"), name)\n\t}\n\treturn obj.(*v1.AwsApiGatewayBasePathMapping), nil\n}", "func (c *Cache) getBlock(aoffset int64, locked bool) *cacheBlock {\n\tif !locked {\n\t\tc.mu.Lock()\n\t\tdefer c.mu.Unlock()\n\t}\n\n\tif blk, ok := c.blocks[aoffset]; ok {\n\t\tc.lru.MoveToFront(blk.lru)\n\t\treturn blk\n\t}\n\n\treturn nil\n}", "func (s previewNamespaceLister) Get(name string) (*v1alpha1.Preview, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"preview\"), name)\n\t}\n\treturn obj.(*v1alpha1.Preview), nil\n}", "func (s *Index) Get() IndexSnapshot {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\tii := IndexSnapshot{\n\t\tTipSetKey: s.index.TipSetKey,\n\t\tMiners: make(map[string]Slashes, len(s.index.Miners)),\n\t}\n\tfor addr, v := range s.index.Miners {\n\t\thistory := make([]uint64, len(v.Epochs))\n\t\tcopy(history, v.Epochs)\n\t\tii.Miners[addr] = Slashes{\n\t\t\tEpochs: history,\n\t\t}\n\t}\n\treturn ii\n}", "func (s ingressListenerNamespaceLister) Get(name string) (*v1alpha1.IngressListener, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"ingresslistener\"), name)\n\t}\n\treturn obj.(*v1alpha1.IngressListener), nil\n}", "func (s traitNamespaceLister) Get(name string) (*v1alpha1.Trait, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"trait\"), name)\n\t}\n\treturn obj.(*v1alpha1.Trait), nil\n}", "func (s redisTriggerNamespaceLister) Get(name string) (*v1beta1.RedisTrigger, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"redistrigger\"), name)\n\t}\n\treturn obj.(*v1beta1.RedisTrigger), nil\n}", "func (s horusecManagerNamespaceLister) Get(name string) (*v1alpha1.HorusecManager, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"horusecmanager\"), name)\n\t}\n\treturn obj.(*v1alpha1.HorusecManager), nil\n}", "func (s *BlocksService) Get(ctx context.Context, id string) (*GetBlock, *http.Response, error) {\n\tquery := &BlockIdQuery{Id: id}\n\n\tvar responseStruct *GetBlock\n\tresp, err := s.client.SendRequest(ctx, \"GET\", \"blocks/get\", query, &responseStruct)\n\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn responseStruct, resp, err\n}", "func (s marketplaceAgreementNamespaceLister) Get(name string) (*v1alpha1.MarketplaceAgreement, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"marketplaceagreement\"), name)\n\t}\n\treturn obj.(*v1alpha1.MarketplaceAgreement), nil\n}", "func (s deepOneNamespaceLister) Get(name string) (*v1.DeepOne, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"deepone\"), name)\n\t}\n\treturn obj.(*v1.DeepOne), nil\n}", "func (c *releaseClient) Get(name string) (*Release, error) {\n\tlist, err := c.config.Releases.List(func(r *release.Release) bool {\n\t\treturn r.Namespace == c.config.Namespace() && r.Name == name\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t} else if len(list) == 0 {\n\t\treturn nil, errors.New(\"release not found\")\n\t} else if len(list) > 1 {\n\t\treturn nil, errors.New(\"release is ambiguous\")\n\t}\n\treturn getRelease(c.config, list[0])\n}", "func (i IndexFile) Get(name, version string) (*bundle.Bundle, error) {\n\tvs, ok := i.Entries[name]\n\tif !ok {\n\t\treturn nil, ErrNoBundleName\n\t}\n\tif len(vs) == 0 {\n\t\treturn nil, ErrNoBundleVersion\n\t}\n\n\tvar constraint *semver.Constraints\n\tif len(version) == 0 {\n\t\tconstraint, _ = semver.NewConstraint(\"*\")\n\t} else {\n\t\tvar err error\n\t\tconstraint, err = semver.NewConstraint(version)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tfor _, ver := range vs {\n\t\ttest, err := semver.NewVersion(ver.Version)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif constraint.Check(test) {\n\t\t\treturn ver, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"No bundle version found for %s-%s\", name, version)\n}", "func (s *rolloutBlockLister) RolloutBlocks(namespace string) RolloutBlockNamespaceLister {\n\treturn rolloutBlockNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "func (s rBACDefinitionNamespaceLister) Get(name string) (*v1beta1.RBACDefinition, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1beta1.Resource(\"rbacdefinition\"), name)\n\t}\n\treturn obj.(*v1beta1.RBACDefinition), nil\n}", "func (r *Wrapper) Get(name string) any {\n\tval, ok := r.Lookup(name)\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn val\n}", "func (t TokensWrapper) GetItem(itemName string) TokensItem {\n\t// find the item by name in content\n\tfor _, item := range t.Content {\n\t\tif item.Name == itemName {\n\t\t\treturn item\n\t\t}\n\t}\n\tpanic(\"No item found\")\n}", "func (s passwordNamespaceLister) Get(name string) (*v1alpha1.Password, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"password\"), name)\n\t}\n\treturn obj.(*v1alpha1.Password), nil\n}" ]
[ "0.6030591", "0.59331393", "0.5855316", "0.5818759", "0.5671234", "0.56690836", "0.5618589", "0.55901265", "0.5538037", "0.55035794", "0.548112", "0.54450256", "0.5436534", "0.54056436", "0.539699", "0.53958815", "0.53886515", "0.5377897", "0.5372501", "0.53640854", "0.5357762", "0.5344105", "0.53276235", "0.53193927", "0.53012586", "0.53006095", "0.5300465", "0.52989495", "0.5297278", "0.52763087", "0.5264586", "0.5255019", "0.525478", "0.5251468", "0.52328426", "0.5229231", "0.52226484", "0.5211426", "0.5205007", "0.51946324", "0.5174489", "0.51598877", "0.51497984", "0.51446956", "0.51446134", "0.5138133", "0.51276106", "0.51200664", "0.5098904", "0.50793546", "0.507923", "0.5072328", "0.50701433", "0.50588965", "0.50491536", "0.50416297", "0.503744", "0.50307083", "0.50288147", "0.5014426", "0.5013779", "0.5012299", "0.50084287", "0.50067544", "0.50029355", "0.4997747", "0.49892905", "0.4982563", "0.49793637", "0.49771762", "0.49555033", "0.49526963", "0.494825", "0.49412373", "0.4928392", "0.49261126", "0.49250874", "0.49233764", "0.49201262", "0.4916522", "0.49064025", "0.49057132", "0.48977345", "0.4882732", "0.48796386", "0.48794276", "0.4869863", "0.48592183", "0.48477304", "0.48390046", "0.48388767", "0.48290822", "0.48269212", "0.48169485", "0.48142573", "0.48138276", "0.48018044", "0.47983798", "0.4797203", "0.4783067" ]
0.80333996
0
AddCopy creates a new QuarksSecrets controller to watch for the user defined secrets.
AddCopy создает новый контроллер QuarksSecrets для наблюдения за секретами, определенными пользователем.
func AddCopy(ctx context.Context, config *config.Config, mgr manager.Manager) error { ctx = ctxlog.NewContextWithRecorder(ctx, "copy-reconciler", mgr.GetEventRecorderFor("copy-recorder")) log := ctxlog.ExtractLogger(ctx) r := NewCopyReconciler(ctx, config, mgr, credsgen.NewInMemoryGenerator(log), controllerutil.SetControllerReference) c, err := controller.New("copy-controller", mgr, controller.Options{ Reconciler: r, MaxConcurrentReconciles: config.MaxQuarksSecretWorkers, }) if err != nil { return errors.Wrap(err, "Adding copy controller to manager failed.") } nsPred := newNSPredicate(ctx, mgr.GetClient(), config.MonitoredID) // Watch for changes to the copied status of QuarksSecrets p := predicate.Funcs{ CreateFunc: func(e event.CreateEvent) bool { return false }, DeleteFunc: func(e event.DeleteEvent) bool { return false }, GenericFunc: func(e event.GenericEvent) bool { return false }, UpdateFunc: func(e event.UpdateEvent) bool { n := e.ObjectNew.(*qsv1a1.QuarksSecret) if n.Status.Copied != nil { ctxlog.Debugf(ctx, "Skipping QuarksSecret '%s', if copy status '%v' is true", n.Name, *n.Status.Copied) return !(*n.Status.Copied) } return true }, } err = c.Watch(&source.Kind{Type: &qsv1a1.QuarksSecret{}}, &handler.EnqueueRequestForObject{}, nsPred, p) if err != nil { return errors.Wrapf(err, "Watching quarks secrets failed in copy controller.") } // Watch for changes to user created secrets p = predicate.Funcs{ CreateFunc: func(e event.CreateEvent) bool { return false }, DeleteFunc: func(e event.DeleteEvent) bool { return false }, GenericFunc: func(e event.GenericEvent) bool { return false }, UpdateFunc: func(e event.UpdateEvent) bool { n := e.ObjectNew.(*corev1.Secret) o := e.ObjectOld.(*corev1.Secret) shouldProcessReconcile := isUserCreatedSecret(n) if reflect.DeepEqual(n.Data, o.Data) && reflect.DeepEqual(n.Labels, o.Labels) && reflect.DeepEqual(n.Annotations, o.Annotations) { return false } return shouldProcessReconcile }, } err = c.Watch(&source.Kind{Type: &corev1.Secret{}}, handler.EnqueueRequestsFromMapFunc( func(a crc.Object) []reconcile.Request { secret := a.(*corev1.Secret) if skip.Reconciles(ctx, mgr.GetClient(), secret) { return []reconcile.Request{} } reconciles, err := listQuarksSecretsReconciles(ctx, mgr.GetClient(), secret, secret.Namespace) if err != nil { ctxlog.Errorf(ctx, "Failed to calculate reconciles for secret '%s/%s': %v", secret.Namespace, secret.Name, err) } if len(reconciles) > 0 { return reconciles } return reconciles }), nsPred, p) if err != nil { return errors.Wrapf(err, "Watching user defined secrets failed in copy controller.") } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\n \t// minimumRefreshRate = os.Getenv(\"MINIMUM_REFRESH_RATE\")\n\n\t// Create a new controller\n\tc, err := controller.New(\"vaultsecret-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 VaultSecret\n\terr = c.Watch(&source.Kind{Type: &crdv1alpha1.VaultSecret{}}, &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 Secrets and requeue the owner VaultSecret\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &crdv1alpha1.VaultSecret{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func copySecret(ctx context.Context, src, dst kubernetes.Interface, namespace, name string) error {\n\tsecret, err := src.CoreV1().Secrets(namespace).Get(ctx, name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"failed retrieving secret: %s from source cluster: %w\", name, err)\n\t}\n\t_, err = dst.CoreV1().Secrets(namespace).Create(ctx, &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: secret.Labels,\n\t\t},\n\t\tData: secret.Data,\n\t}, metav1.CreateOptions{})\n\tif !errors.IsAlreadyExists(err) && err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func CopySecret(corev1Input clientcorev1.CoreV1Interface, srcNS string, srcSecretName string, tgtNS string, svcAccount string) (*corev1.Secret, error) {\n\treturn CopySecretWithName(corev1Input,\n\t\tsrcNS,\n\t\tsrcSecretName,\n\t\ttgtNS,\n\t\tsrcSecretName, /* Use same target name as source by default */\n\t\tsvcAccount)\n}", "func (c *Client) Copy(pod *k8sv1.Pod, container, containerPath, localPath string, exclude []string) error {\n\treturn nil\n}", "func CopySecretWithName(corev1Input clientcorev1.CoreV1Interface, srcNS, srcSecretName, tgtNS, tgtSecretName, svcAccount string) (*corev1.Secret, error) {\n\ttgtNamespaceSvcAcct := corev1Input.ServiceAccounts(tgtNS)\n\tsrcSecrets := corev1Input.Secrets(srcNS)\n\ttgtNamespaceSecrets := corev1Input.Secrets(tgtNS)\n\n\t// First try to find the secret we're supposed to copy\n\tsrcSecret, err := srcSecrets.Get(context.Background(), srcSecretName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// check for nil source secret\n\tif srcSecret == nil {\n\t\treturn nil, errors.New(\"error copying secret; there is no error but secret is nil\")\n\t}\n\n\t// Found the secret, so now make a copy in our new namespace\n\tnewSecret, err := tgtNamespaceSecrets.Create(\n\t\tcontext.Background(),\n\t\t&corev1.Secret{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: tgtSecretName,\n\t\t\t},\n\t\t\tData: srcSecret.Data,\n\t\t\tType: srcSecret.Type,\n\t\t},\n\t\tmetav1.CreateOptions{})\n\n\t// If the secret already exists then that's ok - may have already been created\n\tif err != nil && !apierrs.IsAlreadyExists(err) {\n\t\treturn nil, fmt.Errorf(\"error copying the Secret: %s\", err)\n\t}\n\n\ttgtSvcAccount, err := tgtNamespaceSvcAcct.Get(context.Background(), svcAccount, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting service account %s: %w\", svcAccount, err)\n\t}\n\n\tfor _, secret := range tgtSvcAccount.ImagePullSecrets {\n\t\tif secret.Name == tgtSecretName {\n\t\t\treturn newSecret, nil\n\t\t}\n\t}\n\t// Prevent overwriting existing imagePullSecrets\n\tpatch := `[{\"op\":\"add\",\"path\":\"/imagePullSecrets/-\",\"value\":{\"name\":\"` + tgtSecretName + `\"}}]`\n\tif len(tgtSvcAccount.ImagePullSecrets) == 0 {\n\t\tpatch = `[{\"op\":\"add\",\"path\":\"/imagePullSecrets\",\"value\":[{\"name\":\"` + tgtSecretName + `\"}]}]`\n\t}\n\t_, err = tgtNamespaceSvcAcct.Patch(context.Background(), svcAccount, types.JSONPatchType,\n\t\t[]byte(patch), metav1.PatchOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"patch failed on NS/SA (%s/%s): %w\",\n\t\t\ttgtNS, svcAccount, err)\n\t}\n\treturn newSecret, 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 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 newSecrets(c *APIV1Client) *secrets {\n\treturn &secrets{\n\t\tclient: c.RESTClient(),\n\t}\n}", "func (c *KubeTestPlatform) AddSecrets(secrets []kube.SecretDescription) error {\n\tif c.KubeClient == nil {\n\t\treturn fmt.Errorf(\"kubernetes cluster needs to be setup\")\n\t}\n\n\tfor _, secret := range secrets {\n\t\tc.Secrets.Add(kube.NewSecret(c.KubeClient, secret.Namespace, secret.Name, secret.Data))\n\t}\n\n\t// setup secret resources\n\tif err := c.Secrets.setup(); 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(\"copybird-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 Copybird\n\terr = c.Watch(&source.Kind{Type: &v1alpha1.Copybird{}}, &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 Copybird\n\terr = c.Watch(&source.Kind{Type: &v1beta1.CronJob{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &v1alpha1.Copybird{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r *SecretsResource) Create(request *http.Request) (rest.Resource, error) {\n\tvar secretCurrent api.SecretCurrent\n\n\tdefer request.Body.Close()\n\tdecoder := json.NewDecoder(request.Body)\n\tif err := decoder.Decode(&secretCurrent); err != nil {\n\t\treturn nil, rest.HTTPBadRequest.WithDetails(err.Error())\n\t}\n\tif secretCurrent.Current == nil {\n\t\treturn nil, rest.HTTPBadRequest.WithDetails(\"No current secret\")\n\t}\n\n\tif err := r.secrets.Add(request.Context(), secretCurrent.ID, secretCurrent.Type, *secretCurrent.Current); err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewSecretResource(r.secrets, secretCurrent.ID, r.logger), nil\n}", "func (l CMD) AddSecret(secret string) Logger {\n\tl.secrets = append(l.secrets, secret)\n\treturn l\n}", "func AddClientSecret(ctx context.Context, objID string) (autorest.Response, error) {\n\tappClient := getApplicationsClient()\n\treturn appClient.UpdatePasswordCredentials(\n\t\tctx,\n\t\tobjID,\n\t\tgraphrbac.PasswordCredentialsUpdateParameters{\n\t\t\tValue: &[]graphrbac.PasswordCredential{\n\t\t\t\t{\n\t\t\t\t\tStartDate: &date.Time{time.Now()},\n\t\t\t\t\tEndDate: &date.Time{time.Date(2018, time.December, 20, 22, 0, 0, 0, time.UTC)},\n\t\t\t\t\tValue: to.StringPtr(\"052265a2-bdc8-49aa-81bd-ecf7e9fe0c42\"), // this will become the client secret! Record this value, there is no way to get it back\n\t\t\t\t\tKeyID: to.StringPtr(\"08023993-9209-4580-9d4a-e060b44a64b8\"),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n}", "func NewSecretReplicator(client kubernetes.Interface, options ReplicatorOptions, resyncPeriod time.Duration) Replicator {\n\trepl := ObjectReplicator{\n\t\tReplicatorProps: NewReplicatorProps(client, \"secret\", options),\n\t\tReplicatorActions: _secretActions,\n\t}\n\tsecrets := client.CoreV1().Secrets(\"\")\n\tlistWatch := cache.ListWatch{\n\t\tListFunc: func(lo metav1.ListOptions) (runtime.Object, error) {\n\t\t\treturn secrets.List(lo)\n\t\t},\n\t\tWatchFunc: secrets.Watch,\n\t}\n\trepl.InitStores(&listWatch, &v1.Secret{}, resyncPeriod)\n\treturn &repl\n}", "func Create(ctx context.Context, dev *model.Dev, c *kubernetes.Clientset, s *syncthing.Syncthing) error {\n\tsecretName := GetSecretName(dev)\n\n\tsct, err := Get(ctx, secretName, dev.Namespace, c)\n\tif err != nil && !strings.Contains(err.Error(), \"not found\") {\n\t\treturn fmt.Errorf(\"error getting kubernetes secret: %s\", err)\n\t}\n\n\tconfig, err := getConfigXML(s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error generating syncthing configuration: %s\", err)\n\t}\n\tdata := &v1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: secretName,\n\t\t\tLabels: map[string]string{\n\t\t\t\tconstants.DevLabel: \"true\",\n\t\t\t},\n\t\t},\n\t\tType: v1.SecretTypeOpaque,\n\t\tData: map[string][]byte{\n\t\t\t\"config.xml\": config,\n\t\t\t\"cert.pem\": []byte(certPEM),\n\t\t\t\"key.pem\": []byte(keyPEM),\n\t\t},\n\t}\n\n\tidx := 0\n\tfor _, s := range dev.Secrets {\n\t\tcontent, err := os.ReadFile(s.LocalPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading secret '%s': %s\", s.LocalPath, err)\n\t\t}\n\t\tif strings.Contains(s.GetKeyName(), \"stignore\") {\n\t\t\tidx++\n\t\t\tdata.Data[fmt.Sprintf(\"%s-%d\", s.GetKeyName(), idx)] = content\n\t\t} else {\n\t\t\tdata.Data[s.GetKeyName()] = content\n\t\t}\n\n\t}\n\n\tif sct.Name == \"\" {\n\t\t_, err := c.CoreV1().Secrets(dev.Namespace).Create(ctx, data, metav1.CreateOptions{})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating kubernetes sync secret: %s\", err)\n\t\t}\n\n\t\toktetoLog.Infof(\"created okteto secret '%s'\", secretName)\n\t} else {\n\t\t_, err := c.CoreV1().Secrets(dev.Namespace).Update(ctx, data, metav1.UpdateOptions{})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error updating kubernetes okteto secret: %s\", err)\n\t\t}\n\t\toktetoLog.Infof(\"updated okteto secret '%s'\", secretName)\n\t}\n\treturn nil\n}", "func NewSecretController(informerFactory informers.SharedInformerFactory, syncrule helpers.SyncRule, local bool) *SecretController {\n\tsecretInformer := informerFactory.Core().V1().Secrets()\n\n\tc := &SecretController{\n\t\tinformerFactory: informerFactory,\n\t\tsecretInformer: secretInformer,\n\t\tsyncrule: syncrule,\n\t}\n\tif local {\n\t\tsecretInformer.Informer().AddEventHandler(\n\t\t\t// Your custom resource event handlers.\n\t\t\tcache.ResourceEventHandlerFuncs{\n\t\t\t\t// Called on creation\n\t\t\t\tAddFunc: c.localSecretAdd,\n\t\t\t\t// Called on resource update and every resyncPeriod on existing resources.\n\t\t\t\tUpdateFunc: c.localSecretUpdate,\n\t\t\t\t// Called on resource deletion.\n\t\t\t\tDeleteFunc: c.localSecretDelete,\n\t\t\t},\n\t\t)\n\t\treturn c\n\t}\n\tsecretInformer.Informer().AddEventHandler(\n\t\t// Your custom resource event handlers.\n\t\tcache.ResourceEventHandlerFuncs{\n\t\t\t// Called on creation\n\t\t\tAddFunc: c.secretAdd,\n\t\t\t// Called on resource update and every resyncPeriod on existing resources.\n\t\t\tUpdateFunc: c.secretUpdate,\n\t\t\t// Called on resource deletion.\n\t\t\tDeleteFunc: c.secretDelete,\n\t\t},\n\t)\n\treturn c\n}", "func (in *Secret) DeepCopy() *Secret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Secret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (api *APIClient) AddSecrets(vaultName string, secrets []Secret) error {\n\taddVaultSecretsRequest := graphql.NewRequest(addVaultSecretsRequestString)\n\taddVaultSecretsInput := AddVaultSecretsInput{\n\t\tAffiliationName: api.Affiliation,\n\t\tSecrets: secrets,\n\t\tVaultName: vaultName,\n\t}\n\taddVaultSecretsRequest.Var(\"addVaultSecretsInput\", addVaultSecretsInput)\n\n\tvar addVaultSecretsResponse AddVaultSecretsResponse\n\tif err := api.RunGraphQlMutation(addVaultSecretsRequest, &addVaultSecretsResponse); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewSecretWatcher(kubeClient *unversioned.Client, configmap string, cmdRunner CmdRunner, done <-chan bool) Watcher {\n\tnamespace, name := parseNamespaceName(configmap)\n\tcmw := SecretWatcher{\n\t\tname: name,\n\t\tnamespace: namespace,\n\t\tkubeClient: kubeClient,\n\t\tcmdRunner: cmdRunner,\n\t\tdone: done,\n\t}\n\n\tcmw.watch()\n\treturn cmw\n}", "func addSecretsVolume(pod corev1.Pod) (patch []patchOperation) {\n\n\tvolume := corev1.Volume{\n\t\tName: \"secrets\",\n\t\tVolumeSource: corev1.VolumeSource{\n\t\t\tEmptyDir: &corev1.EmptyDirVolumeSource{Medium: corev1.StorageMediumMemory},\n\t\t},\n\t}\n\n\tpath := \"/spec/volumes\"\n\tvar value interface{}\n\n\tif len(pod.Spec.Volumes) != 0 {\n\t\tpath = path + \"/-\"\n\t\tvalue = volume\n\t} else {\n\t\tvalue = []corev1.Volume{volume}\n\t}\n\n\tpatch = append(patch, patchOperation{\n\t\tOp: \"add\",\n\t\tPath: path,\n\t\tValue: value,\n\t})\n\n\treturn\n}", "func (c Clipboard) Add(s string) {\n\tc.Storage.Save(s)\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 Copy(data string) {\n\tif err := clipboard.WriteAll(data); err != nil {\n\t\tfmt.Println(\"There was a problem copying to the computers local clipboard\")\n\t}\n\n\tdefer GenerateNewTokenOnError(func() {\n\t\tCopy(data)\n\t})\n\ttoken := RetrieveToken()\n\tfireboardtools.SetClipboard(token, data)\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 (r *Registry) Copy() *Registry {\n\tplugins := make(map[string]interface{})\n\tfor k, v := range r.plugins {\n\t\tplugins[k] = v\n\t}\n\n\tproviders := make(map[string]interface{})\n\tfor k, v := range r.providers {\n\t\tproviders[k] = v\n\t}\n\n\treturn &Registry{\n\t\tplugins: plugins,\n\t\tproviders: providers,\n\t}\n}", "func (op *Operator) initSecretWatcher() cache.Controller {\n\tlw := &cache.ListWatch{\n\t\tListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {\n\t\t\treturn op.KubeClient.CoreV1().Secrets(op.Opt.WatchNamespace()).List(metav1.ListOptions{})\n\t\t},\n\t\tWatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {\n\t\t\treturn op.KubeClient.CoreV1().Secrets(op.Opt.WatchNamespace()).Watch(metav1.ListOptions{})\n\t\t},\n\t}\n\t_, informer := cache.NewIndexerInformer(lw,\n\t\t&core.Secret{},\n\t\top.Opt.ResyncPeriod,\n\t\tcache.ResourceEventHandlerFuncs{\n\t\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\t\tif oldSecret, ok := old.(*core.Secret); ok {\n\t\t\t\t\tif newSecret, ok := new.(*core.Secret); ok {\n\t\t\t\t\t\tif reflect.DeepEqual(oldSecret.Data, newSecret.Data) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tctx := etx.Background()\n\t\t\t\t\t\tlogger := log.New(ctx)\n\t\t\t\t\t\t// Secret DataChanged. We need to list all Ingress and check which of\n\t\t\t\t\t\t// those ingress uses this secret as basic auth secret.\n\t\t\t\t\t\titems, err := op.listIngresses()\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Errorln(err)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor i := range items {\n\t\t\t\t\t\t\tengress := &items[i]\n\t\t\t\t\t\t\tif engress.ShouldHandleIngress(op.Opt.IngressClass) || op.IngressServiceUsesAuthSecret(engress, newSecret) {\n\t\t\t\t\t\t\t\tif engress.UsesAuthSecret(newSecret.Namespace, newSecret.Name) {\n\t\t\t\t\t\t\t\t\tctrl := ingress.NewController(ctx, op.KubeClient, op.CRDClient, op.VoyagerClient, op.PromClient, op.ServiceLister, op.EndpointsLister, op.Opt, engress)\n\t\t\t\t\t\t\t\t\tif ctrl.IsExists() {\n\t\t\t\t\t\t\t\t\t\tcfgErr := ctrl.Update(0, nil)\n\t\t\t\t\t\t\t\t\t\tif cfgErr != nil {\n\t\t\t\t\t\t\t\t\t\t\tlogger.Infof(\"Failed to update offshoots of %s Ingress %s/%s. Reason: %s\", engress.APISchema(), engress.Namespace, engress.Name, cfgErr)\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\tctrl.Create()\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcache.Indexers{},\n\t)\n\treturn informer\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 Create(c *client.Client, i *Instance) error {\n\tsecretType, err := detectSecretType(i.Type)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsecret := v1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: i.Name,\n\t\t\tNamespace: i.Namespace,\n\t\t},\n\t\tData: map[string][]byte{\n\t\t\ti.Key: []byte(i.Value),\n\t\t},\n\t\tType: secretType,\n\t}\n\t_, err = c.Clientset.CoreV1().Secrets(i.Namespace).Create(\n\t\tcontext.TODO(),\n\t\t&secret,\n\t\tmetav1.CreateOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func ApplySecrets(rclient client.Client, secret *corev1.Secret) (string, error) {\n\tvar operation string\n\t// apply\n\tfound := &corev1.Secret{}\n\tif err := rclient.Get(context.TODO(), types.NamespacedName{Name: secret.Name, Namespace: secret.Namespace}, found); err != nil {\n\t\tif k8sErrors.IsNotFound(err) {\n\t\t\t// create\n\t\t\tif err := rclient.Create(context.TODO(), secret); err != nil {\n\t\t\t\treturn \"\", errors.WithStack(err)\n\t\t\t}\n\t\t\toperation = \"Created\"\n\t\t} else {\n\t\t\treturn \"\", errors.WithStack(err)\n\t\t}\n\n\t} else {\n\t\t//secret found, check if we need to update\n\t\tif !reflect.DeepEqual(secret.Data, found.Data) {\n\t\t\tif err := rclient.Update(context.TODO(), secret); err != nil {\n\t\t\t\treturn \"\", errors.WithStack(err)\n\t\t\t}\n\t\t\toperation = \"Updated\"\n\t\t} else {\n\t\t\t//Nothing happened\n\t\t\treturn \"\", nil\n\t\t}\n\n\t}\n\n\treturn operation, nil\n}", "func RegisterSecretsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SecretsClient) error {\n\n\tmux.Handle(\"POST\", pattern_Secrets_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Secrets_Create_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Secrets_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Secrets_Read_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Secrets_Read_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Secrets_Read_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_Secrets_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Secrets_Update_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Secrets_Update_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PATCH\", pattern_Secrets_Update_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Secrets_Update_1(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Secrets_Update_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_Secrets_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Secrets_Delete_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Secrets_Delete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_Secrets_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Secrets_List_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Secrets_List_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\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(\"sawtooth-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 Sawtooth\n\terr = c.Watch(&source.Kind{Type: &sawtoothv1alpha1.Sawtooth{}}, &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 Sawtooth\n\tsrc := &source.Kind{Type: &corev1.Pod{}}\n\tpred := predicate.Funcs{\n\t\tUpdateFunc: func(e event.UpdateEvent) bool {\n\t\t\treturn false\n\t\t},\n\t\tDeleteFunc: func(e event.DeleteEvent) bool {\n\t\t\treturn false\n\t\t},\n\t}\n\terr = c.Watch(src, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &sawtoothv1alpha1.Sawtooth{},\n\t}, pred)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func newSecretForCR(cr *crdv1alpha1.VaultSecret) *corev1.Secret {\n\n\tsecret := vault.GetSecret(cr.Spec.Path)\n\n\tcr.Status.RequestId = secret.RequestID\n\n\tvar secretMap map[string][]byte\n\tsecretMap = make(map[string][]byte)\n\tfor key, secret := range secret.Data {\n\t\tsecretMap[key] = []byte(secret.(string))\n\t}\n\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t}\n\treturn &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tType: \"Opaque\",\n\t\tData: secretMap,\n\t}\n}", "func NewSecretController(ca ca.CertificateAuthority, certTTL time.Duration, identityDomain string,\n\tgracePeriodRatio float32, minGracePeriod time.Duration, dualUse bool,\n\tcore corev1.CoreV1Interface, forCA bool, namespace string, dnsNames map[string]DNSNameEntry) (*SecretController, error) {\n\n\tif gracePeriodRatio < 0 || gracePeriodRatio > 1 {\n\t\treturn nil, fmt.Errorf(\"grace period ratio %f should be within [0, 1]\", gracePeriodRatio)\n\t}\n\tif gracePeriodRatio < recommendedMinGracePeriodRatio || gracePeriodRatio > recommendedMaxGracePeriodRatio {\n\t\tlog.Warnf(\"grace period ratio %f is out of the recommended window [%.2f, %.2f]\",\n\t\t\tgracePeriodRatio, recommendedMinGracePeriodRatio, recommendedMaxGracePeriodRatio)\n\t}\n\n\tif identityDomain == \"\" {\n\t\tidentityDomain = DefaultIdentityDomain\n\t}\n\n\tc := &SecretController{\n\t\tca: ca,\n\t\tcertTTL: certTTL,\n\t\tidentityDomain: identityDomain,\n\t\tgracePeriodRatio: gracePeriodRatio,\n\t\tminGracePeriod: minGracePeriod,\n\t\tdualUse: dualUse,\n\t\tcore: core,\n\t\tforCA: forCA,\n\t\tdnsNames: dnsNames,\n\t\tmonitoring: newMonitoringMetrics(),\n\t}\n\n\tsaLW := &cache.ListWatch{\n\t\tListFunc: func(options metav1.ListOptions) (runtime.Object, error) {\n\t\t\treturn core.ServiceAccounts(namespace).List(options)\n\t\t},\n\t\tWatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {\n\t\t\treturn core.ServiceAccounts(namespace).Watch(options)\n\t\t},\n\t}\n\trehf := cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: c.saAdded,\n\t\tDeleteFunc: c.saDeleted,\n\t\tUpdateFunc: c.saUpdated,\n\t}\n\tc.saStore, c.saController = cache.NewInformer(saLW, &v1.ServiceAccount{}, time.Minute, rehf)\n\n\tistioSecretSelector := fields.SelectorFromSet(map[string]string{\"type\": IstioSecretType}).String()\n\tscrtLW := &cache.ListWatch{\n\t\tListFunc: func(options metav1.ListOptions) (runtime.Object, error) {\n\t\t\toptions.FieldSelector = istioSecretSelector\n\t\t\treturn core.Secrets(namespace).List(options)\n\t\t},\n\t\tWatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {\n\t\t\toptions.FieldSelector = istioSecretSelector\n\t\t\treturn core.Secrets(namespace).Watch(options)\n\t\t},\n\t}\n\tc.scrtStore, c.scrtController =\n\t\tcache.NewInformer(scrtLW, &v1.Secret{}, secretResyncPeriod, cache.ResourceEventHandlerFuncs{\n\t\t\tDeleteFunc: c.scrtDeleted,\n\t\t\tUpdateFunc: c.scrtUpdated,\n\t\t})\n\n\treturn c, nil\n}", "func NewReplicator(client kubernetes.Interface, resyncPeriod time.Duration, allowAll bool) common.Replicator {\n\trepl := Replicator{\n\t\tGenericReplicator: common.NewGenericReplicator(common.ReplicatorConfig{\n\t\t\tKind: \"Secret\",\n\t\t\tObjType: &v1.Secret{},\n\t\t\tAllowAll: allowAll,\n\t\t\tResyncPeriod: resyncPeriod,\n\t\t\tClient: client,\n\t\t\tListFunc: func(lo metav1.ListOptions) (runtime.Object, error) {\n\t\t\t\treturn client.CoreV1().Secrets(\"\").List(context.TODO(), lo)\n\t\t\t},\n\t\t\tWatchFunc: func(lo metav1.ListOptions) (watch.Interface, error) {\n\t\t\t\treturn client.CoreV1().Secrets(\"\").Watch(context.TODO(), lo)\n\t\t\t},\n\t\t}),\n\t}\n\trepl.UpdateFuncs = common.UpdateFuncs{\n\t\tReplicateDataFrom: repl.ReplicateDataFrom,\n\t\tReplicateObjectTo: repl.ReplicateObjectTo,\n\t\tPatchDeleteDependent: repl.PatchDeleteDependent,\n\t\tDeleteReplicatedResource: repl.DeleteReplicatedResource,\n\t}\n\n\treturn &repl\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\tisAnnotatedSecret := predicate.Funcs{\n\t\tUpdateFunc: func(e event.UpdateEvent) bool {\n\t\t\toldSecret, ok := e.ObjectOld.(*corev1.Secret)\n\t\t\tif !ok {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tnewSecret, ok := e.ObjectNew.(*corev1.Secret)\n\t\t\tif !ok {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif newSecret.Type != util.TLSSecret {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\toldValue, _ := e.MetaOld.GetAnnotations()[certExpiryAlertAnnotation]\n\t\t\tnewValue, _ := e.MetaNew.GetAnnotations()[certExpiryAlertAnnotation]\n\t\t\told := oldValue == \"true\"\n\t\t\tnew := newValue == \"true\"\n\t\t\t// if the content has changed we trigger is the annotation is there\n\t\t\tif !reflect.DeepEqual(newSecret.Data[util.Cert], oldSecret.Data[util.Cert]) {\n\t\t\t\treturn new\n\t\t\t}\n\t\t\t// otherwise we trigger if the annotation has changed\n\t\t\treturn old != new\n\t\t},\n\t\tCreateFunc: func(e event.CreateEvent) bool {\n\t\t\tsecret, ok := e.Object.(*corev1.Secret)\n\t\t\tif !ok {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif secret.Type != util.TLSSecret {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tvalue, _ := e.Meta.GetAnnotations()[certExpiryAlertAnnotation]\n\t\t\treturn value == \"true\"\n\t\t},\n\t}\n\n\t// Watch for changes to primary resource CertExpiryAlert\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{\n\t\tTypeMeta: v1.TypeMeta{\n\t\t\tKind: \"Secret\",\n\t\t},\n\t}}, &handler.EnqueueRequestForObject{}, isAnnotatedSecret)\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 (c *secrets) Create(ctx context.Context, secret *v1.Secret,\n\topts metav1.CreateOptions) (result *v1.Secret, err error) {\n\tresult = &v1.Secret{}\n\terr = c.client.Post().\n\t\tResource(\"secrets\").\n\t\tVersionedParams(opts).\n\t\tBody(secret).\n\t\tDo(ctx).\n\t\tInto(result)\n\n\treturn\n}", "func (r *Helm) Copy() *Helm {\n\treturn &Helm{\n\t\tID: r.ID,\n\t\t//ProjectName: r.ProjectName,\n\t\tType: r.Type,\n\t\tName: r.Name,\n\t\tAddress: r.Address,\n\t\tUsername: r.Username,\n\t\tPrefix: r.Prefix,\n\t}\n}", "func SaveVarsInSecret(client kubectl.Client, vars map[string]string, secretName string) error {\n\tif vars == nil {\n\t\tvars = map[string]string{}\n\t}\n\n\t// marshal vars\n\tbytes, err := json.Marshal(vars)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsecret, err := client.KubeClient().CoreV1().Secrets(client.Namespace()).Get(context.TODO(), secretName, metav1.GetOptions{})\n\tif err != nil {\n\t\tif kerrors.IsNotFound(err) == false {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = client.KubeClient().CoreV1().Secrets(client.Namespace()).Create(context.TODO(), &corev1.Secret{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: secretName,\n\t\t\t},\n\t\t\tData: map[string][]byte{\n\t\t\t\tSecretVarsKey: bytes,\n\t\t\t},\n\t\t}, metav1.CreateOptions{})\n\t\treturn err\n\t}\n\n\tif secret.Data == nil {\n\t\tsecret.Data = map[string][]byte{}\n\t}\n\n\tsecret.Data[SecretVarsKey] = bytes\n\t_, err = client.KubeClient().CoreV1().Secrets(client.Namespace()).Update(context.TODO(), secret, metav1.UpdateOptions{})\n\treturn err\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"volumebackup-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 VolumeBackup\n\terr = c.Watch(&source.Kind{Type: &backupsv1alpha1.VolumeBackup{}}, &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 VolumeBackup\n\terr = c.Watch(&source.Kind{Type: &v1alpha1.VolumeSnapshot{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &backupsv1alpha1.VolumeBackup{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func createSecrets(ctx context.Context, srcInfo *scanner.SourceInfo, appName string) error {\n\tif srcInfo == nil || len(srcInfo.Secrets) == 0 {\n\t\treturn nil\n\t}\n\n\tvar err error\n\tio := iostreams.FromContext(ctx)\n\tsecrets := map[string]string{}\n\n\tfor _, secret := range srcInfo.Secrets {\n\t\tval := \"\"\n\t\t// If a secret should be a random default, just generate it without displaying\n\t\t// Otherwise, prompt to type it in\n\t\tif secret.Generate != nil {\n\t\t\tif val, err = secret.Generate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not generate random string: %w\", err)\n\t\t\t}\n\t\t} else if secret.Value != \"\" {\n\t\t\tval = secret.Value\n\t\t} else {\n\t\t\tprompt := fmt.Sprintf(\"Set secret %s:\", secret.Key)\n\t\t\tsurveyInput := &survey.Input{Message: prompt, Help: secret.Help}\n\t\t\tsurvey.AskOne(surveyInput, &val)\n\t\t}\n\n\t\tif val != \"\" {\n\t\t\tsecrets[secret.Key] = val\n\t\t}\n\t}\n\n\tif len(secrets) > 0 {\n\t\tapiClient := client.FromContext(ctx).API()\n\t\t_, err := apiClient.SetSecrets(ctx, appName, secrets)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Fprintf(io.Out, \"Set secrets on %s: %s\\n\", appName, strings.Join(lo.Keys(secrets), \", \"))\n\t}\n\treturn nil\n}", "func NewSecretsAddCommandFactory(ui cli.Ui) cli.CommandFactory {\n\treturn func() (cli.Command, error) {\n\t\tworkingDirectory, err := os.Getwd()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn &SecretsAddCommand{\n\t\t\tSecretsBaseCommand: NewSecretsBaseCommand(\"add\", workingDirectory, ui),\n\t\t}, nil\n\t}\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(\"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, mapFn handler.ToRequestsFunc) error {\n\t// Create a new controller\n\tc, err := controller.New(\"certmerge-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 CertMerge\n\tif err := c.Watch(&source.Kind{Type: &certmergev1alpha1.CertMerge{}}, &handler.EnqueueRequestForObject{}); err != nil {\n\t\treturn err\n\t}\n\n\t// This will trigger the Reconcile if the Merged Secret is modified\n\tif err := c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestForOwner{IsController: true, OwnerType: &certmergev1alpha1.CertMerge{}}); err != nil {\n\t\treturn err\n\t}\n\n\t// This predicate deduplicate the watch trigger if no data is modified inside the secret\n\t// if the Secret is Deleted, don't send the delete event as we can trigger it from the update\n\n\tupdateFunc := func(e event.UpdateEvent) bool {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"event\": e,\n\t\t}).Debugf(\"Update Predicate event\")\n\t\t// This update is in fact a Delete event, process it\n\t\tif e.MetaNew.GetDeletionGracePeriodSeconds() != nil {\n\t\t\treturn true\n\t\t}\n\n\t\t// if old and new data is the same, don't reconcile\n\t\tnewObj := e.ObjectNew.DeepCopyObject().(*corev1.Secret)\n\t\toldObj := e.ObjectOld.DeepCopyObject().(*corev1.Secret)\n\t\tif cmp.Equal(newObj.Data, oldObj.Data) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t}\n\tdeleteFunc := func(e event.DeleteEvent) bool {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"event\": e,\n\t\t}).Debugf(\"Delete Predicate event\")\n\t\treturn false\n\t}\n\n\t// Watch for Secret change and process them through the SecretTriggerCertMerge function\n\t// This watch enables us to reconcile a CertMerge when a concerned Secret is changed (create/update/delete)\n\tp := predicate.Funcs{\n\t\tUpdateFunc: updateFunc,\n\t\t// don't process any Delete event as we catch them in Update\n\t\tDeleteFunc: deleteFunc,\n\t}\n\ts := &source.Kind{\n\t\tType: &corev1.Secret{},\n\t}\n\th := &handler.EnqueueRequestsFromMapFunc{\n\t\tToRequests: mapFn,\n\t}\n\tif err := c.Watch(s, h, p); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewController(handler *Handler, secretInformer coreinformers.SecretInformer, azureKeyVaultSecretsInformer informers.AzureKeyVaultSecretInformer, azureFrequency AzurePollFrequency) *Controller {\n\t// Create event broadcaster\n\t// Add azure-keyvault-controller types to the default Kubernetes Scheme so Events can be\n\t// logged for azure-keyvault-controller types.\n\tutilruntime.Must(keyvaultScheme.AddToScheme(scheme.Scheme))\n\n\tcontroller := &Controller{\n\t\thandler: handler,\n\t\tsecretsSynced: secretInformer.Informer().HasSynced,\n\t\tazureKeyVaultSecretsSynced: azureKeyVaultSecretsInformer.Informer().HasSynced,\n\t\tworkqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), \"AzureKeyVaultSecrets\"),\n\t\tworkqueueAzure: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemFastSlowRateLimiter(azureFrequency.Normal, azureFrequency.Slow, azureFrequency.MaxFailuresBeforeSlowingDown), \"AzureKeyVault\"),\n\t}\n\n\tlog.Info(\"Setting up event handlers\")\n\t// Set up an event handler for when AzureKeyVaultSecret resources change\n\tazureKeyVaultSecretsInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tsecret := obj.(*akv.AzureKeyVaultSecret)\n\t\t\tif secret.Spec.Output.Secret.Name == \"\" {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Debugf(\"AzureKeyVaultSecret '%s' added. Adding to queue.\", secret.Name)\n\t\t\tcontroller.enqueueAzureKeyVaultSecret(obj)\n\t\t\tcontroller.enqueueAzurePoll(obj)\n\t\t},\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tnewSecret := new.(*akv.AzureKeyVaultSecret)\n\t\t\toldSecret := old.(*akv.AzureKeyVaultSecret)\n\t\t\tif oldSecret.Spec.Output.Secret.Name == \"\" {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif newSecret.ResourceVersion == oldSecret.ResourceVersion {\n\t\t\t\tlog.Debugf(\"AzureKeyVaultSecret '%s' added to Azure queue to check if changed in Azure.\", newSecret.Name)\n\t\t\t\t// Check if secret has changed in Azure\n\t\t\t\tcontroller.enqueueAzurePoll(new)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlog.Debugf(\"AzureKeyVaultSecret '%s' changed. Adding to queue.\", newSecret.Name)\n\t\t\tcontroller.enqueueAzureKeyVaultSecret(new)\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tsecret := obj.(*akv.AzureKeyVaultSecret)\n\t\t\tif secret.Spec.Output.Secret.Name == \"\" {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Debugf(\"AzureKeyVaultSecret '%s' deleted. Adding to delete queue.\", secret.Name)\n\t\t\tcontroller.enqueueDeleteAzureKeyVaultSecret(obj)\n\t\t},\n\t})\n\n\t// Set up an event handler for when Secret resources change. This\n\t// handler will lookup the owner of the given Secret, and if it is\n\t// owned by a AzureKeyVaultSecret resource will enqueue that Secret resource for\n\t// processing. This way, we don't need to implement custom logic for\n\t// handling AzureKeyVaultSecret resources. More info on this pattern:\n\t// https://github.com/kubernetes/community/blob/8cafef897a22026d42f5e5bb3f104febe7e29830/contributors/devel/controllers.md\n\tsecretInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tsecret := obj.(*corev1.Secret)\n\t\t\tlog.Debugf(\"Secret '%s' added. Handling.\", secret.Name)\n\t\t\tcontroller.enqueueObject(obj)\n\t\t},\n\t\tUpdateFunc: func(old, new interface{}) {\n\t\t\tnewSecret := new.(*corev1.Secret)\n\t\t\toldSecret := old.(*corev1.Secret)\n\n\t\t\tif newSecret.ResourceVersion == oldSecret.ResourceVersion {\n\t\t\t\t// Periodic resync will send update events for all known Secrets.\n\t\t\t\t// Two different versions of the same Secret will always have different RVs.\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsecret := new.(*corev1.Secret)\n\t\t\tlog.Debugf(\"Secret '%s' controlled by AzureKeyVaultSecret changed. Handling.\", secret.Name)\n\t\t\tcontroller.enqueueObject(new)\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tsecret := obj.(*corev1.Secret)\n\t\t\tlog.Debugf(\"Secret '%s' deleted. Handling.\", secret.Name)\n\t\t\tcontroller.enqueueObject(obj)\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(\"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 updateSecret(kubeClient *kubernetes.Clientset, secretName string, succChan chan<- string, errChan chan<- error) {\n\tb := bytes.NewBuffer(nil)\n\t// Secrets\n\tsecret, err := kubeClient.Secrets(\"deis\").Get(secretName)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tsuccChan <- fmt.Sprintf(\"secret %s not found\", secretName)\n\t\t\treturn\n\t\t}\n\t\terrChan <- err\n\t\treturn\n\t}\n\tsecretNameDet := strings.SplitN(secret.ObjectMeta.Name, \"-\", 2)\n\tpath := \"workflow/charts/\" + secretNameDet[1] + \"templates/\" + secretNameDet[1] + \"-secret.yaml\"\n\tb.WriteString(\"\\n---\\n# Source: \" + path + \"\\n\")\n\tsecret.Kind = \"Secret\"\n\tsecret.APIVersion = \"v1\"\n\tsecret.ResourceVersion = \"\"\n\ty, err := yaml.Marshal(secret)\n\tif err != nil {\n\t\tfmt.Printf(\"err: %v\\n\", err)\n\t\terrChan <- err\n\t\treturn\n\t}\n\tb.WriteString(string(y))\n\n\tfactory := cmdutil.NewFactory(nil)\n\tcurrent := factory.NewBuilder().ContinueOnError().NamespaceParam(\"deis\").DefaultNamespace().Stream(b, \"\").Flatten().Do()\n\terr = current.Visit(func(info *resource.Info, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tobj, err := cmdutil.MaybeConvertObject(info.Object, info.Mapping.GroupVersionKind.GroupVersion(), info.Mapping)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tname, namespace := info.Name, info.Namespace\n\t\toldData, err := json.Marshal(obj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := updateAnnotations(obj); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tnewData, err := json.Marshal(obj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpatchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, obj)\n\t\tcreatedPatch := err == nil\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"couldn't compute patch: %v\", err)\n\t\t}\n\n\t\tmapping := info.ResourceMapping()\n\t\tclient, err := factory.ClientForMapping(mapping)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thelper := resource.NewHelper(client, mapping)\n\n\t\tif createdPatch {\n\t\t\t_, err = helper.Patch(namespace, name, api.StrategicMergePatchType, patchBytes)\n\t\t} else {\n\t\t\t_, err = helper.Replace(namespace, name, false, obj)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\treturn\n\t}\n\tsuccChan <- fmt.Sprintf(\"secret %s annotated successfuly\", secretName)\n}", "func (r *Reconciler) copyConfigurationResources(ctx context.Context, cluster,\n\tsourceCluster *v1beta1.PostgresCluster) error {\n\n\tfor i := range sourceCluster.Spec.Backups.PGBackRest.Configuration {\n\t\t// While all volume projections from .Configuration will be carried over to\n\t\t// the pgBackRest restore Job, we only explicitly copy the relevant ConfigMaps\n\t\t// and Secrets. Any DownwardAPI or ServiceAccountToken projections will need\n\t\t// to be handled manually.\n\t\t// - https://kubernetes.io/docs/concepts/storage/projected-volumes/\n\t\tif sourceCluster.Spec.Backups.PGBackRest.Configuration[i].Secret != nil {\n\t\t\tsecretProjection := sourceCluster.Spec.Backups.PGBackRest.Configuration[i].Secret\n\t\t\tsecretCopy := &corev1.Secret{}\n\t\t\tsecretName := types.NamespacedName{\n\t\t\t\tName: secretProjection.Name,\n\t\t\t\tNamespace: sourceCluster.Namespace,\n\t\t\t}\n\t\t\t// Get the existing Secret for the copy, if it exists. It **must**\n\t\t\t// exist if not configured as optional.\n\t\t\tif secretProjection.Optional != nil && *secretProjection.Optional {\n\t\t\t\tif err := errors.WithStack(r.Client.Get(ctx, secretName,\n\t\t\t\t\tsecretCopy)); apierrors.IsNotFound(err) {\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err := errors.WithStack(\n\t\t\t\t\tr.Client.Get(ctx, secretName, secretCopy)); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Set a unique name for the Secret copy using the original Secret\n\t\t\t// name and the Secret projection index number.\n\t\t\tsecretCopyName := fmt.Sprintf(naming.RestoreConfigCopySuffix, secretProjection.Name, i)\n\n\t\t\t// set the new name and namespace\n\t\t\tsecretCopy.ObjectMeta = metav1.ObjectMeta{\n\t\t\t\tName: secretCopyName,\n\t\t\t\tNamespace: cluster.Namespace,\n\t\t\t}\n\t\t\tsecretCopy.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind(\"Secret\"))\n\t\t\tsecretCopy.Annotations = naming.Merge(\n\t\t\t\tcluster.Spec.Metadata.GetAnnotationsOrNil(),\n\t\t\t\tcluster.Spec.Backups.PGBackRest.Metadata.GetAnnotationsOrNil(),\n\t\t\t)\n\t\t\tsecretCopy.Labels = naming.Merge(\n\t\t\t\tcluster.Spec.Metadata.GetLabelsOrNil(),\n\t\t\t\tcluster.Spec.Backups.PGBackRest.Metadata.GetLabelsOrNil(),\n\t\t\t\t// this label allows for cleanup when the restore completes\n\t\t\t\tnaming.PGBackRestRestoreJobLabels(cluster.Name),\n\t\t\t)\n\t\t\tif err := r.setControllerReference(cluster, secretCopy); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := errors.WithStack(r.apply(ctx, secretCopy)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// update the copy of the source PostgresCluster to add the new Secret\n\t\t\t// projection(s) to the restore Job\n\t\t\tsourceCluster.Spec.Backups.PGBackRest.Configuration[i].Secret.Name = secretCopyName\n\t\t}\n\n\t\tif sourceCluster.Spec.Backups.PGBackRest.Configuration[i].ConfigMap != nil {\n\t\t\tconfigMapProjection := sourceCluster.Spec.Backups.PGBackRest.Configuration[i].ConfigMap\n\t\t\tconfigMapCopy := &corev1.ConfigMap{}\n\t\t\tconfigMapName := types.NamespacedName{\n\t\t\t\tName: configMapProjection.Name,\n\t\t\t\tNamespace: sourceCluster.Namespace,\n\t\t\t}\n\t\t\t// Get the existing ConfigMap for the copy, if it exists. It **must**\n\t\t\t// exist if not configured as optional.\n\t\t\tif configMapProjection.Optional != nil && *configMapProjection.Optional {\n\t\t\t\tif err := errors.WithStack(r.Client.Get(ctx, configMapName,\n\t\t\t\t\tconfigMapCopy)); apierrors.IsNotFound(err) {\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err := errors.WithStack(\n\t\t\t\t\tr.Client.Get(ctx, configMapName, configMapCopy)); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Set a unique name for the ConfigMap copy using the original ConfigMap\n\t\t\t// name and the ConfigMap projection index number.\n\t\t\tconfigMapCopyName := fmt.Sprintf(naming.RestoreConfigCopySuffix, configMapProjection.Name, i)\n\n\t\t\t// set the new name and namespace\n\t\t\tconfigMapCopy.ObjectMeta = metav1.ObjectMeta{\n\t\t\t\tName: configMapCopyName,\n\t\t\t\tNamespace: cluster.Namespace,\n\t\t\t}\n\t\t\tconfigMapCopy.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind(\"ConfigMap\"))\n\t\t\tconfigMapCopy.Annotations = naming.Merge(\n\t\t\t\tcluster.Spec.Metadata.GetAnnotationsOrNil(),\n\t\t\t\tcluster.Spec.Backups.PGBackRest.Metadata.GetAnnotationsOrNil(),\n\t\t\t)\n\t\t\tconfigMapCopy.Labels = naming.Merge(\n\t\t\t\tcluster.Spec.Metadata.GetLabelsOrNil(),\n\t\t\t\tcluster.Spec.Backups.PGBackRest.Metadata.GetLabelsOrNil(),\n\t\t\t\t// this label allows for cleanup when the restore completes\n\t\t\t\tnaming.PGBackRestRestoreJobLabels(cluster.Name),\n\t\t\t)\n\t\t\tif err := r.setControllerReference(cluster, configMapCopy); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := errors.WithStack(r.apply(ctx, configMapCopy)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// update the copy of the source PostgresCluster to add the new ConfigMap\n\t\t\t// projection(s) to the restore Job\n\t\t\tsourceCluster.Spec.Backups.PGBackRest.Configuration[i].ConfigMap.Name = configMapCopyName\n\t\t}\n\t}\n\treturn nil\n}", "func (in *StringSecret) DeepCopy() *StringSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StringSecret)\n\tin.DeepCopyInto(out)\n\treturn out\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 PutSecrets(ctx context.Context, cfg Config, secrets map[string]interface{}) error {\n\tcheckDefaults(&cfg)\n\tvClient, err := login(ctx, cfg)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to login to vault\")\n\t}\n\t_, err = vClient.Logical().Write(cfg.SecretPath, secrets)\n\treturn errors.Wrap(err, \"unable to make vault request\")\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"mutatingwebhook-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch secret\n\terr = c.Watch(&source.Kind{Type: &corev1.Secret{}}, &handler.EnqueueRequestsFromMapFunc{\n\t\tToRequests: handler.ToRequestsFunc(func(obj handler.MapObject) []reconcile.Request {\n\t\t\trequests := []reconcile.Request{}\n\t\t\trequests = append(requests, reconcile.Request{\n\t\t\t\tNamespacedName: types.NamespacedName{\n\t\t\t\t\tName: webhookConfigNamePrefix + obj.Meta.GetNamespace(),\n\t\t\t\t\tNamespace: \"\",\n\t\t\t\t},\n\t\t\t})\n\t\t\treturn requests\n\t\t})}, predicate.Funcs{\n\t\tCreateFunc: func(event event.CreateEvent) bool {\n\t\t\treturn event.Meta.GetName() == serviceAccountSecretName\n\t\t},\n\t\tUpdateFunc: func(event event.UpdateEvent) bool {\n\t\t\treturn event.MetaNew.GetName() == serviceAccountSecretName\n\t\t},\n\t\t// deletion and generic events don't interest us\n\t\tDeleteFunc: func(event event.DeleteEvent) bool {\n\t\t\treturn false\n\t\t},\n\t\tGenericFunc: func(event event.GenericEvent) bool {\n\t\t\treturn false\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch MutatingWebhookConfigurations\n\terr = c.Watch(&source.Kind{Type: &v1beta1.MutatingWebhookConfiguration{}}, &handler.EnqueueRequestForObject{}, predicate.Funcs{\n\t\tCreateFunc: func(event event.CreateEvent) bool {\n\t\t\treturn strings.HasPrefix(event.Meta.GetName(), webhookConfigNamePrefix)\n\t\t},\n\t\tUpdateFunc: func(event event.UpdateEvent) bool {\n\t\t\treturn strings.HasPrefix(event.MetaNew.GetName(), webhookConfigNamePrefix)\n\t\t},\n\t\t// deletion and generic events don't interest us\n\t\tDeleteFunc: func(event event.DeleteEvent) bool {\n\t\t\treturn false\n\t\t},\n\t\tGenericFunc: func(event event.GenericEvent) bool {\n\t\t\treturn false\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewSecrets(k8sClient kubernetes.Interface) *Secrets {\n\treturn &Secrets{\n\t\tk8sClient: k8sClient,\n\t}\n}", "func UpdateSecrets(request types.FunctionDeployment, deployment *appsv1.Deployment, existingSecrets map[string]*apiv1.Secret) error {\n\t// Add / reference pre-existing secrets within Kubernetes\n\tsecretVolumeProjections := []apiv1.VolumeProjection{}\n\n\tfor _, secretName := range request.Secrets {\n\t\tdeployedSecret, ok := existingSecrets[secretName]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Required secret '%s' was not found in the cluster\", secretName)\n\t\t}\n\n\t\tswitch deployedSecret.Type {\n\n\t\tcase apiv1.SecretTypeDockercfg,\n\t\t\tapiv1.SecretTypeDockerConfigJson:\n\n\t\t\tdeployment.Spec.Template.Spec.ImagePullSecrets = append(\n\t\t\t\tdeployment.Spec.Template.Spec.ImagePullSecrets,\n\t\t\t\tapiv1.LocalObjectReference{\n\t\t\t\t\tName: secretName,\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tbreak\n\n\t\tdefault:\n\n\t\t\tprojectedPaths := []apiv1.KeyToPath{}\n\t\t\tfor secretKey := range deployedSecret.Data {\n\t\t\t\tprojectedPaths = append(projectedPaths, apiv1.KeyToPath{Key: secretKey, Path: secretKey})\n\t\t\t}\n\n\t\t\tprojection := &apiv1.SecretProjection{Items: projectedPaths}\n\t\t\tprojection.Name = secretName\n\t\t\tsecretProjection := apiv1.VolumeProjection{\n\t\t\t\tSecret: projection,\n\t\t\t}\n\t\t\tsecretVolumeProjections = append(secretVolumeProjections, secretProjection)\n\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvolumeName := fmt.Sprintf(\"%s-projected-secrets\", request.Service)\n\tprojectedSecrets := apiv1.Volume{\n\t\tName: volumeName,\n\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\tProjected: &apiv1.ProjectedVolumeSource{\n\t\t\t\tSources: secretVolumeProjections,\n\t\t\t},\n\t\t},\n\t}\n\n\t// remove the existing secrets volume, if we can find it. The update volume will be\n\t// added below\n\texistingVolumes := removeVolume(volumeName, deployment.Spec.Template.Spec.Volumes)\n\tdeployment.Spec.Template.Spec.Volumes = existingVolumes\n\tif len(secretVolumeProjections) > 0 {\n\t\tdeployment.Spec.Template.Spec.Volumes = append(existingVolumes, projectedSecrets)\n\t}\n\n\t// add mount secret as a file\n\tupdatedContainers := []apiv1.Container{}\n\tfor _, container := range deployment.Spec.Template.Spec.Containers {\n\t\tmount := apiv1.VolumeMount{\n\t\t\tName: volumeName,\n\t\t\tReadOnly: true,\n\t\t\tMountPath: secretsMountPath,\n\t\t}\n\n\t\t// remove the existing secrets volume mount, if we can find it. We update it later.\n\t\tcontainer.VolumeMounts = removeVolumeMount(volumeName, container.VolumeMounts)\n\t\tif len(secretVolumeProjections) > 0 {\n\t\t\tcontainer.VolumeMounts = append(container.VolumeMounts, mount)\n\t\t}\n\n\t\tupdatedContainers = append(updatedContainers, container)\n\t}\n\n\tdeployment.Spec.Template.Spec.Containers = updatedContainers\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(\"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 (o OAUTHKeysList) Copy() elemental.Identifiables {\n\n\tcopy := append(OAUTHKeysList{}, o...)\n\treturn &copy\n}", "func (c *SecretConverter) newSecret() *corev1.Secret {\n\tsecret := &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: c.keyvaultSecret.Name,\n\t\t\tNamespace: c.keyvaultSecret.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*metav1.NewControllerRef(c.keyvaultSecret, schema.GroupVersionKind{\n\t\t\t\t\tGroup: keyvaultsecretv1alpha1.SchemeGroupVersion.Group,\n\t\t\t\t\tVersion: keyvaultsecretv1alpha1.SchemeGroupVersion.Version,\n\t\t\t\t\tKind: \"KeyvaultSecret\",\n\t\t\t\t}),\n\t\t\t},\n\t\t},\n\t}\n\treturn secret\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 newGCPSecretCR(namespace, creds string) *corev1.Secret {\n\treturn &corev1.Secret{\n\t\tType: \"Opaque\",\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Secret\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: gcpSecretName,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tData: map[string][]byte{\n\t\t\t\"osServiceAccount.json\": []byte(creds),\n\t\t},\n\t}\n}", "func (k *K8s) Write(b []byte) (int, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)\n\tdefer cancel()\n\n\tsecret, err := k.client.CoreV1().Secrets(k.ns).Get(ctx, k.secret, metav1.GetOptions{})\n\n\tif errors.IsNotFound(err) {\n\t\ts := &corev1.Secret{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: k.secret,\n\t\t\t},\n\t\t\tType: corev1.SecretTypeOpaque,\n\t\t\tData: map[string][]byte{\n\t\t\t\tk.key: b,\n\t\t\t},\n\t\t}\n\n\t\tif _, err := k.client.CoreV1().Secrets(k.ns).Create(ctx, s, metav1.CreateOptions{}); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"failed to create secret %s in namespace %s: %v\", k.secret, k.ns, err)\n\t\t}\n\n\t\treturn len(b), nil\n\t}\n\n\t// compare the bytes and only update existing secrets if the bytes are not the same\n\tif !bytes.Equal(secret.Data[k.key], b) {\n\t\tsecret.Data[k.key] = b\n\n\t\tif _, err := k.client.CoreV1().Secrets(k.ns).Update(ctx, secret, metav1.UpdateOptions{}); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"failed to update secret %s in namespace %s: %v\", k.secret, k.ns, err)\n\t\t}\n\t}\n\n\treturn len(b), nil\n}", "func (hc *Hailconfig) Copy(oldAlias, newAlias string) error {\n\tif !hc.IsPresent(oldAlias) {\n\t\treturn errors.New(\"old alias is not present\")\n\t}\n\tif hc.IsPresent(newAlias) {\n\t\treturn errors.New(\"new alias is already present\")\n\t}\n\thc.Add(newAlias, hc.Scripts[oldAlias].Command, hc.Scripts[oldAlias].Description)\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 (bs *Bindings) Copy() (*Bindings, error) {\r\n\tbytes, err := json.Marshal(bs)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tret := NewBindings()\r\n\terr = json.Unmarshal(bytes, &ret)\r\n\r\n\treturn &ret, nil\r\n}", "func (c *configuration) Secret(clientSet ClientSet) *Secret {\n\tif clientSet != nil {\n\t\treturn NewSecret(clientSet)\n\t}\n\treturn nil\n\n}", "func AddSecretEventClient(contextName string, namespace string, client chan SecretEvent) error {\n\n\t// Get the receiver or create it\n\tctxReceiver, ok := contextReceivers[contextName]\n\tif !ok {\n\n\t\tclientset, err := context.GetClientset(contextName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmetrics, err := context.GetMetrics(contextName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tctxReceiver = &contextReceiver{\n\t\t\tclientset: clientset,\n\t\t\tmetrics: metrics,\n\t\t}\n\n\t\tcontextReceivers[contextName] = ctxReceiver\n\t}\n\n\tnsReceiver, ok := ctxReceiver.namespaceReceivers[namespace]\n\tif !ok {\n\t\tnsReceiver = &namespaceReceiver{}\n\t\tctxReceiver.namespaceReceivers[namespace] = nsReceiver\n\t}\n\n\t// If the event are not received, create a new event receiver\n\treceiver := nsReceiver.secretEventReceiver\n\tif receiver == nil {\n\n\t\treceiver = newSecretEventReceiver(ctxReceiver.clientset, namespace)\n\n\t\tnsReceiver.secretEventReceiver = receiver\n\t}\n\n\t// Add the client\n\treceiver.addClient(client)\n\n\treturn nil\n}", "func (s *SecretService) PutSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error {\n\t// PutSecrets operates on intersection between m and keys beloging to orgID.\n\t// We need to have read access to those secrets since it deletes the secrets (within the intersection) that have not be overridden.\n\tif err := authorizeReadSecret(ctx, orgID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := authorizeWriteSecret(ctx, orgID); err != nil {\n\t\treturn err\n\t}\n\n\terr := s.s.PutSecrets(ctx, orgID, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Client) AddSecret(variableID string, secretValue string) error {\n\treq, err := c.AddSecretRequest(variableID, secretValue)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := c.SubmitRequest(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn response.EmptyResponse(resp)\n}", "func (r *PassLessReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tl := log.FromContext(ctx)\n\n\t// Fetch the PassLess instance\n\tpsls := &v1alpha1.PassLess{}\n\terr := r.Client.Get(ctx, req.NamespacedName, psls)\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\t// Define a new Secret object\n\tsecret := psls.CreateSecret(r.generator(ctx))\n\thashcode := secrets.Hashcode(secret)\n\n\t// Set PassLess instance as the owner and controller\n\tif err := controllerutil.SetControllerReference(psls, secret, r.Scheme); err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Check if this Secret already exists\n\tfound := &corev1.Secret{}\n\terr = r.Client.Get(ctx, types.NamespacedName{\n\t\tName: secret.Name,\n\t\tNamespace: secret.Namespace,\n\t}, found)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tl.Info(\"Creating a new secret\",\n\t\t\t\"Hash\", hashcode,\n\t\t)\n\t\terr = r.Client.Create(ctx, secret)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Secret created successfully - don't requeue\n\t\treturn ctrl.Result{}, nil\n\t} else if err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Secret already exists, check if need update\n\tif needsUpdate(secret, found) {\n\t\tl.Info(\"Updating a secret\",\n\t\t\t\"Hash\", hashcode,\n\t\t)\n\t\terr = r.Client.Update(ctx, secret)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\treturn ctrl.Result{}, nil\n}", "func New(out io.Writer, in io.Reader, hasInput bool, snptStore *snippet.Store) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"copy [snippet ID | snippet name]\",\n\t\tAliases: []string{\"cp\"},\n\t\tShort: \"Copy a snippet to the clipboard\",\n\t\tLong: `\nCopy a snippet to the clipboard.\n\nIf you do not provide a snippet ID or snippet name then a prompt will be shown and you can select the snippet you want to copy to the clipboard.\n\nSnpt will read from stdin if provided and attempt to extract a snippet ID from it. The stdin should be formatted like:\n\n\tSome random string [snippet ID]\n\nSnpt will parse anything in the square brackets that appears at the end of the string. This is useful for piping into Snpt:\n\n\techo 'foo - bar baz [aff9aa71ead70963p3bfa4e49b18d27539f9d9d8]' | snpt cp`,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tsnpt, err := cliHelper.ResolveSnippet(args, hasInput, in, snptStore)\n\n\t\t\tif err != nil || snpt.GetId() == \"\" {\n\t\t\t\treturn errors.New(\"Failed to retrieve snippet from database\")\n\t\t\t}\n\n\t\t\tif err := clipboard.WriteAll(snpt.Content); err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to copy %s to the clipboard\", snpt.GetFilename())\n\t\t\t}\n\n\t\t\tcliHelper.PrintSuccess(out, \"%s copied to the clipboard\", snpt.GetFilename())\n\n\t\t\treturn nil\n\t\t},\n\t}\n}", "func newSecretForCR(cr *ricobergerdev1alpha1.VaultSecret, data map[string][]byte) (*corev1.Secret, error) {\n\tlabels := map[string]string{}\n\tfor k, v := range cr.ObjectMeta.Labels {\n\t\tlabels[k] = v\n\t}\n\n\tannotations := map[string]string{}\n\tfor k, v := range cr.ObjectMeta.Annotations {\n\t\tannotations[k] = v\n\t}\n\n\tif cr.Spec.Templates != nil {\n\t\tnewdata := make(map[string][]byte)\n\t\tfor k, v := range cr.Spec.Templates {\n\t\t\ttemplated, err := runTemplate(cr, v, data)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Template ERROR: %w\", err)\n\t\t\t}\n\t\t\tnewdata[k] = templated\n\t\t}\n\t\tdata = newdata\n\t}\n\n\treturn &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t\tAnnotations: annotations,\n\t\t},\n\t\tData: data,\n\t\tType: cr.Spec.Type,\n\t}, 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(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 (g *Guard) Secret(v []byte) (*Secret, error) {\n\tg.lock.Lock()\n\tdefer g.lock.Unlock()\n\n\tb, err := memguard.NewMutableFromBytes(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := Secret{\n\t\tbuffer: b,\n\t\tguard: g,\n\t}\n\n\tg.secrets = append(g.secrets, &s)\n\treturn &s, nil\n}", "func newSecretClient(subID string, authorizer auth.Authorizer) (*client, error) {\n\tc, err := wssdcloudclient.GetSecretClient(&subID, authorizer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &client{c}, nil\n}", "func backupSecrets(env *localenv.LocalEnvironment, path string) error {\n\tsuffix, err := users.CryptoRandomToken(6)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tbackupPath := fmt.Sprintf(\"%v-%v\", path, suffix)\n\terr = utils.CopyDirContents(path, backupPath)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tenv.Printf(\"Backed up %v to %v\\n\", path, backupPath)\n\treturn nil\n}", "func UpdateSecrets(request requests.CreateFunctionRequest, deployment *v1beta1.Deployment, existingSecrets map[string]*apiv1.Secret) error {\n\t// Add / reference pre-existing secrets within Kubernetes\n\tsecretVolumeProjections := []apiv1.VolumeProjection{}\n\n\tfor _, secretName := range request.Secrets {\n\t\tdeployedSecret, ok := existingSecrets[secretName]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Required secret '%s' was not found in the cluster\", secretName)\n\t\t}\n\n\t\tswitch deployedSecret.Type {\n\n\t\tcase apiv1.SecretTypeDockercfg,\n\t\t\tapiv1.SecretTypeDockerConfigJson:\n\n\t\t\tdeployment.Spec.Template.Spec.ImagePullSecrets = append(\n\t\t\t\tdeployment.Spec.Template.Spec.ImagePullSecrets,\n\t\t\t\tapiv1.LocalObjectReference{\n\t\t\t\t\tName: secretName,\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tbreak\n\n\t\tdefault:\n\n\t\t\tprojectedPaths := []apiv1.KeyToPath{}\n\t\t\tfor secretKey := range deployedSecret.Data {\n\t\t\t\tprojectedPaths = append(projectedPaths, apiv1.KeyToPath{Key: secretKey, Path: secretKey})\n\t\t\t}\n\n\t\t\tprojection := &apiv1.SecretProjection{Items: projectedPaths}\n\t\t\tprojection.Name = secretName\n\t\t\tsecretProjection := apiv1.VolumeProjection{\n\t\t\t\tSecret: projection,\n\t\t\t}\n\t\t\tsecretVolumeProjections = append(secretVolumeProjections, secretProjection)\n\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvolumeName := fmt.Sprintf(\"%s-projected-secrets\", request.Service)\n\tprojectedSecrets := apiv1.Volume{\n\t\tName: volumeName,\n\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\tProjected: &apiv1.ProjectedVolumeSource{\n\t\t\t\tSources: secretVolumeProjections,\n\t\t\t},\n\t\t},\n\t}\n\n\t// remove the existing secrets volume, if we can find it. The update volume will be\n\t// added below\n\texistingVolumes := removeVolume(volumeName, deployment.Spec.Template.Spec.Volumes)\n\tdeployment.Spec.Template.Spec.Volumes = existingVolumes\n\tif len(secretVolumeProjections) > 0 {\n\t\tdeployment.Spec.Template.Spec.Volumes = append(existingVolumes, projectedSecrets)\n\t}\n\n\t// add mount secret as a file\n\tupdatedContainers := []apiv1.Container{}\n\tfor _, container := range deployment.Spec.Template.Spec.Containers {\n\t\tmount := apiv1.VolumeMount{\n\t\t\tName: volumeName,\n\t\t\tReadOnly: true,\n\t\t\tMountPath: \"/run/secrets\",\n\t\t}\n\n\t\t// remove the existing secrets volume mount, if we can find it. We update it later.\n\t\tcontainer.VolumeMounts = removeVolumeMount(volumeName, container.VolumeMounts)\n\t\tif len(secretVolumeProjections) > 0 {\n\t\t\tcontainer.VolumeMounts = append(container.VolumeMounts, mount)\n\t\t}\n\n\t\tupdatedContainers = append(updatedContainers, container)\n\t}\n\n\tdeployment.Spec.Template.Spec.Containers = updatedContainers\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 Secret(s *dag.Secret) *envoy_api_v2_auth.Secret {\n\treturn &envoy_api_v2_auth.Secret{\n\t\tName: Secretname(s),\n\t\tType: &envoy_api_v2_auth.Secret_TlsCertificate{\n\t\t\tTlsCertificate: &envoy_api_v2_auth.TlsCertificate{\n\t\t\t\tPrivateKey: &envoy_api_v2_core.DataSource{\n\t\t\t\t\tSpecifier: &envoy_api_v2_core.DataSource_InlineBytes{\n\t\t\t\t\t\tInlineBytes: s.PrivateKey(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tCertificateChain: &envoy_api_v2_core.DataSource{\n\t\t\t\t\tSpecifier: &envoy_api_v2_core.DataSource_InlineBytes{\n\t\t\t\t\t\tInlineBytes: s.Cert(),\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(\"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(\"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(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 Secret(s *dag.Secret) *envoy_tls_v3.Secret {\n\treturn &envoy_tls_v3.Secret{\n\t\tName: envoy.Secretname(s),\n\t\tType: &envoy_tls_v3.Secret_TlsCertificate{\n\t\t\tTlsCertificate: &envoy_tls_v3.TlsCertificate{\n\t\t\t\tPrivateKey: &envoy_core_v3.DataSource{\n\t\t\t\t\tSpecifier: &envoy_core_v3.DataSource_InlineBytes{\n\t\t\t\t\t\tInlineBytes: s.PrivateKey(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tCertificateChain: &envoy_core_v3.DataSource{\n\t\t\t\t\tSpecifier: &envoy_core_v3.DataSource_InlineBytes{\n\t\t\t\t\t\tInlineBytes: s.Cert(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func New(mgr manager.Manager, operatorNamespace, operandNamespace string) (runtimecontroller.Controller, error) {\n\toperatorCache := mgr.GetCache()\n\treconciler := &reconciler{\n\t\tclient: mgr.GetClient(),\n\t\tcache: operatorCache,\n\t\trecorder: mgr.GetEventRecorderFor(controllerName),\n\t\toperatorNamespace: operatorNamespace,\n\t\toperandNamespace: operandNamespace,\n\t}\n\tc, err := runtimecontroller.New(controllerName, mgr, runtimecontroller.Options{Reconciler: reconciler})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Index ingresscontrollers over the default certificate name so that\n\t// secretToIngressController can look up ingresscontrollers that\n\t// reference the secret.\n\tif err := operatorCache.IndexField(context.Background(), &operatorv1.IngressController{}, \"defaultCertificateName\", client.IndexerFunc(func(o client.Object) []string {\n\t\tsecret := controller.RouterEffectiveDefaultCertificateSecretName(o.(*operatorv1.IngressController), operandNamespace)\n\t\treturn []string{secret.Name}\n\t})); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create index for ingresscontroller: %v\", err)\n\t}\n\n\tsecretsInformer, err := operatorCache.GetInformer(context.Background(), &corev1.Secret{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create informer for secrets: %v\", err)\n\t}\n\tif err := c.Watch(&source.Informer{Informer: secretsInformer}, handler.EnqueueRequestsFromMapFunc(reconciler.secretToIngressController)); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := c.Watch(source.Kind(operatorCache, &operatorv1.IngressController{}), &handler.EnqueueRequestForObject{}, predicate.Funcs{\n\t\tCreateFunc: func(e event.CreateEvent) bool { return reconciler.hasSecret(e.Object, e.Object) },\n\t\tDeleteFunc: func(e event.DeleteEvent) bool { return reconciler.hasSecret(e.Object, e.Object) },\n\t\tUpdateFunc: func(e event.UpdateEvent) bool { return reconciler.secretChanged(e.ObjectOld, e.ObjectNew) },\n\t\tGenericFunc: func(e event.GenericEvent) bool { return reconciler.hasSecret(e.Object, e.Object) },\n\t}, predicate.NewPredicateFuncs(func(o client.Object) bool {\n\t\treturn reconciler.hasClusterIngressDomain(o) || isDefaultIngressController(o)\n\t})); 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 (_m *requestHeaderMapUpdatable) AddCopy(name string, value string) {\n\t_m.Called(name, value)\n}", "func (b *Bucket) Copy() *Bucket {\n\tmd := make(map[string]Metadata)\n\tfor k, v := range b.Metadata {\n\t\tmd[k] = v\n\t}\n\treturn &Bucket{\n\t\tKey: b.Key,\n\t\tOwner: b.Owner,\n\t\tName: b.Name,\n\t\tVersion: b.Version,\n\t\tLinkKey: b.LinkKey,\n\t\tPath: b.Path,\n\t\tMetadata: md,\n\t\tCreatedAt: b.CreatedAt,\n\t\tUpdatedAt: b.UpdatedAt,\n\t}\n}", "func ApplySecretHash(c client.Client, pod *corev1.PodTemplateSpec, annotationName string, namespace string, secretName string, keys ...string) error {\n\n\tsecret := &corev1.Secret{}\n\n\t// fetch secret\n\n\tif err := c.Get(context.Background(), client.ObjectKey{Namespace: namespace, Name: secretName}, secret); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// we could pause reconciling until the secret is provided\n\t\t\treturn util.NewConfigurationError(\"Secret '\" + secretName + \"' missing for deployment\")\n\t\t}\n\t\treturn err\n\t}\n\n\t// create hash\n\n\trec := cchange.NewRecorder()\n\tif len(keys) == 0 {\n\t\trec.AddBytesFromMap(secret.Data)\n\t} else {\n\t\tfor _, k := range keys {\n\t\t\tif v, ok := secret.Data[k]; ok {\n\t\t\t\trec.AddBytes(v)\n\t\t\t} else {\n\t\t\t\treturn util.NewConfigurationError(\"Missing key '%s' in data section of Secret %s/%s\", k, namespace, secretName)\n\t\t\t}\n\t\t}\n\t}\n\n\t// store hash\n\n\tsetHashInformation(pod, annotationName, rec)\n\n\t// done\n\n\treturn nil\n\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 (c *Container) Copy() Scheduable {\n\tnewEl := NewContainer(c.id, c.start, c.end)\n\tsliceCopy := make([]Task, len(c.GetTasks()))\n\tcopy(sliceCopy, c.GetTasks())\n\tnewEl.SetTasks(sliceCopy)\n\treturn newEl\n}", "func generateSplunkSecret() []byte {\n\treturn resources.GenerateSecret(secretBytes, 24)\n}", "func PostSecret(c *gin.Context) {\n\trepo := session.Repo(c)\n\n\tin := new(model.Secret)\n\tif err := c.Bind(in); err != nil {\n\t\tc.String(http.StatusBadRequest, \"Error parsing secret. %s\", err)\n\t\treturn\n\t}\n\tsecret := &model.Secret{\n\t\tRepoID: repo.ID,\n\t\tName: in.Name,\n\t\tValue: in.Value,\n\t\tEvents: in.Events,\n\t\tImages: in.Images,\n\t}\n\tif err := secret.Validate(); err != nil {\n\t\tc.String(400, \"Error inserting secret. %s\", err)\n\t\treturn\n\t}\n\tif err := Config.Services.Secrets.SecretCreate(repo, secret); err != nil {\n\t\tc.String(500, \"Error inserting secret %q. %s\", in.Name, err)\n\t\treturn\n\t}\n\tc.JSON(200, secret.Copy())\n}", "func (b *Executor) Copy(excludes []string, copies ...imagebuilder.Copy) error {\n\tfor _, copy := range copies {\n\t\tlogrus.Debugf(\"COPY %#v, %#v\", excludes, copy)\n\t\tif err := b.volumeCacheInvalidate(copy.Dest); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsources := []string{}\n\t\tfor _, src := range copy.Src {\n\t\t\tif strings.HasPrefix(src, \"http://\") || strings.HasPrefix(src, \"https://\") {\n\t\t\t\tsources = append(sources, src)\n\t\t\t} else if len(copy.From) > 0 {\n\t\t\t\tif other, ok := b.named[copy.From]; ok && other.index < b.index {\n\t\t\t\t\tsources = append(sources, filepath.Join(other.mountPoint, src))\n\t\t\t\t} else {\n\t\t\t\t\treturn errors.Errorf(\"the stage %q has not been built\", copy.From)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsources = append(sources, filepath.Join(b.contextDir, src))\n\t\t\t}\n\t\t}\n\n\t\toptions := buildah.AddAndCopyOptions{\n\t\t\tChown: copy.Chown,\n\t\t}\n\n\t\tif err := b.builder.Add(copy.Dest, copy.Download, options, sources...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Config) AddSecretVolumesToIntendedSTS(sts *appsv1.StatefulSet, volumeConfigMapMap map[string]string) {\n\tAddSecretVolumesToIntendedSTS(sts, volumeConfigMapMap)\n}", "func (sr *StoredRecording) Copy(key *ari.Key, dest string) (*ari.StoredRecordingHandle, error) {\n\th, err := sr.StageCopy(key, dest)\n\tif err != nil {\n\t\t// NOTE: return the handle even on failure so that it can be used to\n\t\t// delete the existing stored recording, should the Copy fail.\n\t\t// ARI provides no facility to force-copy a recording.\n\t\treturn h, err\n\t}\n\n\treturn h, h.Exec()\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 (config *Config) AddSecret(tenants string, pw []byte) ([]byte, error) {\n\tvar err error\n\n\tsecret, err := config.GetSecretMap()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"AddSecret(GetSecretMap)\")\n\t}\n\n\t// create secret key once if it doesn't exist\n\tif _, ok := secret.Name[\"secretkey\"]; !ok {\n\n\t\tsecret.Name = make(map[string][]byte)\n\t\tsecret.Name[\"secretkey\"], err = GetSecretKey()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"AddSecret(GetSecretKey)\")\n\t\t}\n\t}\n\n\t// encrypt password\n\tencPw, err := PwEncrypt(pw, secret.Name[\"secretkey\"])\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"AddSecret(PwEncrypt)\")\n\t}\n\n\tfor _, tenant := range strings.Split(tenants, \",\") {\n\n\t\t// check, if cmd line tenant exists in configfile\n\t\ttInfo := config.FindTenant(low(tenant))\n\t\tif \"\" == tInfo.Name {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"tenant\": low(tenant),\n\t\t\t}).Error(\"missing tenant\")\n\t\t\treturn nil, errors.New(\"Did not find tenant in configfile tenants slice.\")\n\t\t}\n\n\t\t// add password to secret map\n\t\tsecret.Name[low(tenant)] = encPw\n\t}\n\n\t// write pw information back to the config file\n\tnewSecret, err := proto.Marshal(&secret)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"AddSecret(Marshal)\")\n\t}\n\n\treturn newSecret, nil\n}", "func (in *PlatformSecrets) DeepCopy() *PlatformSecrets {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PlatformSecrets)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"dataset-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 Dataset\n\terr = c.Watch(&source.Kind{Type: &comv1alpha1.Dataset{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Controller) Secrets() typedv1.SecretInterface {\n\treturn c.client.Secrets(c.namespace.Name)\n}" ]
[ "0.61047924", "0.58078575", "0.55848235", "0.5407227", "0.5254048", "0.5200474", "0.51375145", "0.49901083", "0.49053696", "0.48901126", "0.4862202", "0.4833981", "0.48101637", "0.48065236", "0.47915724", "0.47563052", "0.47331327", "0.47252765", "0.47191927", "0.46923995", "0.46914914", "0.46902007", "0.46865007", "0.46711046", "0.46570998", "0.4650207", "0.46490082", "0.46382594", "0.46232036", "0.4599958", "0.45986438", "0.4596334", "0.4593119", "0.45889023", "0.45665815", "0.45661953", "0.4566038", "0.45653766", "0.45627588", "0.45614845", "0.45536909", "0.45528078", "0.45497867", "0.4540884", "0.45382547", "0.45379573", "0.4531662", "0.45311275", "0.4502233", "0.45020038", "0.4491847", "0.44830003", "0.4473667", "0.44679958", "0.44658107", "0.4458257", "0.44511703", "0.44473505", "0.4445275", "0.44396394", "0.44379643", "0.44253808", "0.44222635", "0.44151437", "0.44099846", "0.44096527", "0.44045958", "0.43938085", "0.43860948", "0.43849128", "0.43721133", "0.43594605", "0.4357975", "0.43526936", "0.4344357", "0.4340745", "0.4338392", "0.43382633", "0.43373346", "0.43364128", "0.4333047", "0.4317101", "0.43116635", "0.43021196", "0.42978936", "0.42968196", "0.429542", "0.42912114", "0.42884743", "0.42862293", "0.4281692", "0.4280333", "0.42769882", "0.4275873", "0.42651674", "0.4261313", "0.4260805", "0.42597207", "0.4257963", "0.42568064" ]
0.8458819
0
listQuarksSecretsReconciles lists all Quarks Secrets associated with the a particular secret.
listQuarksSecretsReconciles перечисляет все Quarks Secrets, связанные с определенным секретом.
func listQuarksSecretsReconciles(ctx context.Context, client crc.Client, secret *corev1.Secret, namespace string) ([]reconcile.Request, error) { quarksSecretList := &qsv1a1.QuarksSecretList{} err := client.List(ctx, quarksSecretList, crc.InNamespace(namespace)) if err != nil { return nil, errors.Wrap(err, "failed to list QuarksSecrets") } result := []reconcile.Request{} for _, quarksSecret := range quarksSecretList.Items { if quarksSecret.Spec.SecretName == secret.Name { request := reconcile.Request{ NamespacedName: types.NamespacedName{ Name: quarksSecret.Name, Namespace: quarksSecret.Namespace, }} result = append(result, request) ctxlog.NewMappingEvent(secret).Debug(ctx, request, "QuarksSecret", secret.Name, qsv1a1.KubeSecretReference) } } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s Secrets) List(ctx context.Context, maxResults int32) ([]string, error) {\n\tvers, err := s.Ops.Secrets().List(ctx, maxResults)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout := make([]string, 0, len(vers))\n\tfor _, ver := range vers {\n\t\tout = append(out, ver.ID)\n\t}\n\treturn out, nil\n}", "func (c *Client) ListScramSecrets(ctx context.Context, params *ListScramSecretsInput, optFns ...func(*Options)) (*ListScramSecretsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListScramSecretsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListScramSecrets\", params, optFns, addOperationListScramSecretsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListScramSecretsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (c *ClientSetClient) ListSecrets(namespace string, opts metav1.ListOptions) (*v1.SecretList, error) {\n\tctx := context.TODO()\n\treturn c.clientset.CoreV1().Secrets(namespace).List(ctx, opts)\n}", "func (api *API) ListWorkersSecrets(ctx context.Context, rc *ResourceContainer, params ListWorkersSecretsParams) (WorkersListSecretsResponse, error) {\n\tif rc.Level != AccountRouteLevel {\n\t\treturn WorkersListSecretsResponse{}, ErrRequiredAccountLevelResourceContainer\n\t}\n\n\tif rc.Identifier == \"\" {\n\t\treturn WorkersListSecretsResponse{}, ErrMissingAccountID\n\t}\n\n\turi := fmt.Sprintf(\"/accounts/%s/workers/scripts/%s/secrets\", rc.Identifier, params.ScriptName)\n\tres, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn WorkersListSecretsResponse{}, err\n\t}\n\n\tresult := WorkersListSecretsResponse{}\n\tif err := json.Unmarshal(res, &result); err != nil {\n\t\treturn result, fmt.Errorf(\"%s: %w\", errUnmarshalError, err)\n\t}\n\n\treturn result, err\n}", "func (dir EnvDir) Secrets() []string {\n\treturn []string{}\n}", "func (v *Vault) ListSecrets() {\n\tlog.Debugf(\"Listing secrets in Vault KV Path: %v\", s.VaultKVPath())\n\td, err := v.Client.Logical().List(s.VaultKVPath())\n\tif err != nil {\n\t\tlog.Fatalf(\"Vault error: %v\", err)\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Key\"})\n\tfor _, l := range d.Data[\"keys\"].([]interface{}) {\n\t\ttable.Append([]string{l.(string)})\n\t}\n\ttable.Render()\n}", "func GetSecretList(c *gin.Context) {\n\trepo := session.Repo(c)\n\tlist, err := Config.Services.Secrets.SecretList(repo)\n\tif err != nil {\n\t\tc.String(500, \"Error getting secret list. %s\", err)\n\t\treturn\n\t}\n\t// copy the secret detail to remove the sensitive\n\t// password and token fields.\n\tfor i, secret := range list {\n\t\tlist[i] = secret.Copy()\n\t}\n\tc.JSON(200, list)\n}", "func (ef EnvFlags) Secrets() []string {\n\tresult := make([]string, len(ef))\n\ti := 0\n\tfor _, v := range ef {\n\t\tresult[i] = v\n\t\ti++\n\t}\n\treturn result\n}", "func (s S) Secrets() []v1.Secret {\n\treturn s.secrets\n}", "func getSecrets(p *Plugin) ([]Secret, error) {\n\ttype (\n\t\t// PasswordState JSON response for the passwords\n\t\tPasswordList struct {\n\t\t\tPasswordID int `json:\"PasswordID\"`\n\t\t\tTitle string `json:\"Title\"`\n\t\t\tUserName string `json:\"UserName\"`\n\t\t\tDescription string `json:\"Description\"`\n\t\t\tGenericField1 string `json:\"GenericField1\"`\n\t\t\tGenericField2 string `json:\"GenericField2\"`\n\t\t\tGenericField3 string `json:\"GenericField3\"`\n\t\t\tGenericField4 string `json:\"GenericField4\"`\n\t\t\tGenericField5 string `json:\"GenericField5\"`\n\t\t\tGenericField6 string `json:\"GenericField6\"`\n\t\t\tGenericField7 string `json:\"GenericField7\"`\n\t\t\tGenericField8 string `json:\"GenericField8\"`\n\t\t\tGenericField9 string `json:\"GenericField9\"`\n\t\t\tGenericField10 string `json:\"GenericField10\"`\n\t\t\tAccountTypeID int `json:\"AccountTypeID\"`\n\t\t\tNotes string `json:\"Notes\"`\n\t\t\tURL string `json:\"URL\"`\n\t\t\tPassword string `json:\"Password\"`\n\t\t\tExpiryDate string `json:\"ExpiryDate\"`\n\t\t\tAllowExport bool `json:\"AllowExport\"`\n\t\t\tAccountType string `json:\"AccountType\"`\n\t\t}\n\t)\n\n\tvar (\n\t\turl strings.Builder\n\t\tsecrets []Secret\n\t)\n\n\turl.WriteString(strings.TrimRight(p.Config.ApiEndpoint, \"/\"))\n\turl.WriteString(\"/passwords/{PasswordListID}\")\n\n\t// Configure the API client:\n\tclient := resty.New()\n\tclient.\n\t\tSetRetryCount(p.Config.ConnectionRetries).\n\t\tSetTimeout(time.Duration(p.Config.ConnectionTimeout) * time.Second)\n\tif p.Config.Debug {\n\t\tclient.SetDebug(true)\n\t}\n\tif p.Config.SkipTlsVerify {\n\t\tclient.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: p.Config.SkipTlsVerify})\n\t}\n\tclient.\n\t\tSetQueryParams(map[string]string{\n\t\t\t\"QueryAll\": \"true\",\n\t\t\t\"PreventAuditing\": \"false\",\n\t\t}).\n\t\tSetPathParams(map[string]string{\n\t\t\t\"PasswordListID\": strconv.Itoa(p.Config.PasswordListId),\n\t\t}).\n\t\tSetHeaders(map[string]string{\n\t\t\t\"APIKey\": p.Config.ApiKey,\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t})\n\n\t// Send the request:\n\tlogrus.WithField(\"endpoint\", p.Config.ApiEndpoint).WithField(\"list_id\", p.Config.PasswordListId).Infoln(\"Querying PasswordState API.\")\n\tresponse, err := client.R().\n\t\tSetResult([]PasswordList{}).\n\t\tGet(url.String())\n\n\tif err != nil {\n\t\tlogrus.WithError(err).Errorln(\"Failed to retrieved data from PasswordState.\")\n\t\treturn nil, err\n\t}\n\n\tpasswords := *response.Result().(*[]PasswordList)\n\tlogrus.WithField(\"count\", len(passwords)).Infoln(\"Passwords retrieved from PasswordState.\")\n\tlogrus.WithField(\"key_field\", p.Config.KeyField).WithField(\"value_field\", p.Config.ValueField).Infoln(\"Converting retrieved passwords to secrets.\")\n\tfor _, password := range passwords {\n\t\tkey := reflect.Indirect(reflect.ValueOf(password)).FieldByName(p.Config.KeyField).String()\n\t\tif key == \"\" || key == \"<invalid Value>\" {\n\t\t\tlogrus.WithField(\"password_id\", password.PasswordID).WithField(\"field\", p.Config.KeyField).Warnln(\"Key is empty. Skipping the secret.\")\n\t\t\tcontinue\n\t\t}\n\t\tvalue := reflect.Indirect(reflect.ValueOf(password)).FieldByName(p.Config.ValueField).String()\n\t\tif value == \"\" || value == \"<invalid Value>\" {\n\t\t\tlogrus.WithField(\"password_id\", password.PasswordID).WithField(\"field\", p.Config.ValueField).Warnln(\"Value is empty. Skipping the secret.\")\n\t\t\tcontinue\n\t\t}\n\t\tsecret := Secret{\n\t\t\tKey: key,\n\t\t\tValue: value,\n\t\t}\n\t\tsecrets = append(secrets, secret)\n\t}\n\n\tlogrus.WithField(\"count\", len(secrets)).Infoln(\"Finished processing the secrets.\")\n\treturn secrets, nil\n}", "func (s *ActionsService) ListEnvSecrets(ctx context.Context, repoID int, env string, opts *ListOptions) (*Secrets, *Response, error) {\n\turl := fmt.Sprintf(\"repositories/%v/environments/%v/secrets\", repoID, env)\n\treturn s.listSecrets(ctx, url, opts)\n}", "func (l *Libvirt) ListAllSecrets() ([]*Secret, error) {\n\treq := libvirt.RemoteConnectListAllSecretsReq{\n\t\tNeedResults: 1,\n\t\tFlags: 0}\n\tres := libvirt.RemoteConnectListAllSecretsRes{}\n\n\tbuf, err := encode(&req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := l.send(libvirt.RemoteProcConnectListAllSecrets, 0, libvirt.MessageTypeCall, libvirt.RemoteProgram, libvirt.MessageStatusOK, &buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := <-resp\n\tif r.Header.Status != libvirt.MessageStatusOK {\n\t\treturn nil, decodeError(r.Payload)\n\t}\n\n\tdec := xdr.NewDecoder(bytes.NewReader(r.Payload))\n\t_, err = dec.Decode(&res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar secrets []*Secret\n\tfor _, secret := range res.Secrets {\n\t\tsecrets = append(secrets, &Secret{l: l, RemoteSecret: secret})\n\t}\n\treturn secrets, nil\n}", "func (r *SecretsResource) List(request *http.Request) (interface{}, error) {\n\treturn r.secrets.List(request.Context(), api.SecretListFilter{\n\t\tURL: request.FormValue(\"url\"),\n\t\tTag: request.FormValue(\"tag\"),\n\t\tType: api.SecretType(request.FormValue(\"type\")),\n\t\tName: request.FormValue(\"name\"),\n\t\tDeleted: request.FormValue(\"deleted\") == \"true\",\n\t})\n}", "func (l *Libvirt) Secrets() ([]Secret, error) {\n\tsecrets, _, err := l.ConnectListAllSecrets(1, 0)\n\treturn secrets, err\n}", "func (t envTemplate) Secrets() []string {\n\treturn []string{}\n}", "func ReconcileSecrets(ctx context.Context, namedGetters []NamedSecretCreatorGetter, namespace string, client ctrlruntimeclient.Client, objectModifiers ...ObjectModifier) error {\n\tfor _, get := range namedGetters {\n\t\tname, create := get()\n\t\tcreateObject := SecretObjectWrapper(create)\n\t\tcreateObject = createWithNamespace(createObject, namespace)\n\t\tcreateObject = createWithName(createObject, name)\n\n\t\tfor _, objectModifier := range objectModifiers {\n\t\t\tcreateObject = objectModifier(createObject)\n\t\t}\n\n\t\tif err := EnsureNamedObject(ctx, types.NamespacedName{Namespace: namespace, Name: name}, createObject, client, &corev1.Secret{}, false); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to ensure Secret %s/%s: %v\", namespace, name, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *secrets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.SecretList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\n\tresult = &v1.SecretList{}\n\terr = c.client.Get().\n\t\tResource(\"secrets\").\n\t\tVersionedParams(opts).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\n\treturn\n}", "func (m *Synchronization) GetSecrets()([]SynchronizationSecretKeyStringValuePairable) {\n val, err := m.GetBackingStore().Get(\"secrets\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]SynchronizationSecretKeyStringValuePairable)\n }\n return nil\n}", "func (s *Secrets) List(ctx context.Context, ns, labelSelector string) ([]v1.Secret, error) {\n\tsList, err := s.k8sClient.CoreV1().Secrets(ns).List(ctx, metav1.ListOptions{LabelSelector: labelSelector})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sList.Items, nil\n}", "func (c *GoClient) GetSecretList(namespace string) (*corev1.SecretList, error) {\n\tresources, err := c.client.CoreV1().Secrets(namespace).List(context.TODO(), metav1.ListOptions{})\n\treturn resources, errors.WithStack(err)\n}", "func (e EnvFile) Secrets() []string {\n\treturn e.env.Secrets()\n}", "func (o EnvironmentDaprComponentOutput) Secrets() EnvironmentDaprComponentSecretArrayOutput {\n\treturn o.ApplyT(func(v *EnvironmentDaprComponent) EnvironmentDaprComponentSecretArrayOutput { return v.Secrets }).(EnvironmentDaprComponentSecretArrayOutput)\n}", "func (secretsManager *SecretsManagerV2) ListSecrets(listSecretsOptions *ListSecretsOptions) (result *SecretMetadataPaginatedCollection, response *core.DetailedResponse, err error) {\n\treturn secretsManager.ListSecretsWithContext(context.Background(), listSecretsOptions)\n}", "func (a *EnvironmentSecretApiService) ListEnvironmentSecrets(ctx _context.Context, environmentId string) ApiListEnvironmentSecretsRequest {\n\treturn ApiListEnvironmentSecretsRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tenvironmentId: environmentId,\n\t}\n}", "func (r *syncCommand) applySecrets(secrets []*api.Secret) error {\n\tlog.Infof(\"%s\", color.GreenString(\"-> synchronizing the secrets with vault, secrets: %d\", len(secrets)))\n\n\tfor _, s := range secrets {\n\t\t// step: validate the secret\n\t\tif err := s.IsValid(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Infof(\"[secret: %s] adding the secret\", s.Path)\n\n\t\t// step: apply the secret\n\t\tif err := r.client.AddSecret(s); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (r *ReconcileVaultSecret) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\tlog.Printf(\"Reconciling VaultSecret %s/%s\\n\", request.Namespace, request.Name)\n\n\t// Fetch the VaultSecret instance\n\tinstance := &crdv1alpha1.VaultSecret{}\n\terr := r.client.Get(context.TODO(), request.NamespacedName, instance)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\t// Define a new Secret object\n\tsecret := newSecretForCR(instance)\n\n\t// Set VaultSecret instance as the owner and controller\n\tif err := controllerutil.SetControllerReference(instance, secret, r.scheme); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\trefreshRate := time.Duration(30)\n\n\t// Check if this Secret already exists\n\tfound := &corev1.Secret{}\n\terr = r.client.Get(context.TODO(), types.NamespacedName{Name: secret.Name, Namespace: secret.Namespace}, found)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tlog.Printf(\"Creating a new Secret %s/%s\\n\", secret.Namespace, secret.Name)\n\t\terr = r.client.Create(context.TODO(), secret)\n\t\tif err != nil {\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\n\t\t// Secret created successfully - requeue after x seconds\n\t\treturn reconcile.Result{Requeue: true, RequeueAfter: time.Second*refreshRate}, nil\n\t} else if err != nil {\n\t\treturn reconcile.Result{Requeue: true, RequeueAfter: time.Second*refreshRate}, err\n\t}\n\n\t// Secret already exists - update and requeue\n\tlog.Printf(\"Secret %s/%s already exists, updating...\", found.Namespace, found.Name)\n\terr = r.client.Update(context.TODO(), secret)\n\tif err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\treturn reconcile.Result{Requeue: true, RequeueAfter: time.Second*refreshRate}, nil\n}", "func (o TriggerBuildOutput) Secrets() TriggerBuildSecretArrayOutput {\n\treturn o.ApplyT(func(v TriggerBuild) []TriggerBuildSecret { return v.Secrets }).(TriggerBuildSecretArrayOutput)\n}", "func (c *Client) ListSecrets(ctx context.Context, params *ListSecretsInput, optFns ...func(*Options)) (*ListSecretsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListSecretsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListSecrets\", params, optFns, addOperationListSecretsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListSecretsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (s *k8sStore) syncSecrets(ing *networkingv1.Ingress) {\n\tkey := ik8s.MetaNamespaceKey(ing)\n\tfor _, secrKey := range s.secretIngressMap.getSecretKeys(key) {\n\t\ts.syncSecret(secrKey)\n\t}\n}", "func (c *Client) ListSecrets(ctx context.Context, params *ListSecretsInput, optFns ...func(*Options)) (*ListSecretsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListSecretsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListSecrets\", params, optFns, c.addOperationListSecretsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListSecretsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (c *Client) ListSecretVersions(secretBlindName string, withData bool) ([]*api.EncryptedSecretVersion, error) {\n\tout := []*api.EncryptedSecretVersion{}\n\trawURL := fmt.Sprintf(pathSecretVersions+\"?encrypted_blob=%t\", c.base.String(), secretBlindName, withData)\n\terr := c.get(rawURL, true, &out)\n\treturn out, errio.Error(err)\n}", "func (r *VaultSecretReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := logr.FromContext(ctx)\n\n\t// Set reconciliation if the vault-secret does not specify a version.\n\treconcileResult := ctrl.Result{}\n\tif vault.ReconciliationTime > 0 {\n\t\treconcileResult = ctrl.Result{\n\t\t\tRequeueAfter: time.Second * time.Duration(vault.ReconciliationTime),\n\t\t}\n\t}\n\n\t// Fetch the VaultSecret instance\n\tinstance := &ricobergerdev1alpha1.VaultSecret{}\n\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 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// Check if the VaultSecret instance is marked to be deleted, which is\n // indicated by the deletion timestamp being set. The object will be deleted.\n isVaultSecretMarkedToBeDeleted := instance.GetDeletionTimestamp() != nil\n if isVaultSecretMarkedToBeDeleted {\n return ctrl.Result{}, nil\n }\n\n\t// Get secret from Vault.\n\t// If the VaultSecret contains the vaulRole property we are creating a new client with the specified Vault Role to\n\t// get the secret.\n\t// When the property isn't set we are using the shared client. It is also possible that the shared client is nil, so\n\t// that we have to check for this first. This could happen since we do not return an error when we initializing the\n\t// client during start up, to not require a default Vault Role.\n\tvar data map[string][]byte\n\n\tvar vaultClient *vault.Client\n\n\tif instance.Spec.VaultRole != \"\" {\n\t\tlog.WithValues(\"vaultRole\", instance.Spec.VaultRole).Info(\"Create client to get secret from Vault\")\n\t\tvaultClient, err = vault.CreateClient(instance.Spec.VaultRole)\n\t\tif err != nil {\n\t\t\t// Error creating the Vault client - requeue the request.\n\t\t\tr.updateConditions(ctx, instance, conditionReasonFetchFailed, err.Error(), metav1.ConditionFalse)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t} else {\n\t\tlog.Info(\"Use shared client to get secret from Vault\")\n\t\tif vault.SharedClient == nil {\n\t\t\terr = fmt.Errorf(\"shared client not initialized and vaultRole property missing\")\n\t\t\tlog.Error(err, \"Could not get secret from Vault\")\n\t\t\tr.updateConditions(ctx, instance, conditionReasonFetchFailed, err.Error(), metav1.ConditionFalse)\n\t\t\treturn ctrl.Result{}, err\n\t\t} else {\n\t\t\tvaultClient = vault.SharedClient\n\t\t}\n\t}\n\n\tif instance.Spec.SecretEngine == \"\" || instance.Spec.SecretEngine == kvEngine {\n\t\tdata, err = vaultClient.GetSecret(instance.Spec.SecretEngine, instance.Spec.Path, instance.Spec.Keys, instance.Spec.Version, instance.Spec.IsBinary, instance.Spec.VaultNamespace)\n\t\tif err != nil {\n\t\t\t// Error while getting the secret from Vault - requeue the request.\n\t\t\tlog.Error(err, \"Could not get secret from vault\")\n\t\t\tr.updateConditions(ctx, instance, conditionReasonFetchFailed, err.Error(), metav1.ConditionFalse)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t} else if instance.Spec.SecretEngine == pkiEngine {\n\t\tif err := ValidatePKI(instance); err != nil {\n\t\t\tlog.Error(err, \"Resource validation failed\")\n\t\t\tr.updateConditions(ctx, instance, conditionReasonInvalidResource, err.Error(), metav1.ConditionFalse)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tvar expiration *time.Time\n\t\tdata, expiration, err = vaultClient.GetCertificate(instance.Spec.Path, instance.Spec.Role, instance.Spec.EngineOptions)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Could not get certificate from vault\")\n\t\t\tr.updateConditions(ctx, instance, conditionReasonFetchFailed, err.Error(), metav1.ConditionFalse)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Requeue before expiration\n\t\tlog.Info(fmt.Sprintf(\"Certificate will expire on %s\", expiration.String()))\n\t\tra := expiration.Sub(time.Now()) - vaultClient.GetPKIRenew()\n\t\tif ra <= 0 {\n\t\t\treconcileResult.Requeue = true\n\t\t} else {\n\t\t\treconcileResult.RequeueAfter = ra\n\t\t\tlog.Info(fmt.Sprintf(\"Certificate will be renewed on %s\", time.Now().Add(ra).String()))\n\t\t}\n\t}\n\n\t// Define a new Secret object\n\tsecret, err := newSecretForCR(instance, data)\n\tif err != nil {\n\t\t// Error while creating the Kubernetes secret - requeue the request.\n\t\tlog.Error(err, \"Could not create Kubernetes secret\")\n\t\tr.updateConditions(ctx, instance, conditionReasonCreateFailed, err.Error(), metav1.ConditionFalse)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Set VaultSecret instance as the owner and controller\n\terr = ctrl.SetControllerReference(instance, secret, r.Scheme)\n\tif err != nil {\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Check if this Secret already exists\n\tfound := &corev1.Secret{}\n\terr = r.Get(ctx, types.NamespacedName{Name: secret.Name, Namespace: secret.Namespace}, found)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tlog.Info(\"Creating a new Secret\", \"Secret.Namespace\", secret.Namespace, \"Secret.Name\", secret.Name)\n\t\terr = r.Create(ctx, secret)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Could not create secret\")\n\t\t\tr.updateConditions(ctx, instance, conditionReasonCreateFailed, err.Error(), metav1.ConditionFalse)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Secret created successfully - requeue only if no version is specified\n\t\tr.updateConditions(ctx, instance, conditionReasonCreated, \"Secret was created\", metav1.ConditionTrue)\n\t\treturn reconcileResult, nil\n\t} else if err != nil {\n\t\tlog.Error(err, \"Could not create secret\")\n\t\tr.updateConditions(ctx, instance, conditionReasonCreateFailed, err.Error(), metav1.ConditionFalse)\n\t\treturn ctrl.Result{}, err\n\t}\n\n\t// Secret already exists, update the secret\n\t// Merge -> Checks the existing data keys and merge them into the updated secret\n\t// Replace -> Do not check the data keys and replace the secret\n\tif instance.Spec.ReconcileStrategy == \"Merge\" {\n\t\tsecret = mergeSecretData(secret, found)\n\n\t\tlog.Info(\"Updating a Secret\", \"Secret.Namespace\", secret.Namespace, \"Secret.Name\", secret.Name)\n\t\terr = r.Update(ctx, secret)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Could not update secret\")\n\t\t\tr.updateConditions(ctx, instance, conditionReasonMergeFailed, err.Error(), metav1.ConditionFalse)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tr.updateConditions(ctx, instance, conditionReasonUpdated, \"Secret was updated\", metav1.ConditionTrue)\n\t} else {\n\t\tlog.Info(\"Updating a Secret\", \"Secret.Namespace\", secret.Namespace, \"Secret.Name\", secret.Name)\n\t\terr = r.Update(ctx, secret)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Could not update secret\")\n\t\t\tr.updateConditions(ctx, instance, conditionReasonUpdateFailed, err.Error(), metav1.ConditionFalse)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tr.updateConditions(ctx, instance, conditionReasonUpdated, \"Secret was updated\", metav1.ConditionTrue)\n\t}\n\n\t// Secret updated successfully - requeue only if no version is specified\n\treturn reconcileResult, nil\n}", "func (l *Libvirt) ConnectListSecrets(Maxuuids int32) (rUuids []string, err error) {\n\tvar buf []byte\n\n\targs := ConnectListSecretsArgs {\n\t\tMaxuuids: Maxuuids,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar r response\n\tr, err = l.requestStream(140, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Return value unmarshaling\n\ttpd := typedParamDecoder{}\n\tct := map[string]xdr.TypeDecoder{\"libvirt.TypedParam\": tpd}\n\trdr := bytes.NewReader(r.Payload)\n\tdec := xdr.NewDecoderCustomTypes(rdr, 0, ct)\n\t// Uuids: []string\n\t_, err = dec.Decode(&rUuids)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func configEditorCredentialsSecretFrom(objs []client.Object) string {\n\tfor _, obj := range objs {\n\t\tif !strings.Contains(obj.GetName(), \"quay-config-editor-credentials\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tgvk := obj.GetObjectKind().GroupVersionKind()\n\t\tif gvk.Version != \"v1\" {\n\t\t\tcontinue\n\t\t}\n\t\tif gvk.Kind != \"Secret\" {\n\t\t\tcontinue\n\t\t}\n\n\t\treturn obj.GetName()\n\t}\n\treturn \"\"\n}", "func (c *Client) ListSecretKeys(secretBlindName string) ([]*api.EncryptedSecretKey, error) {\n\tout := []*api.EncryptedSecretKey{}\n\trawURL := fmt.Sprintf(pathSecretKeys, c.base.String(), secretBlindName)\n\terr := c.get(rawURL, true, &out)\n\treturn out, errio.Error(err)\n}", "func (s Secrets) ListDeleted(ctx context.Context, maxResults int32) ([]Deleted, error) {\n\treturn s.Ops.Secrets().ListDeleted(ctx, maxResults)\n}", "func (m *ApplicationResource) ListClientSecretsForApplication(ctx context.Context, appId string) ([]*ClientSecret, *Response, error) {\n\turl := fmt.Sprintf(\"/api/v1/apps/%v/credentials/secrets\", appId)\n\n\trq := m.client.CloneRequestExecutor()\n\n\treq, err := rq.WithAccept(\"application/json\").WithContentType(\"application/json\").NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar clientSecret []*ClientSecret\n\n\tresp, err := rq.Do(ctx, req, &clientSecret)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn clientSecret, resp, nil\n}", "func (s *secretRenewer) Secrets() secrets {\n\ts.m.RLock()\n\tdefer s.m.RUnlock()\n\treturn secrets{\n\t\tRoots: s.roots,\n\t\tCertificates: s.certificates,\n\t}\n}", "func secretsByteList(secrets []string) [][][]byte {\n\tvar s [][][]byte\n\tfor _, secret := range secrets {\n\t\tlines, lastLine := splitAfterNewline([]byte(secret))\n\t\tif lines == nil && lastLine == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar secretLines [][]byte\n\t\tif lines != nil {\n\t\t\tsecretLines = append(secretLines, lines...)\n\t\t}\n\t\tif lastLine != nil {\n\t\t\tsecretLines = append(secretLines, lastLine)\n\t\t}\n\t\ts = append(s, secretLines)\n\t}\n\treturn s\n}", "func (o *InlineResponse2002) SetSecrets(v []Secret) {\n\to.Secrets = &v\n}", "func (a *apiServer) ListSecret(ctx context.Context, in *emptypb.Empty) (response *pps.SecretInfos, retErr error) {\n\tmetricsFn := metrics.ReportUserAction(ctx, a.reporter, \"ListSecret\")\n\tdefer func(start time.Time) { metricsFn(start, retErr) }(time.Now())\n\n\tsecrets, err := a.env.KubeClient.CoreV1().Secrets(a.namespace).List(ctx, metav1.ListOptions{\n\t\tLabelSelector: \"secret-source=pachyderm-user\",\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to list secrets\")\n\t}\n\tsecretInfos := []*pps.SecretInfo{}\n\tfor _, s := range secrets.Items {\n\t\tsecretInfos = append(secretInfos, &pps.SecretInfo{\n\t\t\tSecret: &pps.Secret{\n\t\t\t\tName: s.Name,\n\t\t\t},\n\t\t\tType: string(s.Type),\n\t\t\tCreationTimestamp: timestamppb.New(s.GetCreationTimestamp().Time),\n\t\t})\n\t}\n\n\treturn &pps.SecretInfos{\n\t\tSecretInfo: secretInfos,\n\t}, nil\n}", "func (o ContainerV1Output) SecretRefs() ContainerV1SecretRefArrayOutput {\n\treturn o.ApplyT(func(v *ContainerV1) ContainerV1SecretRefArrayOutput { return v.SecretRefs }).(ContainerV1SecretRefArrayOutput)\n}", "func ListArtifactCredentials(c *gin.Context) {\n\tresponse := ArtifactsCredentials{\n\t\tArtifactsCredential{\n\t\t\tName: \"helm-stable\",\n\t\t\tTypes: []string{\n\t\t\t\t\"helm/chart\",\n\t\t\t},\n\t\t},\n\t\tArtifactsCredential{\n\t\t\tName: \"embedded-artifact\",\n\t\t\tTypes: []string{\n\t\t\t\t\"embedded/base64\",\n\t\t\t},\n\t\t},\n\t}\n\tc.JSON(http.StatusOK, response)\n}", "func UpdateSecrets(kubeClient *kubernetes.Clientset, secrets []string) error {\n\tsuccChan, errChan := make(chan string), make(chan error)\n\n\tfor _, secret := range secrets {\n\t\tgo updateSecret(kubeClient, secret, succChan, errChan)\n\t}\n\tfor i := 0; i < len(secrets); i++ {\n\t\tselect {\n\t\tcase successMsg := <-succChan:\n\t\t\tfmt.Println(successMsg)\n\t\tcase err := <-errChan:\n\t\t\tfmt.Println(err)\n\t\t}\n\t}\n\treturn nil\n}", "func ResolveSecrets(ctx context.Context, client client.Client, secretRefs []v1alpha1.ObjectReference) ([]corev1.Secret, error) {\n\tsecrets := make([]corev1.Secret, len(secretRefs))\n\tfor i, secretRef := range secretRefs {\n\t\tsecret := corev1.Secret{}\n\t\t// todo: check for cache\n\t\tif err := client.Get(ctx, secretRef.NamespacedName(), &secret); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsecrets[i] = secret\n\t}\n\treturn secrets, nil\n}", "func (cc *CredsConfig) GetSecretsCreds(id string) map[string]string {\n\treturn cc.Secrets[id]\n}", "func (r *Reconciler) ReconcileSecretAdmin() error {\n\n\tlog := r.Logger.WithField(\"func\", \"ReconcileSecretAdmin\")\n\n\tutil.KubeCheck(r.SecretAdmin)\n\tutil.SecretResetStringDataFromData(r.SecretAdmin)\n\n\tns := r.Request.Namespace\n\tname := r.Request.Name\n\tsecretAdminName := name + \"-admin\"\n\n\tr.SecretAdmin = &corev1.Secret{}\n\terr := r.GetObject(secretAdminName, r.SecretAdmin)\n\tif err == nil {\n\t\treturn nil\n\t}\n\tif !errors.IsNotFound(err) {\n\t\tlog.Errorf(\"Failed getting admin secret: %v\", err)\n\t\treturn err\n\t}\n\n\tr.SecretAdmin = &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: ns,\n\t\t\tName: secretAdminName,\n\t\t\tLabels: map[string]string{\"app\": \"noobaa\"},\n\t\t},\n\t\tType: corev1.SecretTypeOpaque,\n\t\tStringData: map[string]string{\n\t\t\t\"system\": name,\n\t\t\t\"email\": options.AdminAccountEmail,\n\t\t\t\"password\": string(r.SecretOp.Data[\"password\"]),\n\t\t},\n\t}\n\n\tlog.Infof(\"listing accounts\")\n\tres, err := r.NBClient.ListAccountsAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, account := range res.Accounts {\n\t\tif account.Email == options.AdminAccountEmail {\n\t\t\tif len(account.AccessKeys) > 0 {\n\t\t\t\tr.SecretAdmin.StringData[\"AWS_ACCESS_KEY_ID\"] = account.AccessKeys[0].AccessKey\n\t\t\t\tr.SecretAdmin.StringData[\"AWS_SECRET_ACCESS_KEY\"] = account.AccessKeys[0].SecretKey\n\t\t\t}\n\t\t}\n\t}\n\n\tr.Own(r.SecretAdmin)\n\treturn r.Client.Create(r.Ctx, r.SecretAdmin)\n}", "func (o TriggerBuildStepOutput) SecretEnvs() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v TriggerBuildStep) []string { return v.SecretEnvs }).(pulumi.StringArrayOutput)\n}", "func (secretsManager *SecretsManagerV2) ListSecretsWithContext(ctx context.Context, listSecretsOptions *ListSecretsOptions) (result *SecretMetadataPaginatedCollection, response *core.DetailedResponse, err error) {\n\terr = core.ValidateStruct(listSecretsOptions, \"listSecretsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = secretsManager.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(secretsManager.Service.Options.URL, `/api/v2/secrets`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listSecretsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"secrets_manager\", \"V2\", \"ListSecrets\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tif listSecretsOptions.Offset != nil {\n\t\tbuilder.AddQuery(\"offset\", fmt.Sprint(*listSecretsOptions.Offset))\n\t}\n\tif listSecretsOptions.Limit != nil {\n\t\tbuilder.AddQuery(\"limit\", fmt.Sprint(*listSecretsOptions.Limit))\n\t}\n\tif listSecretsOptions.Sort != nil {\n\t\tbuilder.AddQuery(\"sort\", fmt.Sprint(*listSecretsOptions.Sort))\n\t}\n\tif listSecretsOptions.Search != nil {\n\t\tbuilder.AddQuery(\"search\", fmt.Sprint(*listSecretsOptions.Search))\n\t}\n\tif listSecretsOptions.Groups != nil {\n\t\tbuilder.AddQuery(\"groups\", strings.Join(listSecretsOptions.Groups, \",\"))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = secretsManager.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalSecretMetadataPaginatedCollection)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func (o TriggerBuildOptionsOutput) SecretEnvs() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v TriggerBuildOptions) []string { return v.SecretEnvs }).(pulumi.StringArrayOutput)\n}", "func (k *FileKeystore) List() ([]string, error) {\n\tk.RLock()\n\tdefer k.RUnlock()\n\n\tkeys := make([]string, 0, len(k.secrets))\n\tfor key := range k.secrets {\n\t\tkeys = append(keys, key)\n\t}\n\n\treturn keys, nil\n}", "func (o *InlineResponse2002) GetSecrets() []Secret {\n\tif o == nil || o.Secrets == nil {\n\t\tvar ret []Secret\n\t\treturn ret\n\t}\n\treturn *o.Secrets\n}", "func (o GithubEnterpriseConfigOutput) Secrets() GitHubEnterpriseSecretsResponseOutput {\n\treturn o.ApplyT(func(v *GithubEnterpriseConfig) GitHubEnterpriseSecretsResponseOutput { return v.Secrets }).(GitHubEnterpriseSecretsResponseOutput)\n}", "func (c *Channel) GetNeedRegisterSecrets(blockNumber int64) (secrets []common.Hash) {\n\tfor _, l := range c.PartnerState.Lock2UnclaimedLocks {\n\t\tif l.Lock.Expiration > blockNumber-int64(c.RevealTimeout) && l.Lock.Expiration < blockNumber {\n\t\t\t//底层负责处理重复的问题\n\t\t\tsecrets = append(secrets, l.Secret)\n\t\t}\n\t}\n\treturn\n}", "func DeleteSecrets(t *testing.T, ctx framework.TestContext, credNames []string) { // nolint:interfacer\n\tistioCfg := istio.DefaultConfigOrFail(t, ctx)\n\tsystemNS := namespace.ClaimOrFail(t, ctx, istioCfg.SystemNamespace)\n\tkubeAccessor := ctx.Environment().(*kube.Environment).Accessor\n\tfor _, cn := range credNames {\n\t\terr := kubeAccessor.DeleteSecret(systemNS.Name(), cn)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to delete secret (error: %s)\", err)\n\t\t}\n\t}\n\t// Check if Kubernetes secret is deleted\n\tmaxRetryNumber := 5\n\tcheckRetryInterval := time.Second * 1\n\tfor _, cn := range credNames {\n\t\tt.Logf(\"Check ingress Kubernetes secret %s:%s...\", systemNS.Name(), cn)\n\t\tfor i := 0; i < maxRetryNumber; i++ {\n\t\t\t_, err := kubeAccessor.GetSecret(systemNS.Name()).Get(cn, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\tt.Logf(\"Secret %s:%s is deleted\", systemNS.Name(), cn)\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tt.Logf(\"Secret %s:%s still exists.\", systemNS.Name(), cn)\n\t\t\t\ttime.Sleep(checkRetryInterval)\n\t\t\t}\n\t\t}\n\t}\n}", "func (c *FakeAzureKeyVaultEnvSecrets) List(opts v1.ListOptions) (result *v1alpha1.AzureKeyVaultEnvSecretList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(azurekeyvaultenvsecretsResource, azurekeyvaultenvsecretsKind, c.ns, opts), &v1alpha1.AzureKeyVaultEnvSecretList{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\n\tlabel, _, _ := testing.ExtractFromListOptions(opts)\n\tif label == nil {\n\t\tlabel = labels.Everything()\n\t}\n\tlist := &v1alpha1.AzureKeyVaultEnvSecretList{ListMeta: obj.(*v1alpha1.AzureKeyVaultEnvSecretList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.AzureKeyVaultEnvSecretList).Items {\n\t\tif label.Matches(labels.Set(item.Labels)) {\n\t\t\tlist.Items = append(list.Items, item)\n\t\t}\n\t}\n\treturn list, err\n}", "func (r *Reconciler) ReconcileSecretServer() error {\n\tutil.KubeCheck(r.SecretServer)\n\tutil.SecretResetStringDataFromData(r.SecretServer)\n\n\tif r.SecretServer.StringData[\"jwt\"] == \"\" {\n\t\tr.SecretServer.StringData[\"jwt\"] = util.RandomBase64(16)\n\t}\n\tif r.SecretServer.StringData[\"server_secret\"] == \"\" {\n\t\tr.SecretServer.StringData[\"server_secret\"] = util.RandomHex(4)\n\t}\n\tr.Own(r.SecretServer)\n\tutil.KubeCreateSkipExisting(r.SecretServer)\n\treturn nil\n}", "func (o TriggerBuildOptionsPtrOutput) SecretEnvs() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *TriggerBuildOptions) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SecretEnvs\n\t}).(pulumi.StringArrayOutput)\n}", "func (c *Controller) Secrets() typedv1.SecretInterface {\n\treturn c.client.Secrets(c.namespace.Name)\n}", "func (c *Controller) secretsUsedByPeers(meta metav1.ObjectMeta) (sets.String, error) {\n\tsecretUsed := sets.NewString()\n\n\tdbList, err := c.pgLister.Postgreses(meta.Namespace).List(labels.Everything())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, es := range dbList {\n\t\tif es.Name != meta.Name {\n\t\t\tsecretUsed.Insert(es.Spec.GetSecrets()...)\n\t\t}\n\t}\n\n\tlabelMap := map[string]string{\n\t\tapi.LabelDatabaseKind: api.ResourceKindPostgres,\n\t}\n\tdrmnList, err := c.ExtClient.KubedbV1alpha1().DormantDatabases(meta.Namespace).List(\n\t\tmetav1.ListOptions{\n\t\t\tLabelSelector: labels.SelectorFromSet(labelMap).String(),\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, ddb := range drmnList.Items {\n\t\tif ddb.Name != meta.Name {\n\t\t\tsecretUsed.Insert(ddb.GetDatabaseSecrets()...)\n\t\t}\n\t}\n\n\treturn secretUsed, nil\n}", "func GetSecretNames(host string, verifyTLS bool, apiKey string, project string, config string, includeDynamicSecrets bool) ([]string, Error) {\n\tvar params []queryParam\n\tparams = append(params, queryParam{Key: \"project\", Value: project})\n\tparams = append(params, queryParam{Key: \"config\", Value: config})\n\tparams = append(params, queryParam{Key: \"include_dynamic_secrets\", Value: strconv.FormatBool(includeDynamicSecrets)})\n\n\turl, err := generateURL(host, \"/v3/configs/config/secrets/names\", params)\n\tif err != nil {\n\t\treturn nil, Error{Err: err, Message: \"Unable to generate url\"}\n\t}\n\n\tstatusCode, _, response, err := GetRequest(url, verifyTLS, apiKeyHeader(apiKey))\n\tif err != nil {\n\t\treturn nil, Error{Err: err, Message: \"Unable to fetch secret names\", Code: statusCode}\n\t}\n\n\tvar result struct {\n\t\tNames []string `json:\"names\"`\n\t}\n\terr = json.Unmarshal(response, &result)\n\tif err != nil {\n\t\treturn nil, Error{Err: err, Message: \"Unable to parse API response\", Code: statusCode}\n\t}\n\n\treturn result.Names, Error{}\n}", "func (s *STFConfig) PullSecrets() []corev1.LocalObjectReference {\n\tsecrets := make([]corev1.LocalObjectReference, 0)\n\tif s.STFImage != nil {\n\t\tif s.STFImage.ImagePullSecrets != nil {\n\t\t\tsecrets = append(secrets, s.STFImage.ImagePullSecrets...)\n\t\t}\n\t}\n\tif s.ADB != nil {\n\t\tif s.ADB.ImagePullSecrets != nil {\n\t\t\tsecrets = append(secrets, s.ADB.ImagePullSecrets...)\n\t\t}\n\t}\n\treturn secrets\n}", "func getSecretsToRotate(client *k8s.Client, namespace string) (error, *corev1.SecretList) {\n\n\tl := new(k8s.LabelSelector)\n\tl.Eq(rotateKeyLabel, \"true\")\n\n\tvar secrets corev1.SecretList\n\tif err := client.List(context.TODO(), namespace, &secrets, l.Selector()); err != nil {\n\t\treturn err, nil\n\t}\n\treturn nil, &secrets\n}", "func (s SecretWatchableSet) Get() ([]WatchableResource, string, error) {\n\t// Query the initial list of Namespaces\n\t// TODO: Limit namespaces to only namespaces with label\n\tk8sSecrets, err := s.KubeClient.Core().Secrets(api.NamespaceAll).List(api.ListOptions{})\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\t// Filter out the secrets that are not router API Key secrets or that do not have the proper secret key\n\tsecrets := []WatchableResource{}\n\n\t// Filter secrets that have the APIKeySecret name\n\tfor _, secret := range k8sSecrets.Items {\n\t\tif secret.Name == s.Config.APIKeySecret {\n\t\t\tsecrets = append(secrets, s.ConvertToModel(&secret))\n\t\t}\n\t}\n\n\treturn secrets, k8sSecrets.ListMeta.ResourceVersion, nil\n}", "func (c *Cluster) GetSecrets(options apitypes.SecretListOptions) ([]types.Secret, error) {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\n\tstate := c.currentNodeState()\n\tif !state.IsActiveManager() {\n\t\treturn nil, c.errNoManager(state)\n\t}\n\n\tfilters, err := newListSecretsFilters(options.Filters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tctx, cancel := c.getRequestContext()\n\tdefer cancel()\n\n\tr, err := state.controlClient.ListSecrets(ctx,\n\t\t&swarmapi.ListSecretsRequest{Filters: filters})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsecrets := []types.Secret{}\n\n\tfor _, secret := range r.Secrets {\n\t\tsecrets = append(secrets, convert.SecretFromGRPC(secret))\n\t}\n\n\treturn secrets, nil\n}", "func makeSecrets(secretNames []string) *v1.SecretList {\n\tvar secrets []v1.Secret\n\tfor _, secretName := range secretNames {\n\t\tobjMeta := metav1.ObjectMeta{Name: secretName}\n\t\tsecrets = append(secrets, v1.Secret{ObjectMeta: objMeta})\n\t}\n\treturn &v1.SecretList{Items: secrets}\n}", "func maskSecrets(values, secrets []string) []string {\n\tout := make([]string, len(values))\n\tfor vIndex, value := range values {\n\t\tout[vIndex] = value\n\t}\n\tfor _, secret := range secrets {\n\t\tfor vIndex, value := range out {\n\t\t\tout[vIndex] = strings.Replace(value, secret, \"###\", -1)\n\t\t}\n\t}\n\treturn out\n}", "func ExampleAuthorizationServerClient_ListSecrets() {\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 := armapimanagement.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewAuthorizationServerClient().ListSecrets(ctx, \"rg1\", \"apimService1\", \"newauthServer2\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.AuthorizationServerSecretsContract = armapimanagement.AuthorizationServerSecretsContract{\n\t// \tClientSecret: to.Ptr(\"2\"),\n\t// \tResourceOwnerPassword: to.Ptr(\"pwd\"),\n\t// \tResourceOwnerUsername: to.Ptr(\"un\"),\n\t// }\n}", "func computeSecretNames(secretList []corev1.Secret) sets.String {\n\tnames := sets.NewString()\n\n\tfor _, secret := range secretList {\n\t\tif secret.Type != corev1.SecretTypeOpaque {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, ownerRef := range secret.OwnerReferences {\n\t\t\tif ownerRef.APIVersion == gardencorev1beta1.SchemeGroupVersion.String() && ownerRef.Kind == \"Shoot\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tnames.Insert(secret.Name)\n\t}\n\n\treturn names\n}", "func (o TriggerBuildPtrOutput) Secrets() TriggerBuildSecretArrayOutput {\n\treturn o.ApplyT(func(v *TriggerBuild) []TriggerBuildSecret {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Secrets\n\t}).(TriggerBuildSecretArrayOutput)\n}", "func (tc *Configs) ListRemotes() error {\n\tfor _, tf := range tc.Files {\n\t\ttc.StdOut.Write([]byte(color.Green(fmt.Sprintf(\"(%s) %s\\n\", tf.Basename(), tf.Filepath))))\n\t\tif err := tf.Remotes.List(tc.StdOut); err != nil {\n\t\t\ttc.StdErr.Write([]byte(color.Red(err.Error())))\n\t\t}\n\t\ttc.StdOut.Write([]byte(color.Green(\"---\\n\\n\")))\n\t}\n\treturn nil\n}", "func (input *CreateTaskDefinitionInput) Secrets() []*awsecs.Secret {\n\treturn convertSecretVars(input.SecretVars)\n}", "func (j *JobSecrets) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"dcAccessSecurityCode\":\n\t\t\terr = unpopulate(val, \"DcAccessSecurityCode\", &j.DcAccessSecurityCode)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"error\":\n\t\t\terr = unpopulate(val, \"Error\", &j.Error)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"jobSecretsType\":\n\t\t\terr = unpopulate(val, \"JobSecretsType\", &j.JobSecretsType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"podSecrets\":\n\t\t\terr = unpopulate(val, \"PodSecrets\", &j.PodSecrets)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", j, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) {\n\turl := fmt.Sprintf(\"repos/%v/%v/actions/secrets\", owner, repo)\n\treturn s.listSecrets(ctx, url, opts)\n}", "func GetAllSecret() map[string]interface{} {\n\tpath := PROJECT + \"/metadata/\" + ENV\n\treturn GetAllSecretFromPath(path)\n}", "func (nsar *NamespacedServiceAccountReflector) List() ([]interface{}, error) {\n\treturn virtualkubelet.List[virtualkubelet.Lister[*corev1.Secret], *corev1.Secret](\n\t\tnsar.remoteSecrets,\n\t)\n}", "func ExampleConnectedEnvironmentsDaprComponentsClient_ListSecrets() {\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 := armappcontainers.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewConnectedEnvironmentsDaprComponentsClient().ListSecrets(ctx, \"examplerg\", \"myenvironment\", \"reddog\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.DaprSecretsCollection = armappcontainers.DaprSecretsCollection{\n\t// \tValue: []*armappcontainers.DaprSecret{\n\t// \t\t{\n\t// \t\t\tName: to.Ptr(\"secret1\"),\n\t// \t\t\tValue: to.Ptr(\"value1\"),\n\t// \t\t},\n\t// \t\t{\n\t// \t\t\tName: to.Ptr(\"secret2\"),\n\t// \t\t\tValue: to.Ptr(\"value2\"),\n\t// \t}},\n\t// }\n}", "func (m *Synchronization) SetSecrets(value []SynchronizationSecretKeyStringValuePairable)() {\n err := m.GetBackingStore().Set(\"secrets\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *SecretService) PatchSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error {\n\tif err := authorizeWriteSecret(ctx, orgID); err != nil {\n\t\treturn err\n\t}\n\n\terr := s.s.PatchSecrets(ctx, orgID, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (d *Database) ListPasswords() ([]storage.Password, error) {\n\tpasswords, err := d.client.Password.Query().All(context.TODO())\n\tif err != nil {\n\t\treturn nil, convertDBError(\"list passwords: %w\", err)\n\t}\n\n\tstoragePasswords := make([]storage.Password, 0, len(passwords))\n\tfor _, p := range passwords {\n\t\tstoragePasswords = append(storagePasswords, toStoragePassword(p))\n\t}\n\treturn storagePasswords, nil\n}", "func QuoteList(unquoted []string) string {\n\tvar quoted = make([]string, len(unquoted))\n\tfor i, u := range unquoted {\n\t\tquoted[i] = Quote(u)\n\t}\n\n\treturn strings.Join(quoted, \" \")\n}", "func (d *driver) SyncSecrets(sec *coreapi.Secret) (map[string]string, error) {\n\tcfg, err := clusterconfig.GetAWSConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get the existing SecretKey and AccessKey\n\tvar existingAccessKey, existingSecretKey []byte\n\tif v, ok := sec.Data[\"REGISTRY_STORAGE_S3_ACCESSKEY\"]; ok {\n\t\texistingAccessKey = v\n\t}\n\tif v, ok := sec.Data[\"REGISTRY_STORAGE_S3_SECRETKEY\"]; ok {\n\t\texistingSecretKey = v\n\t}\n\n\t// Check if the existing SecretKey and AccessKey match what we got from the cluster or user configuration\n\tif !bytes.Equal([]byte(cfg.Storage.S3.AccessKey), existingAccessKey) || !bytes.Equal([]byte(cfg.Storage.S3.SecretKey), existingSecretKey) {\n\n\t\tdata := map[string]string{\n\t\t\t\"REGISTRY_STORAGE_S3_ACCESSKEY\": cfg.Storage.S3.AccessKey,\n\t\t\t\"REGISTRY_STORAGE_S3_SECRETKEY\": cfg.Storage.S3.SecretKey,\n\t\t}\n\t\treturn data, nil\n\n\t}\n\treturn nil, nil\n}", "func (s *ContainerDefinition) SetSecrets(v []*Secret) *ContainerDefinition {\n\ts.Secrets = v\n\treturn s\n}", "func GetSecretsFromCR(r ReconcilerCommon, obj runtime.Object, namespace string, spec interface{}, envVars *map[string]util.EnvSetter) ([]cinderv1beta1.Hash, error) {\n\thashes := []cinderv1beta1.Hash{}\n\tspecParameters := make(map[string]interface{})\n\tinrec, _ := json.Marshal(spec)\n\tjson.Unmarshal(inrec, &specParameters)\n\n\tfor param, value := range specParameters {\n\t\tif strings.HasSuffix(param, \"Secret\") {\n\t\t\t_, hash, err := GetSecret(r.GetClient(), fmt.Sprintf(\"%v\", value), namespace)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// add hash to envVars\n\t\t\t(*envVars)[param] = util.EnvValue(hash)\n\t\t\thashes = append(hashes, cinderv1beta1.Hash{Name: param, Hash: hash})\n\t\t}\n\t}\n\n\treturn hashes, nil\n}", "func (secretsManager *SecretsManagerV2) ListSecretVersionsWithContext(ctx context.Context, listSecretVersionsOptions *ListSecretVersionsOptions) (result *SecretVersionMetadataCollection, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(listSecretVersionsOptions, \"listSecretVersionsOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(listSecretVersionsOptions, \"listSecretVersionsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"secret_id\": *listSecretVersionsOptions.SecretID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = secretsManager.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(secretsManager.Service.Options.URL, `/api/v2/secrets/{secret_id}/versions`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listSecretVersionsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"secrets_manager\", \"V2\", \"ListSecretVersions\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = secretsManager.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalSecretVersionMetadataCollection)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func (pager *SecretsPager) GetAll() (allItems []SecretMetadataIntf, err error) {\n\treturn pager.GetAllWithContext(context.Background())\n}", "func (expDetails *ExperimentDetails) ValidateSecrets(clients ClientSets) error {\n\n\tfor _, v := range expDetails.Secrets {\n\t\tif v.Name == \"\" || v.MountPath == \"\" {\n\t\t\treturn errors.New(\"Incomplete Information in Secret, will skip execution\")\n\t\t}\n\t\terr := clients.ValidateSecrets(v.Name, expDetails)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Unable to get Secret with Name: %v, in namespace: %v\", v.Name, expDetails.Namespace)\n\t\t}\n\t\tklog.V(0).Infof(\"Succesfully Validated Secret: %v\", v.Name)\n\t}\n\treturn nil\n}", "func (nsq *NamespaceSecretQuery) All(ctx context.Context) ([]*NamespaceSecret, error) {\n\tif err := nsq.prepareQuery(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn nsq.sqlAll(ctx)\n}", "func GetSecrets(host string, verifyTLS bool, apiKey string, project string, config string, secrets []string, includeDynamicSecrets bool, dynamicSecretsTTL time.Duration) ([]byte, Error) {\n\tvar params []queryParam\n\tparams = append(params, queryParam{Key: \"project\", Value: project})\n\tparams = append(params, queryParam{Key: \"config\", Value: config})\n\tparams = append(params, queryParam{Key: \"include_dynamic_secrets\", Value: strconv.FormatBool(includeDynamicSecrets)})\n\n\tif secrets != nil {\n\t\tparams = append(params, queryParam{Key: \"secrets\", Value: strings.Join(secrets, \",\")})\n\t}\n\n\tif dynamicSecretsTTL > 0 {\n\t\tttlSeconds := int(dynamicSecretsTTL.Seconds())\n\t\tparams = append(params, queryParam{Key: \"dynamic_secrets_ttl_sec\", Value: strconv.Itoa(ttlSeconds)})\n\t}\n\n\turl, err := generateURL(host, \"/v3/configs/config/secrets\", params)\n\tif err != nil {\n\t\treturn nil, Error{Err: err, Message: \"Unable to generate url\"}\n\t}\n\n\theaders := apiKeyHeader(apiKey)\n\theaders[\"Accept\"] = \"application/json\"\n\tstatusCode, _, response, err := GetRequest(url, verifyTLS, headers)\n\tif err != nil {\n\t\treturn nil, Error{Err: err, Message: \"Unable to fetch secrets\", Code: statusCode}\n\t}\n\n\treturn response, Error{}\n}", "func GetSecrets() Secrets {\n\treturn Secrets{\n\t\tClientID: ClientID,\n\t\tClientSecret: ClientSecret,\n\t}\n}", "func (d *Driver) List() ([]string, error) {\n\td.lockfile.Lock()\n\tdefer d.lockfile.Unlock()\n\tsecretData, err := d.getAllData()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tallID := make([]string, 0, len(secretData))\n\tfor k := range secretData {\n\t\tallID = append(allID, k)\n\t}\n\tsort.Strings(allID)\n\treturn allID, err\n}", "func (secretsManager *SecretsManagerV2) ListConfigurations(listConfigurationsOptions *ListConfigurationsOptions) (result *ConfigurationMetadataPaginatedCollection, response *core.DetailedResponse, err error) {\n\treturn secretsManager.ListConfigurationsWithContext(context.Background(), listConfigurationsOptions)\n}", "func (e *ChefEnvironment) RecipeList() []string {\n\trecipeList := make(map[string]string)\n\tcbList := e.cookbookList()\n\tfor _, cb := range cbList {\n\t\tif cb == nil {\n\t\t\tcontinue\n\t\t}\n\t\tcbv := cb.LatestConstrained(e.CookbookVersions[cb.Name])\n\t\tif cbv == nil {\n\t\t\tcontinue\n\t\t}\n\t\trlist, _ := cbv.RecipeList()\n\n\t\tfor _, recipe := range rlist {\n\t\t\trecipeList[recipe] = recipe\n\t\t}\n\t}\n\tsortedRecipes := make([]string, len(recipeList))\n\ti := 0\n\tfor k := range recipeList {\n\t\tsortedRecipes[i] = k\n\t\ti++\n\t}\n\tsort.Strings(sortedRecipes)\n\treturn sortedRecipes\n}", "func setupConfigMapReconciler(mgr manager.Manager, log logr.Logger) error {\n\n\tlog = log.WithName(\"secret-reconciler\")\n\n\terr := ctrl.NewControllerManagedBy(mgr).\n\t\tFor(&corev1.Secret{}, builder.OnlyMetadata).\n\t\tComplete(reconcile.Func(func(_ context.Context, r reconcile.Request) (reconcile.Result, error) {\n\t\t\tlog := log\n\t\t\tlog = log.WithValues(\"secret\", r.NamespacedName)\n\t\t\tlog.Info(\"start\")\n\t\t\tdefer log.Info(\"end\")\n\n\t\t\tsecret := &corev1.Secret{}\n\t\t\terr := mgr.GetClient().Get(context.Background(), r.NamespacedName, secret)\n\t\t\tswitch {\n\t\t\t// If the secret doesn't exist, the reconciliation is done.\n\t\t\tcase apierrors.IsNotFound(err):\n\t\t\t\tlog.Info(\"secret not found\")\n\t\t\t\treturn reconcile.Result{}, nil\n\t\t\tcase err != nil:\n\t\t\t\treturn reconcile.Result{}, fmt.Errorf(\"looking for Secret %s: %w\", r.NamespacedName, err)\n\t\t\t}\n\n\t\t\tif secret.Annotations != nil && secret.Annotations[\"secret-found\"] == \"yes\" {\n\t\t\t\treturn reconcile.Result{}, nil\n\t\t\t}\n\n\t\t\tif secret.Annotations == nil {\n\t\t\t\tsecret.Annotations = make(map[string]string)\n\t\t\t}\n\t\t\tsecret.Annotations[\"secret-found\"] = \"yes\"\n\t\t\terr = mgr.GetClient().Update(context.Background(), secret)\n\t\t\tif err != nil {\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\n\t\t\treturn reconcile.Result{}, nil\n\t\t}))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while completing new controller: %w\", err)\n\t}\n\n\treturn nil\n}", "func (s *sealedSecretLister) List(selector labels.Selector) (ret []*v1alpha1.SealedSecret, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.SealedSecret))\n\t})\n\treturn ret, err\n}", "func (r *ReconcileRethinkDBCluster) reconcileAdminSecret(cr *rethinkdbv1alpha1.RethinkDBCluster) error {\n\tname := fmt.Sprintf(\"%s-%s\", cr.ObjectMeta.Name, RethinkDBAdminKey)\n\tfound := &corev1.Secret{}\n\terr := r.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: cr.Namespace}, found)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tlog.Info(\"creating new secret\", \"secret\", name)\n\t\tsecret, err := newUserSecret(cr, RethinkDBAdminKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Set RethinkDBCluster instance as the owner and controller\n\t\tif err = controllerutil.SetControllerReference(cr, secret, r.scheme); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Create the Secret and return\n\t\treturn r.client.Create(context.TODO(), secret)\n\t} else if err != nil {\n\t\treturn err\n\t}\n\tlog.Info(\"secret exists\", \"secret\", found.Name)\n\treturn nil\n}", "func getSecrets(targetSecret, targetType string, secrets *v1.SecretList) (foundSecrets []*v1.Secret) {\n\tvar maxVersionned int\n\tsecretReleases := make(map[string]int)\n\tsecretFamilies := make(map[string]*v1.Secret)\n\n\tfor _, secret := range secrets.Items {\n\t\tif (targetType == \"\" || string(secret.Type) == targetType) && strings.Contains(secret.Name, targetSecret) {\n\t\t\tif matchVersioned, _ := regexp.MatchString(\"^\"+targetSecret+\"-[0-9]*$\", secret.Name); matchVersioned {\n\t\t\t\tif release := getRelease(secret.Name); release >= maxVersionned {\n\t\t\t\t\tmaxVersionned = release\n\t\t\t\t\tfoundSecrets = []*v1.Secret{secret.DeepCopy()}\n\t\t\t\t}\n\t\t\t} else if len(foundSecrets) == 0 {\n\t\t\t\trelease := getRelease(secret.Name)\n\t\t\t\tfamily := strings.TrimSuffix(secret.Name, strconv.Itoa(release))\n\t\t\t\tif release >= secretReleases[family] {\n\t\t\t\t\tsecretReleases[family] = release\n\t\t\t\t\tsecretFamilies[family] = secret.DeepCopy()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Flatten families if we haven't found any perfectly matching secret\n\tif len(foundSecrets) == 0 {\n\t\tfor _, secret := range secretFamilies {\n\t\t\tfoundSecrets = append(foundSecrets, secret.DeepCopy())\n\t\t}\n\t}\n\treturn\n}", "func ListQuotas(query ...*models.QuotaQuery) ([]*Quota, error) {\n\tcondition, params := quotaQueryConditions(query...)\n\n\tsql := fmt.Sprintf(`\nSELECT\n a.id,\n a.reference,\n a.reference_id,\n a.hard,\n b.used,\n b.creation_time,\n b.update_time\nFROM\n quota AS a\n JOIN quota_usage AS b ON a.id = b.id %s`, condition)\n\n\torderBy := quotaOrderBy(query...)\n\tif orderBy != \"\" {\n\t\tsql += ` order by ` + orderBy\n\t}\n\n\tif len(query) > 0 && query[0] != nil {\n\t\tpage, size := query[0].Page, query[0].Size\n\t\tif size > 0 {\n\t\t\tsql += ` limit ?`\n\t\t\tparams = append(params, size)\n\t\t\tif page > 0 {\n\t\t\t\tsql += ` offset ?`\n\t\t\t\tparams = append(params, size*(page-1))\n\t\t\t}\n\t\t}\n\t}\n\n\tvar quotas []*Quota\n\tif _, err := GetOrmer().Raw(sql, params).QueryRows(&quotas); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, quota := range quotas {\n\t\td, ok := driver.Get(quota.Reference)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tref, err := d.Load(quota.ReferenceID)\n\t\tif err != nil {\n\t\t\tlog.Warning(fmt.Sprintf(\"Load quota reference object (%s, %s) failed: %v\", quota.Reference, quota.ReferenceID, err))\n\t\t\tcontinue\n\t\t}\n\n\t\tquota.Ref = ref\n\t}\n\n\treturn quotas, nil\n}", "func (r *TenantReconciler) syncResourceQuotas(tenant *capsulev1alpha1.Tenant) error {\n\t// getting requested ResourceQuota keys\n\tkeys := make([]string, 0, len(tenant.Spec.ResourceQuota))\n\tfor i := range tenant.Spec.ResourceQuota {\n\t\tkeys = append(keys, strconv.Itoa(i))\n\t}\n\n\t// getting ResourceQuota labels for the mutateFn\n\ttenantLabel, err := capsulev1alpha1.GetTypeLabel(&capsulev1alpha1.Tenant{})\n\tif err != nil {\n\t\treturn err\n\t}\n\ttypeLabel, err := capsulev1alpha1.GetTypeLabel(&corev1.ResourceQuota{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ns := range tenant.Status.Namespaces {\n\t\tif err := r.pruningResources(ns, keys, &corev1.ResourceQuota{}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor i, q := range tenant.Spec.ResourceQuota {\n\t\t\ttarget := &corev1.ResourceQuota{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: fmt.Sprintf(\"capsule-%s-%d\", tenant.Name, i),\n\t\t\t\t\tNamespace: ns,\n\t\t\t\t\tAnnotations: make(map[string]string),\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\ttenantLabel: tenant.Name,\n\t\t\t\t\t\ttypeLabel: strconv.Itoa(i),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\tres, err := controllerutil.CreateOrUpdate(context.TODO(), r.Client, target, func() (err error) {\n\t\t\t\t// Requirement to list ResourceQuota of the current Tenant\n\t\t\t\ttr, err := labels.NewRequirement(tenantLabel, selection.Equals, []string{tenant.Name})\n\t\t\t\tif err != nil {\n\t\t\t\t\tr.Log.Error(err, \"Cannot build ResourceQuota Tenant requirement\")\n\t\t\t\t}\n\t\t\t\t// Requirement to list ResourceQuota for the current index\n\t\t\t\tir, err := labels.NewRequirement(typeLabel, selection.Equals, []string{strconv.Itoa(i)})\n\t\t\t\tif err != nil {\n\t\t\t\t\tr.Log.Error(err, \"Cannot build ResourceQuota index requirement\")\n\t\t\t\t}\n\n\t\t\t\t// Listing all the ResourceQuota according to the said requirements.\n\t\t\t\t// These are required since Capsule is going to sum all the used quota to\n\t\t\t\t// sum them and get the Tenant one.\n\t\t\t\trql := &corev1.ResourceQuotaList{}\n\t\t\t\terr = r.List(context.TODO(), rql, &client.ListOptions{\n\t\t\t\t\tLabelSelector: labels.NewSelector().Add(*tr).Add(*ir),\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tr.Log.Error(err, \"Cannot list ResourceQuota\", \"tenantFilter\", tr.String(), \"indexFilter\", ir.String())\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t// Iterating over all the options declared for the ResourceQuota,\n\t\t\t\t// summing all the used quota across different Namespaces to determinate\n\t\t\t\t// if we're hitting a Hard quota at Tenant level.\n\t\t\t\t// For this case, we're going to block the Quota setting the Hard as the\n\t\t\t\t// used one.\n\t\t\t\tfor rn, rq := range q.Hard {\n\t\t\t\t\tr.Log.Info(\"Desired hard \" + rn.String() + \" quota is \" + rq.String())\n\n\t\t\t\t\t// Getting the whole usage across all the Tenant Namespaces\n\t\t\t\t\tvar qt resource.Quantity\n\t\t\t\t\tfor _, rq := range rql.Items {\n\t\t\t\t\t\tqt.Add(rq.Status.Used[rn])\n\t\t\t\t\t}\n\t\t\t\t\tr.Log.Info(\"Computed \" + rn.String() + \" quota for the whole Tenant is \" + qt.String())\n\n\t\t\t\t\tswitch qt.Cmp(q.Hard[rn]) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\t// The Tenant is matching exactly the Quota:\n\t\t\t\t\t\t// falling through next case since we have to block further\n\t\t\t\t\t\t// resource allocations.\n\t\t\t\t\t\tfallthrough\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\t// The Tenant is OverQuota:\n\t\t\t\t\t\t// updating all the related ResourceQuota with the current\n\t\t\t\t\t\t// used Quota to block further creations.\n\t\t\t\t\t\tfor i := range rql.Items {\n\t\t\t\t\t\t\tif _, ok := rql.Items[i].Status.Used[rn]; ok {\n\t\t\t\t\t\t\t\trql.Items[i].Spec.Hard[rn] = rql.Items[i].Status.Used[rn]\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tum := make(map[corev1.ResourceName]resource.Quantity)\n\t\t\t\t\t\t\t\tum[rn] = resource.Quantity{}\n\t\t\t\t\t\t\t\trql.Items[i].Spec.Hard = um\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// The Tenant is respecting the Hard quota:\n\t\t\t\t\t\t// restoring the default one for all the elements,\n\t\t\t\t\t\t// also for the reconciliated one.\n\t\t\t\t\t\tfor i := range rql.Items {\n\t\t\t\t\t\t\trql.Items[i].Spec.Hard[rn] = q.Hard[rn]\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttarget.Spec = q\n\t\t\t\t\t}\n\t\t\t\t\tif err := r.resourceQuotasUpdate(rn, qt, rql.Items...); err != nil {\n\t\t\t\t\t\tr.Log.Error(err, \"cannot proceed with outer ResourceQuota\")\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn controllerutil.SetControllerReference(tenant, target, r.Scheme)\n\t\t\t})\n\t\t\tr.Log.Info(\"Resource Quota sync result: \"+string(res), \"name\", target.Name, \"namespace\", target.Namespace)\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 (_SecretRegistry *SecretRegistryFilterer) FilterSecretRevealed(opts *bind.FilterOpts, secret [][32]byte) (*SecretRegistrySecretRevealedIterator, error) {\n\n\tvar secretRule []interface{}\n\tfor _, secretItem := range secret {\n\t\tsecretRule = append(secretRule, secretItem)\n\t}\n\n\tlogs, sub, err := _SecretRegistry.contract.FilterLogs(opts, \"SecretRevealed\", secretRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &SecretRegistrySecretRevealedIterator{contract: _SecretRegistry.contract, event: \"SecretRevealed\", logs: logs, sub: sub}, nil\n}" ]
[ "0.57259434", "0.5530794", "0.5380004", "0.53071386", "0.5273651", "0.5255789", "0.52251434", "0.52205926", "0.5210257", "0.51597595", "0.51561975", "0.5152343", "0.51374936", "0.51229763", "0.5094752", "0.50841784", "0.50665426", "0.50590277", "0.4997374", "0.4994975", "0.49898404", "0.49666545", "0.49582323", "0.4902275", "0.48804143", "0.48764372", "0.4870767", "0.48363695", "0.48257938", "0.48228982", "0.48217928", "0.4816341", "0.47949284", "0.47887215", "0.47737128", "0.47486764", "0.47395253", "0.4719133", "0.47088355", "0.46940726", "0.4685228", "0.46791238", "0.46607658", "0.4652358", "0.46431896", "0.46385083", "0.4638246", "0.46196413", "0.46095887", "0.45934063", "0.45678544", "0.4559498", "0.4555953", "0.45416754", "0.45386076", "0.45251524", "0.45120144", "0.45112836", "0.45085225", "0.44907853", "0.448551", "0.44838235", "0.44827318", "0.4481105", "0.44731006", "0.44706622", "0.44672617", "0.4464964", "0.4463902", "0.44551912", "0.44523993", "0.44338405", "0.4433673", "0.4422235", "0.44220558", "0.44216207", "0.4418273", "0.4376854", "0.4371942", "0.4362906", "0.43594304", "0.43495166", "0.43369624", "0.43351397", "0.4330278", "0.43292725", "0.4323123", "0.43226314", "0.43189907", "0.43175444", "0.43169552", "0.43142772", "0.43106794", "0.43073753", "0.43073592", "0.43068594", "0.4305521", "0.4301968", "0.42931703", "0.4291662" ]
0.833262
0
RecoverPanics wraps http.Handler to recover and log panics.
RecoverPanics оборачивает http.Handler для восстановления и логирования паник.
func RecoverPanics(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { defer func() { if x := recover(); x != nil { w.WriteHeader(http.StatusInternalServerError) fmt.Fprint(w, "apis panic. Look in log for details.") glog.Infof("APIServer panic'd on %v %v: %#v\n%s\n", req.Method, req.RequestURI, x, debug.Stack()) } }() defer httplog.NewLogged(req, &w).StacktraceWhen( httplog.StatusIsNot( http.StatusOK, http.StatusAccepted, http.StatusMovedPermanently, http.StatusTemporaryRedirect, http.StatusConflict, http.StatusNotFound, StatusUnprocessableEntity, ), ).Log() // Dispatch to the internal handler handler.ServeHTTP(w, req) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func RecoverPanics(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tdefer func() {\n\t\t\tif x := recover(); x != nil {\n\t\t\t\thttp.Error(w, \"apis panic. Look in log for details.\", http.StatusInternalServerError)\n\t\t\t\tglog.Errorf(\"APIServer panic'd on %v %v: %v\\n%s\\n\", req.Method, req.RequestURI, x, debug.Stack())\n\t\t\t}\n\t\t}()\n\t\tdefer httplog.NewLogged(req, &w).StacktraceWhen(\n\t\t\thttplog.StatusIsNot(\n\t\t\t\thttp.StatusOK,\n\t\t\t\thttp.StatusCreated,\n\t\t\t\thttp.StatusAccepted,\n\t\t\t\thttp.StatusBadRequest,\n\t\t\t\thttp.StatusMovedPermanently,\n\t\t\t\thttp.StatusTemporaryRedirect,\n\t\t\t\thttp.StatusConflict,\n\t\t\t\thttp.StatusNotFound,\n\t\t\t\thttp.StatusUnauthorized,\n\t\t\t\thttp.StatusForbidden,\n\t\t\t\terrors.StatusUnprocessableEntity,\n\t\t\t\thttp.StatusSwitchingProtocols,\n\t\t\t),\n\t\t).Log()\n\n\t\t// Dispatch to the internal handler\n\t\thandler.ServeHTTP(w, req)\n\t})\n}", "func panicRecover(handler func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer gulu.Panic.Recover(nil)\n\n\t\thandler(w, r)\n\t}\n}", "func recovery(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tpanicked := true\n\t\tdefer func() {\n\t\t\tif panicked {\n\t\t\t\tconst code = http.StatusInternalServerError\n\t\t\t\tswitch err := recover(); err := err.(type) {\n\t\t\t\tdefault:\n\t\t\t\t\tapp.Metric.PanicsTotal.Inc()\n\t\t\t\t\tlog := structlog.FromContext(r.Context(), nil)\n\t\t\t\t\tlog.PrintErr(\"panic\", def.LogHTTPStatus, code, \"err\", err, structlog.KeyStack, structlog.Auto)\n\t\t\t\t\tmiddlewareError(w, code, \"internal error\")\n\t\t\t\tcase net.Error:\n\t\t\t\t\tlog := structlog.FromContext(r.Context(), nil)\n\t\t\t\t\tlog.PrintErr(\"recovered\", def.LogHTTPStatus, code, \"err\", err)\n\t\t\t\t\tmiddlewareError(w, code, \"internal error\")\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tnext.ServeHTTP(w, r)\n\t\tpanicked = false\n\t})\n}", "func PanicRecover(h juggler.Handler, vars *expvar.Map) juggler.Handler {\n\treturn juggler.HandlerFunc(func(ctx context.Context, c *juggler.Conn, m message.Msg) {\n\t\tdefer func() {\n\t\t\tif e := recover(); e != nil {\n\t\t\t\tif vars != nil {\n\t\t\t\t\tvars.Add(\"RecoveredPanics\", 1)\n\t\t\t\t}\n\n\t\t\t\tvar err error\n\t\t\t\tswitch e := e.(type) {\n\t\t\t\tcase error:\n\t\t\t\t\terr = e\n\t\t\t\tdefault:\n\t\t\t\t\terr = fmt.Errorf(\"%v\", e)\n\t\t\t\t}\n\t\t\t\tc.Close(err)\n\t\t\t}\n\t\t}()\n\t\th.Handle(ctx, c, m)\n\t})\n}", "func Recovery() func(h http.Handler) http.Handler {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tdefer errors.Recover(log.Fatal)\n\t\t\th.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func Recoverer(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer func() {\n\t\t\tif rec := recover(); rec != nil {\n\t\t\t\tvar err error\n\n\t\t\t\tswitch t := rec.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\terr = Error(t)\n\t\t\t\tcase error:\n\t\t\t\t\terr = t\n\t\t\t\tdefault:\n\t\t\t\t\terr = ErrUnknownError\n\t\t\t\t}\n\t\t\t\tif errors.Is(err, http.ErrAbortHandler) {\n\t\t\t\t\t// ErrAbortHandler is called when the client closes the connection or the connection is closed\n\t\t\t\t\t// so we don't need to lose our poop, just clean it up and move on\n\t\t\t\t\tErrorOut.Printf(\"%s\\n\", ErrRequestError{r, ErrAborted.Error()})\n\t\t\t\t\tDebugOut.Printf(\"ErrAbortHandler: %s\\n\", ErrRequestError{r, fmt.Sprintf(\"Panic occurred: %s\", gerrors.Wrap(err, 2).ErrorStack())})\n\t\t\t\t\thttp.Error(w, ErrRequestError{r, StatusClientClosedRequestText}.Error(), StatusClientClosedRequest) // Machine-readable\n\t\t\t\t\treturn\n\t\t\t\t} else if Conf.GetBool(ConfigRecovererLogStackTraces) {\n\t\t\t\t\tErrorOut.Printf(\"%s\\n\", ErrRequestError{r, fmt.Sprintf(\"Panic occurred: %s\", gerrors.Wrap(err, 2).ErrorStack())})\n\t\t\t\t} else {\n\t\t\t\t\tErrorOut.Printf(\"%s\\n\", ErrRequestError{r, fmt.Sprintf(\"Panic occurred: %s\", err)})\n\t\t\t\t}\n\t\t\t\t//http.Error(w, ErrRequestError{r, \"an internal error occurred\"}.Error(), http.StatusInternalServerError)\n\t\t\t\tRequestErrorResponse(r, w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func Recover(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif rvr := recover(); rvr != nil {\n\n\t\t\t\tlogEntry := middleware.GetLogEntry(r)\n\t\t\t\tif logEntry != nil {\n\t\t\t\t\tlogEntry.Panic(rvr, debug.Stack())\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"Panic: %+v\\n\", rvr)\n\t\t\t\t\tdebug.PrintStack()\n\t\t\t\t}\n\n\t\t\t\trender.Render(w, r, common.ErrorRender(errors.New(\"Internal server error\"), http.StatusInternalServerError))\n\t\t\t}\n\t\t}()\n\n\t\tnext.ServeHTTP(w, r)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func Recover(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tdefer func() {\n\t\t\tif r := recover(); r != nil {\n\t\t\t\tvar msg string\n\t\t\t\tswitch x := r.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\tmsg = fmt.Sprintf(\"panic: %s\", x)\n\t\t\t\tcase error:\n\t\t\t\t\tmsg = fmt.Sprintf(\"panic: %s\", x)\n\t\t\t\tdefault:\n\t\t\t\t\tmsg = \"unknown panic\"\n\t\t\t\t}\n\t\t\t\tconst size = 64 << 10 // 64KB\n\t\t\t\tbuf := make([]byte, size)\n\t\t\t\tbuf = buf[:runtime.Stack(buf, false)]\n\t\t\t\tlines := strings.Split(string(buf), \"\\n\")\n\t\t\t\tlog.Printf(\"%s\\n%s\", msg, strings.Join(lines, \"\\n\"))\n\n\t\t\t\trenderer.Error(w, msg, http.StatusInternalServerError)\n\t\t\t}\n\t\t}()\n\t\th.ServeHTTP(w, req)\n\t})\n}", "func recoverHandler(c *web.C, h http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\treqID := middleware.GetReqID(*c)\n\n\t\tdefer func() {\n\t\t\tif e := recover(); e != nil {\n\t\t\t\tmsg := fmt.Sprintf(\"Panic detected on request %s:\\n%+v\\nIP: %v, URL: %s\\n\",\n\t\t\t\t\treqID, e, r.RemoteAddr, r.URL.Path)\n\t\t\t\tdvid.ReportPanic(msg, WebServer())\n\t\t\t\thttp.Error(w, msg, 500)\n\t\t\t}\n\t\t}()\n\n\t\th.ServeHTTP(w, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func recoverHandler(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tlog.Printf(\"panic: %+v\", err)\n\t\t\t\tlog.Print(string(debug.Stack()))\n\t\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\t\t}\n\t\t}()\n\n\t\tnext.ServeHTTP(w, r)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func recoverer(logger Logger) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\t\t// Capture our own copy of the logger so change in this closure\n\t\t\t// won't affect the object passed-in.\n\n\t\t\tlogger := logger\n\n\t\t\t// Defer a function to catch any panic and log a stack trace.\n\n\t\t\tdefer func() {\n\t\t\t\tif rcv := recover(); rcv != nil {\n\t\t\t\t\tif reqID := middleware.GetReqID(r.Context()); reqID != \"\" {\n\t\t\t\t\t\tlogger = logger.With(\"HTTP Request ID\", reqID)\n\t\t\t\t\t}\n\n\t\t\t\t\tscheme := \"http\"\n\t\t\t\t\tif r.TLS != nil {\n\t\t\t\t\t\tscheme = \"https\"\n\t\t\t\t\t}\n\n\t\t\t\t\tlogger.Errorw(\n\t\t\t\t\t\tlogMsgPanicRecovery,\n\t\t\t\t\t\t\"Method\", r.Method,\n\t\t\t\t\t\t\"URI\", fmt.Sprintf(\"%s://%s%s\", scheme, r.Host, r.RequestURI),\n\t\t\t\t\t\t\"Protocol\", r.Proto,\n\t\t\t\t\t\t\"Remote Address\", r.RemoteAddr,\n\t\t\t\t\t\t\"Panic Value\", rcv,\n\t\t\t\t\t\t\"Stack Trace\", string(debug.Stack()),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func Recovery() func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\t\tdefer func() {\n\t\t\t\tif err := recover(); err != nil {\n\t\t\t\t\tcombinedErr := fmt.Sprintf(\"PANIC: %v\\n%s\", err, string(log.Stack(2)))\n\t\t\t\t\thttp.Error(w, combinedErr, 500)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tnext.ServeHTTP(w, req)\n\t\t})\n\t}\n}", "func (app *application) recoverPanic(next http.Handler) http.Handler {\r\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\r\n\t\tdefer func() {\r\n\t\t\tif err := recover(); err != nil {\r\n\t\t\t\tw.Header().Set(\"Connection\", \"close\")\r\n\t\t\t\tapp.serverError(w, fmt.Errorf(\"%s\", err))\r\n\t\t\t}\r\n\t\t}()\r\n\t\tnext.ServeHTTP(w, r)\r\n\t})\r\n}", "func PanicRecoverHandler(err error) {\n\tif r := recover(); r != nil {\n\t\tswitch x := r.(type) {\n\t\tcase string:\n\t\t\terr = errors.New(x)\n\t\tcase error:\n\t\t\terr = x\n\t\tdefault:\n\t\t\terr = errors.New(\"Unknown panic\")\n\t\t}\n\t}\n}", "func recoverInternal(w http.ResponseWriter) {\n\tvar err error\n\tr := recover()\n\tstatusCode := http.StatusInternalServerError\n\tif r != nil {\n\t\tlog.Println(\"Recovering from Panic:\", r)\n\t\tswitch t := r.(type) {\n\t\tcase string:\n\t\t\terr = errors.New(t)\n\t\tcase model.CustomError:\n\t\t\terr = t\n\t\t\tswitch t.ErrorType() {\n\t\t\tcase model.ErrorUnprocessableJSON:\n\t\t\t\tstatusCode = http.StatusUnprocessableEntity\n\t\t\tcase model.ErrorNotFound:\n\t\t\t\tstatusCode = http.StatusNotFound\n\t\t\tcase model.ErrorBadRequest:\n\t\t\t\tstatusCode = http.StatusBadRequest\n\t\t\tcase model.ErrorDefault:\n\t\t\t\tstatusCode = http.StatusInternalServerError\n\t\t\t}\n\t\tcase error:\n\t\t\terr = t\n\t\tdefault:\n\t\t\terr = errors.New(unknownErrorStr)\n\t\t}\n\t\tlog.Printf(\"Successfuly recovered from panic: %s\\n\", err.Error())\n\t\thttp.Error(w, err.Error(), statusCode)\n\t}\n}", "func (app *application) recoverPanic(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// Create a deferred function (which will always be run in the event of a panic\n\t\t// as Go unwinds the stack).\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\t// If there was a panic, set a \"Connection: close\" header on the\n\t\t\t\t// response. This acts as a trigger to make Go's HTTP server\n\t\t\t\t// automatically close the current connection after a response has been\n\t\t\t\t// sent.\n\t\t\t\tw.Header().Set(\"Connection\", \"close\")\n\t\t\t\tapp.serverErrorResponse(w, r, fmt.Errorf(\"%s\", err))\n\t\t\t}\n\t\t}()\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func recoveryHandle(app http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tstack := debug.Stack()\n\t\t\t\tlog.Println(string(stack))\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tfmt.Fprintf(w, \"<h1>panic: %v</h1><pre>%s</pre>\", err, linkForm(string(stack)))\n\t\t\t}\n\t\t}()\n\t\tapp.ServeHTTP(w, r)\n\t}\n}", "func Recover() func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t\tdefer func() {\n\t\t\t\tif err := recover(); err != nil {\n\t\t\t\t\thttp.Error(w, fmt.Sprintf(\"[PANIC RECOVERED] %v\", err), http.StatusInternalServerError)\n\t\t\t\t}\n\t\t\t}()\n\t\t\tnext.ServeHTTP(w, r)\n\t\t}\n\t\treturn http.HandlerFunc(fn)\n\t}\n}", "func RecoverPanic(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\t// Check if there has been a panic\n\t\t\tif err := recover(); err != nil {\n\t\t\t\t// return a 500 Internal Server response\n\t\t\t\thelpers.ServerError(w, r, fmt.Errorf(\"%s\", err))\n\t\t\t}\n\t\t}()\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func Recover(next http.Handler) http.Handler {\n\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tlog.Printf(\"panic : %+v\", err)\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tw.Header().Set(\"Content-Type\", \"json/application\")\n\t\t\t\tpanicError := &responses.Error{\n\t\t\t\t\tCode: http.StatusInternalServerError,\n\t\t\t\t\tMessage: \"panic internal server error\",\n\t\t\t\t}\n\n\t\t\t\tencodeError := json.NewEncoder(w).Encode(panicError)\n\t\t\t\tif encodeError != nil {\n\t\t\t\t\t// A recover error can be critical, though it is better to avoid shutting down a running server.\n\t\t\t\t\tlog.Printf(\"\\n\\nfailed to recover: %s\", encodeError.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\t\tnext.ServeHTTP(w, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func (h Handlers) RecoverHandler(next http.Handler) http.Handler {\r\n\tfn := func(w http.ResponseWriter, r *http.Request) {\r\n\t\tdefer func() {\r\n\t\t\tif err := recover(); err != nil {\r\n\t\t\t\tif h.debugmode {\r\n\t\t\t\t\tlog.Printf(\"panic: %+v\", err)\r\n\t\t\t\t\tlog.Printf(CallerInfo(1))\r\n\t\t\t\t\tlog.Printf(CallerInfo(2))\r\n\t\t\t\t\tlog.Printf(CallerInfo(3))\r\n\t\t\t\t\tlog.Printf(CallerInfo(4))\r\n\t\t\t\t\tlog.Printf(CallerInfo(5))\r\n\t\t\t\t\tlog.Printf(CallerInfo(6))\r\n\t\t\t\t\tlog.Printf(CallerInfo(7))\r\n\t\t\t\t\tlog.Printf(CallerInfo(8))\r\n\t\t\t\t\tlog.Printf(CallerInfo(9))\r\n\t\t\t\t}\r\n\t\t\t\thttp.Error(w, \"Internal Server Error\", http.StatusInternalServerError)\r\n\t\t\t}\r\n\t\t}()\r\n\t\tnext.ServeHTTP(w, r)\r\n\t}\r\n\treturn http.HandlerFunc(fn)\r\n}", "func logStackOnRecover(s runtime.NegotiatedSerializer, panicReason interface{}, w http.ResponseWriter) {\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(fmt.Sprintf(\"recover from panic situation: - %v\\r\\n\", panicReason))\n\tfor i := 2; ; i++ {\n\t\t_, file, line, ok := rt.Caller(i)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tbuffer.WriteString(fmt.Sprintf(\" %s:%d\\r\\n\", file, line))\n\t}\n\tklog.Errorln(buffer.String())\n\n\theaders := http.Header{}\n\tif ct := w.Header().Get(\"Content-Type\"); len(ct) > 0 {\n\t\theaders.Set(\"Accept\", ct)\n\t}\n\tresponsewriters.ErrorNegotiated(apierrors.NewGenericServerResponse(http.StatusInternalServerError, \"\", schema.GroupResource{}, \"\", \"\", 0, false), s, schema.GroupVersion{}, w, &http.Request{Header: headers})\n}", "func Recovery(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tvar logMsg string\n\t\t\t\tif se, ok := err.(srverror.Error); ok {\n\t\t\t\t\tse.ServeHTTP(w, r)\n\t\t\t\t\tutil.VerboseRequest(r, se.Error())\n\t\t\t\t\tif se.Status() == 500 {\n\t\t\t\t\t\tlogMsg = srverror.LogString(se, r, w)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tutil.Verbose(\"Non-standard panic\")\n\t\t\t\t\tw.WriteHeader(500)\n\t\t\t\t\tw.Write([]byte(\"{\\\"message\\\": \\\"Server Error\\\"}\"))\n\t\t\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\t\t\tswitch v := err.(type) {\n\t\t\t\t\tcase string:\n\t\t\t\t\t\tutil.VerboseRequest(r, \"Panic: %s\", v)\n\t\t\t\t\t\tlogMsg = srverror.LogString(errors.New(v), r, w)\n\t\t\t\t\tcase error:\n\t\t\t\t\t\tutil.VerboseRequest(r, \"Panic: %s\", v.Error())\n\t\t\t\t\t\tlogMsg = srverror.LogString(v, r, w)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tutil.VerboseRequest(r, \"Panic: %v\", v)\n\t\t\t\t\t\tlogMsg = srverror.LogString(fmt.Errorf(\"%v\", v), r, w)\n\t\t\t\t\t}\n\t\t\t\t\tif *debugflag {\n\t\t\t\t\t\tdbug.PrintStack()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(logMsg) > 0 {\n\t\t\t\t\tlogErr := srverror.WriteToFile(logMsg)\n\t\t\t\t\tif logErr != nil {\n\t\t\t\t\t\tutil.Verbose(\"Failed to write log to file: %s\", logErr.Error())\n\t\t\t\t\t}\n\t\t\t\t\tlogErr = email.SendErrorEmail(logMsg)\n\t\t\t\t\tif logErr != nil {\n\t\t\t\t\t\tutil.Verbose(\"Failed to send log email: %s\", logErr.Error())\n\t\t\t\t\t} else {\n\t\t\t\t\t\tutil.Verbose(\"An email has been sent to %s describing this issue\", config.V.ErrorEmail)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func recoverHandler(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\t//log.Printf(\"panic: %+v\", err)\n\t\t\t\t// notice that we're using 1, so it will actually log the where\n\t\t\t\t// the error happened, 0 = this function, we don't want that.\n\t\t\t\tpc, fn, line, _ := runtime.Caller(2)\n\t\t\t\tlog.Printf(\"[panic] in %s[%s:%d] %v\", runtime.FuncForPC(pc).Name(), fn, line, err)\n\t\t\t\t//log.Println(\"stacktrace from panic: \\n\" + string(debug.Stack()))\n\t\t\t\t//debug.PrintStack()\n\t\t\t\t// postgresql error check\n\t\t\t\t// pqErr, ok := err.(*pq.Error)\n\t\t\t\t// if ok {\n\t\t\t\t// \tlog.Printf(\"%+v\\n\", pqErr)\n\t\t\t\t// }\n\t\t\t\tWriteJSONError(w, ErrInternalServer)\n\t\t\t}\n\t\t}()\n\n\t\tnext.ServeHTTP(w, r)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func recoverHandler(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tlog.Printf(\"error: %+v\", err)\n\t\t\t\thttp.Error(w, http.StatusText(500), 500)\n\t\t\t}\n\t\t}()\n\t\tnext.ServeHTTP(w, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func NewRecoverHandler() Middleware {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tdefer func() {\n\t\t\t\tif err := recover(); err != nil {\n\t\t\t\t\thandler.WriteError(w, r, fmt.Errorf(\"PANIC: %+v\", err), http.StatusInternalServerError)\n\t\t\t\t}\n\t\t\t}()\n\t\t\th.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func Recover() echo.MiddlewareFunc {\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) (err error) {\n\t\t\tdefer func() {\n\t\t\t\tif p := recover(); p != nil {\n\t\t\t\t\tfmt.Fprintln(os.Stderr, p)\n\t\t\t\t\tos.Stderr.Write(debug.Stack())\n\t\t\t\t\tif pErr, ok := p.(error); ok {\n\t\t\t\t\t\terr = ErrHTTPRecovered.WithCause(pErr)\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = ErrHTTPRecovered.WithAttributes(\"panic\", p)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}()\n\t\t\treturn next(c)\n\t\t}\n\t}\n}", "func PanicHandler() http.Handler { return panicHandler{} }", "func Recovery(inner http.Handler) http.Handler {\n\trecovery := &SimpleRecovery{}\n\treturn http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {\n\t\trecovery.ServeHTTP(rw, r, inner)\n\t})\n}", "func GinRecovery(logger log.Logger) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\t// Check for a broken connection, as it is not really a\n\t\t\t\t// condition that warrants a panic stack trace.\n\t\t\t\tvar brokenPipe bool\n\t\t\t\tif ne, ok := err.(*net.OpError); ok {\n\t\t\t\t\tif se, ok := ne.Err.(*os.SyscallError); ok {\n\t\t\t\t\t\tif strings.Contains(strings.ToLower(se.Error()), \"broken pipe\") ||\n\t\t\t\t\t\t\tstrings.Contains(strings.ToLower(se.Error()), \"connection reset by peer\") {\n\t\t\t\t\t\t\tbrokenPipe = true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif logger != nil {\n\t\t\t\t\thttpRequest, _ := httputil.DumpRequest(c.Request, false)\n\t\t\t\t\theaders := strings.Split(string(httpRequest), \"\\r\\n\")\n\t\t\t\t\tfor idx, header := range headers {\n\t\t\t\t\t\tcurrent := strings.Split(header, \":\")\n\t\t\t\t\t\tif current[0] == \"Authorization\" {\n\t\t\t\t\t\t\theaders[idx] = current[0] + \": *\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tlogger.Errorc(c.Request.Context(), \"[Recovery] panic recovered:\\n%s\\n [%s]\",\n\t\t\t\t\t\tstrings.Join(headers, \"\\r\\n\"), err)\n\t\t\t\t}\n\n\t\t\t\tif brokenPipe {\n\t\t\t\t\t// If the connection is dead, we can't write a status to it.\n\t\t\t\t\tc.Error(err.(error)) // nolint: errcheck\n\t\t\t\t\tc.Abort()\n\t\t\t\t} else {\n\t\t\t\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tc.Next()\n\t}\n}", "func CreateRecoverMiddleware(logger log.Interface) Middleware {\n\treturn func(next http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t\tdefer func() {\n\t\t\t\tif err := recover(); err != nil && err != http.ErrAbortHandler {\n\t\t\t\t\tstack := make([]byte, stackSize)\n\t\t\t\t\tstack = stack[:runtime.Stack(stack, false)]\n\n\t\t\t\t\tlogger.\n\t\t\t\t\t\tWithField(\"request_id\", context_utils.GetRequestID(r.Context())).\n\t\t\t\t\t\tWithField(\"error_type\", \"panic\").\n\t\t\t\t\t\tWithField(\"stack\", fmt.Sprintf(\"%s\", stack)).\n\t\t\t\t\t\tErrorf(\"%v\", err)\n\n\t\t\t\t\tresponse.InternalServerError(w)\n\t\t\t\t}\n\t\t\t}()\n\t\t\tnext.ServeHTTP(w, r)\n\t\t}\n\n\t\treturn http.HandlerFunc(fn)\n\t}\n}", "func Recover(logger *log.Logger) mware.Middleware {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tdefer func(l *log.Logger) {\n\t\t\t\tif err := recover(); err != nil {\n\t\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\t\tl.Println(err)\n\t\t\t\t}\n\t\t\t}(logger)\n\n\t\t\th.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func PanicCatcher(w http.ResponseWriter, r *http.Request) {\n\tctx := httpway.GetContext(r)\n\n\tdefer func() {\n\n\t\tif rec := recover(); rec != nil {\n\t\t\tif ctx.StatusCode() == 0 {\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tfmt.Fprintf(w, \"Internal Server error\")\n\n\t\t\t\tif _, ok := w.(http.Flusher); ok {\n\t\t\t\t\tprintln(\"HAHAHAHAHA FLUSHER\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !ctx.HasLog() {\n\t\t\t\tpanic(rec)\n\t\t\t}\n\n\t\t\tfile, line := getFileLine()\n\t\t\tctx.Log().Error(\"Panic catched on %s:%d - %s\", file, line, rec)\n\n\t\t}\n\t}()\n\n\tctx.Next(w, r)\n}", "func Recovery(n janice.HandlerFunc) janice.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) error {\n\t\tdefer func() {\n\t\t\tif rec := recover(); rec != nil {\n\t\t\t\tle := Logger.WithField(\"type\", \"recovery\")\n\n\t\t\t\tif rid, ok := GetRequestID(r); ok {\n\t\t\t\t\tle = le.WithField(\"request\", rid)\n\t\t\t\t}\n\n\t\t\t\tle.Error(rec)\n\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t}\n\t\t}()\n\n\t\treturn n(w, r)\n\t}\n}", "func Recovery(handlers ...func(c *Context, err interface{})) Middleware {\n\treturn func(c *Context) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tif handlers != nil {\n\t\t\t\t\tfor i := range handlers {\n\t\t\t\t\t\thandlers[i](c, err)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tc.Render(http.StatusInternalServerError, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tc.Next()\n\t}\n}", "func NewRecover() Middleware {\n\treturn func(next http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t\t// defer the recovery\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\tlog.Printf(\"There was a panic with this message: %v\\n\", r)\n\t\t\t\t\tswitch x := r.(type) {\n\t\t\t\t\tcase string:\n\t\t\t\t\t\thttp.Error(w, r.(string), http.StatusInternalServerError)\n\t\t\t\t\tcase error:\n\t\t\t\t\t\terr := x\n\t\t\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\thttp.Error(w, \"unknown panic\", http.StatusInternalServerError)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\t// call the actual api handler\n\t\t\tnext.ServeHTTP(w, r)\n\t\t}\n\n\t\treturn http.HandlerFunc(fn)\n\t}\n}", "func recoveryMw(app http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tstack := debug.Stack()\n\t\t\t\tlog.Println(string(stack))\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tfmt.Fprintf(w, \"<h1>panic: %v</h1><pre>%s</pre>\", err, makeLinks(string(stack)))\n\t\t\t}\n\t\t}()\n\t\tapp.ServeHTTP(w, r)\n\t}\n}", "func PanicRecoverMiddlewareBuilder(log *logrus.Entry) Middleware {\n\treturn func(h http.HandlerFunc) http.HandlerFunc {\n\t\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t\tdefer func() {\n\t\t\t\tif rec := recover(); rec != nil {\n\t\t\t\t\t// Send useful debuggin information to the console.\n\t\t\t\t\tlog.WithContext(r.Context()).WithFields(logrus.Fields{\n\t\t\t\t\t\tlogfmt.StackKey: debug.Stack(),\n\t\t\t\t\t\t\"cause\": rec,\n\t\t\t\t\t}).Errorln(\"Request handler panicked! Recovering.\")\n\n\t\t\t\t\t// Clear the ResponseWriter and send internal error code.\n\t\t\t\t\tif wf, ok := w.(http.Flusher); ok {\n\t\t\t\t\t\twf.Flush()\n\t\t\t\t\t}\n\t\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\th(w, r)\n\t\t}\n\t}\n}", "func logStackOnRecover(panicReason interface{}, httpWriter http.ResponseWriter) {\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(fmt.Sprintf(\"recover from panic situation: - %v\\r\\n\", panicReason))\n\tfor i := 2; ; i += 1 {\n\t\t_, file, line, ok := runtime.Caller(i)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tbuffer.WriteString(fmt.Sprintf(\" %s:%d\\r\\n\", file, line))\n\t}\n\t//\tlog.Print(buffer.String())\n\tlogger := log.New(os.Stderr, \"[server2 logStackOnRecover] \", log.LstdFlags|log.Lshortfile)\n\tlogger.Print(buffer.String())\n\thttpWriter.WriteHeader(http.StatusInternalServerError)\n\thttpWriter.Write(buffer.Bytes())\n}", "func PanicHandler() func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\t\tdefer PanicRecovery(nil, true, logging.TransactionFromContext(req.Context()))()\n\n\t\t\tnext.ServeHTTP(w, req)\n\t\t})\n\t}\n}", "func (m Middleware) RecoverHandler(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\t//FIXME: broken\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Printf(\"Recover from panic: %+v\", err)\n\t\t\thttp.Error(rw, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\t}\n\t}()\n\tnext.ServeHTTP(rw, r)\n}", "func (h *TaskHandler) panicHandler(w http.ResponseWriter, r *http.Request, rcv interface{}) {\n\tctx := r.Context()\n\tpe := &errors2.Error{\n\t\tCode: errors2.EInternal,\n\t\tMsg: \"a panic has occurred\",\n\t\tErr: fmt.Errorf(\"%s: %v\", r.URL.String(), rcv),\n\t}\n\n\tif entry := h.log.Check(zapcore.ErrorLevel, pe.Msg); entry != nil {\n\t\tentry.Stack = string(debug.Stack())\n\t\tentry.Write(zap.Error(pe.Err))\n\t}\n\n\th.HandleHTTPError(ctx, pe, w)\n}", "func Recoverer(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\t// stack := stack(3)\n\t\t\t\tL(r.Context()).Error(\"panic\", zap.Error(err.(error)), zap.Stack(\"stack\"))\n\t\t\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\t\t}\n\t\t}()\n\n\t\tnext.ServeHTTP(w, r)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func PanicRecoveryMiddleware(h http.HandlerFunc, logger *zap.Logger) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif rec := recover(); rec != nil {\n\t\t\t\t// log the error\n\t\t\t\tlogger.Error(fmt.Sprint(rec))\n\n\t\t\t\t// write the error response\n\t\t\t\thelpers.JSONResponse(w, 500, map[string]interface{}{\n\t\t\t\t\t\"error\": \"Internal Error\",\n\t\t\t\t})\n\t\t\t}\n\t\t}()\n\n\t\th(w, r)\n\t}\n}", "func GlobalRecover(devConf *configs.DevelopConfig) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tdefer func(c *gin.Context) {\n\t\t\tif hh.IsStaticFile(c) {\n\t\t\t\tc.Next()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlg.Info(\"[GlobalRecover] defer func()\")\n\n\t\t\t//when crossing request, context data can't be left.\n\t\t\t//c.Set(\"skipMiddleWare\", \"1\")\n\n\t\t\tif c.IsAborted() {\n\t\t\t\tlg.Debug(\"[GlobalRecover] c.IsAborted() is true\")\n\n\t\t\t\t// response\n\t\t\t\tsetResponse(c, getErrMsg(c), c.Writer.Status())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif devConf.RecoverEnable {\n\t\t\t\tif rec := recover(); rec != nil {\n\t\t\t\t\tlg.Debugf(\"[GlobalRecover] recover() is not nil:\\n %v\", rec)\n\t\t\t\t\t//TODO:How should response data be decided whether html or json?\n\t\t\t\t\t//TODO:Ajax or not doesn't matter to response. HTTP header of Accept may be better.\n\t\t\t\t\t//TODO:How precise should I follow specifications of HTTP header.\n\n\t\t\t\t\tsetResponse(c, u.Itos(rec), 500)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}(c)\n\n\t\tc.Next()\n\t\t//Next is [Main gin Recovery]\n\t}\n}", "func RecoveryMid(app http.Handler) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tstack := debug.Stack()\n\t\t\t\tlog.Println(string(stack))\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tfmt.Fprintf(w, \"<h1>panic: %v</h1><pre>%s</pre>\", err, errLinks(string(stack)))\n\t\t\t}\n\t\t}()\n\t\tapp.ServeHTTP(w, r)\n\t}\n}", "func recoverPanic(w http.ResponseWriter, panicSrc string) {\n\tif r := recover(); r != nil {\n\t\tgenericMsg := fmt.Sprintf(panicMessageTmpl, panicSrc)\n\t\tfmt.Fprintf(os.Stderr, fmt.Sprintf(\"%s\\npanic message: %v\\nstack trace: %s\", genericMsg, r, debug.Stack()))\n\t\tif w != nil {\n\t\t\twriteHTTPErrorResponse(w, http.StatusInternalServerError, crashStatus, genericMsg)\n\t\t}\n\t}\n}", "func Recoverer() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tlogger := GetLogger(c)\n\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tif logger != nil {\n\t\t\t\t\tlogger.Errorf(\"recv stack: %s\\n%s\", err, string(debug.Stack()))\n\t\t\t\t}\n\n\t\t\t\twriteInternalServerError(c)\n\t\t\t\t//c.Abort()\n\t\t\t\t//c.String(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))\n\t\t\t}\n\t\t}()\n\t\tc.Next()\n\t}\n}", "func panicHandler() mux.MiddlewareFunc {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t// http.Server hides panics from handlers, we want to record them and fix the cause\n\t\t\tdefer func() {\n\t\t\t\terr := recover()\n\t\t\t\tif err != nil {\n\t\t\t\t\tbuf := make([]byte, 1<<20)\n\t\t\t\t\tn := runtime.Stack(buf, true)\n\t\t\t\t\tlogrus.Warnf(\"Recovering from API service endpoint handler panic: %v, %s\", err, buf[:n])\n\t\t\t\t\t// Try to inform client things went south... won't work if handler already started writing response body\n\t\t\t\t\tutils.InternalServerError(w, fmt.Errorf(\"%v\", err))\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\th.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func Recovery() HandlerFunc {\n\treturn func(ctx *Context) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\t// Inform server of error\n\t\t\t\tlog.Printf(\"%s\\n\\n\", trace(err))\n\t\t\t\t// Inform client of error\n\t\t\t\tctx.Fail(http.StatusInternalServerError, \"Internal Server Error\")\n\t\t\t}\n\t\t}()\n\n\t\tctx.Next()\n\t}\n}", "func RecoverHandler(next http.Handler) http.Handler {\n\t// Define a function that defers a function to recover from a panic\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tlog.Printf(\"panic: %+v\", err)\n\t\t\t\thttp.Error(w, http.StatusText(500), 500)\n\t\t\t}\n\t\t}()\n\n\t\tnext.ServeHTTP(w, r)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func panicHandler(w http.ResponseWriter, r *http.Request) {\n\tfuncPanic()\n}", "func PanicRecoveryLogging(logFunc amqprpc.LogFunc) amqprpc.ServerMiddlewareFunc {\n\treturn PanicRecovery(func(r interface{}, _ context.Context, _ *amqprpc.ResponseWriter, d amqp.Delivery) {\n\t\tlogFunc(\"recovered (%s): %v\", d.CorrelationId, r)\n\t})\n}", "func PanicHandler(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tdefer func() {\n\t\terr := recover()\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"%s: %s\", err, debug.Stack())\n\t\t\thttp.Error(w, \"Internal Server Error\", http.StatusInternalServerError)\n\t\t}\n\t}()\n\n\tnext(w, r)\n}", "func NewRecoverMiddleware(logger *zap.Logger) Middleware {\n\treturn func(h fasthttp.RequestHandler) fasthttp.RequestHandler {\n\t\treturn func(ctx *fasthttp.RequestCtx) {\n\t\t\tdefer func() {\n\t\t\t\tif rec := recover(); rec != nil {\n\t\t\t\t\tlogger.DPanic(\"recover\")\n\t\t\t\t\tctx.Response.SetStatusCode(fasthttp.StatusInternalServerError)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}()\n\t\t\th(ctx)\n\t\t}\n\t}\n}", "func panicRecover(input *models.RunningInput) {\n\tif err := recover(); err != nil {\n\t\ttrace := make([]byte, 2048)\n\t\truntime.Stack(trace, true)\n\t\tlog.Printf(\"E! FATAL: [%s] panicked: %s, Stack:\\n%s\",\n\t\t\tinput.LogName(), err, trace)\n\t\tlog.Println(\"E! PLEASE REPORT THIS PANIC ON GITHUB with \" +\n\t\t\t\"stack trace, configuration, and OS information: \" +\n\t\t\t\"https://github.com/influxdata/telegraf/issues/new/choose\")\n\t}\n}", "func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc {\n\t// Defaults\n\tif config.Skipper == nil {\n\t\tconfig.Skipper = DefaultRecoverConfig.Skipper\n\t}\n\tif config.StackSize == 0 {\n\t\tconfig.StackSize = DefaultRecoverConfig.StackSize\n\t}\n\n\treturn func(next echo.Handler) echo.Handler {\n\t\treturn echo.HandlerFunc(func(c echo.Context) error {\n\t\t\tif config.Skipper(c) {\n\t\t\t\treturn next.Handle(c)\n\t\t\t}\n\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\tpanicErr := echo.NewPanicError(r, nil)\n\t\t\t\t\tpanicErr.SetDebug(c.Echo().Debug())\n\t\t\t\t\tvar err error\n\t\t\t\t\tswitch r := r.(type) {\n\t\t\t\t\tcase error:\n\t\t\t\t\t\terr = r\n\t\t\t\t\tdefault:\n\t\t\t\t\t\terr = fmt.Errorf(\"%v\", r)\n\t\t\t\t\t}\n\t\t\t\t\tif config.DisableStackAll {\n\t\t\t\t\t\tc.Error(panicErr.SetError(err))\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tcontent := \"[PANIC RECOVER] \" + err.Error()\n\t\t\t\t\tfor i := 1; len(content) < config.StackSize; i++ {\n\t\t\t\t\t\tpc, file, line, ok := runtime.Caller(i)\n\t\t\t\t\t\tif !ok {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tt := &echo.Trace{\n\t\t\t\t\t\t\tFile: file,\n\t\t\t\t\t\t\tLine: line,\n\t\t\t\t\t\t\tFunc: runtime.FuncForPC(pc).Name(),\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpanicErr.AddTrace(t)\n\t\t\t\t\t\tcontent += \"\\n\" + fmt.Sprintf(`%v:%v`, file, line)\n\t\t\t\t\t}\n\t\t\t\t\tpanicErr.SetErrorString(content)\n\t\t\t\t\tc.Logger().Error(panicErr)\n\t\t\t\t\tc.Error(panicErr)\n\t\t\t\t}\n\t\t\t}()\n\t\t\treturn next.Handle(c)\n\t\t})\n\t}\n}", "func Recover(pf ...func(c *gin.Context, stack string)) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\ts := stack()\n\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\"app\": c.GetString(gin_handler.KEY_APPNAME),\n\t\t\t\t\t\"stack\": s,\n\t\t\t\t}).Error(err)\n\n\t\t\t\tfor _, f := range pf {\n\t\t\t\t\tf(c, s)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\tc.Next()\n\t}\n}", "func PanicLogging(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tgoErr := errors.Wrap(err, 3)\n\t\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\t\t\"err\": goErr.Err,\n\t\t\t\t\t\"stackTrace\": string(goErr.Stack()),\n\t\t\t\t}).Errorf(\"Panic recovery -> %s\\n\", goErr.Err)\n\t\t\t}\n\t\t}()\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func recoverFunc(w http.ResponseWriter, r *http.Request) {\n\trecoverError := recover()\n\tif recoverError != nil {\n\t\thttp.Error(w, fmt.Sprint(\"Error: \", recoverError), http.StatusInternalServerError)\n\t}\n}", "func withRecover(ctx context.Context, fn func()) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlogger.Error(ctx, \"dispatcher-panic error: %v\", err)\n\t\t\tsentry.Panic(err, \"request_id\", middleware.GetRequestId(ctx))\n\t\t}\n\t}()\n\n\tfn()\n}", "func RecoverMiddleware(next HandlerFunc) HandlerFunc {\n\tfn := func(ctx *Context) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\te := NewError(err)\n\t\t\t\thttpRequest, _ := httputil.DumpRequest(ctx.Request, true)\n\t\t\t\tlog.Printf(\"[Recovery] panic recovered:\\n%s\\n%s\\n%s\", string(httpRequest), err, e.StackTraceString())\n\t\t\t\tctx.statusCode = 500\n\t\t\t\tctx.Abort(500, map[string]interface{}{\n\t\t\t\t\t\"Code\": ctx.statusCode,\n\t\t\t\t\t\"Title\": \"Internal Server Error\",\n\t\t\t\t\t\"HTTPRequest\": string(httpRequest),\n\t\t\t\t\t\"Message\": e.Error(),\n\t\t\t\t\t\"StackTrace\": e.Stack,\n\t\t\t\t})\n\t\t\t}\n\t\t}()\n\t\tnext(ctx)\n\t}\n\treturn fn\n}", "func handlePanic(resp http.ResponseWriter, status int) {\n\tif p := recover(); p != nil {\n\n\t\tmessageFmt := \"Unhandled panic: %s\"\n\t\tvar err error\n\n\t\tswitch p.(type) {\n\t\tcase nil:\n\t\t\t// normal case, just ignore.\n\t\tcase string:\n\t\t\tmessageFmt = p.(string)\n\t\t\terr = errors.New(messageFmt)\n\t\tcase error:\n\t\t\terr = p.(error)\n\t\tdefault:\n\t\t\terr = errors.New(fmt.Sprint(p))\n\t\t}\n\n\t\tif err != nil {\n\t\t\treportError(err, messageFmt, resp, status)\n\t\t}\n\t}\n}", "func Recovery() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tyiigo.Logger.Error(fmt.Sprintf(\"yiigo demo panic: %v\", err), zap.ByteString(\"stack\", debug.Stack()))\n\n\t\t\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\t\t\"success\": false,\n\t\t\t\t\t\"code\": 5000,\n\t\t\t\t\t\"msg\": \"服务器错误,请稍后重试\",\n\t\t\t\t})\n\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\n\t\tc.Next()\n\t}\n}", "func RecoverAndLog() {\n\tif r := recover(); r != nil {\n\t\tfmt.Println(\"Panic digested from \", r)\n\n\t\tlog.Printf(\"Internal error: %v\", r)\n\t\tbuf := make([]byte, 1<<16)\n\t\tstackSize := runtime.Stack(buf, true)\n\t\t//log.Printf(\"%s\\n\", string(buf[0:stackSize]))\n\n\t\tvar dir = platform.GetSurgeDir()\n\t\tvar logPathOS = dir + string(os.PathSeparator) + \"paniclog.txt\"\n\t\tf, _ := os.OpenFile(logPathOS, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)\n\t\tw := bufio.NewWriter(f)\n\t\tw.WriteString(string(buf[0:stackSize]))\n\t\tw.Flush()\n\n\t\tpushError(\"Panic\", \"Please check your log file and paniclog for more info\")\n\n\t\tpanic(\"Panic dumped but not digested, please check your log\")\n\t}\n}", "func (req *Request) handlePanic() {\n\tif rec := recover(); rec != nil {\n\t\treq.Response.WriteHeader(http.StatusInternalServerError)\n\t\treq.Response.Write([]byte(`{\"error\":\"Something went wrong\"}`))\n\n\t\t// The recovered panic may not be an error\n\t\tvar err error\n\t\tswitch val := rec.(type) {\n\t\tcase error:\n\t\t\terr = val\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"%v\", val)\n\t\t}\n\t\terr = fmt.Errorf(\"panic: %v\", err)\n\n\t\tlogger.Errorf(`message: \"%s\", %s`, err.Error(), req)\n\t\tlogger.Errorf(string(debug.Stack()))\n\n\t\t// Send an email async\n\t\tif mailer.Emailer != nil {\n\t\t\tsendEmail := func(stacktrace []byte) {\n\t\t\t\terr := mailer.Emailer.SendStackTrace(stacktrace, req.Endpoint(), err.Error(), req.ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Error(err.Error())\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tgo sendEmail(debug.Stack())\n\t\t}\n\t}\n}", "func WithPanicRecovery(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tdefer runtime.HandleCrash(func(err interface{}) {\n\t\t\thttp.Error(w, \"This request caused apisever to panic. Look in log for details.\", http.StatusInternalServerError)\n\t\t\tglog.Errorf(\"APIServer panic'd on %v %v: %v\\n%s\\n\", req.Method, req.RequestURI, err, debug.Stack())\n\t\t})\n\n\t\tlogger := httplog.NewLogged(req, &w)\n\t\tdefer logger.Log()\n\n\t\t// Dispatch to the internal handler\n\t\thandler.ServeHTTP(w, req)\n\t})\n}", "func LoggingAndRecovery(c lars.Context) {\n\n\tt1 := time.Now()\n\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\ttrace := make([]byte, 1<<16)\n\t\t\tn := runtime.Stack(trace, true)\n\t\t\tlog.Printf(\" %srecovering from panic: %+v\\nStack Trace:\\n %s%s\", ansi.Red, err, trace[:n], ansi.Reset)\n\t\t\tHandlePanic(c, trace[:n])\n\t\t\treturn\n\t\t}\n\t\tcolor := status\n\t res := c.Response()\n\t req := c.Request()\n\t code := res.Status()\n\n\t switch {\n\t case code >= http.StatusInternalServerError:\n\t\t color = status500\n\t case code >= http.StatusBadRequest:\n\t\t color = status400\n\t case code >= http.StatusMultipleChoices:\n\t\t color = status300\n\t }\n\n\t t2 := time.Now()\n\n\t log.Printf(\"%s %d %s[%s%s%s] %q %v %d\\n\", color, code, ansi.Reset, color, req.Method, ansi.Reset, req.URL, t2.Sub(t1), res.Size())\n\t}()\n\n\tc.Next()\t\n}", "func Panic(panicHandler http.Handler) Middleware {\n\treturn func(h http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tdefer func() {\n\t\t\t\tif e := recover(); e != nil {\n\t\t\t\t\tlog.Errorf(r.Context(), \"middleware.Panic: %v\", e)\n\t\t\t\t\tpanicHandler.ServeHTTP(w, r)\n\t\t\t\t}\n\t\t\t}()\n\t\t\th.ServeHTTP(w, r)\n\t\t})\n\t}\n}", "func (h *Panic) ServeHTTP(r http.ResponseWriter, req *http.Request) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\th.loggerFunc(\"begin: recovered from panic\")\n\t\t\th.loggerFunc(fmt.Sprintf(\"unkown value of recover (%v)\", r))\n\t\t\th.loggerFunc(fmt.Sprintf(\"url %v\", req.URL.String()))\n\t\t\th.loggerFunc(fmt.Sprintf(\"method %v\", req.Method))\n\t\t\th.loggerFunc(fmt.Sprintf(\"remote address %v\", req.RemoteAddr))\n\t\t\th.loggerFunc(fmt.Sprintf(\"stack strace of cause \\n %v\", string(debug.Stack())))\n\t\t\th.loggerFunc(\"end: recovered from panic\")\n\t\t}\n\t}()\n\th.Next.ServeHTTP(r, req)\n}", "func Recovery(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar failed bool\n\t\tsafe.Routine(\n\t\t\tfunc() {\n\t\t\t\tnext(w, r)\n\t\t\t},\n\t\t\tfunc() {\n\t\t\t\tfailed = true\n\t\t\t},\n\t\t\tr,\n\t\t)\n\t\tif failed {\n\t\t\tframework.JSON(\n\t\t\t\tw,\n\t\t\t\thttp.StatusInternalServerError,\n\t\t\t\tstruct {\n\t\t\t\t\tError string `json:\"error\"`\n\t\t\t\t}{\n\t\t\t\t\tError: http.StatusText(http.StatusInternalServerError),\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\t}\n}", "func Recover(next noodle.Handler) noodle.Handler {\n\treturn func(c context.Context, w http.ResponseWriter, r *http.Request) (err error) {\n\t\tdefer func() {\n\t\t\tif e := recover(); e != nil {\n\t\t\t\terr = RecoverError{e, debug.Stack()}\n\t\t\t}\n\t\t}()\n\t\terr = next(c, w, r)\n\t\treturn\n\t}\n}", "func (o *Obs) PanicRecover() {\n\tif r := recover(); r != nil {\n\t\t// According to Russ Cox (leader of the Go team) capturing the stack trace here works:\n\t\t// https://groups.google.com/d/msg/golang-nuts/MB8GyW5j2UY/m_YYy7mGYbIJ .\n\t\to.Logger.WithField(\"stack\", string(debug.Stack())).Error(fmt.Sprintf(\"%v\", r))\n\t}\n}", "func PanicHandler() func(http.ResponseWriter, *http.Request, interface{}) {\n\treturn func(w http.ResponseWriter, r *http.Request, rcv interface{}) {\n\t\tresponse := ResultInternalServerErr\n\t\tif env := viper.GetString(`env`); env == \"development\" {\n\t\t\tif rcv != nil {\n\t\t\t\tresponse.SetMessage(rcv)\n\t\t\t}\n\t\t}\n\n\t\tlog.Printf(\"%s %s\", r.Method, r.URL.Path)\n\t\tlog.Printf(\"Panic Error: %+v\", rcv)\n\n\t\tJSONResult(w, &response)\n\t}\n}", "func TestRecovererPanicWithStack(t *testing.T) {\n\treq, err := http.NewRequest(\"GET\", \"/\", nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tConvey(\"When a request is made, and panics, it is recovered\", t, func() {\n\t\ttestHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tpanic(\"OH MY GOSH!\")\n\t\t})\n\n\t\tConf.Set(ConfigRecovererLogStackTraces, true)\n\n\t\trr := httptest.NewRecorder()\n\n\t\thandler := Recoverer(testHandler)\n\n\t\t// Set up a dummy requestID\n\t\tctx := WithRqID(req.Context(), \"abc123\")\n\t\treq = req.WithContext(ctx)\n\n\t\thandler.ServeHTTP(rr, req)\n\n\t\tSo(rr.Code, ShouldEqual, http.StatusInternalServerError)\n\t\tSo(rr.Body.String(), ShouldContainSubstring, http.StatusText(http.StatusInternalServerError))\n\t})\n}", "func RecoverMiddleware(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer recoverInternal(w)\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func panicHandler(handler http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tlogrus.Panic(fmt.Sprintf(\"%v\", err))\n\t\t\t}\n\t\t}()\n\t\thandler.ServeHTTP(w, r)\n\t})\n}", "func (m *Monitor) Recovery(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {\n\t// recovery func\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\t// log stack\n\t\t\tstack := make([]byte, MAXSTACKSIZE)\n\t\t\tstack = stack[:runtime.Stack(stack, false)]\n\t\t\terrStack := string(stack)\n\t\t\tlog.Errorf(\"panic grpc invoke: %s, err=%v, stack:\\n%s\", info.FullMethod, r, errStack)\n\n\t\t\tfunc() {\n\t\t\t\tdefer func() {\n\t\t\t\t\tif r := recover(); err != nil {\n\t\t\t\t\t\tlog.Errorf(\"report sentry failed: %s, trace:\\n%s\", r, debug.Stack())\n\t\t\t\t\t\terr = grpc.Errorf(codes.Internal, \"panic error: %v\", r)\n\t\t\t\t\t}\n\t\t\t\t}()\n\t\t\t\tswitch rval := r.(type) {\n\t\t\t\tcase error:\n\t\t\t\t\tm.ObserveError(info.FullMethod, rval)\n\t\t\t\tdefault:\n\t\t\t\t\tm.ObserveError(info.FullMethod, errors.New(fmt.Sprint(rval)))\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\t// if panic, set custom error to 'err', in order that client and sense it.\n\t\t\terr = grpc.Errorf(codes.Internal, \"panic error: %v\", r)\n\t\t}\n\t}()\n\n\treturn handler(ctx, req)\n}", "func TestMiddlewares_OnPanic(t *testing.T) {\n\tassert := assertlib.New(t)\n\thook, restoreFct := logging.MockSharedLoggerHook()\n\tdefer restoreFct()\n\tapp, _ := New()\n\trouter := app.HTTPHandler\n\trouter.Get(\"/dummy\", func(http.ResponseWriter, *http.Request) {\n\t\tpanic(\"error in service\")\n\t})\n\tsrv := httptest.NewServer(router)\n\tdefer srv.Close()\n\n\tnbLogsBeforeRequest := len(hook.AllEntries())\n\trequest, _ := http.NewRequest(\"GET\", srv.URL+\"/dummy\", http.NoBody)\n\trequest.Header.Set(\"X-Forwarded-For\", \"1.1.1.1\")\n\tresponse, err := http.DefaultClient.Do(request)\n\tassert.NoError(err)\n\tif err != nil {\n\t\treturn\n\t}\n\trespBody, _ := ioutil.ReadAll(response.Body)\n\t_ = response.Body.Close()\n\n\t// check that the error has been handled by the recover\n\tassert.Equal(http.StatusInternalServerError, response.StatusCode)\n\tassert.Equal(\"Internal Server Error\\n\", string(respBody))\n\tassert.Equal(\"text/plain; charset=utf-8\", response.Header.Get(\"Content-type\"))\n\tallLogs := hook.AllEntries()\n\tassert.Equal(2, len(allLogs)-nbLogsBeforeRequest)\n\t// check that the req id is correct\n\tassert.Equal(allLogs[len(allLogs)-1].Data[\"req_id\"], allLogs[len(allLogs)-2].Data[\"req_id\"])\n\t// check that the recovere put the error info in the logs\n\tassert.Equal(\"error in service\", hook.LastEntry().Data[\"panic\"])\n\tassert.NotNil(hook.LastEntry().Data[\"stack\"])\n\t// check that the real IP is used in the logs\n\tassert.Equal(\"1.1.1.1\", allLogs[len(allLogs)-1].Data[\"remote_addr\"])\n\tassert.Equal(\"1.1.1.1\", allLogs[len(allLogs)-2].Data[\"remote_addr\"])\n}", "func PanicRecovery(onRecovery func(interface{}, context.Context, *amqprpc.ResponseWriter, amqp.Delivery)) amqprpc.ServerMiddlewareFunc {\n\treturn func(next amqprpc.HandlerFunc) amqprpc.HandlerFunc {\n\t\treturn func(ctx context.Context, rw *amqprpc.ResponseWriter, d amqp.Delivery) {\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\tonRecovery(r, ctx, rw, d)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tnext(ctx, rw, d)\n\t\t}\n\t}\n}", "func panicRecover() {\n\tif rec := recover(); rec != nil {\n\t\tlog.Printf(\"Panic: %v\", rec)\n\t}\n}", "func Recoverer(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif rvr := recover(); rvr != nil {\n\n\t\t\t\tvar err error\n\t\t\t\tswitch x := rvr.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\terr = errors.New(x)\n\t\t\t\tcase error:\n\t\t\t\t\terr = x\n\t\t\t\tdefault:\n\t\t\t\t\terr = errors.New(\"unknown error\")\n\t\t\t\t}\n\n\t\t\t\tlog.Error().Stack().Err(errors.Wrap(err, \"unexpected error\")).Msg(\"unexpected error\")\n\t\t\t\tdebug.PrintStack()\n\t\t\t\trenderServerError(err, w, r)\n\t\t\t}\n\t\t}()\n\n\t\tnext.ServeHTTP(w, r)\n\t}\n\n\treturn http.HandlerFunc(fn)\n}", "func (rec *Recoverer) Wrap(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tw.Header().Set(\"Connection\", \"close\")\n\t\t\t\trestErr := &rest.Error{\n\t\t\t\t\tErr: fmt.Errorf(\"there was a panic: %s\", err),\n\t\t\t\t\tStatus: http.StatusInternalServerError,\n\t\t\t\t\tMessage: \"Internal Server Error\",\n\t\t\t\t\tIsSilent: false,\n\t\t\t\t\tInternalLogs: []zapcore.Field{\n\t\t\t\t\t\tzap.Stack(\"stack\"),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\trest.SendRESTError(w, r, rec.Logger, restErr)\n\t\t\t}\n\t\t}()\n\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func PanicRecovery(err *error, logErrors bool, txnID string) func() {\n\treturn func() {\n\n\t\t// If err is nil, we don't want to cause a panic. However, we can't actually set it\n\t\t// and have it persist beyond this function. Therefore, we force logging on so it\n\t\t// isn't just ignored completely if we receive a nil pointer.\n\t\tif err == nil {\n\t\t\tlogErrors = true\n\t\t\terr = new(error)\n\t\t}\n\n\t\tif r := recover(); r != nil && err != nil {\n\t\t\ts, i, _ := identifyPanic()\n\n\t\t\tswitch r := r.(type) {\n\t\t\tcase error:\n\t\t\t\tif logErrors {\n\t\t\t\t\tlog.WithFields(log.Fields{\"panic\": \"error\", \"file\": s, \"line_num\": i, \"txnID\": txnID}).Error(r)\n\t\t\t\t}\n\n\t\t\t\t// Create a new error and assign it to our pointer.\n\t\t\t\t*err = r.(error)\n\t\t\tcase string:\n\t\t\t\tif logErrors {\n\t\t\t\t\tlog.WithFields(log.Fields{\"panic\": \"string\", \"file\": s, \"line_num\": i, \"txnID\": txnID}).Error(r)\n\t\t\t\t}\n\n\t\t\t\t// Create a new error and assign it to our pointer.\n\t\t\t\t*err = errors.New(r)\n\t\t\tdefault:\n\t\t\t\tmsg := fmt.Sprintf(\"%+v\", r)\n\n\t\t\t\tif logErrors {\n\t\t\t\t\tlog.WithFields(log.Fields{\"panic\": \"default\", \"file\": s, \"line_num\": i, \"txnID\": txnID}).Error(msg)\n\t\t\t\t}\n\n\t\t\t\t// Create a new error and assign it to our pointer.\n\t\t\t\t*err = errors.New(\"Panic: \" + msg)\n\t\t\t}\n\t\t}\n\t}\n}", "func handlePanic() {\n\tif r := recover(); r != nil {\n\t\tlog.Printf(\"panic recovered: %s \\n %s\", r, debug.Stack())\n\t}\n}", "func panicHandler(w http.ResponseWriter, r *http.Request) {\n\tfuncThatPanic()\n}", "func Recovery(ctx *gin.Context) {\n\tdefer func(ctx *gin.Context) {\n\t\tif rec := recover(); rec != nil {\n\t\t\t//err := utils.GetError(rec)\n\n\t\t\t//errorCode := rzperrors.ErrorInternalServerError\n\t\t\t//payloadCreationError := rzperrors.NewRzpError(ctx, errorCode, err)\n\t\t\t//logger.RzpError(ctx, payloadCreationError)\n\n\t\t\tresponse := dtos.Base{}\n\t\t\tresponse.Success = false\n\t\t\t//response.Error = payloadCreationError.ErrorCode()\n\t\t\tresponse.Error = errors.New(\"error\")\n\t\t\tctx.JSON(http.StatusInternalServerError, response)\n\t\t}\n\t}(ctx)\n\n\tctx.Next()\n}", "func (this *BaseController) Panic() revel.Result {\n\tdefer func() {\n\t\tmongo.CloseSession(this.UserId, this.MongoSession)\n\t\tthis.MongoSession = nil\n\t}()\n\n\ttracelog.TRACE(this.UserId, \"Panic\", this.Request.URL.Path)\n\treturn nil\n}", "func PanicCatcher(logger *Xlogger) {\n\tif err := recover(); err != nil {\n\t\tlogger.Print(err)\n\t\tlogger.Print(string(debug.Stack()[:]))\n\t}\n}", "func RecoveryHandler(c *gin.Context, err interface{}) {\r\n\tc.JSON(http.StatusInternalServerError, gin.H{\r\n\t\t\"code\": http.StatusInternalServerError,\r\n\t\t\"err\": err,\r\n\t})\r\n}", "func TestPanicInHandler(t *testing.T) {\n\tbuffer := new(strings.Builder)\n\trouter := New()\n\trouter.Use(RecoveryWithWriter(buffer))\n\trouter.GET(\"/recovery\", func(_ *Context) {\n\t\tpanic(\"Oupps, Houston, we have a problem\")\n\t})\n\t// RUN\n\tw := PerformRequest(router, \"GET\", \"/recovery\")\n\t// TEST\n\tassert.Equal(t, http.StatusInternalServerError, w.Code)\n\tassert.Contains(t, buffer.String(), \"panic recovered\")\n\tassert.Contains(t, buffer.String(), \"Oupps, Houston, we have a problem\")\n\tassert.Contains(t, buffer.String(), t.Name())\n\tassert.NotContains(t, buffer.String(), \"GET /recovery\")\n\n\t// Debug mode prints the request\n\tSetMode(DebugMode)\n\t// RUN\n\tw = PerformRequest(router, \"GET\", \"/recovery\")\n\t// TEST\n\tassert.Equal(t, http.StatusInternalServerError, w.Code)\n\tassert.Contains(t, buffer.String(), \"GET /recovery\")\n\n\tSetMode(TestMode)\n}", "func (e *recoverableError) recover() {\n}", "func ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}", "func ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}", "func TestRecovererPanic(t *testing.T) {\n\treq, err := http.NewRequest(\"GET\", \"/\", nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tConvey(\"When a request is made, and panics, it is recovered\", t, func() {\n\t\ttestHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tpanic(\"OH MY GOSH!\")\n\t\t})\n\n\t\trr := httptest.NewRecorder()\n\n\t\thandler := Recoverer(testHandler)\n\n\t\t// Set up a dummy requestID\n\t\tctx := WithRqID(req.Context(), \"abc123\")\n\t\treq = req.WithContext(ctx)\n\n\t\thandler.ServeHTTP(rr, req)\n\n\t\tSo(rr.Code, ShouldEqual, http.StatusInternalServerError)\n\t\tSo(rr.Body.String(), ShouldContainSubstring, http.StatusText(http.StatusInternalServerError))\n\t})\n}", "func WithRecover(next http.Handler) http.Handler {\n\thandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tvar err error\n\t\tdefer func() {\n\t\t\tr := recover()\n\t\t\tif r != nil {\n\t\t\t\tswitch t := r.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\terr = errors.New(t)\n\t\t\t\tcase error:\n\t\t\t\t\terr = t\n\t\t\t\tdefault:\n\t\t\t\t\terr = errors.New(\"Unknown error\")\n\t\t\t\t}\n\t\t\t\tJSONErrorResponse(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\t\tnext.ServeHTTP(w, r)\n\t})\n\treturn handler\n}", "func Recovery(f func(c *gin.Context, err interface{})) gin.HandlerFunc {\r\n\treturn RecoveryWithoutWriter(f)\r\n}", "func panicHandler(r interface{}) error {\n\tfmt.Println(\"600 Error\")\n\treturn ErrPanic(r)\n}", "func (e *Handler) Panic(err error) {\n\thas := e.hasErrPrint(err)\n\tif !has {\n\t\treturn\n\t}\n\tpanic(err)\n}", "func (r NopReporter) Recover(ctx context.Context) { _ = recover() }" ]
[ "0.73594993", "0.7038121", "0.7008406", "0.6885905", "0.6658655", "0.6547491", "0.64594406", "0.64355105", "0.6379547", "0.63791853", "0.63632184", "0.63296616", "0.631733", "0.630849", "0.6275611", "0.6274496", "0.6261786", "0.62580246", "0.6256298", "0.6241197", "0.6223762", "0.6192447", "0.61773324", "0.61270356", "0.61258286", "0.609522", "0.60912746", "0.6077271", "0.60605067", "0.60467154", "0.6045846", "0.6035639", "0.60198396", "0.5901158", "0.58971477", "0.58632076", "0.5855417", "0.58506507", "0.5845874", "0.58378506", "0.58223313", "0.57750255", "0.57744026", "0.5773004", "0.5765472", "0.5742097", "0.5722865", "0.5701837", "0.56872296", "0.5670874", "0.5665572", "0.56514734", "0.56417614", "0.5641385", "0.56173354", "0.56125844", "0.56072664", "0.55658734", "0.5565333", "0.5562891", "0.5558917", "0.5544191", "0.55410916", "0.5512701", "0.550641", "0.55061996", "0.5491171", "0.5484914", "0.5476612", "0.54745084", "0.5470959", "0.5467471", "0.54307073", "0.54284394", "0.54189104", "0.54107344", "0.54085386", "0.5391545", "0.53864807", "0.53848326", "0.5359253", "0.5348781", "0.5340913", "0.5332834", "0.52714217", "0.52656513", "0.5265248", "0.52549696", "0.5253379", "0.52384603", "0.52274966", "0.52261835", "0.5211609", "0.5211609", "0.5209815", "0.51948416", "0.51859206", "0.5177097", "0.5163856", "0.51318914" ]
0.74536425
0
Opts returns a redisconn.Opts object with the configured options applied.
Opts возвращает объект redisconn.Opts с примененными настроенными параметрами.
func (cfg ClientConfig) Opts() redisconn.Opts { opts := redisconn.Opts{} cfg.Options.ApplyOpts(&opts) return opts }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetRedisOpts(driver *dipper.Driver) *Options {\n\tif conn, ok := dipper.GetMapData(driver.Options, \"data.connection\"); ok {\n\t\tdefer delete(conn.(map[string]interface{}), \"Password\")\n\t}\n\tif tls, ok := dipper.GetMapData(driver.Options, \"data.connection.TLS\"); ok {\n\t\tdefer delete(tls.(map[string]interface{}), \"CACerts\")\n\t}\n\n\tif localRedis, ok := os.LookupEnv(\"LOCALREDIS\"); ok && localRedis != \"\" {\n\t\tif opts, e := redis.ParseURL(localRedis); e == nil {\n\t\t\treturn &Options{\n\t\t\t\tOptions: opts,\n\t\t\t}\n\t\t}\n\n\t\treturn &Options{\n\t\t\tOptions: &redis.Options{\n\t\t\t\tAddr: \"127.0.0.1:6379\",\n\t\t\t\tDB: 0,\n\t\t\t},\n\t\t}\n\t}\n\n\topts := &redis.Options{}\n\tif value, ok := driver.GetOptionStr(\"data.connection.Addr\"); ok {\n\t\topts.Addr = value\n\t}\n\tif value, ok := driver.GetOptionStr(\"data.connection.Username\"); ok {\n\t\topts.Username = value\n\t}\n\tif value, ok := driver.GetOptionStr(\"data.connection.Password\"); ok {\n\t\topts.Password = value\n\t}\n\tif DB, ok := driver.GetOptionStr(\"data.connection.DB\"); ok {\n\t\topts.DB = dipper.Must(strconv.Atoi(DB)).(int)\n\t}\n\tif driver.CheckOption(\"data.connection.TLS.Enabled\") {\n\t\topts.TLSConfig = setupTLSConfig(driver)\n\t}\n\n\treturn &Options{\n\t\tOptions: opts,\n\t}\n}", "func (o Opts) ApplyOpts(opts *redisconn.Opts) {\n\n\tif o.DB != nil {\n\t\topts.DB = *o.DB\n\t}\n\tif o.WritePause > 0 {\n\t\topts.WritePause = o.WritePause\n\t}\n\tif o.ReconnectPause > 0 {\n\t\topts.ReconnectPause = o.ReconnectPause\n\t}\n\tif o.TCPKeepAlive > 0 {\n\t\topts.TCPKeepAlive = o.TCPKeepAlive\n\t}\n\to.Timeouts.ApplyOpts(opts)\n}", "func (cfg ClusterConfig) Opts() rediscluster.Opts {\n\topts := rediscluster.Opts{}\n\tcfg.Options.ApplyOpts(&opts.HostOpts)\n\tcfg.Cluster.ApplyOpts(&opts)\n\treturn opts\n}", "func NewOpts() Opts {\n\treturn Opts{\n\t\tBroker: getenv(\"MQTT_TEST_CLIENT_HOST\", \"ssl://mqtt:8883\"),\n\t\tID: getenv(\"MQTT_TEST_CLIENT_ID\", \"test-client\"),\n\t\tSerial: \"1001\",\n\t\tMode: ModeAuto,\n\t\tQoS: 2,\n\t\tRetained: true,\n\t\tSetWill: false,\n\t\tTLS: false,\n\t}\n}", "func (c *conn) Options() *ConnOptions {\n\treturn c.options\n}", "func customizedOption(viper *viper.Viper, rwType RWType) *Options {\n\n\tvar opt = Options{}\n\tletOldEnvSupportViper(viper, rwType)\n\thosts := addrStructure(viper.GetStringSlice(rwType.FmtSuffix(\"REDIS_PORT\")),\n\t\tviper.GetStringSlice(rwType.FmtSuffix(\"REDIS_HOST\")))\n\topt.Type = ClientType(viper.GetString(rwType.FmtSuffix(\"REDIS_TYPE\")))\n\topt.Hosts = hosts\n\topt.ReadOnly = rwType.IsReadOnly()\n\topt.Database = viper.GetInt(rwType.FmtSuffix(\"REDIS_DB_NAME\"))\n\topt.Password = viper.GetString(rwType.FmtSuffix(\"REDIS_DB_PASSWORD\"))\n\topt.KeyPrefix = viper.GetString(rwType.FmtSuffix(\"REDIS_KEY_PREFIX\"))\n\t// various timeout setting\n\topt.DialTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.ReadTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.WriteTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\t// REDIS_MAX_CONNECTIONS\n\topt.PoolSize = viper.GetInt(rwType.FmtSuffix(\"REDIS_MAX_CONNECTIONS\"))\n\topt.PoolTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.IdleTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.IdleCheckFrequency = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.TLSConfig = nil\n\treturn &opt\n}", "func (p *P) Options() []gnomock.Option {\n\tp.setDefaults()\n\n\topts := []gnomock.Option{\n\t\tgnomock.WithHealthCheck(p.healthcheck),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_MODE=setup\"),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_USERNAME=\" + p.Username),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_PASSWORD=\" + p.Password),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_ORG=\" + p.Org),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_BUCKET=\" + p.Bucket),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=\" + p.AuthToken),\n\t}\n\n\treturn opts\n}", "func (r Redis) RedisOptions() *redis.Options {\n\treturn &redis.Options{\n\t\tNetwork: \"tcp\",\n\t\tAddr: r.Address,\n\t\tDB: r.DB,\n\t\tUsername: r.Username,\n\t\tPassword: r.Password,\n\t}\n}", "func (t Timeouts) ApplyOpts(opts *redisconn.Opts) {\n\tif t.Dial > 0 {\n\t\topts.DialTimeout = t.Dial\n\t}\n\tif t.IO > 0 {\n\t\topts.IOTimeout = t.IO\n\t}\n}", "func WithRedisOptions(opts *redis.Options) ClientOption {\n\treturn func(cfg *clientConfig) {\n\t\thost, port, err := net.SplitHostPort(opts.Addr)\n\t\tif err != nil {\n\t\t\thost = defaultHost\n\t\t\tport = defaultPort\n\t\t}\n\t\tcfg.host = host\n\t\tcfg.port = port\n\t\tcfg.db = strconv.Itoa(opts.DB)\n\t}\n}", "func NewOpts() TransactionOptions {\n\treturn TransactionOptions{\n\t\tDescription: \"\",\n\t\tCurrency: \"EUR\",\n\t}\n}", "func ClientOpts(clt *resty.Client) BuildOptions {\n\treturn func(client *PluginClient) {\n\t\tclient.client = clt\n\t}\n}", "func (ep *Endpoint) ClientOpts() ([]client.Opt, error) {\n\tvar result []client.Opt\n\tif ep.Host != \"\" {\n\t\thelper, err := connhelper.GetConnectionHelper(ep.Host)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif helper == nil {\n\t\t\ttlsConfig, err := ep.tlsConfig()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresult = append(result,\n\t\t\t\twithHTTPClient(tlsConfig),\n\t\t\t\tclient.WithHost(ep.Host),\n\t\t\t)\n\n\t\t} else {\n\t\t\tresult = append(result,\n\t\t\t\tclient.WithHTTPClient(&http.Client{\n\t\t\t\t\t// No TLS, and no proxy.\n\t\t\t\t\tTransport: &http.Transport{\n\t\t\t\t\t\tDialContext: helper.Dialer,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\tclient.WithHost(helper.Host),\n\t\t\t\tclient.WithDialContext(helper.Dialer),\n\t\t\t)\n\t\t}\n\t}\n\n\tresult = append(result, client.WithVersionFromEnv(), client.WithAPIVersionNegotiation())\n\treturn result, nil\n}", "func NewWithOpts(options ...Option) *Config {\n\topts := &Options{}\n\n\tfor _, opt := range options {\n\t\topt(opts)\n\t}\n\n\tv := viper.New()\n\tv.AutomaticEnv()\n\tv.SetEnvKeyReplacer(strings.NewReplacer(\"-\", \"_\", \".\", \"_\"))\n\n\tflagSet := new(pflag.FlagSet)\n\n\tc := &Config{\n\t\tKstream: KstreamConfig{},\n\t\tFilament: FilamentConfig{},\n\t\tAPI: APIConfig{},\n\t\tPE: pe.Config{},\n\t\tLog: log.Config{},\n\t\tAggregator: aggregator.Config{},\n\t\tFilters: &Filters{},\n\t\tviper: v,\n\t\tflags: flagSet,\n\t\topts: opts,\n\t}\n\n\tif opts.run || opts.replay {\n\t\taggregator.AddFlags(flagSet)\n\t\tconsole.AddFlags(flagSet)\n\t\tamqp.AddFlags(flagSet)\n\t\telasticsearch.AddFlags(flagSet)\n\t\thttp.AddFlags(flagSet)\n\t\teventlog.AddFlags(flagSet)\n\t\tremovet.AddFlags(flagSet)\n\t\treplacet.AddFlags(flagSet)\n\t\trenamet.AddFlags(flagSet)\n\t\ttrimt.AddFlags(flagSet)\n\t\ttagst.AddFlags(flagSet)\n\t\tmailsender.AddFlags(flagSet)\n\t\tslacksender.AddFlags(flagSet)\n\t\tyara.AddFlags(flagSet)\n\t}\n\n\tif opts.run || opts.capture {\n\t\tpe.AddFlags(flagSet)\n\t}\n\n\tc.addFlags()\n\n\treturn c\n}", "func (w *Websocket) Options() *transport.Options {\n\treturn w.topts\n}", "func TestRedisOptions() *redis.Options {\n\tmr, err := miniredis.Run()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &redis.Options{Addr: mr.Addr()}\n}", "func DialOpts(dialOpts ...grpc.DialOption) ConnectOption {\n\treturn dialOptsOption(dialOpts)\n}", "func (r *root) opts() kivik.Options {\n\treturn r.options\n}", "func (n *natsBroker) Options() broker.Options {\n\treturn n.options\n}", "func (c *Caches) Option() Options {\n\treturn c.options\n}", "func (d *SQLike) Options() *destination.Options {\n\treturn d.options\n}", "func (c *Client) Options() ClientOptions {\n\treturn c.options\n}", "func (c *Container) Options() (*dockertest.RunOptions, error) {\n\n\tstrPort := strconv.Itoa(c.getBrokerPort())\n\tpb := map[docker.Port][]docker.PortBinding{}\n\tpb[docker.Port(fmt.Sprintf(\"%d/tcp\", brokerPort))] = []docker.PortBinding{{\n\t\tHostIP: \"0.0.0.0\",\n\t\tHostPort: strPort,\n\t}}\n\n\tstrPort = strconv.Itoa(c.getClientPort())\n\tpb[docker.Port(fmt.Sprintf(\"%d/tcp\", clientPort))] = []docker.PortBinding{{\n\t\tHostIP: \"0.0.0.0\",\n\t\tHostPort: strPort,\n\t}}\n\n\trepo, tag := c.params.GetRepoTag(\"confluentinc/cp-kafka\", \"5.3.0\")\n\tenv := c.params.MergeEnv([]string{\n\t\t\"KAFKA_BROKER_ID=1\",\n\t\tfmt.Sprintf(\"KAFKA_LISTENERS=\\\"PLAINTEXT://0.0.0.0:%d,BROKER://0.0.0.0:%d\", c.getClientPort(), c.getBrokerPort()),\n\t\t\"KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=\\\"BROKER:PLAINTEXT,PLAINTEXT:PLAINTEXT\\\"\",\n\t\t\"KAFKA_INTER_BROKER_LISTENER_NAME=BROKER\",\n\t\t\"KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1\",\n\t})\n\n\treturn &dockertest.RunOptions{\n\t\tRepository: repo,\n\t\tTag: tag,\n\t\tEnv: env,\n\t\tPortBindings: pb,\n\t}, nil\n}", "func getOpts(opt ...wrapping.Option) (*options, error) {\n\t// First, separate out options into local and global\n\topts := getDefaultOptions()\n\tvar wrappingOptions []wrapping.Option\n\tvar localOptions []OptionFunc\n\tfor _, o := range opt {\n\t\tif o == nil {\n\t\t\tcontinue\n\t\t}\n\t\tiface := o()\n\t\tswitch to := iface.(type) {\n\t\tcase wrapping.OptionFunc:\n\t\t\twrappingOptions = append(wrappingOptions, o)\n\t\tcase OptionFunc:\n\t\t\tlocalOptions = append(localOptions, to)\n\t\t}\n\t}\n\n\t// Parse the global options\n\tvar err error\n\topts.Options, err = wrapping.GetOpts(wrappingOptions...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't ever return blank options\n\tif opts.Options == nil {\n\t\topts.Options = new(wrapping.Options)\n\t}\n\n\t// Local options can be provided either via the WithConfigMap field\n\t// (for over the plugin barrier or embedding) or via local option functions\n\t// (for embedding). First pull from the option.\n\tif opts.WithConfigMap != nil {\n\t\tfor k, v := range opts.WithConfigMap {\n\t\t\tswitch k {\n\t\t\tcase \"mount_path\":\n\t\t\t\topts.withMountPath = v\n\t\t\tcase \"key_name\":\n\t\t\t\topts.withKeyName = v\n\t\t\tcase \"disable_renewal\":\n\t\t\t\topts.withDisableRenewal = v\n\t\t\tcase \"namespace\":\n\t\t\t\topts.withNamespace = v\n\t\t\tcase \"address\":\n\t\t\t\topts.withAddress = v\n\t\t\tcase \"tls_ca_cert\":\n\t\t\t\topts.withTlsCaCert = v\n\t\t\tcase \"tls_ca_path\":\n\t\t\t\topts.withTlsCaPath = v\n\t\t\tcase \"tls_client_cert\":\n\t\t\t\topts.withTlsClientCert = v\n\t\t\tcase \"tls_client_key\":\n\t\t\t\topts.withTlsClientKey = v\n\t\t\tcase \"tls_server_name\":\n\t\t\t\topts.withTlsServerName = v\n\t\t\tcase \"tls_skip_verify\":\n\t\t\t\tvar err error\n\t\t\t\topts.withTlsSkipVerify, err = strconv.ParseBool(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\tcase \"token\":\n\t\t\t\topts.withToken = v\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now run the local options functions. This may overwrite options set by\n\t// the options above.\n\tfor _, o := range localOptions {\n\t\tif o != nil {\n\t\t\tif err := o(&opts); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &opts, nil\n}", "func (gs *GenServer) Options() map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"chan-size\": 100, // size of channel for regular messages\n\t}\n}", "func getOpts(opt ...wrapping.Option) (*options, error) {\n\t// First, separate out options into local and global\n\topts := getDefaultOptions()\n\tvar wrappingOptions []wrapping.Option\n\tvar localOptions []OptionFunc\n\tfor _, o := range opt {\n\t\tif o == nil {\n\t\t\tcontinue\n\t\t}\n\t\tiface := o()\n\t\tswitch to := iface.(type) {\n\t\tcase wrapping.OptionFunc:\n\t\t\twrappingOptions = append(wrappingOptions, o)\n\t\tcase OptionFunc:\n\t\t\tlocalOptions = append(localOptions, to)\n\t\t}\n\t}\n\n\t// Parse the global options\n\tvar err error\n\topts.Options, err = wrapping.GetOpts(wrappingOptions...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't ever return blank options\n\tif opts.Options == nil {\n\t\topts.Options = new(wrapping.Options)\n\t}\n\n\t// Local options can be provided either via the WithConfigMap field\n\t// (for over the plugin barrier or embedding) or via local option functions\n\t// (for embedding). First pull from the option.\n\tif opts.WithConfigMap != nil {\n\t\tfor k, v := range opts.WithConfigMap {\n\t\t\tswitch k {\n\t\t\tcase \"key_not_required\":\n\t\t\t\tkeyNotRequired, err := strconv.ParseBool(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\topts.withKeyNotRequired = keyNotRequired\n\t\t\tcase \"user_agent\":\n\t\t\t\topts.withUserAgent = v\n\t\t\tcase \"credentials\":\n\t\t\t\topts.withCredentials = v\n\t\t\tcase \"project\":\n\t\t\t\topts.withProject = v\n\t\t\tcase \"region\":\n\t\t\t\topts.withRegion = v\n\t\t\tcase \"key_ring\":\n\t\t\t\topts.withKeyRing = v\n\t\t\tcase \"crypto_key\":\n\t\t\t\topts.withCryptoKey = v\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now run the local options functions. This may overwrite options set by\n\t// the options above.\n\tfor _, o := range localOptions {\n\t\tif o != nil {\n\t\t\tif err := o(&opts); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &opts, nil\n}", "func (c *Config) GenerateOpts() (*client.Opts, error) {\n\tif c.A10.Username == \"\" {\n\t\treturn nil, validFail(\"username\", c.A10.Username)\n\t}\n\tif c.A10.Password == \"\" {\n\t\treturn nil, validFail(\"password\", c.A10.Password)\n\t}\n\treturn &c.A10, nil\n}", "func getOpts(opt ...wrapping.Option) (*options, error) {\n\t// First, separate out options into local and global\n\topts := getDefaultOptions()\n\tvar wrappingOptions []wrapping.Option\n\tvar localOptions []OptionFunc\n\tfor _, o := range opt {\n\t\tif o == nil {\n\t\t\tcontinue\n\t\t}\n\t\tiface := o()\n\t\tswitch to := iface.(type) {\n\t\tcase wrapping.OptionFunc:\n\t\t\twrappingOptions = append(wrappingOptions, o)\n\t\tcase OptionFunc:\n\t\t\tlocalOptions = append(localOptions, to)\n\t\t}\n\t}\n\n\t// Parse the global options\n\tvar err error\n\topts.Options, err = wrapping.GetOpts(wrappingOptions...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't ever return blank options\n\tif opts.Options == nil {\n\t\topts.Options = new(wrapping.Options)\n\t}\n\n\t// Local options can be provided either via the WithConfigMap field\n\t// (for over the plugin barrier or embedding) or via local option functions\n\t// (for embedding). First pull from the option.\n\tif opts.WithConfigMap != nil {\n\t\tvar err error\n\t\tfor k, v := range opts.WithConfigMap {\n\t\t\tswitch k {\n\t\t\tcase \"aead_type\":\n\t\t\t\topts.WithAeadType = wrapping.AeadTypeMap(v)\n\t\t\tcase \"hash_type\":\n\t\t\t\topts.WithHashType = wrapping.HashTypeMap(v)\n\t\t\tcase \"key\":\n\t\t\t\topts.WithKey, err = base64.StdEncoding.DecodeString(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"error base64-decoding key value: %w\", err)\n\t\t\t\t}\n\t\t\tcase \"salt\":\n\t\t\t\topts.WithSalt, err = base64.StdEncoding.DecodeString(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"error base64-decoding salt value: %w\", err)\n\t\t\t\t}\n\t\t\tcase \"info\":\n\t\t\t\topts.WithInfo, err = base64.StdEncoding.DecodeString(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"error base64-decoding info value: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now run the local options functions. This may overwrite options set by\n\t// the options above.\n\tfor _, o := range localOptions {\n\t\tif o != nil {\n\t\t\tif err := o(&opts); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &opts, nil\n}", "func fromOptions(options []Option) *baseSettings {\n\t// Start from the default options:\n\topts := &baseSettings{\n\t\tconsumerOptions: []consumer.Option{consumer.WithCapabilities(consumer.Capabilities{MutatesData: true})},\n\t}\n\n\tfor _, op := range options {\n\t\top(opts)\n\t}\n\n\treturn opts\n}", "func ReqOpts(hdr http.Header) *toclient.RequestOptions {\n\topts := toclient.NewRequestOptions()\n\topts.Header = hdr\n\treturn &opts\n}", "func WithDBOpts(v struct {\n\tUseTracedDriver bool\n\tTraceOrphans bool\n\tOmitArgs bool\n\tForcedDriverName string\n}) DBOption {\n\treturn DBOptionFunc(func(o *DB) {\n\t\to.opts = v\n\t})\n}", "func (c *Client) GetCfgOpts() (api.Config, error) {\n\tcfg := api.ConfigMap{}\n\n\tcfg.Set(\"DNSList\", c.Cfg.DNSList)\n\tcfg.Set(\"S3Protocol\", c.Cfg.S3Protocol)\n\tcfg.Set(\"AutoHostNetworkInterfaces\", c.Cfg.AutoHostNetworkInterfaces)\n\tcfg.Set(\"UseLayer3Networking\", c.Cfg.UseLayer3Networking)\n\n\treturn cfg, nil\n}", "func GOpts() *GOptions {\n\treturn gOpts\n}", "func WithPoolSize(size int) OptsFunc {\n\treturn func(o *redis.Options) {\n\t\to.PoolSize = size\n\t}\n}", "func (v *Volume) Options() map[string]string {\n\toptions := make(map[string]string)\n\tfor key, value := range v.config.Options {\n\t\toptions[key] = value\n\t}\n\n\treturn options\n}", "func (f *HTTPFrontend) GetOpts() (opts HTTPFrontendOptions) {\n\topts.CopyFrom(&f.opts)\n\treturn\n}", "func DriverOptions() Options {\n\treturn Options{}\n}", "func SetupConnOptions(opts []nats.Option) []nats.Option {\n\ttotalWait := 10 * time.Minute\n\treconnectDelay := time.Second\n\n\topts = append(opts, nats.ReconnectWait(reconnectDelay))\n\topts = append(opts, nats.MaxReconnects(int(totalWait/reconnectDelay)))\n\topts = append(opts, nats.DisconnectHandler(func(nc *nats.Conn) {\n\t\tlogs.LogConf.Debug(\"Disconnected: will attempt reconnects for\", totalWait.Minutes())\n\t}))\n\topts = append(opts, nats.ReconnectHandler(func(nc *nats.Conn) {\n\t\tlogs.LogConf.Info(\"Reconnected [\", nc.ConnectedUrl(), \"]\")\n\t}))\n\topts = append(opts, nats.ClosedHandler(func(nc *nats.Conn) {\n\t\tlogs.LogConf.Exception(\"Exiting, no servers available\")\n\t}))\n\treturn opts\n}", "func WithDialOpts(d ...grpc.DialOption) Option {\n\treturn func(opts *backendOptions) {\n\t\topts.dialOpts = append(opts.dialOpts, d...)\n\t}\n}", "func WithPoolTimeout(timeout time.Duration) OptsFunc {\n\treturn func(o *redis.Options) {\n\t\to.PoolTimeout = timeout\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 (o Options) GetNormalConfig() *redis.Options {\n\topts := &redis.Options{\n\t\tAddr: o.Hosts[0],\n\t\tPassword: o.Password,\n\t\tDB: o.Database,\n\t\tMaxRetries: o.MaxRedirects,\n\t\tDialTimeout: o.DialTimeout,\n\t\tReadTimeout: o.ReadTimeout,\n\t\tWriteTimeout: o.WriteTimeout,\n\t\tPoolSize: o.PoolSize,\n\t\tPoolTimeout: o.PoolTimeout,\n\t\tIdleTimeout: o.IdleTimeout,\n\t\tIdleCheckFrequency: o.IdleCheckFrequency,\n\t\tTLSConfig: o.TLSConfig,\n\t}\n\treturn opts\n}", "func (o *CreateOptions) GetDriverOpts() map[string]string {\n\tif o.DriverOpts == nil {\n\t\tvar z map[string]string\n\t\treturn z\n\t}\n\treturn o.DriverOpts\n}", "func (spec Spec) Options() ([]grpc.DialOption, error) {\n\tvar opts []grpc.DialOption\n\n\tif spec.Token == \"\" {\n\t\topts = append(opts, grpc.WithInsecure())\n\t} else {\n\t\ttc, err := transportCredentials()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Annotate(err, \"cannot create transport credentials\")\n\t\t}\n\t\topts = append(opts, grpc.WithTransportCredentials(tc))\n\n\t\trc := rpcCredentials{spec.Token}\n\t\topts = append(opts, grpc.WithPerRPCCredentials(rc))\n\t}\n\n\tif spec.Huge {\n\t\tconst HugeMessageSize = 1 << 32\n\t\topts = append(opts, grpc.WithDefaultCallOptions(\n\t\t\tgrpc.MaxCallRecvMsgSize(HugeMessageSize),\n\t\t\tgrpc.MaxCallSendMsgSize(HugeMessageSize),\n\t\t))\n\t}\n\n\treturn opts, nil\n}", "func (oc *OpusDecoder) Options() Options {\n\treturn oc.options\n}", "func (c *FakeClient) Option(opts ...Option) Interface {\n\tfor _, opt := range opts {\n\t\topt(&c.Opts)\n\t}\n\treturn c\n}", "func RealConnectOptions(connectOpts string) (string, error) {\n\t// list of lowercased versions of all go-sql-driver/mysql special params\n\tignored := map[string]bool{\n\t\t\"allowallfiles\": true, // banned in Dir.InstanceDefaultParams, listed here for sake of completeness\n\t\t\"allowcleartextpasswords\": true,\n\t\t\"allownativepasswords\": true,\n\t\t\"allowoldpasswords\": true,\n\t\t\"charset\": true,\n\t\t\"checkconnliveness\": true, // banned in Dir.InstanceDefaultParams, listed here for sake of completeness\n\t\t\"clientfoundrows\": true, // banned in Dir.InstanceDefaultParams, listed here for sake of completeness\n\t\t\"collation\": true,\n\t\t\"columnswithalias\": true, // banned in Dir.InstanceDefaultParams, listed here for sake of completeness\n\t\t\"interpolateparams\": true, // banned in Dir.InstanceDefaultParams, listed here for sake of completeness\n\t\t\"loc\": true, // banned in Dir.InstanceDefaultParams, listed here for sake of completeness\n\t\t\"maxallowedpacket\": true,\n\t\t\"multistatements\": true, // banned in Dir.InstanceDefaultParams, listed here for sake of completeness\n\t\t\"parsetime\": true, // banned in Dir.InstanceDefaultParams, listed here for sake of completeness\n\t\t\"readtimeout\": true,\n\t\t\"rejectreadonly\": true,\n\t\t\"serverpubkey\": true, // banned in Dir.InstanceDefaultParams, listed here for sake of completeness\n\t\t\"timeout\": true,\n\t\t\"tls\": true,\n\t\t\"writetimeout\": true,\n\t}\n\n\toptions, err := SplitConnectOptions(connectOpts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Iterate through the returned map, and remove any driver-specific options.\n\t// This is done via regular expressions substitution in order to keep the\n\t// string in its original order.\n\tfor name, value := range options {\n\t\tif ignored[strings.ToLower(name)] {\n\t\t\tre, err := regexp.Compile(fmt.Sprintf(`%s=%s(,|$)`, regexp.QuoteMeta(name), regexp.QuoteMeta(value)))\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tconnectOpts = re.ReplaceAllString(connectOpts, \"\")\n\t\t}\n\t}\n\tif len(connectOpts) > 0 && connectOpts[len(connectOpts)-1] == ',' {\n\t\tconnectOpts = connectOpts[0 : len(connectOpts)-1]\n\t}\n\treturn connectOpts, nil\n}", "func (sb ServiceBase) Options() Options {\n\treturn sb.options\n}", "func (o TransitGatewayConnectOutput) Options() TransitGatewayConnectOptionsOutput {\n\treturn o.ApplyT(func(v *TransitGatewayConnect) TransitGatewayConnectOptionsOutput { return v.Options }).(TransitGatewayConnectOptionsOutput)\n}", "func (n *noop) Options() Options {\n\treturn n.opts\n}", "func (c Config) GetGoRedisOptions() *redis.Options {\n\treturn &redis.Options{\n\t\tNetwork: c.Network,\n\t\tAddr: c.Addr,\n\t\tPassword: c.Password,\n\t\tDB: c.DB,\n\t\tMaxRetries: c.MaxRetries,\n\t\tMinRetryBackoff: c.MinRetryBackoff,\n\t\tMaxRetryBackoff: c.MaxRetryBackoff,\n\t\tDialTimeout: c.DialTimeout,\n\t\tReadTimeout: c.ReadTimeout,\n\t\tWriteTimeout: c.WriteTimeout,\n\t\tPoolSize: c.PoolSize,\n\t\tMinIdleConns: c.MinIdleConns,\n\t\tMaxConnAge: c.MaxConnAge,\n\t\tPoolTimeout: c.PoolTimeout,\n\t\tIdleTimeout: c.IdleTimeout,\n\t\tIdleCheckFrequency: c.IdleCheckFrequency,\n\t}\n}", "func WithReadTimeout(timeout time.Duration) OptsFunc {\n\treturn func(o *redis.Options) {\n\t\to.ReadTimeout = timeout\n\t}\n}", "func (cc *Cerberus) Opts() *bridges.Opts {\n\treturn &bridges.Opts{\n\t\tName: \"Cerberus\",\n\t\tLambda: true,\n\t}\n}", "func WithTLS(config *tls.Config) Option {\n\treturn func(r *Redis) {\n\t\tr.server.tlsCfg = config\n\t}\n}", "func (mgr *Manager) Options() map[string]string {\n\treturn mgr.GetOptions()\n}", "func NewOpts(exhaustCount int64) *opts {\n\treturn &opts{exhaustionCount: exhaustCount}\n}", "func newOptions() *Options {\n\topts := &Options{}\n\n\toptions := []Option{\n\t\tWithConcurrency(defaultConcurrency),\n\t\tWithMaxRetries(defaultMaxRetries),\n\t\tWithTTL(defaultTTL),\n\t\tWithTimeout(defaultTimeout),\n\t\tWithRetryIntervals(defaultRetryIntervals),\n\t\tWithInitialize(true),\n\t}\n\n\tfor i := range options {\n\t\toptions[i](opts)\n\t}\n\n\treturn opts\n}", "func Options(url string, opts ...RequestOption) (*Response, error) {\n\treturn DefaultSession.Options(url, opts...)\n}", "func (b *base) Options() []func(Call) error {\n\treturn b.options\n}", "func InitWithOptions(conf interface{}, opts Options) error {\n\tcinfo, err := ParseWithOptions(conf, opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn cinfo.Read()\n}", "func toOptions(in *structs.ActiveData) *Options {\n\tif in == nil {\n\t\treturn nil\n\t}\n\n\topts := &Options{}\n\tfor _, m := range in.Moves {\n\t\tmov := toMove(m)\n\t\tif mov != nil {\n\t\t\topts.Moves = append(opts.Moves, mov)\n\t\t}\n\t}\n\topts.CanMegaEvolve = in.CanMegaEvolve\n\n\tfor _, m := range in.ZMoves {\n\t\tif m == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tmov := toMove(m)\n\t\tif mov != nil {\n\t\t\topts.ZMoves = append(opts.ZMoves, mov)\n\t\t}\n\t}\n\topts.CanZMove = len(opts.ZMoves) > 0\n\n\tfor _, m := range in.Dynamax.Moves {\n\t\tmov := toMove(m)\n\t\tif mov != nil {\n\t\t\topts.DMoves = append(opts.DMoves, mov)\n\t\t}\n\t}\n\topts.CanDynamax = in.CanDynamax\n\n\treturn opts\n}", "func (adpt *DockerRunAdapter) Option() *docker.RunOption {\n\tspec := (*yaml.Option)(adpt)\n\n\topt := docker.RunOption{}\n\topt.AddHost = ExpandColonDelimitedStringListWithEnv(spec.AddHost)\n\topt.Attach = spec.Attach\n\topt.BlkioWeight = spec.BlkioWeight\n\topt.BlkioWeightDevice = ExpandColonDelimitedStringListWithEnv(spec.BlkioWeightDevice)\n\topt.CIDFile = spec.CIDFile\n\topt.CPUPeriod = spec.CPUPeriod\n\topt.CPUQuota = spec.CPUQuota\n\topt.CPURtPeriod = spec.CPURtPeriod\n\topt.CPURtRuntime = spec.CPURtRuntime\n\topt.CPUShares = spec.CPUShares\n\topt.CPUs = spec.CPUs\n\topt.CPUsetCPUs = spec.CPUsetCPUs\n\topt.CPUsetMems = spec.CPUsetMems\n\topt.CapAdd = spec.CapAdd\n\topt.CapDrop = spec.CapDrop\n\topt.CgroupParent = spec.CgroupParent\n\topt.DNS = spec.DNS\n\topt.DNSOption = spec.DNSOption\n\topt.DNSSearch = spec.DNSSearch\n\topt.Detach = spec.Detach\n\topt.DetachKeys = spec.DetachKeys\n\topt.Device = ExpandColonDelimitedStringListWithEnv(spec.Device)\n\topt.DeviceCgroupRule = spec.DeviceCgroupRule\n\topt.DeviceReadBPS = ExpandColonDelimitedStringListWithEnv(spec.DeviceReadBPS)\n\topt.DeviceReadIOPS = ExpandColonDelimitedStringListWithEnv(spec.DeviceReadIOPS)\n\topt.DeviceWriteBPS = ExpandColonDelimitedStringListWithEnv(spec.DeviceWriteBPS)\n\topt.DeviceWriteIOPS = ExpandColonDelimitedStringListWithEnv(spec.DeviceWriteIOPS)\n\topt.DisableContentTrust = spec.DisableContentTrust\n\topt.Domainname = spec.Domainname\n\tif spec.Command != nil {\n\t\topt.Entrypoint = spec.Command\n\t} else {\n\t\topt.Entrypoint = spec.Entrypoint\n\t}\n\topt.Env = ExpandStringKeyMapWithEnv(spec.Env)\n\topt.EnvFile = spec.EnvFile\n\topt.Expose = spec.Expose\n\topt.GroupAdd = spec.GroupAdd\n\topt.HealthCmd = spec.HealthCmd\n\topt.HealthInterval = spec.HealthInterval\n\topt.HealthRetries = spec.HealthRetries\n\topt.HealthStartPeriod = spec.HealthStartPeriod\n\topt.HealthTimeout = spec.HealthTimeout\n\topt.Hostname = spec.Hostname\n\topt.IP = spec.IP\n\topt.IP6 = spec.IP6\n\topt.IPC = spec.IPC\n\topt.Init = spec.Init\n\topt.Interactive = spec.Interactive\n\topt.Isolation = spec.Isolation\n\topt.KernelMemory = spec.KernelMemory\n\topt.Label = ExpandStringKeyMapWithEnv(spec.Label)\n\topt.LabelFile = spec.LabelFile\n\topt.Link = ExpandColonDelimitedStringListWithEnv(spec.Link)\n\topt.LinkLocalIP = spec.LinkLocalIP\n\topt.LogDriver = spec.LogDriver\n\topt.LogOpt = ExpandStringKeyMapWithEnv(spec.LogOpt)\n\topt.MacAddress = spec.MacAddress\n\topt.Memory = spec.Memory\n\topt.MemoryReservation = spec.MemoryReservation\n\topt.MemorySwap = spec.MemorySwap\n\topt.MemorySwappiness = spec.MemorySwappiness\n\topt.Mount = ExpandStringKeyMapWithEnv(spec.Mount)\n\topt.Name = spec.Name\n\topt.Network = spec.Network\n\topt.NetworkAlias = spec.NetworkAlias\n\topt.NoHealthcheck = spec.NoHealthcheck\n\topt.OOMKillDisable = spec.OOMKillDisable\n\topt.OOMScoreAdj = spec.OOMScoreAdj\n\topt.PID = spec.PID\n\topt.PidsLimit = spec.PidsLimit\n\topt.Platform = spec.Platform\n\topt.Privileged = spec.Privileged\n\topt.Publish = spec.Publish\n\topt.PublishAll = spec.PublishAll\n\topt.ReadOnly = spec.ReadOnly\n\topt.Restart = spec.Restart\n\topt.Rm = spec.Rm\n\topt.Runtime = spec.Runtime\n\topt.SecurityOpt = ExpandStringKeyMapWithEnv(spec.SecurityOpt)\n\topt.ShmSize = spec.ShmSize\n\topt.SigProxy = spec.SigProxy\n\topt.StopSignal = spec.StopSignal\n\topt.StopTimeout = spec.StopTimeout\n\topt.StorageOpt = ExpandStringKeyMapWithEnv(spec.StorageOpt)\n\topt.Sysctl = ExpandStringKeyMapWithEnv(spec.Sysctl)\n\topt.TTY = spec.TTY\n\topt.Tmpfs = spec.Tmpfs\n\topt.UTS = spec.UTS\n\topt.Ulimit = ExpandStringKeyMapWithEnv(spec.Ulimit)\n\tif spec.User != nil {\n\t\tuser := ExpandColonDelimitedStringWithEnv(*spec.User)\n\t\topt.User = &user\n\t}\n\topt.Userns = spec.Userns\n\topt.Volume = ExpandColonDelimitedStringListWithEnv(spec.Volume)\n\topt.VolumeDriver = spec.VolumeDriver\n\topt.VolumesFrom = spec.VolumesFrom\n\topt.Workdir = spec.Workdir\n\n\treturn &opt\n}", "func (q *query) Options() QueryOptions {\n\treturn q.opts\n}", "func (req *SelectRequest) Opts(opts SelectOpts) *SelectRequest {\n\treq.opts = opts\n\treturn req\n}", "func (factory DriverFactory) GetOptions() interface{} {\n\treturn factory.Ops\n}", "func (s *svc) Options() router.Options {\n\ts.Lock()\n\topts := s.opts\n\ts.Unlock()\n\n\treturn opts\n}", "func (client *Client) Option(opts ...Option) *Client {\n\tfor _, opt := range opts {\n\t\topt(&client.opts)\n\t}\n\treturn client\n}", "func (a *Autocompleter) SuggestOpts(prefix string, opts SuggestOptions) (ret []Suggestion, err error) {\n\tconn := a.pool.Get()\n\tdefer conn.Close()\n\n\targs, inc := a.Serialize(prefix, opts)\n\tvals, err := redis.Strings(conn.Do(\"FT.SUGGET\", args...))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tret = ProcessSugGetVals(vals, inc, opts.WithScores, opts.WithPayloads)\n\n\treturn\n}", "func (h handlerResult) asMetricOpts(repository string) *metricsOpts {\n\treturn &metricsOpts{\n\t\tstatus: h.asStatusOpts(),\n\t\ttimeToDeploy: h.timeToDeploy,\n\t\trepository: repository,\n\t}\n}", "func flagOptions() *options {\n\to := &options{}\n\tflag.IntVar(&o.port, \"port\", 8888, \"Port to listen on.\")\n\tflag.StringVar(&o.gitBinary, \"git-binary\", \"/usr/bin/git\", \"Path to the `git` binary.\")\n\tflag.StringVar(&o.gitReposParentDir, \"git-repos-parent-dir\", \"/git-repo\", \"Path to the parent folder containing all Git repos to serve over HTTP.\")\n\treturn o\n}", "func Options(section string) []string {\n\treturn cfg.Options(section)\n}", "func New(rs *RuleSet) *Opts {\n\topts := Opts{\n\t\trs: rs,\n\t\toptions: make(map[string]bool),\n\t}\n\topts.updateOptions()\n\treturn &opts\n}", "func (j *JSON) Options(o map[string]string) Codec {\n\tjc := j\n\tjc.options = o\n\treturn jc\n}", "func Options(opts ...Option) Option {\n\treturn func(s *Settings) error {\n\t\tfor _, opt := range opts {\n\t\t\tif err := opt(s); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func Options() *DBOptions {\n\treturn &DBOptions{}\n}", "func (c *Client) GetAuthOpts() (authOpts dockerclient.AuthConfigurations) {\n\tauthOpt := dockerclient.AuthConfiguration{\n\t\tUsername: c.AuthConfig.Username,\n\t\tPassword: c.AuthConfig.Password,\n\t}\n\n\tauthOpts = dockerclient.AuthConfigurations{\n\t\tConfigs: make(map[string]dockerclient.AuthConfiguration),\n\t}\n\tauthOpts.Configs[c.Registry] = authOpt\n\n\treturn authOpts\n}", "func (opts DeleteOptions) toConfig() deleteConfig {\n\tcfg := deleteConfig{}\n\n\tfor _, v := range opts {\n\t\tv(&cfg)\n\t}\n\n\treturn cfg\n}", "func (t *Task) Options() task.Options {\n\treturn *t.opts\n}", "func WithConnOptions(opts ...nats.Option) Option {\n\treturn func(t *Transport) error {\n\t\tfor _, o := range opts {\n\t\t\tt.ConnOptions = append(t.ConnOptions, o)\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func DialOptions(v []grpc.DialOption) Configer {\n\treturn func(c *clientv3.Config) {\n\t\tc.DialOptions = v\n\t}\n}", "func New(opts ...ClientOpt) (*client, error) {\n\t// create new Redis client\n\tc := new(client)\n\n\t// create new fields\n\tc.config = new(config)\n\tc.Redis = new(redis.Client)\n\tc.Options = new(redis.Options)\n\n\t// create new logger for the client\n\t//\n\t// https://pkg.go.dev/github.com/sirupsen/logrus?tab=doc#StandardLogger\n\tlogger := logrus.StandardLogger()\n\n\t// create new logger for the client\n\t//\n\t// https://pkg.go.dev/github.com/sirupsen/logrus?tab=doc#NewEntry\n\tc.Logger = logrus.NewEntry(logger).WithField(\"queue\", c.Driver())\n\n\t// apply all provided configuration options\n\tfor _, opt := range opts {\n\t\terr := opt(c)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// parse the url provided\n\toptions, err := redis.ParseURL(c.config.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create the Redis options from the parsed url\n\tc.Options = options\n\n\t// check if clustering mode is enabled\n\tif c.config.Cluster {\n\t\t// create the Redis cluster client from the options\n\t\tc.Redis = redis.NewFailoverClient(failoverFromOptions(c.Options))\n\t} else {\n\t\t// create the Redis client from the parsed url\n\t\tc.Redis = redis.NewClient(c.Options)\n\t}\n\n\t// ping the queue\n\terr = pingQueue(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func toPgOptions(config DbConfig) *pg.Options {\r\n\treturn &pg.Options{\r\n\t\tAddr: fmt.Sprintf(\"%s:%s\", config.Host, config.Port),\r\n\t\tUser: config.UserName,\r\n\t\tPassword: config.UserPassword,\r\n\t\tDatabase: config.DbName,\r\n\t\tApplicationName: AppName,\r\n\t\tReadTimeout: ReadTimeout,\r\n\t\tWriteTimeout: WriteTimeout,\r\n\t\tPoolSize: PoolSize,\r\n\t\tMinIdleConns: MinIdleConns,\r\n\t}\r\n}", "func (m *MonitorSubscriber) Options() *access.NotificationSubscriptionOptions {\n\treturn m.subscriberOptions\n}", "func (c *Context) Options(key string) map[string]interface{} {\n\ti := c.Config.get(name(c.T), key)\n\to, _ := i.(map[string]interface{})\n\treturn o\n}", "func (o ClusterOpts) ApplyOpts(opts *rediscluster.Opts) {\n\tif o.Name != \"\" {\n\t\topts.Name = o.Name\n\t}\n}", "func (o CrostiniOptions) ChromeOpts() []chrome.Option {\n\treturn []chrome.Option{chrome.ExtraArgs(\"--vmodule=crostini*=1\")}\n}", "func DiscoveryOptions(opt map[string]string) DiscoverOption {\n\treturn func(o *dOpts) {\n\t\to.do = opt\n\t}\n}", "func WithClusterOptions(clusterOptions *ClusterOpts) func(*redisDAL) {\n\treturn func(r *redisDAL) {\n\t\tr.clusterOpts = clusterOptions\n\t}\n}", "func (c *Client) getChunkerOptions(ctx context.Context) (*fastcdc.Options, error) {\n\tparams, err := c.iclient.GetChunkerParams(ctx, &pb.Empty{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &fastcdc.Options{\n\t\tMinSize: int(params.MinChunkSize),\n\t\tAverageSize: int(params.AvgChunkSize),\n\t\tMaxSize: int(params.MaxChunkSize),\n\t\tNormalization: int(params.Normalization),\n\t}, nil\n}", "func NewOptions(opts ...Option) Options {\n\toptions := Options{\n\t\tContext: context.Background(),\n\t\tContentType: DefaultContentType,\n\t\tCodecs: make(map[string]codec.Codec),\n\t\tCallOptions: CallOptions{\n\t\t\tContext: context.Background(),\n\t\t\tBackoff: DefaultBackoff,\n\t\t\tRetry: DefaultRetry,\n\t\t\tRetries: DefaultRetries,\n\t\t\tRequestTimeout: DefaultRequestTimeout,\n\t\t\tDialTimeout: transport.DefaultDialTimeout,\n\t\t},\n\t\tLookup: LookupRoute,\n\t\tPoolSize: DefaultPoolSize,\n\t\tPoolTTL: DefaultPoolTTL,\n\t\tSelector: random.NewSelector(),\n\t\tLogger: logger.DefaultLogger,\n\t\tBroker: broker.DefaultBroker,\n\t\tMeter: meter.DefaultMeter,\n\t\tTracer: tracer.DefaultTracer,\n\t}\n\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\n\treturn options\n}", "func WithPassword(password string) RedisClientOption {\n\treturn func(rs *RedisStorage) {\n\t\trs.password = password\n\t}\n}", "func NewOptions(iOpts instrument.Options) Options {\n\treturn &options{\n\t\tiOpts: iOpts,\n\t\trwOpts: xio.NewOptions(),\n\t}\n}", "func NewClientWithOpts(ops ...Opt) (*Client, error) {\n\tc := &Client{\n\t\thost: DefaultAgentHost,\n\t\tversion: api.DefaultVersion,\n\t\thttpClient: defaultHTTPClient(),\n\t\tproto: \"tcp\",\n\t\tscheme: \"http\",\n\t}\n\tfor _, op := range ops {\n\t\tif err := op(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn c, nil\n}", "func (c *ClientConn) Options(u *base.URL) (*base.Response, error) {\n\terr := c.checkState(map[clientConnState]struct{}{\n\t\tclientConnStateInitial: {},\n\t\tclientConnStatePrePlay: {},\n\t\tclientConnStatePreRecord: {},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := c.Do(&base.Request{\n\t\tMethod: base.Options,\n\t\tURL: u,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode != base.StatusOK {\n\t\t// since this method is not implemented by every RTSP server,\n\t\t// return only if status code is not 404\n\t\tif res.StatusCode == base.StatusNotFound {\n\t\t\treturn res, nil\n\t\t}\n\t\treturn res, liberrors.ErrClientWrongStatusCode{Code: res.StatusCode, Message: res.StatusMessage}\n\t}\n\n\tc.getParameterSupported = func() bool {\n\t\tpub, ok := res.Header[\"Public\"]\n\t\tif !ok || len(pub) != 1 {\n\t\t\treturn false\n\t\t}\n\n\t\tfor _, m := range strings.Split(pub[0], \",\") {\n\t\t\tif base.Method(m) == base.GetParameter {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}()\n\n\treturn res, nil\n}", "func ParseConfigWithOptions(connString string, options ParseConfigOptions) (*ConnConfig, error) {\n\tconfig, err := pgconn.ParseConfigWithOptions(connString, options.ParseConfigOptions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstatementCacheCapacity := 512\n\tif s, ok := config.RuntimeParams[\"statement_cache_capacity\"]; ok {\n\t\tdelete(config.RuntimeParams, \"statement_cache_capacity\")\n\t\tn, err := strconv.ParseInt(s, 10, 32)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot parse statement_cache_capacity: %w\", err)\n\t\t}\n\t\tstatementCacheCapacity = int(n)\n\t}\n\n\tdescriptionCacheCapacity := 512\n\tif s, ok := config.RuntimeParams[\"description_cache_capacity\"]; ok {\n\t\tdelete(config.RuntimeParams, \"description_cache_capacity\")\n\t\tn, err := strconv.ParseInt(s, 10, 32)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot parse description_cache_capacity: %w\", err)\n\t\t}\n\t\tdescriptionCacheCapacity = int(n)\n\t}\n\n\tdefaultQueryExecMode := QueryExecModeCacheStatement\n\tif s, ok := config.RuntimeParams[\"default_query_exec_mode\"]; ok {\n\t\tdelete(config.RuntimeParams, \"default_query_exec_mode\")\n\t\tswitch s {\n\t\tcase \"cache_statement\":\n\t\t\tdefaultQueryExecMode = QueryExecModeCacheStatement\n\t\tcase \"cache_describe\":\n\t\t\tdefaultQueryExecMode = QueryExecModeCacheDescribe\n\t\tcase \"describe_exec\":\n\t\t\tdefaultQueryExecMode = QueryExecModeDescribeExec\n\t\tcase \"exec\":\n\t\t\tdefaultQueryExecMode = QueryExecModeExec\n\t\tcase \"simple_protocol\":\n\t\t\tdefaultQueryExecMode = QueryExecModeSimpleProtocol\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"invalid default_query_exec_mode: %s\", s)\n\t\t}\n\t}\n\n\tconnConfig := &ConnConfig{\n\t\tConfig: *config,\n\t\tcreatedByParseConfig: true,\n\t\tStatementCacheCapacity: statementCacheCapacity,\n\t\tDescriptionCacheCapacity: descriptionCacheCapacity,\n\t\tDefaultQueryExecMode: defaultQueryExecMode,\n\t\tconnString: connString,\n\t}\n\n\treturn connConfig, nil\n}", "func WithDB(DB int) RedisClientOption {\n\treturn func(rs *RedisStorage) {\n\t\trs.db = DB\n\t}\n}", "func (b NDPRouterAdvert) Options() NDPOptions {\n\treturn NDPOptions(b[ndpRAOptionsOffset:])\n}", "func (c *Command) Options() map[string]string {\n\toptions := make(map[string]string)\n\tc.Flag.VisitAll(func(f *flag.Flag) {\n\t\tdefaultVal := f.DefValue\n\t\tif len(defaultVal) > 0 {\n\t\t\toptions[f.Name+\"=\"+defaultVal] = f.Usage\n\t\t} else {\n\t\t\toptions[f.Name] = f.Usage\n\t\t}\n\t})\n\treturn options\n}", "func newOptions() *options {\n\treturn &options{\n\t\tlogger: log.NewNopLogger(),\n\t\tclock: clock.New(),\n\t\tcertificateCacheDuration: time.Hour * 24,\n\t}\n}", "func (f destroyFlags) toOptions() *DestroyOptions {\n\treturn &DestroyOptions{\n\t\tName: f.name,\n\t\tNamespace: f.namespace,\n\t\tWait: f.wait,\n\t\tTimeout: f.timeout,\n\t\tDestroyVolumes: f.destroyVolumes,\n\t}\n}" ]
[ "0.69560456", "0.65203357", "0.6464695", "0.60208565", "0.6006148", "0.5755672", "0.5684365", "0.56654674", "0.5618213", "0.55474895", "0.54999447", "0.5461396", "0.5443127", "0.54348564", "0.5417129", "0.5403839", "0.5378627", "0.5340202", "0.53303003", "0.53119975", "0.52790064", "0.526166", "0.5252834", "0.5199802", "0.5180668", "0.5158324", "0.5148363", "0.509073", "0.50532526", "0.5045075", "0.5032252", "0.50231385", "0.50183576", "0.50156385", "0.50026715", "0.49972972", "0.4994592", "0.49903774", "0.49803856", "0.4980093", "0.4970088", "0.4957994", "0.49527076", "0.49504077", "0.49154413", "0.49094644", "0.49004126", "0.48880467", "0.4880945", "0.48726034", "0.48701638", "0.48656613", "0.4860269", "0.48426592", "0.48260927", "0.48253018", "0.482451", "0.4823687", "0.48213887", "0.48065934", "0.4800286", "0.48000553", "0.47915795", "0.4782501", "0.47783083", "0.47670895", "0.476502", "0.47522587", "0.4749502", "0.4748212", "0.47478557", "0.4734543", "0.47322667", "0.4731789", "0.4730132", "0.47177717", "0.47082287", "0.47082043", "0.47055203", "0.47019443", "0.4690764", "0.46720687", "0.46717855", "0.46696323", "0.4669074", "0.4659689", "0.46530065", "0.4629905", "0.46296042", "0.4625627", "0.46206802", "0.46176848", "0.46160537", "0.46127662", "0.46105185", "0.46076348", "0.46022826", "0.45994946", "0.45954064", "0.45876807" ]
0.7253291
0
Opts returns a rediscluster.Opts object with the configured options applied.
Opts возвращает объект rediscluster.Opts с примененными настроенными параметрами.
func (cfg ClusterConfig) Opts() rediscluster.Opts { opts := rediscluster.Opts{} cfg.Options.ApplyOpts(&opts.HostOpts) cfg.Cluster.ApplyOpts(&opts) return opts }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cfg ClientConfig) Opts() redisconn.Opts {\n\topts := redisconn.Opts{}\n\tcfg.Options.ApplyOpts(&opts)\n\treturn opts\n}", "func GetRedisOpts(driver *dipper.Driver) *Options {\n\tif conn, ok := dipper.GetMapData(driver.Options, \"data.connection\"); ok {\n\t\tdefer delete(conn.(map[string]interface{}), \"Password\")\n\t}\n\tif tls, ok := dipper.GetMapData(driver.Options, \"data.connection.TLS\"); ok {\n\t\tdefer delete(tls.(map[string]interface{}), \"CACerts\")\n\t}\n\n\tif localRedis, ok := os.LookupEnv(\"LOCALREDIS\"); ok && localRedis != \"\" {\n\t\tif opts, e := redis.ParseURL(localRedis); e == nil {\n\t\t\treturn &Options{\n\t\t\t\tOptions: opts,\n\t\t\t}\n\t\t}\n\n\t\treturn &Options{\n\t\t\tOptions: &redis.Options{\n\t\t\t\tAddr: \"127.0.0.1:6379\",\n\t\t\t\tDB: 0,\n\t\t\t},\n\t\t}\n\t}\n\n\topts := &redis.Options{}\n\tif value, ok := driver.GetOptionStr(\"data.connection.Addr\"); ok {\n\t\topts.Addr = value\n\t}\n\tif value, ok := driver.GetOptionStr(\"data.connection.Username\"); ok {\n\t\topts.Username = value\n\t}\n\tif value, ok := driver.GetOptionStr(\"data.connection.Password\"); ok {\n\t\topts.Password = value\n\t}\n\tif DB, ok := driver.GetOptionStr(\"data.connection.DB\"); ok {\n\t\topts.DB = dipper.Must(strconv.Atoi(DB)).(int)\n\t}\n\tif driver.CheckOption(\"data.connection.TLS.Enabled\") {\n\t\topts.TLSConfig = setupTLSConfig(driver)\n\t}\n\n\treturn &Options{\n\t\tOptions: opts,\n\t}\n}", "func NewOpts() Opts {\n\treturn Opts{\n\t\tBroker: getenv(\"MQTT_TEST_CLIENT_HOST\", \"ssl://mqtt:8883\"),\n\t\tID: getenv(\"MQTT_TEST_CLIENT_ID\", \"test-client\"),\n\t\tSerial: \"1001\",\n\t\tMode: ModeAuto,\n\t\tQoS: 2,\n\t\tRetained: true,\n\t\tSetWill: false,\n\t\tTLS: false,\n\t}\n}", "func (d *portworx) GetClusterOpts(n node.Node, options []string) (map[string]string, error) {\n\topts := node.ConnectionOpts{\n\t\tIgnoreError: false,\n\t\tTimeBeforeRetry: defaultRetryInterval,\n\t\tTimeout: defaultTimeout,\n\t}\n\tcmd := fmt.Sprintf(\"%s cluster options list -j json\", d.getPxctlPath(n))\n\tout, err := d.nodeDriver.RunCommand(n, cmd, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get pxctl cluster options on node [%s], Err: %v\", n.Name, err)\n\t}\n\tvar data = map[string]interface{}{}\n\terr = json.Unmarshal([]byte(out), &data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal pxctl cluster option on node [%s], Err: %v\", n.Name, err)\n\t}\n\tsort.Strings(options)\n\tvar options_map = make(map[string]string)\n\t//Values can be string, array or map\n\tfor key, val := range data {\n\t\tindex := sort.SearchStrings(options, key)\n\t\tif index < len(options) && options[index] == key {\n\t\t\toptions_map[key] = fmt.Sprint(val)\n\t\t}\n\t}\n\t//Make sure required options are available\n\tfor _, option := range options {\n\t\tif _, ok := options_map[option]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"Failed to find option: %v\", option)\n\t\t}\n\t}\n\treturn options_map, nil\n}", "func (r *root) opts() kivik.Options {\n\treturn r.options\n}", "func (o Opts) ApplyOpts(opts *redisconn.Opts) {\n\n\tif o.DB != nil {\n\t\topts.DB = *o.DB\n\t}\n\tif o.WritePause > 0 {\n\t\topts.WritePause = o.WritePause\n\t}\n\tif o.ReconnectPause > 0 {\n\t\topts.ReconnectPause = o.ReconnectPause\n\t}\n\tif o.TCPKeepAlive > 0 {\n\t\topts.TCPKeepAlive = o.TCPKeepAlive\n\t}\n\to.Timeouts.ApplyOpts(opts)\n}", "func (p *P) Options() []gnomock.Option {\n\tp.setDefaults()\n\n\topts := []gnomock.Option{\n\t\tgnomock.WithHealthCheck(p.healthcheck),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_MODE=setup\"),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_USERNAME=\" + p.Username),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_PASSWORD=\" + p.Password),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_ORG=\" + p.Org),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_BUCKET=\" + p.Bucket),\n\t\tgnomock.WithEnv(\"DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=\" + p.AuthToken),\n\t}\n\n\treturn opts\n}", "func (o ClusterOpts) ApplyOpts(opts *rediscluster.Opts) {\n\tif o.Name != \"\" {\n\t\topts.Name = o.Name\n\t}\n}", "func (c *Caches) Option() Options {\n\treturn c.options\n}", "func customizedOption(viper *viper.Viper, rwType RWType) *Options {\n\n\tvar opt = Options{}\n\tletOldEnvSupportViper(viper, rwType)\n\thosts := addrStructure(viper.GetStringSlice(rwType.FmtSuffix(\"REDIS_PORT\")),\n\t\tviper.GetStringSlice(rwType.FmtSuffix(\"REDIS_HOST\")))\n\topt.Type = ClientType(viper.GetString(rwType.FmtSuffix(\"REDIS_TYPE\")))\n\topt.Hosts = hosts\n\topt.ReadOnly = rwType.IsReadOnly()\n\topt.Database = viper.GetInt(rwType.FmtSuffix(\"REDIS_DB_NAME\"))\n\topt.Password = viper.GetString(rwType.FmtSuffix(\"REDIS_DB_PASSWORD\"))\n\topt.KeyPrefix = viper.GetString(rwType.FmtSuffix(\"REDIS_KEY_PREFIX\"))\n\t// various timeout setting\n\topt.DialTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.ReadTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.WriteTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\t// REDIS_MAX_CONNECTIONS\n\topt.PoolSize = viper.GetInt(rwType.FmtSuffix(\"REDIS_MAX_CONNECTIONS\"))\n\topt.PoolTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.IdleTimeout = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.IdleCheckFrequency = viper.GetDuration(rwType.FmtSuffix(\"REDIS_TIMEOUT\")) * time.Second\n\topt.TLSConfig = nil\n\treturn &opt\n}", "func (c *Container) Options() (*dockertest.RunOptions, error) {\n\n\tstrPort := strconv.Itoa(c.getBrokerPort())\n\tpb := map[docker.Port][]docker.PortBinding{}\n\tpb[docker.Port(fmt.Sprintf(\"%d/tcp\", brokerPort))] = []docker.PortBinding{{\n\t\tHostIP: \"0.0.0.0\",\n\t\tHostPort: strPort,\n\t}}\n\n\tstrPort = strconv.Itoa(c.getClientPort())\n\tpb[docker.Port(fmt.Sprintf(\"%d/tcp\", clientPort))] = []docker.PortBinding{{\n\t\tHostIP: \"0.0.0.0\",\n\t\tHostPort: strPort,\n\t}}\n\n\trepo, tag := c.params.GetRepoTag(\"confluentinc/cp-kafka\", \"5.3.0\")\n\tenv := c.params.MergeEnv([]string{\n\t\t\"KAFKA_BROKER_ID=1\",\n\t\tfmt.Sprintf(\"KAFKA_LISTENERS=\\\"PLAINTEXT://0.0.0.0:%d,BROKER://0.0.0.0:%d\", c.getClientPort(), c.getBrokerPort()),\n\t\t\"KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=\\\"BROKER:PLAINTEXT,PLAINTEXT:PLAINTEXT\\\"\",\n\t\t\"KAFKA_INTER_BROKER_LISTENER_NAME=BROKER\",\n\t\t\"KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1\",\n\t})\n\n\treturn &dockertest.RunOptions{\n\t\tRepository: repo,\n\t\tTag: tag,\n\t\tEnv: env,\n\t\tPortBindings: pb,\n\t}, nil\n}", "func New(modifyOptions ModifyOptions) Options {\n\toption := Options{\n\t\tSkippedPropagatingAPIs: \"cluster.karmada.io;policy.karmada.io;work.karmada.io\",\n\t\tSecurePort: 8090,\n\t\tClusterStatusUpdateFrequency: metav1.Duration{Duration: 10 * time.Second},\n\t\tClusterLeaseDuration: metav1.Duration{Duration: 10 * time.Second},\n\t\tClusterMonitorPeriod: metav1.Duration{Duration: 10 * time.Second},\n\t\tClusterMonitorGracePeriod: metav1.Duration{Duration: 10 * time.Second},\n\t\tClusterStartupGracePeriod: metav1.Duration{Duration: 10 * time.Second},\n\t}\n\n\tif modifyOptions != nil {\n\t\tmodifyOptions(&option)\n\t}\n\treturn option\n}", "func NewWithOpts(options ...Option) *Config {\n\topts := &Options{}\n\n\tfor _, opt := range options {\n\t\topt(opts)\n\t}\n\n\tv := viper.New()\n\tv.AutomaticEnv()\n\tv.SetEnvKeyReplacer(strings.NewReplacer(\"-\", \"_\", \".\", \"_\"))\n\n\tflagSet := new(pflag.FlagSet)\n\n\tc := &Config{\n\t\tKstream: KstreamConfig{},\n\t\tFilament: FilamentConfig{},\n\t\tAPI: APIConfig{},\n\t\tPE: pe.Config{},\n\t\tLog: log.Config{},\n\t\tAggregator: aggregator.Config{},\n\t\tFilters: &Filters{},\n\t\tviper: v,\n\t\tflags: flagSet,\n\t\topts: opts,\n\t}\n\n\tif opts.run || opts.replay {\n\t\taggregator.AddFlags(flagSet)\n\t\tconsole.AddFlags(flagSet)\n\t\tamqp.AddFlags(flagSet)\n\t\telasticsearch.AddFlags(flagSet)\n\t\thttp.AddFlags(flagSet)\n\t\teventlog.AddFlags(flagSet)\n\t\tremovet.AddFlags(flagSet)\n\t\treplacet.AddFlags(flagSet)\n\t\trenamet.AddFlags(flagSet)\n\t\ttrimt.AddFlags(flagSet)\n\t\ttagst.AddFlags(flagSet)\n\t\tmailsender.AddFlags(flagSet)\n\t\tslacksender.AddFlags(flagSet)\n\t\tyara.AddFlags(flagSet)\n\t}\n\n\tif opts.run || opts.capture {\n\t\tpe.AddFlags(flagSet)\n\t}\n\n\tc.addFlags()\n\n\treturn c\n}", "func NewOpts() TransactionOptions {\n\treturn TransactionOptions{\n\t\tDescription: \"\",\n\t\tCurrency: \"EUR\",\n\t}\n}", "func (n *natsBroker) Options() broker.Options {\n\treturn n.options\n}", "func ClientOpts(clt *resty.Client) BuildOptions {\n\treturn func(client *PluginClient) {\n\t\tclient.client = clt\n\t}\n}", "func (d *DefaultDriver) SetClusterOpts(n node.Node, rtOpts map[string]string) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"SetClusterOpts()\",\n\t}\n}", "func NewOpts(exhaustCount int64) *opts {\n\treturn &opts{exhaustionCount: exhaustCount}\n}", "func (ep *Endpoint) ClientOpts() ([]client.Opt, error) {\n\tvar result []client.Opt\n\tif ep.Host != \"\" {\n\t\thelper, err := connhelper.GetConnectionHelper(ep.Host)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif helper == nil {\n\t\t\ttlsConfig, err := ep.tlsConfig()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresult = append(result,\n\t\t\t\twithHTTPClient(tlsConfig),\n\t\t\t\tclient.WithHost(ep.Host),\n\t\t\t)\n\n\t\t} else {\n\t\t\tresult = append(result,\n\t\t\t\tclient.WithHTTPClient(&http.Client{\n\t\t\t\t\t// No TLS, and no proxy.\n\t\t\t\t\tTransport: &http.Transport{\n\t\t\t\t\t\tDialContext: helper.Dialer,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\tclient.WithHost(helper.Host),\n\t\t\t\tclient.WithDialContext(helper.Dialer),\n\t\t\t)\n\t\t}\n\t}\n\n\tresult = append(result, client.WithVersionFromEnv(), client.WithAPIVersionNegotiation())\n\treturn result, nil\n}", "func (cc *Cerberus) Opts() *bridges.Opts {\n\treturn &bridges.Opts{\n\t\tName: \"Cerberus\",\n\t\tLambda: true,\n\t}\n}", "func (gs *GenServer) Options() map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"chan-size\": 100, // size of channel for regular messages\n\t}\n}", "func (r Redis) RedisOptions() *redis.Options {\n\treturn &redis.Options{\n\t\tNetwork: \"tcp\",\n\t\tAddr: r.Address,\n\t\tDB: r.DB,\n\t\tUsername: r.Username,\n\t\tPassword: r.Password,\n\t}\n}", "func TestRedisOptions() *redis.Options {\n\tmr, err := miniredis.Run()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &redis.Options{Addr: mr.Addr()}\n}", "func WithClusterOptions(clusterOptions *ClusterOpts) func(*redisDAL) {\n\treturn func(r *redisDAL) {\n\t\tr.clusterOpts = clusterOptions\n\t}\n}", "func CfgAuthOpts(cfg *viper.Viper) *shttp.AuthenticationOpts {\n\tusername := cfg.GetString(\"analyzer.auth.cluster.username\")\n\tpassword := cfg.GetString(\"analyzer.auth.cluster.password\")\n\treturn &shttp.AuthenticationOpts{\n\t\tUsername: username,\n\t\tPassword: password,\n\t}\n}", "func (c *Client) GetCfgOpts() (api.Config, error) {\n\tcfg := api.ConfigMap{}\n\n\tcfg.Set(\"DNSList\", c.Cfg.DNSList)\n\tcfg.Set(\"S3Protocol\", c.Cfg.S3Protocol)\n\tcfg.Set(\"AutoHostNetworkInterfaces\", c.Cfg.AutoHostNetworkInterfaces)\n\tcfg.Set(\"UseLayer3Networking\", c.Cfg.UseLayer3Networking)\n\n\treturn cfg, nil\n}", "func getOpts(opt ...wrapping.Option) (*options, error) {\n\t// First, separate out options into local and global\n\topts := getDefaultOptions()\n\tvar wrappingOptions []wrapping.Option\n\tvar localOptions []OptionFunc\n\tfor _, o := range opt {\n\t\tif o == nil {\n\t\t\tcontinue\n\t\t}\n\t\tiface := o()\n\t\tswitch to := iface.(type) {\n\t\tcase wrapping.OptionFunc:\n\t\t\twrappingOptions = append(wrappingOptions, o)\n\t\tcase OptionFunc:\n\t\t\tlocalOptions = append(localOptions, to)\n\t\t}\n\t}\n\n\t// Parse the global options\n\tvar err error\n\topts.Options, err = wrapping.GetOpts(wrappingOptions...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't ever return blank options\n\tif opts.Options == nil {\n\t\topts.Options = new(wrapping.Options)\n\t}\n\n\t// Local options can be provided either via the WithConfigMap field\n\t// (for over the plugin barrier or embedding) or via local option functions\n\t// (for embedding). First pull from the option.\n\tif opts.WithConfigMap != nil {\n\t\tfor k, v := range opts.WithConfigMap {\n\t\t\tswitch k {\n\t\t\tcase \"mount_path\":\n\t\t\t\topts.withMountPath = v\n\t\t\tcase \"key_name\":\n\t\t\t\topts.withKeyName = v\n\t\t\tcase \"disable_renewal\":\n\t\t\t\topts.withDisableRenewal = v\n\t\t\tcase \"namespace\":\n\t\t\t\topts.withNamespace = v\n\t\t\tcase \"address\":\n\t\t\t\topts.withAddress = v\n\t\t\tcase \"tls_ca_cert\":\n\t\t\t\topts.withTlsCaCert = v\n\t\t\tcase \"tls_ca_path\":\n\t\t\t\topts.withTlsCaPath = v\n\t\t\tcase \"tls_client_cert\":\n\t\t\t\topts.withTlsClientCert = v\n\t\t\tcase \"tls_client_key\":\n\t\t\t\topts.withTlsClientKey = v\n\t\t\tcase \"tls_server_name\":\n\t\t\t\topts.withTlsServerName = v\n\t\t\tcase \"tls_skip_verify\":\n\t\t\t\tvar err error\n\t\t\t\topts.withTlsSkipVerify, err = strconv.ParseBool(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\tcase \"token\":\n\t\t\t\topts.withToken = v\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now run the local options functions. This may overwrite options set by\n\t// the options above.\n\tfor _, o := range localOptions {\n\t\tif o != nil {\n\t\t\tif err := o(&opts); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &opts, nil\n}", "func (ctrler CtrlDefReactor) GetClusterWatchOptions() *api.ListWatchOptions {\n\tlog.Info(\"GetClusterWatchOptions is not implemented\")\n\topts := &api.ListWatchOptions{}\n\treturn opts\n}", "func getOpts(opt ...wrapping.Option) (*options, error) {\n\t// First, separate out options into local and global\n\topts := getDefaultOptions()\n\tvar wrappingOptions []wrapping.Option\n\tvar localOptions []OptionFunc\n\tfor _, o := range opt {\n\t\tif o == nil {\n\t\t\tcontinue\n\t\t}\n\t\tiface := o()\n\t\tswitch to := iface.(type) {\n\t\tcase wrapping.OptionFunc:\n\t\t\twrappingOptions = append(wrappingOptions, o)\n\t\tcase OptionFunc:\n\t\t\tlocalOptions = append(localOptions, to)\n\t\t}\n\t}\n\n\t// Parse the global options\n\tvar err error\n\topts.Options, err = wrapping.GetOpts(wrappingOptions...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't ever return blank options\n\tif opts.Options == nil {\n\t\topts.Options = new(wrapping.Options)\n\t}\n\n\t// Local options can be provided either via the WithConfigMap field\n\t// (for over the plugin barrier or embedding) or via local option functions\n\t// (for embedding). First pull from the option.\n\tif opts.WithConfigMap != nil {\n\t\tfor k, v := range opts.WithConfigMap {\n\t\t\tswitch k {\n\t\t\tcase \"key_not_required\":\n\t\t\t\tkeyNotRequired, err := strconv.ParseBool(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\topts.withKeyNotRequired = keyNotRequired\n\t\t\tcase \"user_agent\":\n\t\t\t\topts.withUserAgent = v\n\t\t\tcase \"credentials\":\n\t\t\t\topts.withCredentials = v\n\t\t\tcase \"project\":\n\t\t\t\topts.withProject = v\n\t\t\tcase \"region\":\n\t\t\t\topts.withRegion = v\n\t\t\tcase \"key_ring\":\n\t\t\t\topts.withKeyRing = v\n\t\t\tcase \"crypto_key\":\n\t\t\t\topts.withCryptoKey = v\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now run the local options functions. This may overwrite options set by\n\t// the options above.\n\tfor _, o := range localOptions {\n\t\tif o != nil {\n\t\t\tif err := o(&opts); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &opts, nil\n}", "func (v *Volume) Options() map[string]string {\n\toptions := make(map[string]string)\n\tfor key, value := range v.config.Options {\n\t\toptions[key] = value\n\t}\n\n\treturn options\n}", "func newOptions() *Options {\n\topts := &Options{}\n\n\toptions := []Option{\n\t\tWithConcurrency(defaultConcurrency),\n\t\tWithMaxRetries(defaultMaxRetries),\n\t\tWithTTL(defaultTTL),\n\t\tWithTimeout(defaultTimeout),\n\t\tWithRetryIntervals(defaultRetryIntervals),\n\t\tWithInitialize(true),\n\t}\n\n\tfor i := range options {\n\t\toptions[i](opts)\n\t}\n\n\treturn opts\n}", "func (c *Config) GenerateOpts() (*client.Opts, error) {\n\tif c.A10.Username == \"\" {\n\t\treturn nil, validFail(\"username\", c.A10.Username)\n\t}\n\tif c.A10.Password == \"\" {\n\t\treturn nil, validFail(\"password\", c.A10.Password)\n\t}\n\treturn &c.A10, nil\n}", "func Options(section string) []string {\n\treturn cfg.Options(section)\n}", "func WithRedisOptions(opts *redis.Options) ClientOption {\n\treturn func(cfg *clientConfig) {\n\t\thost, port, err := net.SplitHostPort(opts.Addr)\n\t\tif err != nil {\n\t\t\thost = defaultHost\n\t\t\tport = defaultPort\n\t\t}\n\t\tcfg.host = host\n\t\tcfg.port = port\n\t\tcfg.db = strconv.Itoa(opts.DB)\n\t}\n}", "func (c *Client) Options() ClientOptions {\n\treturn c.options\n}", "func (factory *Factory) GetClusterOptions(options ...ClusterOption) []ClusterOption {\n\toptions = append(options, WithTLSEnabled)\n\n\tif factory.options.featureOperatorUnifiedImage {\n\t\toptions = append(options, WithUnifiedImage)\n\t}\n\n\tif factory.options.featureOperatorLocalities {\n\t\toptions = append(options, WithLocalitiesForExclusion)\n\t}\n\n\tif factory.options.featureOperatorDNS {\n\t\toptions = append(options, WithDNSEnabled)\n\t}\n\n\treturn options\n}", "func (mgr *Manager) Options() map[string]string {\n\treturn mgr.GetOptions()\n}", "func fromOptions(options []Option) *baseSettings {\n\t// Start from the default options:\n\topts := &baseSettings{\n\t\tconsumerOptions: []consumer.Option{consumer.WithCapabilities(consumer.Capabilities{MutatesData: true})},\n\t}\n\n\tfor _, op := range options {\n\t\top(opts)\n\t}\n\n\treturn opts\n}", "func (n *noop) Options() Options {\n\treturn n.opts\n}", "func getOpts() []htindex.Option {\n\tvar opts []htindex.Option\n\tcfg := &config{}\n\terr := viper.Unmarshal(cfg)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif cfg.Root != \"\" {\n\t\topts = append(opts, htindex.OptRoot(cfg.Root))\n\t}\n\tif cfg.Input != \"\" {\n\t\topts = append(opts, htindex.OptInput(cfg.Input))\n\t}\n\tif cfg.Output != \"\" {\n\t\topts = append(opts, htindex.OptOutput(cfg.Output))\n\t}\n\tif cfg.Jobs > 0 {\n\t\topts = append(opts, htindex.OptJobs(cfg.Jobs))\n\t}\n\tif cfg.WordsAround > 0 {\n\t\topts = append(opts, htindex.OptWordsAround(cfg.WordsAround))\n\t}\n\tif cfg.ProgressNum > 0 {\n\t\topts = append(opts, htindex.OptProgressNum(cfg.ProgressNum))\n\t}\n\treturn opts\n}", "func DiscoveryOptions(opt map[string]string) DiscoverOption {\n\treturn func(o *dOpts) {\n\t\to.do = opt\n\t}\n}", "func getOpts(opt ...wrapping.Option) (*options, error) {\n\t// First, separate out options into local and global\n\topts := getDefaultOptions()\n\tvar wrappingOptions []wrapping.Option\n\tvar localOptions []OptionFunc\n\tfor _, o := range opt {\n\t\tif o == nil {\n\t\t\tcontinue\n\t\t}\n\t\tiface := o()\n\t\tswitch to := iface.(type) {\n\t\tcase wrapping.OptionFunc:\n\t\t\twrappingOptions = append(wrappingOptions, o)\n\t\tcase OptionFunc:\n\t\t\tlocalOptions = append(localOptions, to)\n\t\t}\n\t}\n\n\t// Parse the global options\n\tvar err error\n\topts.Options, err = wrapping.GetOpts(wrappingOptions...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't ever return blank options\n\tif opts.Options == nil {\n\t\topts.Options = new(wrapping.Options)\n\t}\n\n\t// Local options can be provided either via the WithConfigMap field\n\t// (for over the plugin barrier or embedding) or via local option functions\n\t// (for embedding). First pull from the option.\n\tif opts.WithConfigMap != nil {\n\t\tvar err error\n\t\tfor k, v := range opts.WithConfigMap {\n\t\t\tswitch k {\n\t\t\tcase \"aead_type\":\n\t\t\t\topts.WithAeadType = wrapping.AeadTypeMap(v)\n\t\t\tcase \"hash_type\":\n\t\t\t\topts.WithHashType = wrapping.HashTypeMap(v)\n\t\t\tcase \"key\":\n\t\t\t\topts.WithKey, err = base64.StdEncoding.DecodeString(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"error base64-decoding key value: %w\", err)\n\t\t\t\t}\n\t\t\tcase \"salt\":\n\t\t\t\topts.WithSalt, err = base64.StdEncoding.DecodeString(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"error base64-decoding salt value: %w\", err)\n\t\t\t\t}\n\t\t\tcase \"info\":\n\t\t\t\topts.WithInfo, err = base64.StdEncoding.DecodeString(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"error base64-decoding info value: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now run the local options functions. This may overwrite options set by\n\t// the options above.\n\tfor _, o := range localOptions {\n\t\tif o != nil {\n\t\t\tif err := o(&opts); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &opts, nil\n}", "func (f destroyFlags) toOptions() *DestroyOptions {\n\treturn &DestroyOptions{\n\t\tName: f.name,\n\t\tNamespace: f.namespace,\n\t\tWait: f.wait,\n\t\tTimeout: f.timeout,\n\t\tDestroyVolumes: f.destroyVolumes,\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 (c *conn) Options() *ConnOptions {\n\treturn c.options\n}", "func (f *HTTPFrontend) GetOpts() (opts HTTPFrontendOptions) {\n\topts.CopyFrom(&f.opts)\n\treturn\n}", "func DialOpts(dialOpts ...grpc.DialOption) ConnectOption {\n\treturn dialOptsOption(dialOpts)\n}", "func (w *Websocket) Options() *transport.Options {\n\treturn w.topts\n}", "func NewOptions(chanOpts *tchannel.ChannelOptions) Options {\n\treturn &options{\n\t\tchannelOptions: chanOpts,\n\t\ttchanChannelFn: defaultTChanChannelFn,\n\t\ttchanNodeServerFn: defaultTChanNodeServerFn,\n\t}\n}", "func GOpts() *GOptions {\n\treturn gOpts\n}", "func (s *StanServer) configureClusterOpts() error {\n\topts := s.natsOpts\n\t// If we don't have cluster defined in the configuration\n\t// file and no cluster listen string override, but we do\n\t// have a routes override, we need to report misconfiguration.\n\tif opts.Cluster.ListenStr == \"\" && opts.Cluster.Host == \"\" &&\n\t\topts.Cluster.Port == 0 {\n\t\tif opts.RoutesStr != \"\" {\n\t\t\terr := fmt.Errorf(\"solicited routes require cluster capabilities, e.g. --cluster\")\n\t\t\ts.log.Fatalf(err.Error())\n\t\t\t// Also return error in case server is started from application\n\t\t\t// and no logger has been set.\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\t// If cluster flag override, process it\n\tif opts.Cluster.ListenStr != \"\" {\n\t\tclusterURL, err := url.Parse(opts.Cluster.ListenStr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\th, p, err := net.SplitHostPort(clusterURL.Host)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\topts.Cluster.Host = h\n\t\t_, err = fmt.Sscan(p, &opts.Cluster.Port)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif clusterURL.User != nil {\n\t\t\tpass, hasPassword := clusterURL.User.Password()\n\t\t\tif !hasPassword {\n\t\t\t\treturn fmt.Errorf(\"expected cluster password to be set\")\n\t\t\t}\n\t\t\topts.Cluster.Password = pass\n\n\t\t\tuser := clusterURL.User.Username()\n\t\t\topts.Cluster.Username = user\n\t\t} else {\n\t\t\t// Since we override from flag and there is no user/pwd, make\n\t\t\t// sure we clear what we may have gotten from config file.\n\t\t\topts.Cluster.Username = \"\"\n\t\t\topts.Cluster.Password = \"\"\n\t\t}\n\t}\n\n\t// If we have routes but no config file, fill in here.\n\tif opts.RoutesStr != \"\" && opts.Routes == nil {\n\t\topts.Routes = server.RoutesFromStr(opts.RoutesStr)\n\t}\n\n\treturn nil\n}", "func InitGetOpts(cmd *cobra.Command, args []string) (opts *InitOpts, warns []string, err error) {\n\twarns = make([]string, 0)\n\n\t// Validate cluster name\n\tclusterName, err := GetOneClusterName(cmd, args, true)\n\tif err != nil {\n\t\tif clusterName == \"\" {\n\t\t\treturn nil, warns, err\n\t\t}\n\t\twarns = append(warns, fmt.Sprintf(\"%s. They were replaced and the new cluster name is: %q\", err, clusterName))\n\t}\n\n\t// The `--update` flag will be deprecated and replaced by the `update` command\n\tupdate := false\n\tupdateFlag := cmd.Flags().Lookup(\"update\")\n\tif updateFlag != nil {\n\t\tupdate = updateFlag.Value.String() == \"true\"\n\t}\n\n\t// Validate platform (required unless it's an update)\n\tplatform := cmd.Flags().Lookup(\"platform\").Value.String()\n\tif len(platform) == 0 && !update {\n\t\treturn nil, warns, UserErrorf(\"platform is required\")\n\t}\n\tplatform = strings.ToLower(platform)\n\n\t// The `--path` and `--format` flags are only part of the `kubekit` binary\n\tvar path string\n\tif pathFlag := cmd.Flags().Lookup(\"path\"); pathFlag != nil {\n\t\tpath = pathFlag.Value.String()\n\t}\n\tvar format string\n\tif formatFlag := cmd.Flags().Lookup(\"format\"); formatFlag != nil {\n\t\tformat = formatFlag.Value.String()\n\t}\n\t// TODO: templateName will be used later to create a cluster from a template\n\tvar templateName string\n\tif templateNameFlag := cmd.Flags().Lookup(\"template\"); templateNameFlag != nil {\n\t\ttemplateName = templateNameFlag.Value.String()\n\t}\n\n\t// Variables:\n\tvarsStr := cmd.Flags().Lookup(\"var\").Value.String()\n\tvariables, warnV, errV := GetVariables(varsStr)\n\tif errV != nil {\n\t\treturn nil, warns, err\n\t}\n\tif len(warnV) != 0 {\n\t\twarns = append(warns, warnV...)\n\t}\n\n\t// Credentials:\n\tcreds := GetCredentials(platform, cmd)\n\n\treturn &InitOpts{\n\t\tClusterName: clusterName,\n\t\tPlatform: platform,\n\t\tPath: path,\n\t\tFormat: format,\n\t\tVariables: variables,\n\t\tCredentials: creds,\n\t\tTemplateName: templateName,\n\t\tUpdate: update,\n\t}, warns, nil\n}", "func New(rs *RuleSet) *Opts {\n\topts := Opts{\n\t\trs: rs,\n\t\toptions: make(map[string]bool),\n\t}\n\topts.updateOptions()\n\treturn &opts\n}", "func (spec Spec) Options() ([]grpc.DialOption, error) {\n\tvar opts []grpc.DialOption\n\n\tif spec.Token == \"\" {\n\t\topts = append(opts, grpc.WithInsecure())\n\t} else {\n\t\ttc, err := transportCredentials()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Annotate(err, \"cannot create transport credentials\")\n\t\t}\n\t\topts = append(opts, grpc.WithTransportCredentials(tc))\n\n\t\trc := rpcCredentials{spec.Token}\n\t\topts = append(opts, grpc.WithPerRPCCredentials(rc))\n\t}\n\n\tif spec.Huge {\n\t\tconst HugeMessageSize = 1 << 32\n\t\topts = append(opts, grpc.WithDefaultCallOptions(\n\t\t\tgrpc.MaxCallRecvMsgSize(HugeMessageSize),\n\t\t\tgrpc.MaxCallSendMsgSize(HugeMessageSize),\n\t\t))\n\t}\n\n\treturn opts, nil\n}", "func (c *Component) getTailerOptions(args Arguments) (*kubetail.Options, error) {\n\tif reflect.DeepEqual(c.args.Client, args.Client) && c.lastOptions != nil {\n\t\treturn c.lastOptions, nil\n\t}\n\n\tcfg, err := args.Client.BuildRESTConfig(c.log)\n\tif err != nil {\n\t\treturn c.lastOptions, fmt.Errorf(\"building Kubernetes config: %w\", err)\n\t}\n\tclientSet, err := kubernetes.NewForConfig(cfg)\n\tif err != nil {\n\t\treturn c.lastOptions, fmt.Errorf(\"building Kubernetes client: %w\", err)\n\t}\n\n\treturn &kubetail.Options{\n\t\tClient: clientSet,\n\t\tHandler: loki.NewEntryHandler(c.handler.Chan(), func() {}),\n\t\tPositions: c.positions,\n\t}, nil\n}", "func (o Options) GetNormalConfig() *redis.Options {\n\topts := &redis.Options{\n\t\tAddr: o.Hosts[0],\n\t\tPassword: o.Password,\n\t\tDB: o.Database,\n\t\tMaxRetries: o.MaxRedirects,\n\t\tDialTimeout: o.DialTimeout,\n\t\tReadTimeout: o.ReadTimeout,\n\t\tWriteTimeout: o.WriteTimeout,\n\t\tPoolSize: o.PoolSize,\n\t\tPoolTimeout: o.PoolTimeout,\n\t\tIdleTimeout: o.IdleTimeout,\n\t\tIdleCheckFrequency: o.IdleCheckFrequency,\n\t\tTLSConfig: o.TLSConfig,\n\t}\n\treturn opts\n}", "func (t Timeouts) ApplyOpts(opts *redisconn.Opts) {\n\tif t.Dial > 0 {\n\t\topts.DialTimeout = t.Dial\n\t}\n\tif t.IO > 0 {\n\t\topts.IOTimeout = t.IO\n\t}\n}", "func (s *svc) Options() router.Options {\n\ts.Lock()\n\topts := s.opts\n\ts.Unlock()\n\n\treturn opts\n}", "func newOptions() *options {\n\treturn &options{\n\t\tlogger: log.NewNopLogger(),\n\t\tclock: clock.New(),\n\t\tcertificateCacheDuration: time.Hour * 24,\n\t}\n}", "func (c *Command) Options() map[string]string {\n\toptions := make(map[string]string)\n\tc.Flag.VisitAll(func(f *flag.Flag) {\n\t\tdefaultVal := f.DefValue\n\t\tif len(defaultVal) > 0 {\n\t\t\toptions[f.Name+\"=\"+defaultVal] = f.Usage\n\t\t} else {\n\t\t\toptions[f.Name] = f.Usage\n\t\t}\n\t})\n\treturn options\n}", "func WithZookeepers(zookeepers []string) SessionOpt {\n\treturn func(so SessionOpts) SessionOpts {\n\t\tso.servers = zookeepers\n\t\treturn so\n\t}\n}", "func (c *FakeClient) Option(opts ...Option) Interface {\n\tfor _, opt := range opts {\n\t\topt(&c.Opts)\n\t}\n\treturn c\n}", "func DeleteGetOpts(cmd *cobra.Command, args []string) (opts *DeleteOpts, warns []string, err error) {\n\twarns = make([]string, 0)\n\n\t// cluster_name\n\tclusterName, err := GetOneClusterName(cmd, args, false)\n\tif err != nil {\n\t\treturn nil, warns, err\n\t}\n\n\t// Get the flags `--all` and `--force`\n\tdestroyAll := false\n\tdestroyAllFlag := cmd.Flags().Lookup(\"all\")\n\tif destroyAllFlag != nil {\n\t\tdestroyAll = destroyAllFlag.Value.String() == \"true\"\n\t}\n\tforce := false\n\tforceFlag := cmd.Flags().Lookup(\"force\")\n\tif forceFlag != nil {\n\t\tforce = forceFlag.Value.String() == \"true\"\n\t}\n\n\topts = &DeleteOpts{\n\t\tClusterName: clusterName,\n\t\tDestroyAll: destroyAll,\n\t\tForce: force,\n\t}\n\n\treturn opts, warns, nil\n}", "func (t *Task) Options() task.Options {\n\treturn *t.opts\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 WithPoolSize(size int) OptsFunc {\n\treturn func(o *redis.Options) {\n\t\to.PoolSize = size\n\t}\n}", "func Options(opts ...Option) Option {\n\treturn func(s *Settings) error {\n\t\tfor _, opt := range opts {\n\t\t\tif err := opt(s); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func (h handlerResult) asMetricOpts(repository string) *metricsOpts {\n\treturn &metricsOpts{\n\t\tstatus: h.asStatusOpts(),\n\t\ttimeToDeploy: h.timeToDeploy,\n\t\trepository: repository,\n\t}\n}", "func NewOptions(opts ...Option) *Options {\n\topt := &Options{\n\t\tHandlerConcurrency: defaultHandlerConcurrency,\n\t\tMaxConcurrencyPerEvent: defaultMaxConcurrencyPerEvent,\n\t\tTimeoutPerEvent: defaultTimeout,\n\t\tPubsubReceiveSettings: pubsub.DefaultReceiveSettings,\n\t}\n\tfor _, o := range opts {\n\t\to(opt)\n\t}\n\tif opt.EventRequester == nil {\n\t\topt.EventRequester = defaultCeClient\n\t}\n\treturn opt\n}", "func (opts DeleteOptions) toConfig() deleteConfig {\n\tcfg := deleteConfig{}\n\n\tfor _, v := range opts {\n\t\tv(&cfg)\n\t}\n\n\treturn cfg\n}", "func ReqOpts(hdr http.Header) *toclient.RequestOptions {\n\topts := toclient.NewRequestOptions()\n\topts.Header = hdr\n\treturn &opts\n}", "func (adpt *DockerRunAdapter) Option() *docker.RunOption {\n\tspec := (*yaml.Option)(adpt)\n\n\topt := docker.RunOption{}\n\topt.AddHost = ExpandColonDelimitedStringListWithEnv(spec.AddHost)\n\topt.Attach = spec.Attach\n\topt.BlkioWeight = spec.BlkioWeight\n\topt.BlkioWeightDevice = ExpandColonDelimitedStringListWithEnv(spec.BlkioWeightDevice)\n\topt.CIDFile = spec.CIDFile\n\topt.CPUPeriod = spec.CPUPeriod\n\topt.CPUQuota = spec.CPUQuota\n\topt.CPURtPeriod = spec.CPURtPeriod\n\topt.CPURtRuntime = spec.CPURtRuntime\n\topt.CPUShares = spec.CPUShares\n\topt.CPUs = spec.CPUs\n\topt.CPUsetCPUs = spec.CPUsetCPUs\n\topt.CPUsetMems = spec.CPUsetMems\n\topt.CapAdd = spec.CapAdd\n\topt.CapDrop = spec.CapDrop\n\topt.CgroupParent = spec.CgroupParent\n\topt.DNS = spec.DNS\n\topt.DNSOption = spec.DNSOption\n\topt.DNSSearch = spec.DNSSearch\n\topt.Detach = spec.Detach\n\topt.DetachKeys = spec.DetachKeys\n\topt.Device = ExpandColonDelimitedStringListWithEnv(spec.Device)\n\topt.DeviceCgroupRule = spec.DeviceCgroupRule\n\topt.DeviceReadBPS = ExpandColonDelimitedStringListWithEnv(spec.DeviceReadBPS)\n\topt.DeviceReadIOPS = ExpandColonDelimitedStringListWithEnv(spec.DeviceReadIOPS)\n\topt.DeviceWriteBPS = ExpandColonDelimitedStringListWithEnv(spec.DeviceWriteBPS)\n\topt.DeviceWriteIOPS = ExpandColonDelimitedStringListWithEnv(spec.DeviceWriteIOPS)\n\topt.DisableContentTrust = spec.DisableContentTrust\n\topt.Domainname = spec.Domainname\n\tif spec.Command != nil {\n\t\topt.Entrypoint = spec.Command\n\t} else {\n\t\topt.Entrypoint = spec.Entrypoint\n\t}\n\topt.Env = ExpandStringKeyMapWithEnv(spec.Env)\n\topt.EnvFile = spec.EnvFile\n\topt.Expose = spec.Expose\n\topt.GroupAdd = spec.GroupAdd\n\topt.HealthCmd = spec.HealthCmd\n\topt.HealthInterval = spec.HealthInterval\n\topt.HealthRetries = spec.HealthRetries\n\topt.HealthStartPeriod = spec.HealthStartPeriod\n\topt.HealthTimeout = spec.HealthTimeout\n\topt.Hostname = spec.Hostname\n\topt.IP = spec.IP\n\topt.IP6 = spec.IP6\n\topt.IPC = spec.IPC\n\topt.Init = spec.Init\n\topt.Interactive = spec.Interactive\n\topt.Isolation = spec.Isolation\n\topt.KernelMemory = spec.KernelMemory\n\topt.Label = ExpandStringKeyMapWithEnv(spec.Label)\n\topt.LabelFile = spec.LabelFile\n\topt.Link = ExpandColonDelimitedStringListWithEnv(spec.Link)\n\topt.LinkLocalIP = spec.LinkLocalIP\n\topt.LogDriver = spec.LogDriver\n\topt.LogOpt = ExpandStringKeyMapWithEnv(spec.LogOpt)\n\topt.MacAddress = spec.MacAddress\n\topt.Memory = spec.Memory\n\topt.MemoryReservation = spec.MemoryReservation\n\topt.MemorySwap = spec.MemorySwap\n\topt.MemorySwappiness = spec.MemorySwappiness\n\topt.Mount = ExpandStringKeyMapWithEnv(spec.Mount)\n\topt.Name = spec.Name\n\topt.Network = spec.Network\n\topt.NetworkAlias = spec.NetworkAlias\n\topt.NoHealthcheck = spec.NoHealthcheck\n\topt.OOMKillDisable = spec.OOMKillDisable\n\topt.OOMScoreAdj = spec.OOMScoreAdj\n\topt.PID = spec.PID\n\topt.PidsLimit = spec.PidsLimit\n\topt.Platform = spec.Platform\n\topt.Privileged = spec.Privileged\n\topt.Publish = spec.Publish\n\topt.PublishAll = spec.PublishAll\n\topt.ReadOnly = spec.ReadOnly\n\topt.Restart = spec.Restart\n\topt.Rm = spec.Rm\n\topt.Runtime = spec.Runtime\n\topt.SecurityOpt = ExpandStringKeyMapWithEnv(spec.SecurityOpt)\n\topt.ShmSize = spec.ShmSize\n\topt.SigProxy = spec.SigProxy\n\topt.StopSignal = spec.StopSignal\n\topt.StopTimeout = spec.StopTimeout\n\topt.StorageOpt = ExpandStringKeyMapWithEnv(spec.StorageOpt)\n\topt.Sysctl = ExpandStringKeyMapWithEnv(spec.Sysctl)\n\topt.TTY = spec.TTY\n\topt.Tmpfs = spec.Tmpfs\n\topt.UTS = spec.UTS\n\topt.Ulimit = ExpandStringKeyMapWithEnv(spec.Ulimit)\n\tif spec.User != nil {\n\t\tuser := ExpandColonDelimitedStringWithEnv(*spec.User)\n\t\topt.User = &user\n\t}\n\topt.Userns = spec.Userns\n\topt.Volume = ExpandColonDelimitedStringListWithEnv(spec.Volume)\n\topt.VolumeDriver = spec.VolumeDriver\n\topt.VolumesFrom = spec.VolumesFrom\n\topt.Workdir = spec.Workdir\n\n\treturn &opt\n}", "func (p *Tmpfs) Options() map[string]types.Option {\n\treturn map[string]types.Option{\n\t\t\"ids\": {Value: \"\", Desc: \"tmpfs volume user's ids\"},\n\t\t\"reqID\": {Value: \"\", Desc: \"create tmpfs volume request id\"},\n\t\t\"freeTime\": {Value: \"\", Desc: \"tmpfs volume free time\"},\n\t}\n}", "func WithPoolTimeout(timeout time.Duration) OptsFunc {\n\treturn func(o *redis.Options) {\n\t\to.PoolTimeout = timeout\n\t}\n}", "func NewClusterOptions() *ClusterOpts {\n\treturn &ClusterOpts{\n\t\tMinIdleConnections: defaultMinIdleConnections,\n\t\tConnectionIdleTimeout: defaultIdleTimeout,\n\t\tMaxActiveConnections: defaultMaxActiveConnections,\n\t}\n}", "func DefaultOpts() Opts {\n\treturn Opts{\n\t\tMinRunInterval: MinRunInterval,\n\t\tMaxTimeout: MaxTimeout,\n\n\t\tDefaultRunInterval: DefaultRunInterval,\n\t\tDefaultTimeout: DefaultTimeout,\n\n\t\tMaxCheckParallelism: MaxCheckParallelism,\n\t}\n}", "func (o CrostiniOptions) ChromeOpts() []chrome.Option {\n\treturn []chrome.Option{chrome.ExtraArgs(\"--vmodule=crostini*=1\")}\n}", "func (c *Client) getChunkerOptions(ctx context.Context) (*fastcdc.Options, error) {\n\tparams, err := c.iclient.GetChunkerParams(ctx, &pb.Empty{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &fastcdc.Options{\n\t\tMinSize: int(params.MinChunkSize),\n\t\tAverageSize: int(params.AvgChunkSize),\n\t\tMaxSize: int(params.MaxChunkSize),\n\t\tNormalization: int(params.Normalization),\n\t}, nil\n}", "func (sb ServiceBase) Options() Options {\n\treturn sb.options\n}", "func (o StorageClusterSpecCloudStorageCapacitySpecsOutput) Options() pulumi.MapOutput {\n\treturn o.ApplyT(func(v StorageClusterSpecCloudStorageCapacitySpecs) map[string]interface{} { return v.Options }).(pulumi.MapOutput)\n}", "func NewOptions(opts ...Option) Options {\n\toptions := Options{\n\t\tContext: context.Background(),\n\t\tContentType: DefaultContentType,\n\t\tCodecs: make(map[string]codec.Codec),\n\t\tCallOptions: CallOptions{\n\t\t\tContext: context.Background(),\n\t\t\tBackoff: DefaultBackoff,\n\t\t\tRetry: DefaultRetry,\n\t\t\tRetries: DefaultRetries,\n\t\t\tRequestTimeout: DefaultRequestTimeout,\n\t\t\tDialTimeout: transport.DefaultDialTimeout,\n\t\t},\n\t\tLookup: LookupRoute,\n\t\tPoolSize: DefaultPoolSize,\n\t\tPoolTTL: DefaultPoolTTL,\n\t\tSelector: random.NewSelector(),\n\t\tLogger: logger.DefaultLogger,\n\t\tBroker: broker.DefaultBroker,\n\t\tMeter: meter.DefaultMeter,\n\t\tTracer: tracer.DefaultTracer,\n\t}\n\n\tfor _, o := range opts {\n\t\to(&options)\n\t}\n\n\treturn options\n}", "func loadConfigOpts(cliOpts *cliOptions, host string) (\n\tconfig configuration, err error) {\n\n\tconfig = newConfiguration()\n\n\tif err := config.setPath(cliOpts.ConfigPath); err != nil {\n\t\treturn config, errors.WithMessage(err, \"set path\")\n\t}\n\n\tif err := config.loadConfig(); err != nil {\n\t\treturn config, errors.WithMessagef(err, \"loading %s\", config.Path)\n\t}\n\tlog.Debugf(\"DAOS config read from %s\", config.Path)\n\n\t// Override certificate support if specified in cliOpts\n\tif cliOpts.Insecure {\n\t\tconfig.TransportConfig.AllowInsecure = true\n\t}\n\n\t// get unique identifier to activate SPDK multiprocess mode\n\tconfig.NvmeShmID = hash(host + strconv.Itoa(os.Getpid()))\n\n\tif err = config.getIOParams(cliOpts); err != nil {\n\t\treturn config, errors.Wrap(\n\t\t\terr, \"failed to retrieve I/O service params\")\n\t}\n\n\tif len(config.Servers) == 0 {\n\t\treturn config, errors.New(\"missing I/O service params\")\n\t}\n\n\tfor idx := range config.Servers {\n\t\tconfig.Servers[idx].Hostname = host\n\t}\n\n\treturn config, nil\n}", "func toOptions(in *structs.ActiveData) *Options {\n\tif in == nil {\n\t\treturn nil\n\t}\n\n\topts := &Options{}\n\tfor _, m := range in.Moves {\n\t\tmov := toMove(m)\n\t\tif mov != nil {\n\t\t\topts.Moves = append(opts.Moves, mov)\n\t\t}\n\t}\n\topts.CanMegaEvolve = in.CanMegaEvolve\n\n\tfor _, m := range in.ZMoves {\n\t\tif m == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tmov := toMove(m)\n\t\tif mov != nil {\n\t\t\topts.ZMoves = append(opts.ZMoves, mov)\n\t\t}\n\t}\n\topts.CanZMove = len(opts.ZMoves) > 0\n\n\tfor _, m := range in.Dynamax.Moves {\n\t\tmov := toMove(m)\n\t\tif mov != nil {\n\t\t\topts.DMoves = append(opts.DMoves, mov)\n\t\t}\n\t}\n\topts.CanDynamax = in.CanDynamax\n\n\treturn opts\n}", "func (client *Client) Option(opts ...Option) *Client {\n\tfor _, opt := range opts {\n\t\topt(&client.opts)\n\t}\n\treturn client\n}", "func (k *kubernetes) Init(opts ...runtime.Option) error {\n\tk.Lock()\n\tdefer k.Unlock()\n\n\tfor _, o := range opts {\n\t\to(&k.options)\n\t}\n\n\treturn nil\n}", "func (d *SQLike) Options() *destination.Options {\n\treturn d.options\n}", "func (opts CreateOptions) toConfig() createConfig {\n\tcfg := createConfig{}\n\n\tfor _, v := range opts {\n\t\tv(&cfg)\n\t}\n\n\treturn cfg\n}", "func (opts CreateOptions) toConfig() createConfig {\n\tcfg := createConfig{}\n\n\tfor _, v := range opts {\n\t\tv(&cfg)\n\t}\n\n\treturn cfg\n}", "func NewOptions(instrumentOpts instrument.Options) Options {\n\treturn Options{\n\t\tHasExpensiveAggregations: defaultHasExpensiveAggregations,\n\t\tMetrics: NewMetrics(instrumentOpts.MetricsScope()),\n\t}\n}", "func (oc *OpusDecoder) Options() Options {\n\treturn oc.options\n}", "func NewOptions() Options {\n\tvar opts Options\n\tkingpin.Flag(\"verbose\", \"enable additional logging (env - VERBOSE)\").Envar(\"VERBOSE\").Short('v').BoolVar(&opts.Debug)\n\tkingpin.Flag(\"listen-addr\", \"address:port to listen for requests on (env - LISTEN_ADDR)\").Default(\":8099\").Envar(\"LISTEN_ADDR\").StringVar(&opts.ListenAddr)\n\tkingpin.Flag(\"metrics-listen-addr\", \"address:port to listen for Prometheus metrics on, empty to disable (env - METRICS_LISTEN_ADDR)\").Default(\"\").Envar(\"METRICS_LISTEN_ADDR\").StringVar(&opts.MetricsListenAddr)\n\tkingpin.Flag(\"pprof-listen-addr\", \"address:port to listen for pprof on, empty to disable (env - PPROF_LISTEN_ADDR)\").Default(\"\").Envar(\"PPROF_LISTEN_ADDR\").StringVar(&opts.PprofListenAddr)\n\tkingpin.Flag(\"allowed-endpoint\", \"allowed endpoint (Host header) to accept for incoming requests (env - ALLOWED_ENDPOINT)\").Envar(\"ALLOWED_ENDPOINT\").Required().PlaceHolder(\"my.host.example.com:8099\").StringVar(&opts.AllowedSourceEndpoint)\n\tkingpin.Flag(\"allowed-source-subnet\", \"allowed source IP addresses with netmask (env - ALLOWED_SOURCE_SUBNET)\").Default(\"127.0.0.1/32\").Envar(\"ALLOWED_SOURCE_SUBNET\").StringsVar(&opts.AllowedSourceSubnet)\n\tkingpin.Flag(\"aws-credentials\", \"set of AWS credentials (env - AWS_CREDENTIALS)\").PlaceHolder(\"\\\"AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY\\\"\").Envar(\"AWS_CREDENTIALS\").StringsVar(&opts.AwsCredentials)\n\tkingpin.Flag(\"aws-region\", \"send requests to this AWS S3 region (env - AWS_REGION)\").Envar(\"AWS_REGION\").Default(\"eu-central-1\").StringVar(&opts.Region)\n\tkingpin.Flag(\"upstream-insecure\", \"use insecure HTTP for upstream connections (env - UPSTREAM_INSECURE)\").Envar(\"UPSTREAM_INSECURE\").BoolVar(&opts.UpstreamInsecure)\n\tkingpin.Flag(\"upstream-endpoint\", \"use this S3 endpoint for upstream connections, instead of public AWS S3 (env - UPSTREAM_ENDPOINT)\").Envar(\"UPSTREAM_ENDPOINT\").StringVar(&opts.UpstreamEndpoint)\n\tkingpin.Flag(\"cert-file\", \"path to the certificate file (env - CERT_FILE)\").Envar(\"CERT_FILE\").Default(\"\").StringVar(&opts.CertFile)\n\tkingpin.Flag(\"key-file\", \"path to the private key file (env - KEY_FILE)\").Envar(\"KEY_FILE\").Default(\"\").StringVar(&opts.KeyFile)\n\tkingpin.Parse()\n\treturn opts\n}", "func ConstructorOpts(extra ...node.Option) NodeOpt {\n\treturn func(opts *nodeOpts) error {\n\t\topts.extraNodeOpts = append(opts.extraNodeOpts, extra...)\n\t\treturn nil\n\t}\n}", "func (o StorageNodeSpecCloudStorageDriveConfigsOutput) Options() pulumi.MapOutput {\n\treturn o.ApplyT(func(v StorageNodeSpecCloudStorageDriveConfigs) map[string]interface{} { return v.Options }).(pulumi.MapOutput)\n}", "func CollectOptions(opts ...Option) Options {\n\tvar suiteOpts Options\n\tfor _, o := range opts {\n\t\to(&suiteOpts)\n\t}\n\treturn suiteOpts\n}", "func (b *base) Options() []func(Call) error {\n\treturn b.options\n}", "func (req *SelectRequest) Opts(opts SelectOpts) *SelectRequest {\n\treq.opts = opts\n\treturn req\n}", "func SeriesCellOpts(co ...cell.Option) SeriesOption {\n\treturn seriesOption(func(opts *seriesValues) {\n\t\topts.seriesCellOpts = co\n\t})\n}", "func (b *ExperimentBuilder) Options() (map[string]OptionInfo, error) {\n\tresult := make(map[string]OptionInfo)\n\tptrinfo := reflect.ValueOf(b.config)\n\tif ptrinfo.Kind() != reflect.Ptr {\n\t\treturn nil, errors.New(\"config is not a pointer\")\n\t}\n\tstructinfo := ptrinfo.Elem().Type()\n\tif structinfo.Kind() != reflect.Struct {\n\t\treturn nil, errors.New(\"config is not a struct\")\n\t}\n\tfor i := 0; i < structinfo.NumField(); i++ {\n\t\tfield := structinfo.Field(i)\n\t\tresult[field.Name] = OptionInfo{\n\t\t\tDoc: field.Tag.Get(\"ooni\"),\n\t\t\tType: field.Type.String(),\n\t\t}\n\t}\n\treturn result, nil\n}", "func (ng *NodeGroup) GetOptions(defaults config.NodeGroupAutoscalingOptions) (*config.NodeGroupAutoscalingOptions, error) {\n\t// If node group autoscaling options nil, return defaults\n\tif ng.Autoscaling == nil {\n\t\treturn nil, nil\n\t}\n\n\t// Forge autoscaling configuration from node pool\n\tcfg := &config.NodeGroupAutoscalingOptions{\n\t\tScaleDownUnneededTime: time.Duration(ng.Autoscaling.ScaleDownUnneededTimeSeconds) * time.Second,\n\t\tScaleDownUnreadyTime: time.Duration(ng.Autoscaling.ScaleDownUnreadyTimeSeconds) * time.Second,\n\t}\n\n\t// Switch utilization threshold from defaults given flavor type\n\tif ng.isGpu() {\n\t\tcfg.ScaleDownUtilizationThreshold = defaults.ScaleDownUtilizationThreshold\n\t\tcfg.ScaleDownGpuUtilizationThreshold = float64(ng.Autoscaling.ScaleDownUtilizationThreshold) // Use this one\n\t} else {\n\t\tcfg.ScaleDownUtilizationThreshold = float64(ng.Autoscaling.ScaleDownUtilizationThreshold) // Use this one\n\t\tcfg.ScaleDownGpuUtilizationThreshold = defaults.ScaleDownGpuUtilizationThreshold\n\t}\n\n\treturn cfg, nil\n}", "func (c *Client) GetAuthOpts() (authOpts dockerclient.AuthConfigurations) {\n\tauthOpt := dockerclient.AuthConfiguration{\n\t\tUsername: c.AuthConfig.Username,\n\t\tPassword: c.AuthConfig.Password,\n\t}\n\n\tauthOpts = dockerclient.AuthConfigurations{\n\t\tConfigs: make(map[string]dockerclient.AuthConfiguration),\n\t}\n\tauthOpts.Configs[c.Registry] = authOpt\n\n\treturn authOpts\n}" ]
[ "0.6970594", "0.6281927", "0.59078234", "0.5868081", "0.5761447", "0.56771445", "0.56171125", "0.55353045", "0.5506973", "0.5471589", "0.54695356", "0.54681355", "0.54206634", "0.5406276", "0.5379113", "0.53657633", "0.5356025", "0.5337401", "0.52826387", "0.52810746", "0.5236273", "0.5228371", "0.51983553", "0.51926357", "0.5178007", "0.51692617", "0.51685077", "0.51150644", "0.5107587", "0.509537", "0.5091516", "0.5084232", "0.5067439", "0.50446784", "0.5034239", "0.50328165", "0.50073296", "0.5006212", "0.5004552", "0.5003781", "0.49991316", "0.49750435", "0.49733064", "0.49698144", "0.49545056", "0.49192026", "0.49119982", "0.49042183", "0.49005517", "0.48988387", "0.48947263", "0.4886981", "0.48724514", "0.48624003", "0.48541293", "0.48534524", "0.4829306", "0.48255104", "0.48241454", "0.48240703", "0.4820023", "0.48159155", "0.48143739", "0.48110065", "0.4806841", "0.48058537", "0.47905722", "0.4790194", "0.4789657", "0.47796994", "0.47759378", "0.47727197", "0.47667062", "0.4757676", "0.4756577", "0.47538516", "0.47472742", "0.47454834", "0.47412437", "0.47411454", "0.47149995", "0.47127968", "0.4703587", "0.46948785", "0.46890256", "0.4688184", "0.46690702", "0.46690702", "0.46645752", "0.46609813", "0.46605188", "0.46577546", "0.46539006", "0.46476388", "0.46430048", "0.4636706", "0.4633019", "0.46299204", "0.46298066", "0.46259743" ]
0.73391664
0
VersionString returns a TLS version string.
VersionString возвращает строку версии TLS.
func VersionString(value uint16) string { if str, found := tlsVersionString[value]; found { return str } return fmt.Sprintf("TLS_VERSION_UNKNOWN_%d", value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func VersionString() string {\n\treturn C.GoString(C.LZ4_versionString())\n}", "func TLSVersion(ver uint16) string {\n\tswitch ver {\n\tcase tls.VersionTLS10:\n\t\treturn \"1.0\"\n\tcase tls.VersionTLS11:\n\t\treturn \"1.1\"\n\tcase tls.VersionTLS12:\n\t\treturn \"1.2\"\n\t}\n\treturn fmt.Sprintf(\"Unknown [%x]\", ver)\n}", "func (v *Version) VersionString() string {\n\treturn fmt.Sprintf(\"%s%d.%d.%d%s\", v.Prefix, v.Major, v.Minor, v.Maintenance, v.Suffix)\n}", "func VersionString() string {\n\tif VersionStability != \"stable\" {\n\t\treturn fmt.Sprintf(\"%s-%s\", Version, VersionStability)\n\t}\n\treturn Version\n}", "func GetFormattedVersionString() string {\n\tif versionString == \"\" {\n\t\tversionString = \"Unknown\"\n\t}\n\treturn versionString\n}", "func GetVersionString() string {\n\treturn fmt.Sprintf(\"Praefect, version %v\", version.GetVersion())\n}", "func versionString() string {\n\tvar version string\n\tif SHA != \"\" {\n\t\tversion = fmt.Sprintf(\"%s (%s)\", Version, SHA)\n\t} else {\n\t\tversion = fmt.Sprintf(\"%s-dev\", Version) // no SHA. '0.x.y-dev' indicates it is run from source without build script.\n\t}\n\tif BuildTime != \"\" {\n\t\ti, err := strconv.ParseInt(BuildTime, 10, 64)\n\t\tif err == nil {\n\t\t\ttm := time.Unix(i, 0)\n\t\t\tversion += fmt.Sprintf(\" built %s\", tm.Format(time.RFC822))\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"dnscontrol %s\", version)\n}", "func (pv ProtocolVersion) String() string {\n\tstr := fmt.Sprintf(\"%d.%d.%d\",\n\t\t(pv.Version>>24)&0xFF, // major\n\t\t(pv.Version>>16)&0xFF, // minor\n\t\t(pv.Version>>8)&0xFF, // patch\n\t)\n\n\t// optional build number, only printed when non-0\n\tif build := pv.Version & 0xFF; build != 0 {\n\t\tstr += fmt.Sprintf(\".%d\", build)\n\t}\n\n\t// optional prerelease\n\tif pv.Prerelease != nilPreRelease {\n\t\tindex := 0\n\t\tfor index < 8 && pv.Prerelease[index] != 0 {\n\t\t\tindex++\n\t\t}\n\t\tstr += \"-\" + string(pv.Prerelease[:index])\n\t}\n\n\treturn str\n}", "func TLSVersionName(version uint16) string {\n\tswitch version {\n\tcase tls.VersionSSL30:\n\t\treturn \"SSL 3.0\"\n\tcase tls.VersionTLS10:\n\t\treturn \"TLS 1.0\"\n\tcase tls.VersionTLS11:\n\t\treturn \"TLS 1.1\"\n\tcase tls.VersionTLS12:\n\t\treturn \"TLS 1.2\"\n\tcase tls.VersionTLS13:\n\t\treturn \"TLS 1.3\"\n\t}\n\n\treturn \"Unknown\"\n}", "func GetTLSVersion(tr *http.Transport) string {\n switch tr.TLSClientConfig.MinVersion {\n case tls.VersionTLS10:\n return \"TLS 1.0\"\n case tls.VersionTLS11:\n return \"TLS 1.1\"\n case tls.VersionTLS12:\n return \"TLS 1.2\"\n case tls.VersionTLS13:\n return \"TLS 1.3\"\n }\n\n return \"Unknown\"\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"%0d.%0d\", v.Major, v.Minor)\n}", "func (v DefaultVersion) VersionString() string {\n\treturn v.spec\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"v%d.%d.%d\", v.Major, v.Minor, v.Patches)\n}", "func (v Version) String() string {\n\tvs := fmt.Sprintf(\"%d.%d.%d\", v.major, v.minor, v.patch)\n\tif len(v.preRelease) > 0 {\n\t\tvs += \"-\" + v.PreRelease()\n\t}\n\tif len(v.metadata) > 0 {\n\t\tvs += Metadata + v.Metadata()\n\t}\n\treturn vs\n}", "func GetVersionString() string {\n\treturn \"simple-http-server 1.0\"\n}", "func versionString() string {\n\treturn fmt.Sprintf(\"%s-%s\\n\", caddy.AppName, caddy.AppVersion)\n}", "func String() string {\n\treturn Version\n}", "func Version() string {\n\tapi := C.Create()\n\tdefer C.Free(api)\n\tversion := C.Version(api)\n\treturn C.GoString(version)\n}", "func GetVersionString() string {\n\treturn fmt.Sprintf(\"%s version %s\", os.Args[0], config.Version)\n}", "func (v Version) String() string {\n\ts := strconv.Itoa(v.Major) + \".\" + strconv.Itoa(v.Minor)\n\tif v.Patch > 0 {\n\t\ts += \".\" + strconv.Itoa(v.Patch)\n\t}\n\tif v.PreRelease != \"\" {\n\t\ts += v.PreRelease\n\t}\n\n\treturn s\n}", "func Version(message string) string {\n\treturn Encode(VERSION, message)\n}", "func GetVersion() string {\n\tvar versionString bytes.Buffer\n\tfmt.Fprintf(&versionString, \"v%s\", versn)\n\tif env != \"\" {\n\t\tfmt.Fprintf(&versionString, \"-%s\", env)\n\t}\n\n\treturn versionString.String()\n}", "func (v IPVSVersion) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func (v Version) String() (s string) {\n\tif v.epoch != 0 {\n\t\ts = strconv.Itoa(v.epoch) + \":\"\n\t}\n\ts += v.version\n\tif v.revision != \"\" {\n\t\ts += \"-\" + v.revision\n\t}\n\treturn\n}", "func (m *MongoCrypt) CryptSharedLibVersionString() string {\n\t// Pass in a pointer for \"len\", but ignore the value because C.GoString can determine the string\n\t// length without it.\n\tlen := C.uint(0)\n\tstr := C.GoString(C.mongocrypt_crypt_shared_lib_version_string(m.wrapped, &len))\n\treturn str\n}", "func (client *Client) Version() string {\n\tversion := C.Version(client.api)\n\treturn C.GoString(version)\n}", "func (ver Version) String() string {\n\tif ver.RawVersion != \"\" {\n\t\treturn ver.RawVersion\n\t}\n\tv := fmt.Sprintf(\"v%d.%d.%d\", ver.Major, ver.Minor, ver.Patch)\n\tif ver.PreRelease != \"\" {\n\t\tv += \"-\" + ver.PreRelease\n\t}\n\tif ver.GitHash != \"\" {\n\t\tv += \"(\" + ver.GitHash + \")\"\n\t}\n\t// TODO: Add metadata about the commit or build hash.\n\t// See https://golang.org/issue/29814\n\t// See https://golang.org/issue/33533\n\tvar metadata = strings.Join(ver.MetaData, \".\")\n\tif strings.Contains(ver.PreRelease, \"devel\") && metadata != \"\" {\n\t\tv += \"+\" + metadata\n\t}\n\treturn v\n}", "func (v Version) Version() VersionString {\n\treturn VersionString(v.String())\n}", "func Version() string {\n\tif len(version) == 0 {\n\t\treturn \"UNKNOWN_VERSION\"\n\t}\n\treturn version\n}", "func GetVersionString() string {\n\treturn C.GoString(C.glfwGetVersionString())\n}", "func GetVersionString() string {\n\treturn C.GoString(C.glfwGetVersionString())\n}", "func GetVersionString() string {\n\treturn C.GoString(C.glfwGetVersionString())\n}", "func (version Version) String() string {\n\treturn strconv.Itoa(int(version))\n}", "func (version Version) String() string {\n\treturn strconv.Itoa(int(version))\n}", "func Version() string {\r\n\tonce.Do(func() {\r\n\t\tsemver := fmt.Sprintf(\"%d.%d.%d\", major, minor, patch)\r\n\t\tverBuilder := bytes.NewBufferString(semver)\r\n\t\tif tag != \"\" && tag != \"-\" {\r\n\t\t\tupdated := strings.TrimPrefix(tag, \"-\")\r\n\t\t\t_, err := verBuilder.WriteString(\"-\" + updated)\r\n\t\t\tif err == nil {\r\n\t\t\t\tverBuilder = bytes.NewBufferString(semver)\r\n\t\t\t}\r\n\t\t}\r\n\t\tversion = verBuilder.String()\r\n\t})\r\n\treturn version\r\n}", "func Version() string {\n\treturn C.GoString(C.yices_version)\n}", "func Version() string {\n\tstr := C.GoString(C.mongocrypt_version(nil))\n\treturn str\n}", "func (p ProtocolVersion) String() string {\n\tswitch p {\n\tcase ProtocolVersionUnrecorded:\n\t\treturn \"Unrecorded\"\n\n\tcase ProtocolVersionLegacy:\n\t\treturn \"Legacy\"\n\n\tcase ProtocolVersionMultiLoopOut:\n\t\treturn \"Multi Loop Out\"\n\n\tcase ProtocolVersionSegwitLoopIn:\n\t\treturn \"Segwit Loop In\"\n\n\tcase ProtocolVersionPreimagePush:\n\t\treturn \"Preimage Push\"\n\n\tcase ProtocolVersionUserExpiryLoopOut:\n\t\treturn \"User Expiry Loop Out\"\n\n\tcase ProtocolVersionHtlcV2:\n\t\treturn \"HTLC V2\"\n\n\tcase ProtocolVersionLoopOutCancel:\n\t\treturn \"Loop Out Cancel\"\n\n\tcase ProtocolVersionProbe:\n\t\treturn \"Probe\"\n\n\tcase ProtocolVersionRoutingPlugin:\n\t\treturn \"Routing Plugin\"\n\n\tcase ProtocolVersionHtlcV3:\n\t\treturn \"HTLC V3\"\n\n\tcase ProtocolVersionMuSig2:\n\t\treturn \"MuSig2\"\n\n\tdefault:\n\t\treturn \"Unknown\"\n\t}\n}", "func GetVersion() string {\n\treturn VersionString\n}", "func (fmd *FakeMysqlDaemon) GetVersionString(ctx context.Context) (string, error) {\n\treturn fmd.Version, nil\n}", "func Version() string {\n\tvar hashStr string\n\tif CommitHash != \"\" {\n\t\thashStr = \"+\" + CommitHash\n\t}\n\n\tif currentVersion.label == \"\" {\n\t\treturn fmt.Sprintf(\"%d.%d.%d%s\", currentVersion.major, currentVersion.minor, currentVersion.patch, hashStr)\n\t}\n\n\treturn fmt.Sprintf(\"%d.%d.%d-%s%s\", currentVersion.major, currentVersion.minor, currentVersion.patch, currentVersion.label, hashStr)\n}", "func GetVersion() string {\n\tversion := fmt.Sprintf(`Version : %s\nTag : %s\nBuildTime : %s\nGitHash : %s\nRunMode : %s\nDistribution: %s\nServiceName : %s\n`, CCVersion, CCTag, CCBuildTime, CCGitHash, CCRunMode, CCDistro, ServiceName)\n\treturn version\n}", "func VersionText() string {\n\treturn C.GoString(C.Pa_GetVersionText())\n}", "func (v ComponentVersion) String() string {\n\treturn v.Version\n}", "func (o LayerVersionOutput) Version() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LayerVersion) pulumi.StringOutput { return v.Version }).(pulumi.StringOutput)\n}", "func (v *Version) String() string {\n\treturn fmt.Sprintf(\"Version: %s%d.%d.%d%s\\nBuild Date: %s\\n Minimum Go Version: %s\",\n\t\tv.Prefix, v.Major, v.Minor, v.Maintenance, v.Suffix, v.BuildDate, v.MinGoVersion)\n}", "func (s SymanticVersion) String() string {\n\treturn fmt.Sprintf(\"%v.%v.%v.%v\", s.Major, s.Minor, s.Patch, s.Build)\n}", "func Version() string {\n\tversion := C.GoString(C.lxc_get_version())\n\n\t// New liblxc versions append \"-devel\" when LXC_DEVEL is set.\n\tif strings.HasSuffix(version, \"-devel\") {\n\t\treturn fmt.Sprintf(\"%s (devel)\", version[:(len(version)-len(\"-devel\"))])\n\t}\n\n\treturn version\n}", "func (u *Uname) Version() string {\n\treturn toString(u.Utsname.Version[:])\n}", "func BuildVersionString() string {\n\tprogram := \"k8s-device-plugin\"\n\n\tversion := \"v\" + CurrentVersion.String()\n\tif CommitHash != \"\" {\n\t\tversion += \"-\" + strings.ToUpper(CommitHash)\n\t}\n\n\tosArch := runtime.GOOS + \"/\" + runtime.GOARCH\n\n\tdate := BuildDate\n\tif date == \"\" {\n\t\tdate = \"unknown\"\n\t}\n\n\treturn fmt.Sprintf(\"%s %s %s BuildDate: %s\", program, version, osArch, date)\n\n}", "func (t OptTPacketVersion) String() string {\n\tswitch t {\n\tcase TPacketVersion1:\n\t\treturn \"V1\"\n\tcase TPacketVersion2:\n\t\treturn \"V2\"\n\tcase TPacketVersion3:\n\t\treturn \"V3\"\n\tcase TPacketVersionHighestAvailable:\n\t\treturn \"HighestAvailable\"\n\t}\n\treturn \"InvalidVersion\"\n}", "func Version() string {\n\treturn fmt.Sprintf(\"%v (%v %v)\", version, revisionDate, revision)\n}", "func Version() string {\n\treturn C.GoString(C.worker_version())\n}", "func (s InvalidPolicyVersionError) Version() string {\n\treturn string(s)\n}", "func Version() (string, error) {\n\treturn makeRequest(\"version\")\n}", "func Version() string {\n\treturn versionNumber\n}", "func (l *Libvirt) Version() (string, error) {\n\tver, err := l.ConnectGetLibVersion()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// The version is provided as an int following this formula:\n\t// version * 1,000,000 + minor * 1000 + micro\n\t// See src/libvirt-host.c # virConnectGetLibVersion\n\tmajor := ver / 1000000\n\tver %= 1000000\n\tminor := ver / 1000\n\tver %= 1000\n\tmicro := ver\n\n\tversionString := fmt.Sprintf(\"%d.%d.%d\", major, minor, micro)\n\treturn versionString, nil\n}", "func Version() string {\n\treturn version\n}", "func Version() string {\n\treturn version\n}", "func Version() string {\n\treturn version\n}", "func Version() string {\n\treturn version\n}", "func Version() string {\n\treturn version\n}", "func Version() string {\n\treturn version\n}", "func Version() string {\n\treturn version\n}", "func Version() string {\n\treturn version\n}", "func Version() string {\n\tp := C.unqlite_lib_version()\n\treturn C.GoString(p)\n}", "func (sem *SemVer) String() (version string) {\n\tbase := fmt.Sprintf(\"v%d.%d.%d\", sem.Major, sem.Minor, sem.Patch)\n\tif len(sem.Pre) > 0 {\n\t\tvar build string\n\t\tfor _, val := range sem.Pre {\n\t\t\tbuild = build + \"-\" + val.String()\n\t\t}\n\t\treturn fmt.Sprintf(\"%s%s\", base, build)\n\t}\n\treturn base\n}", "func Version() string {\n\treturn fmt.Sprintf(\"%s %s %s\", AppVendor, AppName, AppVersion)\n}", "func Version() string {\n\tp := C.sqlite3_libversion()\n\treturn C.GoString(p)\n}", "func String() string {\n\tvar version bytes.Buffer\n\tif AppName != \"\" {\n\t\tfmt.Fprintf(&version, \"%s \", AppName)\n\t}\n\tfmt.Fprintf(&version, \"v%s\", Version)\n\tif Prerelease != \"\" {\n\t\tfmt.Fprintf(&version, \"-%s\", Prerelease)\n\t}\n\n\treturn version.String()\n}", "func GetVersion() (string, error) {\n\tvar buffer [4096]C.char\n\tvar cversion *C.char\n\n\trc, err := C.llapi_get_version(&buffer[0], C.int(len(buffer)), &cversion)\n\tif err := isError(rc, err); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn C.GoString(cversion), nil\n}", "func SprintfVersion(v csi.Version) string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func (c *Client) Version() (string, error) {\n\tv, err := c.Clientset.ServerVersion()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn v.String(), nil\n}", "func (n Version) String() string {\n\tif s, ok := verStrings[n]; ok {\n\t\treturn s\n\t}\n\treturn \"unknown\"\n}", "func Version() (version string) {\n\treturn GetVersion()\n}", "func (d *Diag) Version() string {\n\treturn bufToString(d.SzVersionString[:])\n}", "func (g *goVersion) String() string {\n\treturn g.golangVersion()\n}", "func LongString() string {\n\tvar version bytes.Buffer\n\n\tfmt.Fprintf(&version, \"%s\", String())\n\n\tif Build != \"\" {\n\t\tfmt.Fprintf(&version, \"+build.%s\", Build)\n\t\tif GitCommit != \"\" {\n\t\t\tfmt.Fprintf(&version, \".%s\", GitCommit)\n\t\t}\n\t}\n\n\trelease, ok := manifest.KubeManifest.Releases[Version]\n\tif !ok {\n\t\treturn version.String()\n\t}\n\n\tif len(release.KubernetesVersion) != 0 {\n\t\tfmt.Fprintf(&version, \"\\nKubernetes version: %s\", release.KubernetesVersion)\n\t}\n\tif len(release.DockerVersion) != 0 {\n\t\tfmt.Fprintf(&version, \"\\nDocker version: %s\", release.DockerVersion)\n\t}\n\tif len(release.EtcdVersion) != 0 {\n\t\tfmt.Fprintf(&version, \"\\netcd version: %s\", release.EtcdVersion)\n\t}\n\n\treturn version.String()\n}", "func StringToTLSVersion(st string) TLSVersion {\n\tswitch TLSVersion(st) {\n\tcase TLSVersion1p0:\n\t\treturn TLSVersion1p0\n\tcase TLSVersion1p1:\n\t\treturn TLSVersion1p1\n\tcase TLSVersion1p2:\n\t\treturn TLSVersion1p2\n\tcase TLSVersion1p3:\n\t\treturn TLSVersion1p3\n\t}\n\treturn TLSVersionInvalid\n}", "func (e E_OpenconfigSystem_System_SshServer_Config_ProtocolVersion) String() string {\n\treturn ygot.EnumLogString(e, int64(e), \"E_OpenconfigSystem_System_SshServer_Config_ProtocolVersion\")\n}", "func (_TTFT20 *TTFT20Session) Version() (string, error) {\n\treturn _TTFT20.Contract.Version(&_TTFT20.CallOpts)\n}", "func Version() string {\n\treturn libs.Version()\n}", "func formatVersion(v string) string {\n\tconst maxLen = 25\n\tif len(v) <= maxLen {\n\t\treturn v\n\t}\n\tvType, err := version.ParseType(v)\n\tif err != nil {\n\t\tlog.Errorf(context.TODO(), \"formatVersion(%q): error parsing version: %v\", v, err)\n\t\treturn v\n\t}\n\tif vType != version.TypePseudo {\n\t\t// If the version is release or prerelease, return a version string of\n\t\t// maxLen by truncating the end of the string. maxLen is inclusive of\n\t\t// the \"...\" characters.\n\t\treturn v[:maxLen-3] + \"...\"\n\t}\n\n\t// The version string will have a max length of 25:\n\t// base: \"vX.Y.Z-prerelease.0\" = up to 15\n\t// ellipse: \"...\" = 3\n\t// commit: \"-abcdefa\" = 7\n\tcommit := shorten(pseudoVersionRev(v), 7)\n\tbase := shorten(pseudoVersionBase(v), 15)\n\treturn fmt.Sprintf(\"%s...-%s\", base, commit)\n}", "func LibraryVersion() string {\n\treturn C.GoString(C.rl_library_version)\n}", "func Version() string {\n\treturn fmt.Sprint(\"C v1.2\", \"->\", d.Version())\n}", "func GetVersion(self *C.PyObject, args *C.PyObject) *C.PyObject {\n\tav, _ := version.New(version.AgentVersion, version.Commit)\n\n\tcStr := C.CString(av.GetNumber())\n\tpyStr := C.PyString_FromString(cStr)\n\tC.free(unsafe.Pointer(cStr))\n\treturn pyStr\n}", "func (api *API) Version(ctx context.Context) (string, error) {\n\taddr := api.host + \":\" + api.port\n\treturn version(addr)\n}", "func (v *V0) Version() string {\n\tif v == nil {\n\t\treturn VersionUnknown.String()\n\t}\n\treturn v.version.String()\n}", "func Version() string {\n\tvv := version{\n\t\tGitCommit: GitCommit,\n\t\tReleaseVersion: ReleaseVersion,\n\t\tBuildTime: BuildTime,\n\t}\n\tb, err := json.Marshal(vv)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(b)\n}", "func (k *Keybase) version() string {\n\tcmdOut, err := k.Exec(\"version\", \"-S\", \"-f\", \"s\")\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\treturn string(cmdOut)\n}", "func String() string {\n\tv := fmt.Sprintf(\"v%d.%d.%d\", Major, Minor, Patch)\n\tif PreRelease != \"\" {\n\t\tv += \"-\" + PreRelease\n\t}\n\treturn v\n}", "func (o NetworkEndpointGroupAppEngineResponseOutput) Version() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkEndpointGroupAppEngineResponse) string { return v.Version }).(pulumi.StringOutput)\n}", "func (o ClientLibrarySettingsResponseOutput) Version() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ClientLibrarySettingsResponse) string { return v.Version }).(pulumi.StringOutput)\n}", "func (mc *Client) Version() string {\n\n\treturn mc.info.Version\n}", "func terraformVersionString(ctx context.Context, execPath string) (string, error) {\n\ttmpDir, err := os.MkdirTemp(\"\", \"tfversion\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer os.RemoveAll(tmpDir)\n\n\ttf, err := tfexec.NewTerraform(tmpDir, execPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tversion, _, err := tf.Version(context.Background(), true)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn version.String(), nil\n}", "func (o NetworkEndpointGroupAppEngineOutput) Version() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NetworkEndpointGroupAppEngine) *string { return v.Version }).(pulumi.StringPtrOutput)\n}", "func (r *Rkt) Version() (string, error) {\n\tver, err := r.Runner.CombinedOutput(\"rkt version\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// rkt Version: 1.24.0\n\t// appc Version: 0.8.10\n\tline := strings.Split(ver, \"\\n\")[0]\n\treturn strings.Replace(line, \"rkt Version: \", \"\", 1), nil\n}", "func (c *Client) Version() string {\n\treturn c.conn.Version()\n}" ]
[ "0.74643797", "0.7188609", "0.70724016", "0.70276886", "0.6924166", "0.6852171", "0.68485165", "0.68244296", "0.6796393", "0.6793432", "0.67549765", "0.67549765", "0.6725175", "0.6683086", "0.6674843", "0.66420186", "0.6634001", "0.6576915", "0.65724236", "0.6564921", "0.6546409", "0.6538453", "0.64431465", "0.6390172", "0.63689137", "0.6339908", "0.6328728", "0.63096", "0.62843883", "0.62830275", "0.6282773", "0.62682104", "0.62682104", "0.62682104", "0.62500787", "0.62500787", "0.62116396", "0.61987174", "0.61933446", "0.6189796", "0.6184143", "0.6164559", "0.6119192", "0.6103943", "0.60848373", "0.60618293", "0.6055845", "0.60406756", "0.6023757", "0.60044163", "0.6004124", "0.6002915", "0.5989458", "0.59883183", "0.5970228", "0.5965497", "0.59615976", "0.5945609", "0.592246", "0.5890377", "0.5890377", "0.5890377", "0.5890377", "0.5890377", "0.5890377", "0.5890377", "0.5890377", "0.58800375", "0.58696806", "0.586699", "0.58557427", "0.5855509", "0.585215", "0.5850275", "0.5849104", "0.58449733", "0.58431494", "0.5840503", "0.5834918", "0.58325136", "0.5805777", "0.579793", "0.57960546", "0.5794661", "0.57915443", "0.57766557", "0.5766023", "0.57609695", "0.5752789", "0.5742628", "0.57380605", "0.5734378", "0.573253", "0.5731833", "0.5719116", "0.57168096", "0.5713161", "0.5703269", "0.570025", "0.56975526" ]
0.77363867
0
CipherSuiteString returns the TLS cipher suite as a string.
CipherSuiteString возвращает TLS-шифровальную комбинацию в виде строки.
func CipherSuiteString(value uint16) string { if str, found := tlsCipherSuiteString[value]; found { return str } return fmt.Sprintf("TLS_CIPHER_SUITE_UNKNOWN_%d", value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CipherSuiteName(suite uint16) string {\n\tswitch suite {\n\tcase tls.TLS_RSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_RSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_RSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_RSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_RSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_RSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_RC4_128_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\"\n\tcase tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\"\n\tcase tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_AES_128_GCM_SHA256:\n\t\treturn \"TLS_AES_128_GCM_SHA256\"\n\tcase tls.TLS_AES_256_GCM_SHA384:\n\t\treturn \"TLS_AES_256_GCM_SHA384\"\n\tcase tls.TLS_CHACHA20_POLY1305_SHA256:\n\t\treturn \"TLS_CHACHA20_POLY1305_SHA256\"\n\tcase tls.TLS_FALLBACK_SCSV:\n\t\treturn \"TLS_FALLBACK_SCSV\"\n\t}\n\n\treturn \"Unknown\"\n}", "func CipherSuiteName(id uint16) string", "func cipherSuiteName(id uint16) string {\n\tswitch id {\n\tcase 0x0005:\n\t\treturn \"TLS_RSA_WITH_RC4_128_SHA\"\n\tcase 0x000a:\n\t\treturn \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase 0x002f:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA\"\n\tcase 0x0035:\n\t\treturn \"TLS_RSA_WITH_AES_256_CBC_SHA\"\n\tcase 0x003c:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase 0x009c:\n\t\treturn \"TLS_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase 0x009d:\n\t\treturn \"TLS_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase 0xc007:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\"\n\tcase 0xc009:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\"\n\tcase 0xc00a:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\"\n\tcase 0xc011:\n\t\treturn \"TLS_ECDHE_RSA_WITH_RC4_128_SHA\"\n\tcase 0xc012:\n\t\treturn \"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase 0xc013:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\"\n\tcase 0xc014:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\"\n\tcase 0xc023:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256\"\n\tcase 0xc027:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256\"\n\tcase 0xc02f:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase 0xc02b:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\"\n\tcase 0xc030:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase 0xc02c:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\"\n\tcase 0xcca8:\n\t\treturn \"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase 0xcca9:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256\"\n\tcase 0x1301:\n\t\treturn \"TLS_AES_128_GCM_SHA256\"\n\tcase 0x1302:\n\t\treturn \"TLS_AES_256_GCM_SHA384\"\n\tcase 0x1303:\n\t\treturn \"TLS_CHACHA20_POLY1305_SHA256\"\n\tcase 0x5600:\n\t\treturn \"TLS_FALLBACK_SCSV\"\n\t}\n\treturn fmt.Sprintf(\"0x%04X\", id)\n}", "func getEncryptionAlg(ciphersuite string) string {\n\tswitch ciphersuite {\n\tcase \"XSTREAM_X25519_HKDF_SHA256_AES128_SIV\":\n\t\treturn \"AES-SIV\"\n\tcase \"XSTREAM_X25519_HKDF_SHA256_AES128_PMAC_SIV\":\n\t\treturn \"AES-PMAC-SIV\"\n\tdefault:\n\t\tpanic(\"XSTREAM: unknown ciphersuite\")\n\t}\n}", "func CipherSuites() []*tls.CipherSuite", "func cipherToString(cipher packet.CipherFunction) string {\n\tswitch cipher {\n\tcase 2:\n\t\treturn \"3DES\"\n\tcase 3:\n\t\treturn \"CAST5\"\n\tcase 7:\n\t\treturn \"AES128\"\n\tcase 8:\n\t\treturn \"AES192\"\n\tcase 9:\n\t\treturn \"AES256\"\n\tdefault:\n\t\treturn \"NotKnown\"\n\t}\n}", "func InsecureCipherSuites() []*tls.CipherSuite", "func (suite Suite) String() string {\n\tnames := []string{\"Spade\", \"Clubs\", \"Hearts\", \"Diamond\"}\n\treturn names[suite]\n}", "func (c Cipher) String() string {\n\tswitch c {\n\tcase AES128CCM:\n\t\treturn \"AES-128-CCM\"\n\tcase AES128GCM:\n\t\treturn \"AES-128-GCM\"\n\tdefault:\n\t\treturn \"Cipher-\" + strconv.Itoa(int(c))\n\t}\n}", "func (s ListenerTls) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c *Provider) CryptoSuite() core.CryptoSuite {\n\treturn c.cryptoSuite\n}", "func (s SecurityMode) String() string {\n\tswitch s {\n\tcase UnsecureOnly:\n\t\treturn UnsecureOnlyStr\n\tcase SecureOnly:\n\t\treturn SecureOnlyStr\n\tcase SecureAndUnsecure:\n\t\treturn SecureAndUnsecureStr\n\tcase UpgradeSecurity:\n\t\treturn UpgradeSecurityStr\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid security mode value %d\", int(s)))\n\t}\n}", "func GetTLSVersion(tr *http.Transport) string {\n switch tr.TLSClientConfig.MinVersion {\n case tls.VersionTLS10:\n return \"TLS 1.0\"\n case tls.VersionTLS11:\n return \"TLS 1.1\"\n case tls.VersionTLS12:\n return \"TLS 1.2\"\n case tls.VersionTLS13:\n return \"TLS 1.3\"\n }\n\n return \"Unknown\"\n}", "func (s SimulationSoftwareSuite) String() string {\n\treturn awsutil.Prettify(s)\n}", "func TLSCipher(cs uint16) string {\n\tswitch cs {\n\tcase 0x0005:\n\t\treturn \"TLS_RSA_WITH_RC4_128_SHA\"\n\tcase 0x000a:\n\t\treturn \"TLS_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase 0x002f:\n\t\treturn \"TLS_RSA_WITH_AES_128_CBC_SHA\"\n\tcase 0x0035:\n\t\treturn \"TLS_RSA_WITH_AES_256_CBC_SHA\"\n\tcase 0xc007:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\"\n\tcase 0xc009:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\"\n\tcase 0xc00a:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\"\n\tcase 0xc011:\n\t\treturn \"TLS_ECDHE_RSA_WITH_RC4_128_SHA\"\n\tcase 0xc012:\n\t\treturn \"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\"\n\tcase 0xc013:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\"\n\tcase 0xc014:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\"\n\tcase 0xc02f:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\"\n\tcase 0xc02b:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\"\n\tcase 0xc030:\n\t\treturn \"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\"\n\tcase 0xc02c:\n\t\treturn \"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\"\n\t}\n\treturn fmt.Sprintf(\"Unknown [%x]\", cs)\n}", "func (s RobotSoftwareSuite) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ListenerTlsCertificate) String() string {\n\treturn awsutil.Prettify(s)\n}", "func defaultCipherSuite() []uint16 {\n\treturn []uint16{\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,\n\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,\n\t\ttls.TLS_RSA_WITH_AES_128_GCM_SHA256,\n\t\ttls.TLS_RSA_WITH_AES_256_GCM_SHA384,\n\t\ttls.TLS_RSA_WITH_AES_128_CBC_SHA,\n\t\ttls.TLS_RSA_WITH_AES_256_CBC_SHA,\n\t}\n}", "func weakCipherSuites(details scan.LabsEndpointDetails) string {\n\t//Will require update as more vulnerabilities discovered, display results for TLS v1.2\n\t//https://github.com/ssllabs/research/wiki/SSL-and-TLS-Deployment-Best-Practices#23-use-secure-cipher-suites\n\tvar vulnSuites string\n\tfor _, suite := range details.Suites {\n\t\tfor _, suiteList := range suite.List {\n\t\t\tif !strings.Contains(suiteList.Name, \"DHE_\") {\n\t\t\t\tif suite.Protocol == 771 {\n\t\t\t\t\tvulnSuites += suiteList.Name + \"\\n\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn (vulnSuites)\n}", "func (pc *MockProviderContext) CryptoSuite() apicryptosuite.CryptoSuite {\n\treturn pc.cryptoSuite\n}", "func getCipherSuiteNames(ids []uint16) []string {\n\tif len(ids) == 0 {\n\t\treturn nil\n\t}\n\tnames := make([]string, len(ids))\n\tfor i, id := range ids {\n\t\tnames[i] = tls.CipherSuiteName(id)\n\t}\n\treturn names\n}", "func (cl *CommandLineInterface) SuiteStringFlag(name string, shorthand *string, defaultValue *string, description string, validationFn validator) {\n\tcl.StringFlagOnFlagSet(cl.suiteFlags, name, shorthand, defaultValue, description, nil, validationFn)\n}", "func EncodeTLSInfoToText(tcs *tls.ConnectionState, cri *tls.CertificateRequestInfo) string {\n\tversion := lookup(tlsVersions, tcs.Version)\n\tcipher := lookup(cipherSuites, tcs.CipherSuite)\n\tdescription := TLSDescription{\n\t\tVersion: tlscolor(version),\n\t\tCipher: tlscolor(explainCipher(cipher)),\n\t}\n\ttlsInfoContext := tlsInfoContext{\n\t\tConn: &description,\n\t}\n\tif cri != nil {\n\t\tcriDesc, err := EncodeCRIToObject(cri)\n\t\tif err == nil {\n\t\t\ttlsInfoContext.CRI = criDesc.(*CertificateRequestInfo)\n\t\t}\n\t}\n\n\tfuncMap := sprig.TxtFuncMap()\n\textras := template.FuncMap{\n\t\t\"printCommonName\": PrintCommonName,\n\t\t\"printShortName\": PrintShortName,\n\t\t\"greenify\": greenify,\n\t}\n\tfor k, v := range extras {\n\t\tfuncMap[k] = v\n\t}\n\n\tt := template.New(\"TLS template\").Funcs(funcMap)\n\tt, err := t.Parse(tlsLayout)\n\tif err != nil {\n\t\t// Should never happen\n\t\tpanic(err)\n\t}\n\tvar buffer bytes.Buffer\n\tw := bufio.NewWriter(&buffer)\n\terr = t.Execute(w, tlsInfoContext)\n\tif err != nil {\n\t\t// Should never happen\n\t\tpanic(err)\n\t}\n\tw.Flush()\n\treturn string(buffer.Bytes())\n}", "func (s PolicyTls) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Provider) String() string {\n\tcert, err := p.GetLeafCertificate()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn cert.Subject.CommonName\n}", "func (cl *CommandLineInterface) SuiteStringOptionsFlag(name string, shorthand *string, defaultValue *string, description string, validOpts []string) {\n\tcl.StringOptionsFlagOnFlagSet(cl.suiteFlags, name, shorthand, defaultValue, description, validOpts)\n}", "func (s TlsContext) String() string {\n\treturn awsutil.Prettify(s)\n}", "func TLSVersionName(version uint16) string {\n\tswitch version {\n\tcase tls.VersionSSL30:\n\t\treturn \"SSL 3.0\"\n\tcase tls.VersionTLS10:\n\t\treturn \"TLS 1.0\"\n\tcase tls.VersionTLS11:\n\t\treturn \"TLS 1.1\"\n\tcase tls.VersionTLS12:\n\t\treturn \"TLS 1.2\"\n\tcase tls.VersionTLS13:\n\t\treturn \"TLS 1.3\"\n\t}\n\n\treturn \"Unknown\"\n}", "func GetSslmode(ctx *pulumi.Context) string {\n\tv, err := config.Try(ctx, \"postgresql:sslmode\")\n\tif err == nil {\n\t\treturn v\n\t}\n\tvar value string\n\tif d := internal.GetEnvOrDefault(nil, nil, \"PGSSLMODE\"); d != nil {\n\t\tvalue = d.(string)\n\t}\n\treturn value\n}", "func parseCipherSuite(ids []string) []uint16 {\n\tciphers := []uint16{}\n\n\tcorrespondenceMap := map[string]uint16{\n\t\t\"TLS_RSA_WITH_RC4_128_SHA\": tls.TLS_RSA_WITH_RC4_128_SHA,\n\t\t\"TLS_RSA_WITH_3DES_EDE_CBC_SHA\": tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,\n\t\t\"TLS_RSA_WITH_AES_128_CBC_SHA\": tls.TLS_RSA_WITH_AES_128_CBC_SHA,\n\t\t\"TLS_RSA_WITH_AES_256_CBC_SHA\": tls.TLS_RSA_WITH_AES_256_CBC_SHA,\n\t\t\"TLS_RSA_WITH_AES_128_CBC_SHA256\": tls.TLS_RSA_WITH_AES_128_CBC_SHA256,\n\t\t\"TLS_RSA_WITH_AES_128_GCM_SHA256\": tls.TLS_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\"TLS_RSA_WITH_AES_256_GCM_SHA384\": tls.TLS_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA\": tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA\": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA\": tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,\n\t\t\"TLS_ECDHE_RSA_WITH_RC4_128_SHA\": tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA,\n\t\t\"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA\": tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\": tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA\": tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256\": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256\": tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\": tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\": tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\": tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\": tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305\": tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\t\"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305\": tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t}\n\n\tfor _, id := range ids {\n\t\tid = strings.ToUpper(id)\n\t\tif cipher, ok := correspondenceMap[id]; ok {\n\t\t\tciphers = append(ciphers, cipher)\n\t\t} else {\n\t\t\tlogger.Fatalf(\"unknown '%s' cipher\", id)\n\t\t}\n\t}\n\n\treturn ciphers\n}", "func (p Postgres) SSLMode() string {\n\tif p.sslmode != \"\" {\n\t\treturn p.sslmode\n\t}\n\treturn getDefaultValue(p, \"sslmode\")\n}", "func GetTestSuite(bs *messages.BuildStep) string {\n\ttestSuite := bs.Step.Name\n\ts := strings.Split(bs.Step.Name, \" \")\n\n\tif bs.Master.Name() == \"chromium.perf\" {\n\t\tfound := false\n\t\t// If a step has a swarming.summary log, then we assume it's a test\n\t\tfor _, b := range bs.Step.Logs {\n\t\t\tif len(b) > 1 && b[0] == \"swarming.summary\" {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\treturn \"\"\n\t\t}\n\t} else if !(strings.HasSuffix(s[0], \"tests\") || strings.HasSuffix(s[0], \"test_apk\")) {\n\t\t// Some test steps have names like \"webkit_tests iOS(dbug)\" so we look at the first\n\t\t// term before the space, if there is one.\n\t\treturn testSuite\n\t}\n\n\t// Recipes add a suffix to steps of the OS that it's run on, when the test\n\t// is swarmed. The step name is formatted like this: \"<task title> on <OS>\".\n\t// Added in this code:\n\t// https://chromium.googlesource.com/chromium/tools/build/+/9ef66559727c320b3263d7e82fb3fcd1b6a3bd55/scripts/slave/recipe_modules/swarming/api.py#846\n\tif len(s) > 2 && s[1] == \"on\" {\n\t\ttestSuite = s[0]\n\t}\n\n\treturn testSuite\n}", "func (env Environment) String() string {\n\tswitch env {\n\tcase Local:\n\t\treturn \"Local\"\n\tcase Development:\n\t\treturn \"Development\"\n\tcase PreProduction:\n\t\treturn \"Pre-Production\"\n\tcase Production:\n\t\treturn \"Production\"\n\tcase UnitTest:\n\t\treturn \"UnitTest\"\n\tcase SystemIntegrationTest:\n\t\treturn \"SystemIntegrationTest\"\n\tcase SystemTest:\n\t\treturn \"SystemTest\"\n\tcase UserAcceptanceTest:\n\t\treturn \"UserAcceptanceTest\"\n\tcase PerformanceEvaluationTest:\n\t\treturn \"PerformanceEvaluationTest\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Env(%d)\", env)\n\t}\n}", "func (s ListenerTlsAcmCertificate) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s VirtualGatewayTlsValidationContext) String() string {\n\treturn awsutil.Prettify(s)\n}", "func VersionString(value uint16) string {\n\tif str, found := tlsVersionString[value]; found {\n\t\treturn str\n\t}\n\treturn fmt.Sprintf(\"TLS_VERSION_UNKNOWN_%d\", value)\n}", "func (encl StoreEncryptionSpecList) String() string {\n\tvar buffer bytes.Buffer\n\tfor _, ss := range encl.Specs {\n\t\tfmt.Fprintf(&buffer, \"--%s=%s \", cliflagsccl.EnterpriseEncryption.Name, ss)\n\t}\n\t// Trim the extra space from the end if it exists.\n\tif l := buffer.Len(); l > 0 {\n\t\tbuffer.Truncate(l - 1)\n\t}\n\treturn buffer.String()\n}", "func (s ListenerTlsFileCertificate) String() string {\n\treturn awsutil.Prettify(s)\n}", "func GetsockoptString(fd, level, opt int) (string, error) {\n\tbuf := make([]byte, 256)\n\tvallen := _Socklen(len(buf))\n\terr := getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(buf[:vallen-1]), nil\n}", "func (d Database) String() string {\n\treturn fmt.Sprintf(\"sslmode=%s host=%s user=%s dbname=%s\", d.SSLmode, d.Host, d.User, d.DBname)\n}", "func (s ServerGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ServerGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (t *Token) SecureString() string {\n\tdot := bytes.LastIndexByte(t.raw, '.')\n\treturn string(t.raw[:dot]) + `.<signature>`\n}", "func (c *Client) GetSuite(ctx context.Context, params *GetSuiteInput, optFns ...func(*Options)) (*GetSuiteOutput, error) {\n\tif params == nil {\n\t\tparams = &GetSuiteInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"GetSuite\", params, optFns, addOperationGetSuiteMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*GetSuiteOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (d *Device) CgroupString() string {\n\t// Agreement with Product:\n\t// we do not care about sub logic block device, they will take care of it.\n\treturn fmt.Sprintf(\"%s %s:%s %s\", d.Type, deviceNumberString(d.Major), deviceNumberString(d.Minor), d.Permissions)\n}", "func StringToTLSVersion(st string) TLSVersion {\n\tswitch TLSVersion(st) {\n\tcase TLSVersion1p0:\n\t\treturn TLSVersion1p0\n\tcase TLSVersion1p1:\n\t\treturn TLSVersion1p1\n\tcase TLSVersion1p2:\n\t\treturn TLSVersion1p2\n\tcase TLSVersion1p3:\n\t\treturn TLSVersion1p3\n\t}\n\treturn TLSVersionInvalid\n}", "func (s TlsValidationContext) String() string {\n\treturn awsutil.Prettify(s)\n}", "func GetSslMode(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"postgresql:sslMode\")\n}", "func (l CacheMode) String() string {\n\tif l >= CacheMode(len(cacheModeToString)) {\n\t\treturn fmt.Sprintf(\"CacheMode(%d)\", l)\n\t}\n\treturn cacheModeToString[l]\n}", "func (cm CryptMethod) String() string {\n\tif cm == 1 {\n\t\treturn \"AES\"\n\t}\n\treturn \"none\"\n}", "func (s AnalyticsSessionGroupByKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s FirewallRuleGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (t AuthenticatorProtocol) String() string {\n\treturn string(t)\n}", "func (s AnalyticsSessionGroupBySpecification) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (a *L3n4Addr) StringWithProtocol() string {\n\tvar scope string\n\tif a.Scope == ScopeInternal {\n\t\tscope = \"/i\"\n\t}\n\tif a.IsIPv6() {\n\t\treturn \"[\" + a.AddrCluster.String() + \"]:\" + strconv.FormatUint(uint64(a.Port), 10) + \"/\" + a.Protocol + scope\n\t}\n\treturn a.AddrCluster.String() + \":\" + strconv.FormatUint(uint64(a.Port), 10) + \"/\" + a.Protocol + scope\n}", "func (s SecurityGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "func SecureRandomString(keyLength int) (string, error) {\n\tkey, err := randomKey(keyLength)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tid := fmt.Sprintf(\"%0x\", key[0:keyLength])\n\treturn id, nil\n}", "func (s Subject) String() string {\n\treturn fmt.Sprintf(\"%s, %s, %s\", s.AuthenticationInfo, s.AuthorizationInfo, s.Session)\n}", "func (s VirtualGatewayListenerTls) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s VirtualGatewayListenerTlsCertificate) String() string {\n\treturn awsutil.Prettify(s)\n}", "func VersionString() string {\n\treturn C.GoString(C.LZ4_versionString())\n}", "func GetProtocolString(proto string) string {\n\tlookupKey := fmt.Sprintf(\"%s\", proto)\n\n\tprotocolName, err := LookupTZName(lookupKey, \"tz.tezz.ie\")\n\n\tif err != nil {\n\t\tlog.Printf(\"No protocol found for %s, err: %s\", lookupKey, err)\n\t\tprotocolName = proto\n\t}\n\n\treturn fmt.Sprintf(\"Protocol %s is now live on mainnet!\", protocolName)\n}", "func getCipherSuites(names []string) ([]uint16, error) {\n\tif len(names) == 0 {\n\t\treturn defaultCipherSuites, nil\n\t}\n\tcipherSuiteConsts := make([]uint16, len(names))\n\tfor i, name := range names {\n\t\tcipherSuiteConst, ok := cipherSuites[name]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unknown TLS cipher suite '%s' specified for http.tls.cipherSuites\", name)\n\t\t}\n\t\tcipherSuiteConsts[i] = cipherSuiteConst\n\t}\n\treturn cipherSuiteConsts, nil\n}", "func TraceString(ctx context.Context) string {\n\tif ctx == nil {\n\t\treturn \"ctx=null\"\n\t}\n\ts, err := Format(ctx)\n\tif nil != err || \"\" == s {\n\t\treturn \"ctx_format=unset\"\n\t}\n\treturn s\n}", "func TLSVersion(ver uint16) string {\n\tswitch ver {\n\tcase tls.VersionTLS10:\n\t\treturn \"1.0\"\n\tcase tls.VersionTLS11:\n\t\treturn \"1.1\"\n\tcase tls.VersionTLS12:\n\t\treturn \"1.2\"\n\t}\n\treturn fmt.Sprintf(\"Unknown [%x]\", ver)\n}", "func GetCipherPassword() string {\n\tcpass := C.rresGetCipherPassword()\n\treturn C.GoString(cpass)\n}", "func (s SessionContext) String() string {\n\treturn awsutil.Prettify(s)\n}", "func __decryptString(key []byte, enc string) string {\n\tdata, err := base64.StdEncoding.DecodeString(enc)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tsaltHeader := data[:aes.BlockSize]\n\tif string(saltHeader[:7]) != openSSLSaltHeader {\n\t\tlog.Fatal(\"String doesn't appear to have been encrypted with OpenSSL\")\n\t}\n\tsalt := saltHeader[8:]\n\tcreds := __extractOpenSSLCreds(key, salt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn string(__decrypt(creds.key, creds.iv, data))\n}", "func (k Key) GetPlatformString() string {\n\treturn k.platform\n}", "func (s NASSecurityGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "func FirewallMode() string {\n\ts, _ := firewallMode.Load().(string)\n\treturn s\n}", "func (s FeatureGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s SessionSpecification) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s VirtualGatewayTlsValidationContextTrust) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c ConversionMode) GetString() string {\n\tswitch c {\n\tcase NONE:\n\t\treturn \"NONE\"\n\tcase FLOAT:\n\t\treturn \"FLOAT\"\n\tcase INTEGER:\n\t\treturn \"INTEGER\"\n\tcase UNSIGNED:\n\t\treturn \"UNSIGNED INTEGER\"\n\tcase STRING:\n\t\treturn \"STRING\"\n\tcase BOOLEAN:\n\t\treturn \"BOOLEAN\"\n\tcase HWADDRESS:\n\t\treturn \"HARDWARE ADDRESS\"\n\tcase IPADDRESS:\n\t\treturn \"IP ADDRESS\"\n\t}\n\treturn \"\"\n}", "func (s DeclineHandshakeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func GetTLSCommonName(ctx context.Context) string {\n\tissuer := ctx.Value(PouchTLSCommonName)\n\tif issuer == nil {\n\t\treturn \"\"\n\t}\n\treturn issuer.(string)\n}", "func (t ConsumerGroupState) String() string {\n\treturn C.GoString(C.rd_kafka_consumer_group_state_name(\n\t\tC.rd_kafka_consumer_group_state_t(t)))\n}", "func (s TlsValidationContextTrust) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (l Locale) String() string {\n\tconst sep = '-'\n\tvar buf [12]byte\n\n\tlang, script, region := l.Subtags()\n\tn := copy(buf[:], lang)\n\tif script != \"\" {\n\t\tbuf[n] = sep\n\t\tn++\n\t\tn += copy(buf[n:], script)\n\t}\n\tif region != \"\" {\n\t\tbuf[n] = sep\n\t\tn++\n\t\tn += copy(buf[n:], region)\n\t}\n\treturn string(buf[:n])\n}", "func CryptoString(n int) string {\n\ts, err := cryptoString(n)\n\tif err != nil {\n\t\treturn String(n)\n\t}\n\treturn s\n}", "func (s VirtualGatewayClientPolicyTls) String() string {\n\treturn awsutil.Prettify(s)\n}", "func protocolToString(proto Protocol) string {\n\tswitch proto {\n\tcase unix.IPPROTO_TCP:\n\t\treturn \"TCP\"\n\tcase unix.IPPROTO_UDP:\n\t\treturn \"UDP\"\n\tcase unix.IPPROTO_SCTP:\n\t\treturn \"SCTP\"\n\t}\n\treturn \"\"\n}", "func (s GetFirewallRuleGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DescribeFeatureGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ChannelSpecification) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s TlsConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "func ConnectionString() string {\n\tuser := config.DBUser()\n\thost := config.DBHost()\n\tdbname := config.DBName()\n\tpasswd := config.DBPasswd()\n\tconnectString := fmt.Sprintf(\"host=%s user=%s dbname=%s sslmode=disable password=%s\", host, user, dbname, passwd)\n\treturn connectString\n}", "func NewSuiteContext(suiteID string) *types.SuiteContext {\n\tvar suiteCtx types.SuiteContext = types.SuiteContext{}\n\tsuiteCtx.SuiteID = suiteID\n\n\tsuiteCtx.OnlyTestOperator = onlyTestOperator\n\tif suiteCtx.OnlyTestOperator {\n\t\tlog.Info(\"Only testing operator functionality\")\n\t}\n\n\tsuiteCtx.DisableClusteredTests = disableClusteredTests\n\tif suiteCtx.DisableClusteredTests {\n\t\tlog.Info(\"Clustered registry tests disabled\")\n\t}\n\n\tsuiteCtx.DisableConvertersTests = disableConvertersTests\n\tif suiteCtx.DisableConvertersTests {\n\t\tlog.Info(\"Converters tests disabled\")\n\t}\n\n\tsuiteCtx.DisableAuthTests = disableAuthTests\n\tif suiteCtx.DisableAuthTests {\n\t\tlog.Info(\"Keycloak Authentication tests disabled\")\n\t}\n\n\tsuiteCtx.OLMRunAdvancedTestcases = olmRunAdvancedTestcases\n\tif suiteCtx.OLMRunAdvancedTestcases {\n\t\tlog.Info(\"Running Advanced Testcases with OLM deployment\")\n\t}\n\n\tsuiteCtx.SetupSelenium = setupSelenium\n\n\treturn &suiteCtx\n}", "func (s DescribeNASSecurityGroupsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s RuleGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (t OptTPacketVersion) String() string {\n\tswitch t {\n\tcase TPacketVersion1:\n\t\treturn \"V1\"\n\tcase TPacketVersion2:\n\t\treturn \"V2\"\n\tcase TPacketVersion3:\n\t\treturn \"V3\"\n\tcase TPacketVersionHighestAvailable:\n\t\treturn \"HighestAvailable\"\n\t}\n\treturn \"InvalidVersion\"\n}", "func (s KmsEncryptionConfig) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c *Client) GetLanguagePackString(ctx context.Context, request *GetLanguagePackStringRequest) (LanguagePackStringValueClass, error) {\n\tvar result LanguagePackStringValueBox\n\n\tif err := c.rpc.Invoke(ctx, request, &result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.LanguagePackStringValue, nil\n}", "func (s DescribeModelPackageGroupOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DescribeTargetGroupsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func stringToSpec(ja3 string) (*tls.ClientHelloSpec, error) {\n\ttokens := strings.Split(ja3, \",\")\n\n\tversion := tokens[0]\n\tciphers := strings.Split(tokens[1], \"-\")\n\textensions := strings.Split(tokens[2], \"-\")\n\tcurves := strings.Split(tokens[3], \"-\")\n\tif len(curves) == 1 && curves[0] == \"\" {\n\t\tcurves = []string{}\n\t}\n\tpointFormats := strings.Split(tokens[4], \"-\")\n\tif len(pointFormats) == 1 && pointFormats[0] == \"\" {\n\t\tpointFormats = []string{}\n\t}\n\n\t// parse curves\n\tvar targetCurves []tls.CurveID\n\tfor _, c := range curves {\n\t\tcid, err := strconv.ParseUint(c, 10, 16)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttargetCurves = append(targetCurves, tls.CurveID(cid))\n\t}\n\textMap[\"10\"] = &tls.SupportedCurvesExtension{Curves: targetCurves}\n\n\t// parse point formats\n\tvar targetPointFormats []byte\n\tfor _, p := range pointFormats {\n\t\tpid, err := strconv.ParseUint(p, 10, 8)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttargetPointFormats = append(targetPointFormats, byte(pid))\n\t}\n\textMap[\"11\"] = &tls.SupportedPointsExtension{SupportedPoints: targetPointFormats}\n\n\t// build extenions list\n\tvar exts []tls.TLSExtension\n\tfor _, e := range extensions {\n\t\tte, ok := extMap[e]\n\t\tif !ok {\n\t\t\treturn nil, ErrExtensionNotExist(e)\n\t\t}\n\t\texts = append(exts, te)\n\t}\n\t// build SSLVersion\n\tvid64, err := strconv.ParseUint(version, 10, 16)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvid := uint16(vid64)\n\n\t// build CipherSuites\n\tvar suites []uint16\n\tfor _, c := range ciphers {\n\t\tcid, err := strconv.ParseUint(c, 10, 16)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsuites = append(suites, uint16(cid))\n\t}\n\n\treturn &tls.ClientHelloSpec{\n\t\tTLSVersMin: vid,\n\t\tTLSVersMax: vid,\n\t\tCipherSuites: suites,\n\t\tCompressionMethods: []byte{0},\n\t\tExtensions: exts,\n\t\tGetSessionID: sha256.Sum256,\n\t}, nil\n}", "func stringToSpec(ja3 string) (*tls.ClientHelloSpec, error) {\n\ttokens := strings.Split(ja3, \",\")\n\n\tversion := tokens[0]\n\tciphers := strings.Split(tokens[1], \"-\")\n\textensions := strings.Split(tokens[2], \"-\")\n\tcurves := strings.Split(tokens[3], \"-\")\n\tif len(curves) == 1 && curves[0] == \"\" {\n\t\tcurves = []string{}\n\t}\n\tpointFormats := strings.Split(tokens[4], \"-\")\n\tif len(pointFormats) == 1 && pointFormats[0] == \"\" {\n\t\tpointFormats = []string{}\n\t}\n\n\t// parse curves\n\tvar targetCurves []tls.CurveID\n\tfor _, c := range curves {\n\t\tcid, err := strconv.ParseUint(c, 10, 16)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttargetCurves = append(targetCurves, tls.CurveID(cid))\n\t}\n\textMap[\"10\"] = &tls.SupportedCurvesExtension{targetCurves}\n\n\t// parse point formats\n\tvar targetPointFormats []byte\n\tfor _, p := range pointFormats {\n\t\tpid, err := strconv.ParseUint(p, 10, 8)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttargetPointFormats = append(targetPointFormats, byte(pid))\n\t}\n\textMap[\"11\"] = &tls.SupportedPointsExtension{SupportedPoints: targetPointFormats}\n\n\t// build extenions list\n\tvar exts []tls.TLSExtension\n\tfor _, e := range extensions {\n\t\tte, ok := extMap[e]\n\t\tif !ok {\n\t\t\treturn nil, ErrExtensionNotExist(e)\n\t\t}\n\t\texts = append(exts, te)\n\t}\n\t// build SSLVersion\n\tvid64, err := strconv.ParseUint(version, 10, 16)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvid := uint16(vid64)\n\n\t// build CipherSuites\n\tvar suites []uint16\n\tfor _, c := range ciphers {\n\t\tcid, err := strconv.ParseUint(c, 10, 16)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsuites = append(suites, uint16(cid))\n\t}\n\n\treturn &tls.ClientHelloSpec{\n\t\tTLSVersMin: vid,\n\t\tTLSVersMax: vid,\n\t\tCipherSuites: suites,\n\t\tCompressionMethods: []byte{0},\n\t\tExtensions: exts,\n\t\tGetSessionID: sha256.Sum256,\n\t}, nil\n}", "func (cl *CommandLineInterface) SuiteStringSliceFlag(name string, shorthand *string, defaultValue []string, description string) {\n\tcl.StringSliceFlagOnFlagSet(cl.suiteFlags, name, shorthand, defaultValue, description)\n}", "func (s VirtualGatewayListenerTlsAcmCertificate) String() string {\n\treturn awsutil.Prettify(s)\n}" ]
[ "0.69200236", "0.6264078", "0.60463476", "0.553764", "0.552981", "0.55205077", "0.5297108", "0.52549493", "0.521741", "0.5183919", "0.51783603", "0.51552385", "0.5096407", "0.50740904", "0.5053442", "0.49669608", "0.49222544", "0.49079034", "0.4856489", "0.48283112", "0.4725081", "0.46970397", "0.465581", "0.4648689", "0.46257386", "0.46100813", "0.4596472", "0.45590538", "0.45541683", "0.45176986", "0.45173398", "0.4507374", "0.44861397", "0.4485729", "0.44779718", "0.44613433", "0.44572833", "0.44054815", "0.43943477", "0.43728155", "0.43684003", "0.43684003", "0.43590215", "0.43291125", "0.4311861", "0.43038526", "0.42955858", "0.42940152", "0.42821586", "0.42561096", "0.4248566", "0.42333156", "0.42205018", "0.4218728", "0.42178547", "0.42147586", "0.42114002", "0.4206197", "0.4204337", "0.41991788", "0.41960233", "0.41948593", "0.4190752", "0.41898793", "0.41701746", "0.41689342", "0.41607383", "0.41411617", "0.4136703", "0.41302443", "0.41300574", "0.4126731", "0.4124398", "0.41160923", "0.41112393", "0.40916666", "0.40767798", "0.4076571", "0.40729055", "0.40708682", "0.40672797", "0.40590572", "0.4056697", "0.40526065", "0.4051846", "0.40468758", "0.40399182", "0.40388468", "0.40380794", "0.40278676", "0.4027591", "0.4023482", "0.40160418", "0.401533", "0.4010591", "0.40099627", "0.40090314", "0.39999592", "0.39949524", "0.39920157" ]
0.77113676
0
launch will start given hook.
Запуск начнет заданный хук.
func (e *Engine) launch(h Hook) { e.wait.Add(1) go func() { defer e.wait.Done() runtime := &HookRuntime{} // Wait for an event to notify this goroutine that a shutdown is required. // It could either be from engine's context or during Hook startup if an error has occurred. // NOTE: If HookRuntime returns an error, we have to shutdown every Hook... err := runtime.WaitForEvent(e.ctx, h) if err != nil { e.mutex.Lock() e.log(err) e.cancel() e.cause = err e.mutex.Unlock() } // Wait for hook to gracefully shutdown, or kill it after timeout. // This is handled by HookRuntime. for _, err := range runtime.Shutdown(e.timeout) { e.mutex.Lock() e.log(err) e.mutex.Unlock() } }() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Launch(actions []actloop.Action, logger *log.Logger) (stop func()) {\n\tloop := actloop.NewActLoop(actions, logger)\n\tgo loop.Run(time.Second*2, time.Minute*5, notifyReady)\n\treturn loop.Cancel\n}", "func Launch(addr, localDir, filename string,\n\targs []string, logDir string, retry int) error {\n\n\tfields := strings.Split(addr, \":\")\n\tif len(fields) != 2 || len(fields[0]) <= 0 || len(fields[1]) <= 0 {\n\t\treturn fmt.Errorf(\"Launch addr %s not in form of host:port\")\n\t}\n\n\tc, e := connect(fields[0])\n\tif e != nil {\n\t\treturn e\n\t}\n\tdefer c.Close()\n\n\te = c.Call(\"Prism.Launch\",\n\t\t&Cmd{addr, localDir, filename, args, logDir, retry}, nil)\n\tif e != nil {\n\t\treturn fmt.Errorf(\"Prism.Launch failed: %v\", e)\n\t}\n\treturn nil\n}", "func executeLaunch() {\n\tfmt.Println(\"Launching ...\")\n}", "func (vr *VoiceRecorder) Launch(ctx context.Context) error {\n\t// vr.app.Install() will install the app only if the app doesn't exist.\n\tif err := vr.app.Install(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tif err := vr.grantPermissions(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to grant permission\")\n\t}\n\n\tif _, err := vr.app.Launch(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tstartOrStopRecordBtn := vr.app.Device.Object(ui.ID(startOrStopRecordBtnID))\n\tif err := apputil.WaitForExists(startOrStopRecordBtn, defaultUITimeout)(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"voice recorder is not ready\")\n\t}\n\n\treturn nil\n}", "func (tr *TaskRunner) prestart() error {\n\t// Determine if the allocation is terminal and we should avoid running\n\t// prestart hooks.\n\tif tr.shouldShutdown() {\n\t\ttr.logger.Trace(\"skipping prestart hooks since allocation is terminal\")\n\t\treturn nil\n\t}\n\n\tif tr.logger.IsTrace() {\n\t\tstart := time.Now()\n\t\ttr.logger.Trace(\"running prestart hooks\", \"start\", start)\n\t\tdefer func() {\n\t\t\tend := time.Now()\n\t\t\ttr.logger.Trace(\"finished prestart hooks\", \"end\", end, \"duration\", end.Sub(start))\n\t\t}()\n\t}\n\n\t// use a join context to allow any blocking pre-start hooks\n\t// to be canceled by either killCtx or shutdownCtx\n\tjoinedCtx, joinedCancel := joincontext.Join(tr.killCtx, tr.shutdownCtx)\n\tdefer joinedCancel()\n\n\tfor _, hook := range tr.runnerHooks {\n\t\tpre, ok := hook.(interfaces.TaskPrestartHook)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tname := pre.Name()\n\n\t\t// Build the request\n\t\treq := interfaces.TaskPrestartRequest{\n\t\t\tTask: tr.Task(),\n\t\t\tTaskDir: tr.taskDir,\n\t\t\tTaskEnv: tr.envBuilder.Build(),\n\t\t\tTaskResources: tr.taskResources,\n\t\t}\n\n\t\torigHookState := tr.hookState(name)\n\t\tif origHookState != nil {\n\t\t\tif origHookState.PrestartDone {\n\t\t\t\ttr.logger.Trace(\"skipping done prestart hook\", \"name\", pre.Name())\n\n\t\t\t\t// Always set env vars from hooks\n\t\t\t\tif name == HookNameDevices {\n\t\t\t\t\ttr.envBuilder.SetDeviceHookEnv(name, origHookState.Env)\n\t\t\t\t} else {\n\t\t\t\t\ttr.envBuilder.SetHookEnv(name, origHookState.Env)\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Give the hook it's old data\n\t\t\treq.PreviousState = origHookState.Data\n\t\t}\n\n\t\treq.VaultToken = tr.getVaultToken()\n\t\treq.NomadToken = tr.getNomadToken()\n\n\t\t// Time the prestart hook\n\t\tvar start time.Time\n\t\tif tr.logger.IsTrace() {\n\t\t\tstart = time.Now()\n\t\t\ttr.logger.Trace(\"running prestart hook\", \"name\", name, \"start\", start)\n\t\t}\n\n\t\t// Run the prestart hook\n\t\tvar resp interfaces.TaskPrestartResponse\n\t\tif err := pre.Prestart(joinedCtx, &req, &resp); err != nil {\n\t\t\ttr.emitHookError(err, name)\n\t\t\treturn structs.WrapRecoverable(fmt.Sprintf(\"prestart hook %q failed: %v\", name, err), err)\n\t\t}\n\n\t\t// Store the hook state\n\t\t{\n\t\t\thookState := &state.HookState{\n\t\t\t\tData: resp.State,\n\t\t\t\tPrestartDone: resp.Done,\n\t\t\t\tEnv: resp.Env,\n\t\t\t}\n\n\t\t\t// Store and persist local state if the hook state has changed\n\t\t\tif !hookState.Equal(origHookState) {\n\t\t\t\ttr.stateLock.Lock()\n\t\t\t\ttr.localState.Hooks[name] = hookState\n\t\t\t\ttr.stateLock.Unlock()\n\n\t\t\t\tif err := tr.persistLocalState(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Store the environment variables returned by the hook\n\t\tif name == HookNameDevices {\n\t\t\ttr.envBuilder.SetDeviceHookEnv(name, resp.Env)\n\t\t} else {\n\t\t\ttr.envBuilder.SetHookEnv(name, resp.Env)\n\t\t}\n\n\t\t// Store the resources\n\t\tif len(resp.Devices) != 0 {\n\t\t\ttr.hookResources.setDevices(resp.Devices)\n\t\t}\n\t\tif len(resp.Mounts) != 0 {\n\t\t\ttr.hookResources.setMounts(resp.Mounts)\n\t\t}\n\n\t\tif tr.logger.IsTrace() {\n\t\t\tend := time.Now()\n\t\t\ttr.logger.Trace(\"finished prestart hook\", \"name\", name, \"end\", end, \"duration\", end.Sub(start))\n\t\t}\n\t}\n\n\treturn nil\n}", "func (l *Launcher) Launch(self string, cmd []string) error {\n\tprocess, err := l.ProcessFor(cmd)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"determine start command\")\n\t}\n\treturn l.LaunchProcess(self, process)\n}", "func HookOnJobStart(hooks []string, j common.Job) {\n\tlog.WithField(\"id\", j.UUID).Debug(\"Executing hooks against job start.\")\n\n\tdata := copyJobToHookJob(j)\n\n\thooksRun(hooks, data)\n\n}", "func (la Launch) execute(l *Lobby) {\n\tl.started = true\n\tla.Event = \"launch\"\n\tl.send <- la\n}", "func (l *Launcher) Start(sourceProvider launchers.SourceProvider, pipelineProvider pipeline.Provider, registry auditor.Registry, tracker *tailers.TailerTracker) {\n\tl.sources = sourceProvider.GetAddedForType(config.JournaldType)\n\tl.pipelineProvider = pipelineProvider\n\tl.registry = registry\n\tgo l.run()\n}", "func (h *Handler) OnLaunch(ctx context.Context, request *alexa.Request, session *alexa.Session, ctxPtr *alexa.Context, response *alexa.Response) error {\n\tlog.Printf(\"OnLaunch requestId=%s, sessionId=%s\", request.RequestID, session.SessionID)\n\treturn nil\n}", "func (m *TestMod) Hook() error {\n\tm.RegisterCommand(NewTestCommand(m))\n\t//m.RegisterCommand(NewMonkeyCommand(m))\n\n\treturn nil\n}", "func (gitHubHook *GitHubHook) StartGitHubHook() {\n\trouter := httprouter.New()\n\trouter.POST(gitHubHook.GitHubHookEndPoint, gitHubHook.receiveGiHubDelivery)\n\tlog.Fatal(http.ListenAndServe(\":\"+gitHubHook.GitHubHookPort, router))\n}", "func Launch(eventBroker wire.EventBroker, committee Reducers, keys user.Keys,\n\ttimeout time.Duration, rpcBus *wire.RPCBus) {\n\tif committee == nil {\n\t\tcommittee = newReductionCommittee(eventBroker, nil)\n\t}\n\n\thandler := newReductionHandler(committee, keys)\n\tbroker := newBroker(eventBroker, handler, timeout, rpcBus)\n\tgo broker.Listen()\n}", "func Launch(start func() error, shutdown func() error, timeout time.Duration) {\n\tdone := make(chan int)\n\tgo func() {\n\t\tif err := start(); err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tdone <- 1\n\t\t}\n\t\tdone <- 0\n\t}()\n\tch := make(chan os.Signal, 2)\n\tsignal.Notify(ch, []os.Signal{syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT}...)\n\n\tselect {\n\tcase exitCode := <-done:\n\t\tif shutdown != nil {\n\t\t\tif err := shutdownWithTimeout(shutdown, timeout); err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t}\n\t\tos.Exit(exitCode)\n\tcase s := <-ch:\n\t\tfmt.Printf(\"received signal %s: terminating\\n\", s)\n\t\tif shutdown != nil {\n\t\t\tif err := shutdownWithTimeout(shutdown, timeout); err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t}\n\t\tos.Exit(0)\n\t}\n}", "func Launch(th ThreadWithRole) error {\n\tif e := AllocThread(th); e != nil {\n\t\treturn e\n\t}\n\tth.Launch()\n\treturn nil\n}", "func Launch(ctx context.Context, tconn *chrome.TestConn, appID string) error {\n\tif err := testing.Poll(ctx, func(ctx context.Context) error {\n\t\tcapps, err := ash.ChromeApps(ctx, tconn)\n\t\tif err != nil {\n\t\t\ttesting.PollBreak(err)\n\t\t}\n\t\tfor _, capp := range capps {\n\t\t\tif capp.AppID == appID {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn errors.New(\"App not yet found in available Chrome apps\")\n\t}, nil); err != nil {\n\t\treturn err\n\t}\n\treturn tconn.Call(ctx, nil, `tast.promisify(chrome.autotestPrivate.launchApp)`, appID)\n}", "func (s *BaseGShellListener) EnterStart(ctx *StartContext) {}", "func Launch(addr string) {\n\tlog.Fatal(http.ListenAndServe(addr, nil))\n}", "func (p PRPlugin) entrypoint(env *ActionsEnv) (err error) {\n\tswitch env.Event.GetAction() {\n\tcase actionOpen:\n\t\terr = p.onOpen(env)\n\tcase actionReopen:\n\t\terr = p.onReopen(env)\n\tcase actionEdit:\n\t\terr = p.onEdit(env)\n\tcase actionSync:\n\t\terr = p.onSync(env)\n\tdefault:\n\t\tp.Warningf(\"action %q received with no defined procedure, skipping\", env.Event.GetAction())\n\t}\n\n\treturn\n}", "func (fn *RuntimeMonitor) StartBundle(ctx context.Context, emit func([]byte, []byte)) {\n\truntime.Update(ctx, time.Now().UnixNano())\n}", "func (l *Launcher) Main(args []string) (int, error) {\n\tvar ret int\n\tif args == nil || len(args) < 2 {\n\t\t// todo print help about all registered jobs\n\t\tfmt.Println(\"Requires \\\"launch\\\" or job name as parameter\")\n\t\tkeys := l.ListFunctions()\n\t\tif len(keys) > 0 {\n\t\t\tfmt.Println(\"Following job names available:\")\n\t\t\tfor _, name := range keys {\n\t\t\t\tfmt.Println(name)\n\t\t\t}\n\t\t}\n\t\treturn 0, UnknownFunctionError\n\t}\n\tfname := args[1]\n\tif fname == \"launch\" {\n\t\tif fn, found := l.fs[\"workflow\"]; found == false {\n\t\t\tfmt.Println(\"No workflow function registered\")\n\t\t\tos.Exit(1)\n\t\t} else {\n\t\t\tfn.F(args[2:])\n\t\t}\n\t}\n\tfn, found := l.fs[fname]\n\tif !found {\n\t\treturn 0, UnknownFunctionError\n\t}\n\t// execute function\n\tret = fn.F(args[2:])\n\treturn ret, nil\n}", "func RunFromHook(db gorp.SqlExecutor, w *sdk.Workflow, e *sdk.WorkflowNodeRunHookEvent) (*sdk.WorkflowRun, error) {\n\treturn nil, nil\n}", "func start() {\n\tfmt.Printf(\"Starting %s...\", AppName)\n\tif err := Start(1); err != nil {\n\t\tfailed(err)\n\t} else {\n\t\tfmt.Println(\"OK\")\n\t}\n}", "func (app *App) Launch() (string, error) {\n\treturn app.tv.LaunchApp(app.ID)\n}", "func Launch() {\n\thttp.HandleFunc(\"/\", indexHandler)\n\thttp.ListenAndServe(\":1234\", nil)\n}", "func (s *kataBuiltInShim) start(sandbox *Sandbox, params ShimParams) (int, error) {\n\treturn -1, nil\n}", "func OnStart() {\n}", "func Main(args []string) {\n\twebhook.Launch(\n\t\tnil,\n\t\t9997,\n\t\tvalidator.AdmitSP,\n\t\t\"linkerd-sp-validator\",\n\t\t\"sp-validator\",\n\t\targs,\n\t)\n}", "func onLaunch() {\n\tmenu := &Menu{}\n\n\tapp.MenuBar().Mount(menu)\n\tapp.Dock().Mount(menu)\n\n\tmainWindow = newWelcomeWindow()\n}", "func (l *Logger) Hook(e zapcore.Entry) error {\n\tif l.IsHook {\n\t\terr := log.Emit(&log.Content{\n\t\t\tLevel: e.Level.CapitalString(),\n\t\t\tMessage: e.Message,\n\t\t\tDate: e.Time,\n\t\t\tCaller: e.Caller.TrimmedPath(),\n\t\t\tStack: e.Stack,\n\t\t})\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *Basegff3Listener) EnterStart(ctx *StartContext) {}", "func main() {\n\tvar err error\n\n\t// Get the location of the config file (relative to the binary)\n\tconfigLocation := flag.String(\n\t\t\"config\",\n\t\tDEFAULT_CONFIG_LOCATION,\n\t\t\"location of toml config file\")\n\tflag.Parse()\n\n\t// Load the config file (config needs to be toml)\n\tconfig, err = toml.LoadFile(*configLocation)\n\n\tif err != nil {\n\t\tpanic(\"No config file... cannot continue\")\n\t}\n\n\t// Get the port to listen on\n\tportStr := config.Get(\"server.port\").(string)\n\tport, _ := strconv.ParseInt(portStr, 10, 64)\n\n\tif port == 0 || port < 0 {\n\t\tport = DEFAULT_PORT\n\t}\n\n\tfmt.Printf(\"-------------- starting to listen on port %d\", port)\n\thttp.Handle(\"/hook\", http.HandlerFunc(getHook))\n\terr = http.ListenAndServe(fmt.Sprintf(\":%d\", port), nil)\n\n\tif err != nil {\n\t\tpanic(\"Can't listen or serve!!\" + err.Error())\n\t}\n}", "func (ssc *defaultGameStatefulSetControl) newHookRunFromGameStatefulSet(canaryCtx *canaryContext, hookStep *hookv1alpha1.HookStep,\n\targs []hookv1alpha1.Argument, revision string, stepIdx *int32, labels map[string]string) (*hookv1alpha1.HookRun, error) {\n\tset := canaryCtx.set\n\ttemplate, err := ssc.hookTemplateLister.HookTemplates(set.Namespace).Get(hookStep.TemplateName)\n\tif err != nil {\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\tklog.Warningf(\"HookTemplate '%s' not found for GameStatefulSet %s/%s\", hookStep.TemplateName, set.Namespace, set.Name)\n\t\t}\n\t\treturn nil, err\n\t}\n\tnameParts := []string{\"canary\", revision}\n\tif stepIdx != nil {\n\t\tnameParts = append(nameParts, \"step\"+strconv.Itoa(int(*stepIdx)))\n\t}\n\tnameParts = append(nameParts, hookStep.TemplateName)\n\tname := strings.Join(nameParts, \"-\")\n\n\trun, err := commonhookutil.NewHookRunFromTemplate(template, args, name, \"\", set.Namespace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trun.Labels = labels\n\trun.OwnerReferences = []metav1.OwnerReference{*metav1.NewControllerRef(set, util.ControllerKind)}\n\treturn run, nil\n}", "func (c *DockerContainer) startingHook(ctx context.Context) error {\n\tfor _, lifecycleHooks := range c.lifecycleHooks {\n\t\terr := containerHookFn(ctx, lifecycleHooks.PreStarts)(c)\n\t\tif err != nil {\n\t\t\tc.printLogs(ctx)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (w *DefaultPreWorkflowHooksCommandRunner) RunPreHooks(\n\tbaseRepo models.Repo,\n\theadRepo models.Repo,\n\tpull models.PullRequest,\n\tuser models.User,\n) {\n\tif opStarted := w.Drainer.StartOp(); !opStarted {\n\t\tif commentErr := w.VCSClient.CreateComment(baseRepo, pull.Num, ShutdownComment, \"pre_workflow_hooks\"); commentErr != nil {\n\t\t\tw.Logger.Log(logging.Error, \"unable to comment that Atlantis is shutting down: %s\", commentErr)\n\t\t}\n\t\treturn\n\t}\n\tdefer w.Drainer.OpDone()\n\n\tlog := w.buildLogger(baseRepo.FullName, pull.Num)\n\tdefer w.logPanics(baseRepo, pull.Num, log)\n\n\tlog.Info(\"running pre hooks\")\n\n\tunlockFn, err := w.WorkingDirLocker.TryLock(baseRepo.FullName, pull.Num, DefaultWorkspace)\n\tif err != nil {\n\t\tlog.Warn(\"workspace is locked\")\n\t\treturn\n\t}\n\tlog.Debug(\"got workspace lock\")\n\tdefer unlockFn()\n\n\trepoDir, _, err := w.WorkingDir.Clone(log, headRepo, pull, DefaultWorkspace)\n\tif err != nil {\n\t\tlog.Err(\"unable to run pre workflow hooks: %s\", err)\n\t\treturn\n\t}\n\n\tpreWorkflowHooks := make([]*valid.PreWorkflowHook, 0)\n\tfor _, repo := range w.GlobalCfg.Repos {\n\t\tif repo.IDMatches(baseRepo.ID()) && len(repo.PreWorkflowHooks) > 0 {\n\t\t\tpreWorkflowHooks = append(preWorkflowHooks, repo.PreWorkflowHooks...)\n\t\t}\n\t}\n\n\tctx := models.PreWorkflowHookCommandContext{\n\t\tBaseRepo: baseRepo,\n\t\tHeadRepo: headRepo,\n\t\tLog: log,\n\t\tPull: pull,\n\t\tUser: user,\n\t\tVerbose: false,\n\t}\n\n\terr = w.runHooks(ctx, preWorkflowHooks, repoDir)\n\n\tif err != nil {\n\t\tlog.Err(\"pre workflow hook run error results: %s\", err)\n\t}\n}", "func Launch() {\n\trouter := gin.Default()\n\n\t// GET-Route parametrized by 'root' param that hols root domain name,\n\t// usage: 'http://localhost:8080/domain/status/dropbox.com'.\n\trouter.GET(\"domain/status/:root\", getSubdomainStatus)\n\n\t// Run server and check errors\n\tif err := router.Run(addr); err != nil {\n\t\tlog.Fatalf(\"error running web server %v\", err)\n\t}\n}", "func (f *JobRunFunc) PushHook(hook func(context.Context, database.DB, streaming.Sender) (*search.Alert, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "func (sry *Sryun) Hook(req *http.Request) (*model.Repo, *model.Build, error) {\n\treturn nil, nil, nil\n}", "func (l *Logger) Hook(h func(Entry)) *Logger {\n\tl.hook = h\n\treturn l\n}", "func main () {\n\n\tstartGame() // start the game\n\n}", "func main() {\n\tapp.StartApp()\n}", "func startLuna(this js.Value, args []js.Value) interface{} {\n\tinput := args[0].String()\n\treturn js.ValueOf(map[string]interface{}{\n\t\t\"module\": compile(input),\n\t})\n}", "func OnAppStart(f func()) {\n\tstartupHooks = append(startupHooks, f)\n}", "func (g Git) RunHook() error {\n\thook, stdin, args := os.Getenv(\"HOOK\"), os.Getenv(\"STDIN\"), strings.Fields(os.Getenv(\"ARGS\"))\n\tswitch hook {\n\tcase \"pre-commit\":\n\t\treturn g.preCommit()\n\tcase \"commit-msg\":\n\t\tvar messageFile string\n\t\tif len(args) > 0 {\n\t\t\tmessageFile = args[0]\n\t\t}\n\t\treturn g.commitMsg(messageFile)\n\tcase \"pre-push\":\n\t\tif mg.Verbose() {\n\t\t\tfmt.Println(\"Running pre-push hook with\", args)\n\t\t}\n\t\treturn g.prePush(stdin, args...)\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown hook %s\", hook)\n\t}\n}", "func start(){\n\t\t\t\t\n\t\t\t\tdebug.Send(\"exec-run\")\t\t\t\t\n\t\t\t\tdebug.Send(\"interpreter-exec\",\"console\",\"record\")\n\t\t\t\t\n\t\t\t\t\n\n\t}", "func (l *Lifecycle) Start(ctx context.Context) error {\n\tl.mu.Lock()\n\tl.startRecords = make(HookRecords, 0, len(l.hooks))\n\tl.mu.Unlock()\n\n\tfor _, hook := range l.hooks {\n\t\tif hook.OnStart != nil {\n\t\t\tl.mu.Lock()\n\t\t\tl.runningHook = hook\n\t\t\tl.mu.Unlock()\n\n\t\t\truntime, err := l.runStartHook(ctx, hook)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tl.mu.Lock()\n\t\t\tl.startRecords = append(l.startRecords, HookRecord{\n\t\t\t\tCallerFrame: hook.callerFrame,\n\t\t\t\tFunc: hook.OnStart,\n\t\t\t\tRuntime: runtime,\n\t\t\t})\n\t\t\tl.mu.Unlock()\n\t\t}\n\t\tl.numStarted++\n\t}\n\n\treturn nil\n}", "func withHook(preHook *Hook, action func() error, postHook *Hook) error {\n\tif preHook != nil {\n\t\tif err := (*preHook)(); err != nil {\n\t\t\treturn fmt.Errorf(\"running pre-hook: %w\", err)\n\t\t}\n\t}\n\n\tif err := action(); err != nil {\n\t\treturn fmt.Errorf(\"running action: %w\", err)\n\t}\n\n\tif postHook == nil {\n\t\treturn nil\n\t}\n\n\treturn (*postHook)()\n}", "func Run(appStart func() error) {\n\tlchr.run(appStart)\n}", "func main() {\n\tcore.Start()\n}", "func (y *YogClient) launchDroplet(droplet *Droplet) error {\n\terr := droplet.build(y)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdroplets.AddDroplet(droplet.Request.Name, droplet.Droplet.ID)\n\treturn nil\n}", "func (my *Driver) UseLaunchExecutable(l launchFn) {\n\tmy.launchExe = l\n}", "func (o *ComputerLaunchOption) Launch(name string) (err error) {\n\terr = o.ComputerClient.Launch(name)\n\treturn\n}", "func main() {\n\tparts := strings.Split(os.Args[0], \"/\")\n\ttrigger := parts[len(parts)-1]\n\tflag.Parse()\n\n\tswitch trigger {\n\tcase \"install\":\n\t\tbuildpacks.TriggerInstall()\n\tcase \"post-delete\":\n\t\tappName := flag.Arg(0)\n\t\tbuildpacks.TriggerPostDelete(appName)\n\tcase \"post-extract\":\n\t\tappName := flag.Arg(0)\n\t\tsourceWorkDir := flag.Arg(1)\n\t\tbuildpacks.TriggerPostExtract(appName, sourceWorkDir)\n\tcase \"report\":\n\t\tappName := flag.Arg(0)\n\t\tbuildpacks.ReportSingleApp(appName, \"\")\n\tdefault:\n\t\tcommon.LogFail(fmt.Sprintf(\"Invalid plugin trigger call: %s\", trigger))\n\t}\n}", "func insertHook(db gorp.SqlExecutor, node *sdk.WorkflowNode, hook *sdk.WorkflowNodeHook) error {\n\thook.WorkflowNodeID = node.ID\n\tif hook.WorkflowHookModelID == 0 {\n\t\thook.WorkflowHookModelID = hook.WorkflowHookModel.ID\n\t}\n\n\tvar icon string\n\tif hook.WorkflowHookModelID != 0 {\n\t\ticon = hook.WorkflowHookModel.Icon\n\t\tmodel, errm := LoadHookModelByID(db, hook.WorkflowHookModelID)\n\t\tif errm != nil {\n\t\t\treturn sdk.WrapError(errm, \"insertHook> Unable to load model %d\", hook.WorkflowHookModelID)\n\t\t}\n\t\thook.WorkflowHookModel = *model\n\t} else {\n\t\tmodel, errm := LoadHookModelByName(db, hook.WorkflowHookModel.Name)\n\t\tif errm != nil {\n\t\t\treturn sdk.WrapError(errm, \"insertHook> Unable to load model %s\", hook.WorkflowHookModel.Name)\n\t\t}\n\t\thook.WorkflowHookModel = *model\n\t}\n\thook.WorkflowHookModelID = hook.WorkflowHookModel.ID\n\n\t//TODO: to delete when all previous scheduler are updated\n\tif _, ok := hook.Config[\"payload\"]; hook.WorkflowHookModel.Name == sdk.SchedulerModelName && !ok {\n\t\thook.Config[\"payload\"] = sdk.SchedulerModel.DefaultConfig[\"payload\"]\n\t}\n\n\terrmu := sdk.MultiError{}\n\t// Check configuration of the hook vs the model\n\tfor k := range hook.WorkflowHookModel.DefaultConfig {\n\t\tif _, ok := hook.Config[k]; !ok {\n\t\t\terrmu = append(errmu, fmt.Errorf(\"Missing configuration key: %s\", k))\n\t\t}\n\t}\n\tif len(errmu) > 0 {\n\t\treturn sdk.WrapError(&errmu, \"insertHook> Invalid hook configuration\")\n\t}\n\n\t// if it's a new hook\n\tif hook.UUID == \"\" {\n\t\tuuid, erruuid := sessionstore.NewSessionKey()\n\t\tif erruuid != nil {\n\t\t\treturn sdk.WrapError(erruuid, \"insertHook> Unable to load model %d\", hook.WorkflowHookModelID)\n\t\t}\n\t\thook.UUID = string(uuid)\n\n\t\thook.Config[\"hookIcon\"] = sdk.WorkflowNodeHookConfigValue{\n\t\t\tValue: icon,\n\t\t\tConfigurable: false,\n\t\t}\n\t}\n\n\tdbhook := NodeHook(*hook)\n\tif err := db.Insert(&dbhook); err != nil {\n\t\treturn sdk.WrapError(err, \"insertHook> Unable to insert hook\")\n\t}\n\t*hook = sdk.WorkflowNodeHook(dbhook)\n\treturn nil\n}", "func (s *Splasher) splash(cmd *exec.Cmd) (sp *Splash, err error) {\n\t// Exec\n\tsp = &Splash{cmd: cmd}\n\tastilog.Debugf(\"Executing %s\", strings.Join(cmd.Args, \" \"))\n\tif err = sp.cmd.Start(); err != nil {\n\t\terr = errors.Wrapf(err, \"starting %s failed\", s.binaryPath)\n\t}\n\n\t// Wait\n\tgo cmd.Wait()\n\treturn\n}", "func main() {\n\tslackIt()\n}", "func (tr *TaskRunner) initHooks() {\n\thookLogger := tr.logger.Named(\"task_hook\")\n\ttask := tr.Task()\n\n\ttr.logmonHookConfig = newLogMonHookConfig(task.Name, tr.taskDir.LogDir)\n\n\t// Add the hook resources\n\ttr.hookResources = &hookResources{}\n\n\t// Create the task directory hook. This is run first to ensure the\n\t// directory path exists for other hooks.\n\talloc := tr.Alloc()\n\ttr.runnerHooks = []interfaces.TaskHook{\n\t\tnewValidateHook(tr.clientConfig, hookLogger),\n\t\tnewTaskDirHook(tr, hookLogger),\n\t\tnewIdentityHook(tr, hookLogger),\n\t\tnewLogMonHook(tr, hookLogger),\n\t\tnewDispatchHook(alloc, hookLogger),\n\t\tnewVolumeHook(tr, hookLogger),\n\t\tnewArtifactHook(tr, tr.getter, hookLogger),\n\t\tnewStatsHook(tr, tr.clientConfig.StatsCollectionInterval, hookLogger),\n\t\tnewDeviceHook(tr.devicemanager, hookLogger),\n\t}\n\n\t// If the task has a CSI stanza, add the hook.\n\tif task.CSIPluginConfig != nil {\n\t\ttr.runnerHooks = append(tr.runnerHooks, newCSIPluginSupervisorHook(\n\t\t\t&csiPluginSupervisorHookConfig{\n\t\t\t\tclientStateDirPath: tr.clientConfig.StateDir,\n\t\t\t\tevents: tr,\n\t\t\t\trunner: tr,\n\t\t\t\tlifecycle: tr,\n\t\t\t\tcapabilities: tr.driverCapabilities,\n\t\t\t\tlogger: hookLogger,\n\t\t\t}))\n\t}\n\n\t// If Vault is enabled, add the hook\n\tif task.Vault != nil {\n\t\ttr.runnerHooks = append(tr.runnerHooks, newVaultHook(&vaultHookConfig{\n\t\t\tvaultStanza: task.Vault,\n\t\t\tclient: tr.vaultClient,\n\t\t\tevents: tr,\n\t\t\tlifecycle: tr,\n\t\t\tupdater: tr,\n\t\t\tlogger: hookLogger,\n\t\t\talloc: tr.Alloc(),\n\t\t\ttask: tr.taskName,\n\t\t}))\n\t}\n\n\t// Get the consul namespace for the TG of the allocation.\n\tconsulNamespace := tr.alloc.ConsulNamespace()\n\n\t// Identify the service registration provider, which can differ from the\n\t// Consul namespace depending on which provider is used.\n\tserviceProviderNamespace := tr.alloc.ServiceProviderNamespace()\n\n\t// If there are templates is enabled, add the hook\n\tif len(task.Templates) != 0 {\n\t\ttr.runnerHooks = append(tr.runnerHooks, newTemplateHook(&templateHookConfig{\n\t\t\tlogger: hookLogger,\n\t\t\tlifecycle: tr,\n\t\t\tevents: tr,\n\t\t\ttemplates: task.Templates,\n\t\t\tclientConfig: tr.clientConfig,\n\t\t\tenvBuilder: tr.envBuilder,\n\t\t\tconsulNamespace: consulNamespace,\n\t\t\tnomadNamespace: tr.alloc.Job.Namespace,\n\t\t}))\n\t}\n\n\t// Always add the service hook. A task with no services on initial registration\n\t// may be updated to include services, which must be handled with this hook.\n\ttr.runnerHooks = append(tr.runnerHooks, newServiceHook(serviceHookConfig{\n\t\talloc: tr.Alloc(),\n\t\ttask: tr.Task(),\n\t\tnamespace: serviceProviderNamespace,\n\t\tserviceRegWrapper: tr.serviceRegWrapper,\n\t\trestarter: tr,\n\t\tlogger: hookLogger,\n\t}))\n\n\t// If this is a Connect sidecar proxy (or a Connect Native) service,\n\t// add the sidsHook for requesting a Service Identity token (if ACLs).\n\tif task.UsesConnect() {\n\t\t// Enable the Service Identity hook only if the Nomad client is configured\n\t\t// with a consul token, indicating that Consul ACLs are enabled\n\t\tif tr.clientConfig.ConsulConfig.Token != \"\" {\n\t\t\ttr.runnerHooks = append(tr.runnerHooks, newSIDSHook(sidsHookConfig{\n\t\t\t\talloc: tr.Alloc(),\n\t\t\t\ttask: tr.Task(),\n\t\t\t\tsidsClient: tr.siClient,\n\t\t\t\tlifecycle: tr,\n\t\t\t\tlogger: hookLogger,\n\t\t\t}))\n\t\t}\n\n\t\tif task.UsesConnectSidecar() {\n\t\t\ttr.runnerHooks = append(tr.runnerHooks,\n\t\t\t\tnewEnvoyVersionHook(newEnvoyVersionHookConfig(alloc, tr.consulProxiesClient, hookLogger)),\n\t\t\t\tnewEnvoyBootstrapHook(newEnvoyBootstrapHookConfig(alloc, tr.clientConfig.ConsulConfig, consulNamespace, hookLogger)),\n\t\t\t)\n\t\t} else if task.Kind.IsConnectNative() {\n\t\t\ttr.runnerHooks = append(tr.runnerHooks, newConnectNativeHook(\n\t\t\t\tnewConnectNativeHookConfig(alloc, tr.clientConfig.ConsulConfig, hookLogger),\n\t\t\t))\n\t\t}\n\t}\n\n\t// Always add the script checks hook. A task with no script check hook on\n\t// initial registration may be updated to include script checks, which must\n\t// be handled with this hook.\n\ttr.runnerHooks = append(tr.runnerHooks, newScriptCheckHook(scriptCheckHookConfig{\n\t\talloc: tr.Alloc(),\n\t\ttask: tr.Task(),\n\t\tconsul: tr.consulServiceClient,\n\t\tlogger: hookLogger,\n\t}))\n\n\t// If this task driver has remote capabilities, add the remote task\n\t// hook.\n\tif tr.driverCapabilities.RemoteTasks {\n\t\ttr.runnerHooks = append(tr.runnerHooks, newRemoteTaskHook(tr, hookLogger))\n\t}\n}", "func (c *client) Hook(r *http.Request) (*model.Repo, *model.Build, error) {\n\treturn parseHook(r)\n}", "func (consumer *Consumer) Launch() {\n\tconsumer.rxC.runNum++\n\tconsumer.txC.runNum = consumer.rxC.runNum\n\tconsumer.Rx.Launch()\n\tconsumer.Tx.Launch()\n}", "func (listener *WebhookListener) Start(l <-chan struct{}) error {\n\tif klog.V(utils.QuiteLogLel) {\n\t\tfnName := utils.GetFnName()\n\t\tklog.Infof(\"Entering: %v()\", fnName)\n\n\t\tdefer klog.Infof(\"Exiting: %v()\", fnName)\n\t}\n\n\thttp.HandleFunc(\"/webhook\", listener.HandleWebhook)\n\n\tif listener.TLSKeyFile != \"\" && listener.TLSCrtFile != \"\" {\n\t\tklog.Info(\"Starting the WebHook listener on port 8443 with TLS key and cert files: \" + listener.TLSKeyFile + \" \" + listener.TLSCrtFile)\n\t\tklog.Fatal(http.ListenAndServeTLS(\":8443\", listener.TLSCrtFile, listener.TLSKeyFile, nil))\n\t} else {\n\t\tklog.Info(\"Starting the WebHook listener on port 8443 with no TLS.\")\n\t\tklog.Fatal(http.ListenAndServe(\":8443\", nil))\n\t}\n\n\tklog.Info(\"the WebHook listener started on port 8443.\")\n\n\t<-l\n\n\treturn nil\n}", "func (g *Generator) AddPreStartHook(path string, args []string) {\n\tg.initSpec()\n\thook := rspec.Hook{Path: path, Args: args}\n\tg.spec.Hooks.Prestart = append(g.spec.Hooks.Prestart, hook)\n}", "func start(state GameState) {\n\tlog.Printf(\"%s START\\n\", state.Game.ID)\n}", "func start(state GameState) {\n\tlog.Printf(\"%s START\\n\", state.Game.ID)\n}", "func (u *Update) LaunchAppBinary() error {\n\tcmd := exec.Command(*u.oldMollyBinaryPath)\n\terr := cmd.Start()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to execute run command for Molly Wallet: %v\", err)\n\t}\n\treturn nil\n}", "func (tr *TaskRunner) poststart() error {\n\tif tr.logger.IsTrace() {\n\t\tstart := time.Now()\n\t\ttr.logger.Trace(\"running poststart hooks\", \"start\", start)\n\t\tdefer func() {\n\t\t\tend := time.Now()\n\t\t\ttr.logger.Trace(\"finished poststart hooks\", \"end\", end, \"duration\", end.Sub(start))\n\t\t}()\n\t}\n\n\thandle := tr.getDriverHandle()\n\tnet := handle.Network()\n\n\t// Pass the lazy handle to the hooks so even if the driver exits and we\n\t// launch a new one (external plugin), the handle will refresh.\n\tlazyHandle := NewLazyHandle(tr.shutdownCtx, tr.getDriverHandle, tr.logger)\n\n\tvar merr multierror.Error\n\tfor _, hook := range tr.runnerHooks {\n\t\tpost, ok := hook.(interfaces.TaskPoststartHook)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tname := post.Name()\n\t\tvar start time.Time\n\t\tif tr.logger.IsTrace() {\n\t\t\tstart = time.Now()\n\t\t\ttr.logger.Trace(\"running poststart hook\", \"name\", name, \"start\", start)\n\t\t}\n\n\t\treq := interfaces.TaskPoststartRequest{\n\t\t\tDriverExec: lazyHandle,\n\t\t\tDriverNetwork: net,\n\t\t\tDriverStats: lazyHandle,\n\t\t\tTaskEnv: tr.envBuilder.Build(),\n\t\t}\n\t\tvar resp interfaces.TaskPoststartResponse\n\t\tif err := post.Poststart(tr.killCtx, &req, &resp); err != nil {\n\t\t\ttr.emitHookError(err, name)\n\t\t\tmerr.Errors = append(merr.Errors, fmt.Errorf(\"poststart hook %q failed: %v\", name, err))\n\t\t}\n\n\t\t// No need to persist as PoststartResponse is currently empty\n\n\t\tif tr.logger.IsTrace() {\n\t\t\tend := time.Now()\n\t\t\ttr.logger.Trace(\"finished poststart hooks\", \"name\", name, \"end\", end, \"duration\", end.Sub(start))\n\t\t}\n\t}\n\n\treturn merr.ErrorOrNil()\n}", "func LaunchGame(gameVersion game.Interface) error {\n\tlogger := logrus.WithFields(logrus.Fields{\n\t\t\"executable\": gameVersion.Executable(),\n\t})\n\n\tcmd := exec.Command(gameVersion.Executable())\n\tcmd.Dir = gameVersion.WorkingDir()\n\treturn cmd.Run()\n}", "func (c *config) Hook(req *http.Request) (*model.Repo, *model.Build, error) {\n\treturn parseHook(req)\n}", "func Start(wl ...debugLevel) {\n\tif isStarted {\n\t\tcolorLog(\"[ERRO] Fail to start Bee Watch[ %s ]\",\n\t\t\t\"cannot start Bee Watch twice\")\n\t\treturn\n\t}\n\n\tisStarted = true\n\tcolorLog(\"[INIT] BW: Bee Watch v%s.\\n\", APP_VER)\n\n\twatchLevel = LevelTrace\n\tif len(wl) > 0 {\n\t\twatchLevel = wl[0]\n\t}\n\n\tApp.Name = \"Bee Watch\"\n\tApp.HttpPort = 23456\n\tApp.WatchEnabled = true\n\tApp.PrintStack = true\n\tApp.PrintSource = true\n\n\tloadJSON()\n\n\tif App.WatchEnabled {\n\t\tif App.CmdMode {\n\n\t\t} else {\n\t\t\tinitHTTP()\n\t\t}\n\t}\n}", "func invokeHook(fn func() error) error {\n\tif fn != nil {\n\t\treturn fn()\n\t}\n\n\treturn nil\n}", "func (l *LaunchControl) Run(ctx context.Context) error {\n\tctx, cancel := context.WithCancel(ctx)\n\n\tdefer cancel()\n\tch := make(chan Event, ReadBufferDepth)\n\twg := sync.WaitGroup{}\n\n\tfor i := 0; i < NumChannels; i++ {\n\t\tif err := l.Reset(i); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// The first swap enables double buffering.\n\t\tif err := l.SwapBuffers(i); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := l.SetTemplate(0); err != nil {\n\t\treturn err\n\t}\n\n\tlcfg := drivers.ListenConfig{\n\t\tTimeCode: false,\n\t\tActiveSense: false,\n\t\tSysEx: true,\n\t\tOnErr: func(err error) {\n\t\t\t_ = l.handleError(err)\n\t\t},\n\t}\n\n\tvar err error\n\tl.stopFn, err = l.inputDriver.Listen(func(msg []byte, milliseconds int32) {\n\t\tif len(msg) == 3 {\n\t\t\tch <- Event{\n\t\t\t\tTimestamp: milliseconds,\n\t\t\t\tStatus: msg[0],\n\t\t\t\tData1: msg[1],\n\t\t\t\tData2: msg[2],\n\t\t\t}\n\t\t} else {\n\t\t\tl.sysexEvent(msg)\n\t\t}\n\t}, lcfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase evt := <-ch:\n\t\t\t\tl.event(evt)\n\t\t\t}\n\t\t}\n\t}()\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\n\t\tticker := time.NewTicker(FlashPeriod)\n\t\tdefer ticker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase <-ticker.C:\n\t\t\t\tl.lock.Lock()\n\t\t\t\tl.flashes++\n\t\t\t\tch := l.currentChannel\n\t\t\t\tl.lock.Unlock()\n\n\t\t\t\t_ = l.SwapBuffers(ch)\n\t\t\t}\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase err := <-l.errorChan:\n\t\treturn err\n\t}\n}", "func (s *BaseAspidaListener) EnterMain(ctx *MainContext) {}", "func hookTerminator(e *evtx.GoEvtxMap) {\n\tif e.EventID() == 1 {\n\t\tif commandLine, err := e.GetString(&sysmonCommandLine); err == nil {\n\t\t\tif pid, err := e.GetInt(&sysmonProcessId); err == nil {\n\t\t\t\tif blacklistedImages.Contains(commandLine) {\n\t\t\t\t\tlog.Warnf(\"Terminating blacklisted process PID=%d CommandLine=\\\"%s\\\"\", pid, commandLine)\n\t\t\t\t\tif err := terminator(int(pid)); err != nil {\n\t\t\t\t\t\tlog.Errorf(\"Failed to terminate process PID=%d: %s\", pid, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (c *DockerContainer) startedHook(ctx context.Context) error {\n\tfor _, lifecycleHooks := range c.lifecycleHooks {\n\t\terr := containerHookFn(ctx, lifecycleHooks.PostStarts)(c)\n\t\tif err != nil {\n\t\t\tc.printLogs(ctx)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (el *Launcher) Start() error {\n\tlogrus.Debugf(\"engine launcher %v: prepare to start engine %v at %v\",\n\t\tel.LauncherName, el.currentEngine.EngineName, el.currentEngine.GetListen())\n\n\tif err := el.currentEngine.Start(); err != nil {\n\t\treturn err\n\t}\n\n\tel.updateCh <- el\n\n\tlogrus.Debugf(\"engine launcher %v: succeed to start engine %v at %v\",\n\t\tel.LauncherName, el.currentEngine.EngineName, el.currentEngine.GetListen())\n\n\treturn nil\n}", "func NewLaunch(cfg datastore.Config, next http.HandlerFunc) *launch.Launch {\n\treturn launch.New(cfg, next)\n}", "func (p *procBase) start(args ...string) error {\n\tif p.Running() {\n\t\treturn fmt.Errorf(\"Process %s is running\", p.Name())\n\t}\n\n\t// Always log to stderr, we'll capture and process logs.\n\targs = append(args, \"-logtostderr\", \"-v=1\")\n\n\tp.cmd = exec.Command(p.bin, args...)\n\tp.cmd.Stdout = NewLogDemuxer(p.name, p.loggers)\n\tp.cmd.Stderr = p.cmd.Stdout\n\treturn p.cmd.Start()\n}", "func (s *BaseGShellListener) EnterCommandLine(ctx *CommandLineContext) {}", "func (u *UnityServer) startUnityApp() {\n\tu.Logger.Debugf(\"Path: %v\", pathToUnity)\n\tif pathToUnity != \"\" {\n\t\tu.unityApp = exec.Command(pathToUnity)\n\t\tu.unityApp.Run()\n\t} else {\n\t\tu.Logger.Warn(\"Path to unity not set\")\n\t}\n}", "func (g *Generator) AddPostStartHook(path string, args []string) {\n\tg.initSpec()\n\thook := rspec.Hook{Path: path, Args: args}\n\tg.spec.Hooks.Poststart = append(g.spec.Hooks.Poststart, hook)\n}", "func (p *usermdPlugin) Hook(h plugins.HookT, payload string) error {\n\tlog.Tracef(\"usermd Hook: %v\", plugins.Hooks[h])\n\n\tswitch h {\n\tcase plugins.HookTypeNewRecordPre:\n\t\treturn p.hookNewRecordPre(payload)\n\tcase plugins.HookTypeNewRecordPost:\n\t\treturn p.hookNewRecordPost(payload)\n\tcase plugins.HookTypeEditRecordPre:\n\t\treturn p.hookEditRecordPre(payload)\n\tcase plugins.HookTypeEditMetadataPre:\n\t\treturn p.hookEditMetadataPre(payload)\n\tcase plugins.HookTypeSetRecordStatusPre:\n\t\treturn p.hookSetRecordStatusPre(payload)\n\tcase plugins.HookTypeSetRecordStatusPost:\n\t\treturn p.hookSetRecordStatusPost(payload)\n\t}\n\n\treturn nil\n}", "func Run(ctx context.Context, initial Func, hooks ...Hook) (err error) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tpe, ok := e.(error)\n\t\t\tif !ok {\n\t\t\t\tpe = fmt.Errorf(\"%+v\", e)\n\t\t\t}\n\t\t\tmsg := fmt.Sprintf(\"panic in %s\", Name(ctx))\n\t\t\tif err != nil {\n\t\t\t\tmsg += fmt.Sprintf(\"\\noriginal error: %+v\", err)\n\t\t\t}\n\t\t\terr = errors.Wrap(pe, msg)\n\t\t}\n\t}()\n\n\tctx = context.WithValue(ctx, stateKey, &initial)\n\tfor initial != nil {\n\t\tfor i, h := range hooks {\n\t\t\terr = h(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"applying state hook %d\", i)\n\t\t\t}\n\t\t}\n\t\tinitial = initial(ctx)\n\t}\n\treturn\n}", "func (*trackerServer) WorkflowLaunched(c context.Context, req *admin.WorkflowLaunchedRequest) (*admin.WorkflowLaunchedResponse, error) {\n\tif req.RunId == 0 {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"missing run ID\")\n\t}\n\tif err := workflowLaunched(c, req, config.WorkflowCache); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Internal, \"failed to track workflow launched: %v\", err)\n\t}\n\treturn &admin.WorkflowLaunchedResponse{}, nil\n}", "func (l Launcher) Launch(cmd string) (piper.Executor, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\treturn exe{exec.CommandContext(ctx, \"sh\", \"-c\", cmd), cancel, cmd}, nil\n}", "func main() {\n\tdebugln(\"main!\")\n}", "func (h *Hook) Fire(entry *log.Entry) error {\n\n\tstart := time.Now()\n\tpc := make([]uintptr, 3, 3)\n\tcnt := runtime.Callers(6, pc)\n\n\tlo := &LogEntry{\n\t\tMessage: entry.Message,\n\t\tLevel: strings.ToUpper(entry.Level.String()),\n\t\tStartTime: start.Format(h.dateFormat),\n\t\tData: entry.Data,\n\t}\n\n\tfor i := 0; i < cnt; i++ {\n\t\tfu := runtime.FuncForPC(pc[i] - 1)\n\t\tname := fu.Name()\n\t\tif !strings.Contains(name, \"github.com/sirupsen/logrus\") {\n\t\t\tfile, line := fu.FileLine(pc[i] - 1)\n\t\t\tlo.File = path.Base(file)\n\t\t\tlo.Function = path.Base(name)\n\t\t\tlo.Line = strconv.Itoa(line)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tbuff := &bytes.Buffer{}\n\n\tif h.FormatType == constants.LogFormatJSON {\n\t\tjson.NewEncoder(buff).Encode(lo)\n\t} else {\n\t\th.template.Execute(buff, lo)\n\t}\n\n\tif h.logType == constants.LogTypePrint {\n\t\tfmt.Print(string(buff.String()))\n\t}\n\n\tif h.logType == constants.LogTypeFile {\n\t\tgo func() {\n\t\t\th.mutex.Lock()\n\t\t\tlogPath := config.GetString(\"log.path\")\n\n\t\t\trotate := logPath + \"/app-\" + start.Format(\"2006-01-02\")\n\n\t\t\tif h.rotateType == \"static\" {\n\t\t\t\trotate = logPath + \"/app\"\n\t\t\t}\n\n\t\t\tdir, base := filepath.Split(filepath.Clean(rotate))\n\n\t\t\tfileName := dir + base + \".log\"\n\n\t\t\tif helpers.PathExist(logPath) {\n\t\t\t\th.openNew(fileName)\n\t\t\t\tif h.file != nil {\n\t\t\t\t\th.lWriter.SetOutput(h.file)\n\t\t\t\t\th.lWriter.Print(string(buff.String()))\n\t\t\t\t}\n\t\t\t}\n\t\t\th.mutex.Unlock()\n\t\t}()\n\t}\n\treturn nil\n}", "func (tr *TaskRunner) preKill() {\n\tif tr.logger.IsTrace() {\n\t\tstart := time.Now()\n\t\ttr.logger.Trace(\"running pre kill hooks\", \"start\", start)\n\t\tdefer func() {\n\t\t\tend := time.Now()\n\t\t\ttr.logger.Trace(\"finished pre kill hooks\", \"end\", end, \"duration\", end.Sub(start))\n\t\t}()\n\t}\n\n\tfor _, hook := range tr.runnerHooks {\n\t\tkillHook, ok := hook.(interfaces.TaskPreKillHook)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tname := killHook.Name()\n\n\t\t// Time the pre kill hook\n\t\tvar start time.Time\n\t\tif tr.logger.IsTrace() {\n\t\t\tstart = time.Now()\n\t\t\ttr.logger.Trace(\"running prekill hook\", \"name\", name, \"start\", start)\n\t\t}\n\n\t\t// Run the pre kill hook\n\t\treq := interfaces.TaskPreKillRequest{}\n\t\tvar resp interfaces.TaskPreKillResponse\n\t\tif err := killHook.PreKilling(context.Background(), &req, &resp); err != nil {\n\t\t\ttr.emitHookError(err, name)\n\t\t\ttr.logger.Error(\"prekill hook failed\", \"name\", name, \"error\", err)\n\t\t}\n\n\t\t// No need to persist as TaskKillResponse is currently empty\n\n\t\tif tr.logger.IsTrace() {\n\t\t\tend := time.Now()\n\t\t\ttr.logger.Trace(\"finished prekill hook\", \"name\", name, \"end\", end, \"duration\", end.Sub(start))\n\t\t}\n\t}\n}", "func (master *ProcMaster) start(proc ProcContainer) error {\n\tif !proc.IsAlive() {\n\t\terr := proc.Start()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmaster.Watcher.AddProcWatcher(proc, false)\n\t\tproc.SetStatus(\"running\")\n\t}\n\treturn nil\n}", "func (g *GitLab) Hook(ctx context.Context, req *http.Request) (*model.Repo, *model.Pipeline, error) {\n\tdefer req.Body.Close()\n\tpayload, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\teventType := gitlab.WebhookEventType(req)\n\tparsed, err := gitlab.ParseWebhook(eventType, payload)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tswitch event := parsed.(type) {\n\tcase *gitlab.MergeEvent:\n\t\tmergeIID, repo, pipeline, err := convertMergeRequestHook(event, req)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tif pipeline, err = g.loadChangedFilesFromMergeRequest(ctx, repo, pipeline, mergeIID); err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\treturn repo, pipeline, nil\n\tcase *gitlab.PushEvent:\n\t\treturn convertPushHook(event)\n\tcase *gitlab.TagEvent:\n\t\treturn convertTagHook(event)\n\tdefault:\n\t\treturn nil, nil, &types.ErrIgnoreEvent{Event: string(eventType)}\n\t}\n}", "func (d *Demo) Play() {\n\t//Steam isn't in PATH on windows systems, have to specify steam path\n\tcmd := exec.Command(\"steam\", \"-applaunch\", \"440\", \"+playdemo\", d.PathInTFFolder())\n\tif runtime.GOOS == \"windows\" {\n\t\tcmd = exec.Command(\"cmd\", \"/c\", \"start\", \"\", `C:\\Program Files (x86)\\Steam\\Steam.exe`,\n\t\t\t\"-applaunch\", \"440\", \"+playdemo\", d.PathInTFFolder())\n\t}\n\tcmd.Start()\n}", "func (p PRPlugin) onOpen(env *ActionsEnv) error {\n\tp.Debugf(\"%q handler\", actionOpen)\n\t// Create the check run\n\tcheckRun, err := p.createCheckRun(env.Client, env.Owner, env.Repo, env.Event.GetPullRequest().GetHead().GetSHA())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Process the PR and submit the results\n\t_, err = p.processAndSubmit(env, checkRun)\n\treturn err\n}", "func (p Plane) Launch(logCh chan map[string]interface{}) ([]sleepwalker.Result, error) {\n\tdesc := \"airstrike.Plane.Launch\"\n\tvar results []sleepwalker.Result\n\n\tlogCh <- map[string]interface{}{\n\t\t\"source\": desc,\n\t\t\"plane\": p,\n\t}\n\n\tfor _, weapon := range p.Arsenal {\n\t\tresult, err := p.fireWeapon(weapon, logCh)\n\t\tif err != nil {\n\t\t\tlogCh <- map[string]interface{}{\n\t\t\t\t\"source\": desc,\n\t\t\t\t\"error\": err,\n\t\t\t\t\"plane\": p,\n\t\t\t\t\"weapon\": weapon,\n\t\t\t\t\"severity\": \"ERROR\",\n\t\t\t}\n\t\t}\n\t\tresults = append(results, result)\n\t}\n\treturn results, nil\n}", "func main() {\n\tdefer interrupts.WaitForGracefulShutdown()\n\n\to := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)\n\tif err := o.Validate(); err != nil {\n\t\tlogrus.WithError(err).Fatal(\"Invalid options\")\n\t}\n\n\tif o.jsonLog {\n\t\tlogrus.SetFormatter(logrusutil.CreateDefaultFormatter())\n\t}\n\n\tcontroller, err := webhook.NewWebhooksController(o.path, o.namespace, o.botName, o.pluginFilename, o.configFilename)\n\tif err != nil {\n\t\tlogrus.WithError(err).Fatal(\"failed to set up controller\")\n\t}\n\tdefer func() {\n\t\tcontroller.CleanupGitClientDir()\n\t\tcontroller.ConfigMapWatcher.Stop()\n\t}()\n\n\tmux := http.NewServeMux()\n\tmux.Handle(HealthPath, http.HandlerFunc(controller.Health))\n\tmux.Handle(ReadyPath, http.HandlerFunc(controller.Ready))\n\n\tmux.Handle(\"/\", http.HandlerFunc(controller.DefaultHandler))\n\tmux.Handle(o.path, http.HandlerFunc(controller.HandleWebhookRequests))\n\tmux.Handle(o.pollPath, http.HandlerFunc(controller.HandlePollingRequests))\n\n\t// lets serve metrics\n\tmetricsHandler := http.HandlerFunc(controller.Metrics)\n\tgo serveMetrics(metricsHandler)\n\n\tlogrus.Infof(\"Lighthouse is now listening on path %s and port %d for WebHooks\", o.path, o.port)\n\terr = http.ListenAndServe(\":\"+strconv.Itoa(o.port), mux)\n\tlogrus.WithError(err).Errorf(\"failed to serve HTTP\")\n}", "func (s *BaseBundListener) EnterCall_term(ctx *Call_termContext) {}", "func (c *ComputerClient) Launch(name string) (err error) {\n\tapi := fmt.Sprintf(\"/computer/%s/launchSlaveAgent\", name)\n\t_, err = c.RequestWithoutData(\"POST\", api, nil, nil, 200)\n\treturn\n}", "func (plugin OpenPlugin) Run(cliConnection plugin.CliConnection, args []string) {\n\terr := checkArgs(cliConnection, args)\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\tif args[0] == \"open\" {\n\t\tplugin.runAppOpen(cliConnection, args)\n\t} else if args[0] == \"service-open\" {\n\t\tplugin.runServiceOpen(cliConnection, args)\n\t}\n}", "func (s *BasemumpsListener) EnterBreak_(ctx *Break_Context) {}", "func (e *engine) Start(context.Context, *Spec, *Step) error {\n\treturn nil // no-op for bash implementation\n}", "func (p *literalProcessor) start() { go p.run() }", "func main() {\n\tadapter.RunStage(split, chunk, join)\n}", "func (h LogHook) Run(e *zerolog.Event, level zerolog.Level, msg string) {\n\t// Send log type metric\n\th.metric.RecordByLogTypes(level.String())\n\t// Send version in each log entry\n\te.Str(\"version\", Version)\n}" ]
[ "0.5877089", "0.5779476", "0.5759628", "0.57347715", "0.56235826", "0.5620141", "0.56181556", "0.5604568", "0.5598416", "0.5588178", "0.5450167", "0.5426442", "0.54139924", "0.53387564", "0.5329647", "0.5309052", "0.52930015", "0.52812076", "0.5246368", "0.52041054", "0.51378936", "0.51193875", "0.51181525", "0.511654", "0.5091731", "0.5067031", "0.50654596", "0.50652343", "0.5058392", "0.5057855", "0.5033662", "0.5029743", "0.5022925", "0.5021045", "0.4994063", "0.49930233", "0.49903986", "0.4989758", "0.4989042", "0.49866468", "0.49852404", "0.49833524", "0.49793667", "0.49669063", "0.4964295", "0.4947954", "0.49441075", "0.49359623", "0.49284264", "0.49278766", "0.49038512", "0.48831564", "0.48782852", "0.48750383", "0.48687696", "0.4864929", "0.48611107", "0.48521858", "0.48482928", "0.48341486", "0.48310143", "0.4801253", "0.4801253", "0.48000664", "0.47931254", "0.4791028", "0.4776433", "0.4776221", "0.47736102", "0.47567716", "0.47504866", "0.47501722", "0.47355798", "0.47206202", "0.47128433", "0.4712504", "0.4708922", "0.47059795", "0.4696992", "0.46889102", "0.46872878", "0.4672089", "0.46617058", "0.46612144", "0.46514574", "0.465103", "0.46335864", "0.4632002", "0.4631934", "0.46315327", "0.46176216", "0.46134526", "0.46060774", "0.46047756", "0.45957404", "0.45932105", "0.4592357", "0.4586601", "0.45829564", "0.45825824" ]
0.73184854
0
Start will launch the engine and start registered hooks. It will block until every hooks has shutdown, gracefully or with force...
Start запустит движок и начнет зарегистрированные хуки. Он будет блокировать до тех пор, пока все хуки не завершат работу, гладко или принудительно...
func (e *Engine) Start() error { e.init() go e.waitShutdownNotification() for _, h := range e.hooks { e.launch(h) } e.wait.Wait() if e.afterShutdown != nil { e.afterShutdown() } e.mutex.Lock() defer e.mutex.Unlock() return e.cause }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (e *EngineConfig) Start() error {\n\tlogger.Info(\"Engine: Starting...\")\n\n\t// Todo document RunnerType for engine configuration\n\trunnerType := config.GetRunnerType()\n\te.Init(runnerType == \"DIRECT\")\n\n\tactionRunner := e.actionRunner.(interface{})\n\n\tif managedRunner, ok := actionRunner.(util.Managed); ok {\n\t\tutil.StartManaged(\"ActionRunner Service\", managedRunner)\n\t}\n\n\tlogger.Info(\"Engine: Starting Services...\")\n\n\terr := e.serviceManager.Start()\n\n\tif err != nil {\n\t\tlogger.Error(\"Engine: Error Starting Services - \" + err.Error())\n\t} else {\n\t\tlogger.Info(\"Engine: Started Services\")\n\t}\n\n\t// Start the triggers\n\tfor key, value := range e.triggers {\n\t\terr := util.StartManaged(fmt.Sprintf(\"Trigger [ '%s' ]\", key), value.Interf)\n\t\tif err != nil {\n\t\t\tlogger.Infof(\"Trigger [%s] failed to start due to error [%s]\", key, err.Error())\n\t\t\tvalue.Status = trigger.Failed\n\t\t\tvalue.Error = err\n\t\t\tlogger.Debugf(\"StackTrace: %s\", debug.Stack())\n\t\t\tif config.StopEngineOnError() {\n\t\t\t\tlogger.Debugf(\"{%s=true}. Stopping engine\", config.STOP_ENGINE_ON_ERROR_KEY)\n\t\t\t\tlogger.Info(\"Engine: Stopped\")\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t} else {\n\t\t\tlogger.Infof(\"Trigger [%s] started\", key)\n\t\t\tvalue.Status = trigger.Started\n\t\t}\n\t}\n\n\tlogger.Info(\"Engine: Started\")\n\treturn nil\n}", "func (e *Engine) Start() error {\n\tpref, err := prefs.NewPreferences()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot load preferences\")\n\t}\n\n\tif pref.Core.EnableCheckUpdates {\n\t\tgo e.start()\n\t}\n\n\treturn nil\n}", "func (e *Engine) Start(ctx context.Context) {\n\terr := e.processBets(ctx)\n\tif err != nil {\n\t\tlog.Println(\"Engine failed to process bets received:\", err)\n\t\treturn\n\t}\n\n\terr = e.processEventsSettled(ctx)\n\tif err != nil {\n\t\tlog.Println(\"Engine failed to process bets calculated:\", err)\n\t\treturn\n\t}\n\n\t<-ctx.Done()\n}", "func (l *Lifecycle) Start(ctx context.Context) error {\n\tl.mu.Lock()\n\tl.startRecords = make(HookRecords, 0, len(l.hooks))\n\tl.mu.Unlock()\n\n\tfor _, hook := range l.hooks {\n\t\tif hook.OnStart != nil {\n\t\t\tl.mu.Lock()\n\t\t\tl.runningHook = hook\n\t\t\tl.mu.Unlock()\n\n\t\t\truntime, err := l.runStartHook(ctx, hook)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tl.mu.Lock()\n\t\t\tl.startRecords = append(l.startRecords, HookRecord{\n\t\t\t\tCallerFrame: hook.callerFrame,\n\t\t\t\tFunc: hook.OnStart,\n\t\t\t\tRuntime: runtime,\n\t\t\t})\n\t\t\tl.mu.Unlock()\n\t\t}\n\t\tl.numStarted++\n\t}\n\n\treturn nil\n}", "func (el *Launcher) Start() error {\n\tlogrus.Debugf(\"engine launcher %v: prepare to start engine %v at %v\",\n\t\tel.LauncherName, el.currentEngine.EngineName, el.currentEngine.GetListen())\n\n\tif err := el.currentEngine.Start(); err != nil {\n\t\treturn err\n\t}\n\n\tel.updateCh <- el\n\n\tlogrus.Debugf(\"engine launcher %v: succeed to start engine %v at %v\",\n\t\tel.LauncherName, el.currentEngine.EngineName, el.currentEngine.GetListen())\n\n\treturn nil\n}", "func (m *Manager) Start(ctx context.Context) error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\terr := storage.Txn(ctx, m.Store, storage.TransactionParams{}, func(txn storage.Transaction) error {\n\t\tcompiler, err := loadCompilerFromStore(ctx, m.Store, txn)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.setCompiler(compiler)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := func() error {\n\t\tm.mtx.Lock()\n\t\tdefer m.mtx.Unlock()\n\n\t\tfor _, p := range m.plugins {\n\t\t\tif err := p.plugin.Start(ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}(); err != nil {\n\t\treturn err\n\t}\n\n\tconfig := storage.TriggerConfig{OnCommit: m.onCommit}\n\n\treturn storage.Txn(ctx, m.Store, storage.WriteParams, func(txn storage.Transaction) error {\n\t\t_, err := m.Store.Register(ctx, txn, config)\n\t\treturn err\n\t})\n}", "func (a *Application) Start(ctx context.Context) (<-chan interface{}, error) {\n\tif timeout, ok := ctx.Deadline(); ok {\n\t\tlevel.Debug(a.logger).Log(\n\t\t\t\"msg\", \"starting up with timeout\",\n\t\t\t\"timeout\", math.Floor(timeout.Sub(time.Now()).Seconds()),\n\t\t)\n\t}\n\n\tdone := make(chan interface{}, len(a.lifecycle.hooks))\n\n\tfor _, hook := range a.lifecycle.hooks {\n\t\terr := invokeHook(hook.PreStart)\n\t\tif err != nil {\n\t\t\treturn done, err\n\t\t}\n\t}\n\n\tfor _, hook := range a.lifecycle.hooks {\n\t\tif hook.OnStart != nil {\n\t\t\terr := hook.OnStart(ctx, done)\n\t\t\tif err != nil {\n\t\t\t\treturn done, err\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, hook := range a.lifecycle.hooks {\n\t\terr := invokeHook(hook.PostStart)\n\t\tif err != nil {\n\t\t\treturn done, err\n\t\t}\n\t}\n\n\treturn done, nil\n}", "func (e *engine) Start(context.Context, *Spec, *Step) error {\n\treturn nil // no-op for bash implementation\n}", "func Start(c context.Context) (*Dispatcher) {\n\t// create the dispatcher\n\tdispatcher := Dispatcher{\n\t\tChannel: GetEventChannel(),\n\t}\n\n\t// preload the controllers\n\tcontroller.GetController(\"default\")\n\n\t// start the dispatcher\n\tgo dispatcher.Run(c)\n\n\tutil.LogInfo(\"main\", \"ENG\", \"engine active\")\n\n\treturn &dispatcher\n}", "func (o *FakeObjectTrackers) Start() {\n\tgo func() {\n\t\terr := o.ControlMachine.Start()\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"failed to start machine object tracker, Err: %v\", err)\n\t\t}\n\t}()\n\n\tgo func() {\n\t\terr := o.TargetCore.Start()\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"failed to start target core object tracker, Err: %v\", err)\n\t\t}\n\t}()\n}", "func (e *Engine) Start() error {\n\n\twgIface := e.config.WgIface\n\twgAddr := e.config.WgAddr\n\tmyPrivateKey := e.config.WgPrivateKey\n\n\terr := iface.Create(wgIface, wgAddr)\n\tif err != nil {\n\t\tlog.Errorf(\"failed creating interface %s: [%s]\", wgIface, err.Error())\n\t\treturn err\n\t}\n\n\terr = iface.Configure(wgIface, myPrivateKey.String())\n\tif err != nil {\n\t\tlog.Errorf(\"failed configuring Wireguard interface [%s]: %s\", wgIface, err.Error())\n\t\treturn err\n\t}\n\n\tport, err := iface.GetListenPort(wgIface)\n\tif err != nil {\n\t\tlog.Errorf(\"failed getting Wireguard listen port [%s]: %s\", wgIface, err.Error())\n\t\treturn err\n\t}\n\te.wgPort = *port\n\n\te.receiveSignalEvents()\n\te.receiveManagementEvents()\n\n\treturn nil\n}", "func (core *coreService) Start(_ context.Context) error {\n\tif err := core.chainListener.Start(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to start blockchain listener\")\n\t}\n\tif core.messageBatcher != nil {\n\t\tif err := core.messageBatcher.Start(); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to start message batcher\")\n\t\t}\n\t}\n\treturn nil\n}", "func (e *Engine) launch(h Hook) {\n\n\te.wait.Add(1)\n\n\tgo func() {\n\n\t\tdefer e.wait.Done()\n\n\t\truntime := &HookRuntime{}\n\n\t\t// Wait for an event to notify this goroutine that a shutdown is required.\n\t\t// It could either be from engine's context or during Hook startup if an error has occurred.\n\t\t// NOTE: If HookRuntime returns an error, we have to shutdown every Hook...\n\t\terr := runtime.WaitForEvent(e.ctx, h)\n\t\tif err != nil {\n\t\t\te.mutex.Lock()\n\t\t\te.log(err)\n\t\t\te.cancel()\n\t\t\te.cause = err\n\t\t\te.mutex.Unlock()\n\t\t}\n\n\t\t// Wait for hook to gracefully shutdown, or kill it after timeout.\n\t\t// This is handled by HookRuntime.\n\t\tfor _, err := range runtime.Shutdown(e.timeout) {\n\t\t\te.mutex.Lock()\n\t\t\te.log(err)\n\t\t\te.mutex.Unlock()\n\t\t}\n\n\t}()\n}", "func Start(context.Context, *Config) ([]*logical.Loop, func(), error) {\n\tpanic(wire.Build(\n\t\twire.Bind(new(logical.Config), new(*Config)),\n\t\tProvideFirestoreClient,\n\t\tProvideLoops,\n\t\tProvideTombstones,\n\t\tlogical.Set,\n\t\tscript.Set,\n\t\tstaging.Set,\n\t\ttarget.Set,\n\t))\n}", "func (s *Server) Start(ctx context.Context) {\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tlogger := log.FromContext(ctx)\n\t\tlogger.Info(\"I have to go...\")\n\t\tlogger.Info(\"Stopping server gracefully\")\n\t\ts.Stop()\n\t}()\n\n\ts.tcpEntryPoints.Start()\n\ts.udpEntryPoints.Start()\n\ts.watcher.Start()\n\n\ts.routinesPool.GoCtx(s.listenSignals)\n}", "func (mgr *Manager) Start(register string) error {\n\terr := mgr.Register(register)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif mgr.tagsMap == nil || mgr.tagsMap[\"pindex\"] {\n\t\tmldd := mgr.options[\"managerLoadDataDir\"]\n\t\tif mldd == \"sync\" || mldd == \"async\" || mldd == \"\" {\n\t\t\terr := mgr.LoadDataDir()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif mgr.tagsMap == nil || mgr.tagsMap[\"planner\"] {\n\t\tgo mgr.PlannerLoop()\n\t\tgo mgr.PlannerKick(\"start\")\n\t}\n\n\tif mgr.tagsMap == nil ||\n\t\t(mgr.tagsMap[\"pindex\"] && mgr.tagsMap[\"janitor\"]) {\n\t\tgo mgr.JanitorLoop()\n\t\tgo mgr.JanitorKick(\"start\")\n\t}\n\n\treturn mgr.StartCfg()\n}", "func (op *AddonOperator) Start() error {\n\tif err := op.bootstrap(); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"Start first converge for modules\")\n\t// Loading the onStartup hooks into the queue and running all modules.\n\t// Turning tracking changes on only after startup ends.\n\n\t// Bootstrap main queue with tasks to run Startup process.\n\top.BootstrapMainQueue(op.TaskQueues)\n\t// Start main task queue handler\n\top.TaskQueues.StartMain()\n\n\t// Global hooks are registered, initialize their queues.\n\top.CreateAndStartQueuesForGlobalHooks()\n\n\t// ManagerEventsHandler handle events for kubernetes and schedule bindings.\n\t// Start it before start all informers to catch all kubernetes events (#42)\n\top.ManagerEventsHandler.Start()\n\n\t// Enable events from schedule manager.\n\top.ScheduleManager.Start()\n\n\top.KubeConfigManager.Start()\n\top.ModuleManager.Start()\n\top.StartModuleManagerEventHandler()\n\n\treturn nil\n}", "func (lr *LogicRunner) Start(ctx context.Context) error {\n\tlr.ArtifactManager = lr.Ledger.GetArtifactManager()\n\n\tif lr.Cfg.BuiltIn != nil {\n\t\tbi := builtin.NewBuiltIn(lr.MessageBus, lr.ArtifactManager)\n\t\tif err := lr.RegisterExecutor(core.MachineTypeBuiltin, bi); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlr.machinePrefs = append(lr.machinePrefs, core.MachineTypeBuiltin)\n\t}\n\n\tif lr.Cfg.GoPlugin != nil {\n\t\tif lr.Cfg.RPCListen != \"\" {\n\t\t\tStartRPC(ctx, lr)\n\t\t}\n\n\t\tgp, err := goplugin.NewGoPlugin(lr.Cfg, lr.MessageBus, lr.ArtifactManager)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := lr.RegisterExecutor(core.MachineTypeGoPlugin, gp); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlr.machinePrefs = append(lr.machinePrefs, core.MachineTypeGoPlugin)\n\t}\n\n\t// TODO: use separate handlers\n\tif err := lr.MessageBus.Register(core.TypeCallMethod, lr.Execute); err != nil {\n\t\treturn err\n\t}\n\tif err := lr.MessageBus.Register(core.TypeCallConstructor, lr.Execute); err != nil {\n\t\treturn err\n\t}\n\n\tif err := lr.MessageBus.Register(core.TypeExecutorResults, lr.ExecutorResults); err != nil {\n\t\treturn err\n\t}\n\tif err := lr.MessageBus.Register(core.TypeValidateCaseBind, lr.ValidateCaseBind); err != nil {\n\t\treturn err\n\t}\n\tif err := lr.MessageBus.Register(core.TypeValidationResults, lr.ProcessValidationResults); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (_m *MockHistoryEngine) Start() {\n\t_m.Called()\n}", "func (s *Service) Start(sc service.Context) error {\n\ts.sc = sc\n\n\ts.routines.Add(1)\n\tgo s.executionManagerLoop()\n\n\treturn nil\n}", "func Start(ctx context.Context, config *Config) error {\n\tlog.Debug(\"start application\")\n\n\tserviceRepo := service.NewRepository()\n\n\tserviceConfig := service.Config{\n\t\tNoTrackMode: config.NoTrackMode,\n\t\tConnDefaults: config.Defaults,\n\t\tConnsSettings: config.ServicesConnsSettings,\n\t\tDatabasesRE: config.DatabasesRE,\n\t\tDisabledCollectors: config.DisableCollectors,\n\t\tCollectorsSettings: config.CollectorsSettings,\n\t}\n\n\tvar wg sync.WaitGroup\n\tctx, cancel := context.WithCancel(ctx)\n\n\tif config.ServicesConnsSettings == nil || len(config.ServicesConnsSettings) == 0 {\n\t\t// run background discovery, the service repo will be fulfilled at first iteration\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tserviceRepo.StartBackgroundDiscovery(ctx, serviceConfig)\n\t\t\twg.Done()\n\t\t}()\n\t} else {\n\t\t// fulfill service repo using passed services\n\t\tserviceRepo.AddServicesFromConfig(serviceConfig)\n\n\t\t// setup exporters for all services\n\t\terr := serviceRepo.SetupServices(serviceConfig)\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Start auto-update loop if it is enabled.\n\tif config.AutoUpdate != \"off\" {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tac := &autoupdate.Config{\n\t\t\t\tBinaryPath: config.BinaryPath,\n\t\t\t\tBinaryVersion: config.BinaryVersion,\n\t\t\t\tUpdatePolicy: config.AutoUpdate,\n\t\t\t}\n\t\t\tautoupdate.StartAutoupdateLoop(ctx, ac)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\terrCh := make(chan error)\n\tdefer close(errCh)\n\n\t// Start HTTP metrics listener.\n\twg.Add(1)\n\tgo func() {\n\t\tif err := runMetricsListener(ctx, config); err != nil {\n\t\t\terrCh <- err\n\t\t}\n\t\twg.Done()\n\t}()\n\n\t// Start metrics sender if necessary.\n\tif config.SendMetricsURL != \"\" {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tif err := runSendMetricsLoop(ctx, config, serviceRepo); err != nil {\n\t\t\t\terrCh <- err\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\t// Waiting for errors or context cancelling.\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Info(\"exit signaled, stop application\")\n\t\t\tcancel()\n\t\t\twg.Wait()\n\t\t\treturn nil\n\t\tcase err := <-errCh:\n\t\t\tcancel()\n\t\t\twg.Wait()\n\t\t\treturn err\n\t\t}\n\t}\n}", "func Start(ctx context.Context, config *Config) error {\n\tlog.Debug(\"start application\")\n\n\tserviceRepo := service.NewRepository()\n\n\tserviceConfig := service.Config{\n\t\tNoTrackMode: config.NoTrackMode,\n\t\tConnDefaults: config.Defaults,\n\t\tConnsSettings: config.ServicesConnsSettings,\n\t\tDatabasesRE: config.DatabasesRE,\n\t\tDisabledCollectors: config.DisableCollectors,\n\t\tCollectorsSettings: config.CollectorsSettings,\n\t}\n\n\tvar wg sync.WaitGroup\n\tctx, cancel := context.WithCancel(ctx)\n\n\tif config.ServicesConnsSettings == nil {\n\t\t// run background discovery, the service repo will be fulfilled at first iteration\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tserviceRepo.StartBackgroundDiscovery(ctx, serviceConfig)\n\t\t\twg.Done()\n\t\t}()\n\t} else {\n\t\t// fulfill service repo using passed services\n\t\tserviceRepo.AddServicesFromConfig(serviceConfig)\n\n\t\t// setup exporters for all services\n\t\terr := serviceRepo.SetupServices(serviceConfig)\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Start auto-update loop if it is enabled.\n\tif config.AutoUpdate != \"off\" {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tac := &autoupdate.Config{\n\t\t\t\tBinaryPath: config.BinaryPath,\n\t\t\t\tBinaryVersion: config.BinaryVersion,\n\t\t\t\tUpdatePolicy: config.AutoUpdate,\n\t\t\t}\n\t\t\tautoupdate.StartAutoupdateLoop(ctx, ac)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\terrCh := make(chan error)\n\tdefer close(errCh)\n\n\t// Start HTTP metrics listener.\n\twg.Add(1)\n\tgo func() {\n\t\tif err := runMetricsListener(ctx, config); err != nil {\n\t\t\terrCh <- err\n\t\t}\n\t\twg.Done()\n\t}()\n\n\t// Start metrics sender if necessary.\n\tif config.SendMetricsURL != \"\" {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tif err := runSendMetricsLoop(ctx, config, serviceRepo); err != nil {\n\t\t\t\terrCh <- err\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\t// Waiting for errors or context cancelling.\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Info(\"exit signaled, stop application\")\n\t\t\tcancel()\n\t\t\twg.Wait()\n\t\t\treturn nil\n\t\tcase err := <-errCh:\n\t\t\tcancel()\n\t\t\twg.Wait()\n\t\t\treturn err\n\t\t}\n\t}\n}", "func (e *Engine) Start(ctx context.Context) {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event, ok := <-e.inEvents:\n\t\t\t\tif ok {\n\t\t\t\t\te.processEvent(event)\n\t\t\t\t}\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlog.Infoln(\"received done, exiting\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "func (s *LocalService) Start() error {\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, route := range s.routes {\n\t\tpath := filepath.Join(s.chroot, route.Username)\n\t\tif err := watcher.Add(path); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ts.watcher = watcher\n\n\tgo s.watch()\n\n\treturn nil\n}", "func (bot *Bot) Start() (err error) {\n\tif bot.opts.Webhook != nil {\n\t\treturn bot.startWebhook()\n\t}\n\treturn nil\n}", "func (p *Init) Start(ctx context.Context) error {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\treturn p.initState.Start(ctx)\n}", "func (a App) Start() error {\n\tgo a.checkerLoop()\n\treturn nil\n}", "func (c *Concentrator) Start() {\n\tc.exitWG.Add(1)\n\tgo func() {\n\t\tdefer watchdog.LogOnPanic()\n\t\tdefer c.exitWG.Done()\n\t\tc.Run()\n\t}()\n}", "func (s *Server) Start() {\n\tlog.Print(\"starting Mock Webhook server\")\n\ts.server.Start()\n}", "func Start(config *Config, placesStore places.PlacesStoreClient, templatesStorage *templates.Storage) error {\n\tif config == nil {\n\t\treturn fmt.Errorf(\"bot config is nil\")\n\t}\n\n\tdialogs, err := vkdialogs.LoadFromFile(config.DialogsPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not load vk dialogs: %v\", err)\n\t}\n\n\tbot := newWebhookBot(\n\t\tconfig.GroupID,\n\t\tconfig.Confirmation,\n\t\tvkapi.NewClient(config.Token),\n\t\tplacesStore,\n\t\tdialogs,\n\t\ttemplatesStorage,\n\t)\n\n\treturn http.ListenAndServe(config.Host, bot)\n}", "func (srv *Server) Start() {\n\tvar config *rest.Config\n\tvar err error\n\n\tif strings.ToUpper(srv.RunMode) == \"KUBE\" {\n\t\t// Create the Kubernetes in-cluster config\n\t\tconfig, err = rest.InClusterConfig()\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t} else {\n\t\t// use the current context in kubeconfig\n\t\tconfig, err = clientcmd.BuildConfigFromFlags(\"\", filepath.Join(util.HomeDir(), \".kube\", \"config\"))\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t}\n\n\t// Create the clientset\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\t// Create a watcher\n\twatcher, err := clientset.CoreV1().Services(\"\").Watch(metav1.ListOptions{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\t// Create a channel for the events to come in from the watcher\n\teventChannel := watcher.ResultChan()\n\n\t// Start an indefinite loop\n\tfor {\n\t\tevt := <-eventChannel\n\t\tsrv.handleEvent(evt)\n\t}\n}", "func Start(ctx context.Context, configFile string) (done chan struct{}) {\n\tdone = make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(done)\n\n\t\tl := zerolog.New(os.Stdout)\n\n\t\terr := runApp(ctx, l, configFile)\n\t\tif err != nil {\n\t\t\tl.Fatal().Err(err).Msg(\"running app\")\n\t\t}\n\t}()\n\n\treturn done\n}", "func Start() {\n\tconfig, err := parseConfig()\n\tif err != nil {\n\t\t_, _ = fmt.Fprintln(os.Stderr, err)\n\n\t\tflag.PrintDefaults()\n\t\tos.Exit(1)\n\t}\n\n\tvos.LoadUserEnv()\n\n\t// stop exist servers first\n\tStopLogtail()\n\n\tgo StartLogtail(config)\n\n\tgo func() {\n\t\tif err := http.ListenAndServe(fmt.Sprintf(\":%d\", config.Port), &httpHandler{}); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\thandleSignal()\n}", "func (s *Server) OnStart(ctx context.Context) error { s.run(ctx); return nil }", "func (service *Service) Start(ctx context.Context, initFn func() error) {\n\thandleErr(service.openSQLDBConnections(ctx))\n\thandleErr(service.openRedisConnections(ctx))\n\thandleErr(service.openExternalConnections(ctx))\n\thandleErr(service.initGRPC(ctx))\n\thandleErr(initFn())\n\thandleErr(service.run(ctx))\n}", "func (eng *Engine) Start(b []byte) error {\n\t// read configuration\n\tconfig := Config{}\n\terr := json.Unmarshal(b, &config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfigdata := ConfigData{}\n\terr = json.Unmarshal(b, &configdata)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// get plugins from configuration\n\tauth, err := createAuthentication(config.Authentication.Plugin, configdata.Authentication)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbytestore, err := createByteStore(config.ByteStore.Plugin, configdata.ByteStore)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfilesystem, err := createFileSystem(&bytestore, config.FileSystem.Plugin, configdata.FileSystem)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstatestore, err := createStateStore(config.StateStore.Plugin, configdata.StateStore)\n\tif err != nil {\n\t\treturn err\n\t}\n\tparser, err := createParser(config.Parser.Plugin, configdata.Parser)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// setup engine\n\teng.Authentication = auth\n\teng.ByteStore = bytestore\n\teng.FileSystem = filesystem\n\teng.StateStore = statestore\n\teng.Parser = parser\n\n\treturn nil\n}", "func Start() {\n\t// initialize the global DB connection\n\tinitPwmDb()\n\n\tfmt.Println(\"Starting pwm local API\")\n\tpwmapi.Start()\n}", "func (s *Session) Start(ctx context.Context) {\n\ts.done = make(chan interface{})\n\n\twgBackend := sync.WaitGroup{}\n\t// Start database\n\tgo func() {\n\t\twgBackend.Add(1)\n\t\terr := s.db.start(ctx)\n\t\tif err != nil {\n\t\t\ts.db.logger.Errorf(err.Error())\n\t\t}\n\t\twgBackend.Done()\n\t}()\n\n\t// Start plugins\n\twgPlugin := sync.WaitGroup{}\n\tstartPlugin := func(f func()) {\n\t\twgPlugin.Add(1)\n\t\tf()\n\t\twgPlugin.Done()\n\t}\n\tfor _, plugin := range s.plugins {\n\t\tgo startPlugin(plugin.Start)\n\t}\n\n\t// Start router\n\tgo func() {\n\t\twgBackend.Add(1)\n\t\ts.router.start(ctx, 5*time.Second, 5*time.Second)\n\t\twgBackend.Done()\n\t}()\n\n\t// Start Webhook handling server\n\ts.logger.Info(\"starting web server\")\n\ts.webServer.finalize()\n\tgo s.webServer.ListenAndServe()\n\n\t// Wait here until we received termination signal\n\t<-s.done\n\ts.logger.Info(\"terminating\")\n\n\t// Termination process\n\t// Shutdown Http server\n\ttimeout, stop := context.WithTimeout(context.Background(), 5*time.Second)\n\terr := s.webServer.Shutdown(timeout)\n\tstop()\n\tif err != nil {\n\t\ts.logger.Errorf(\"failed to shutdown httpserver: %s\", err.Error())\n\t\treturn\n\t}\n\ts.logger.Info(\"httpserver shutdown\")\n\n\t// Terminate plugins\n\tfor _, plugin := range s.plugins {\n\t\tplugin.Stop()\n\t}\n\twgPlugin.Wait()\n\ts.logger.Info(\"all plugins terminated\")\n\n\t// Wait for backend service\n\twgBackend.Wait()\n\ts.logger.Info(\"all backend services terminated\")\n\n\ts.logger.Info(\"session closed\")\n}", "func (m *Mod) Start() {\n\tm.app.WG.Add(1)\n\tgo m.start()\n\t// wait for all modules to start\n\tm.app.WG.Wait()\n}", "func (om *OpenMock) Start() {\n\tom.SetupLogrus()\n\tom.SetupRepo()\n\tom.SetRedis()\n\n\terr := om.Load()\n\tif err != nil {\n\t\tlogrus.Fatalf(\"%s: %s\", \"failed to load yaml templates for mocks\", err)\n\t}\n\n\tif om.HTTPEnabled {\n\t\tgo om.startHTTP()\n\t}\n\tif om.KafkaEnabled {\n\t\tgo om.startKafka()\n\t}\n\tif om.AMQPEnabled {\n\t\tgo om.startAMQP()\n\t}\n\tif om.GRPCEnabled {\n\t\tgo om.startGRPC()\n\t}\n\n\tif om.TemplatesDirHotReload {\n\t\tgo func() {\n\t\t\terr := reload.Do(logrus.Infof, reload.Dir(om.TemplatesDir, reload.Exec))\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Fatal(err)\n\t\t\t}\n\t\t}()\n\t}\n}", "func (s *Service) Start(store Store, options *Options) error {\n\ts.Options = options\n\tif store == nil {\n\t\tdb, err := ConnectBoltStore(options.DbPath)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ts.store = *db\n\t} else {\n\t\ts.store = store\n\t}\n\ts.channel = make(chan int)\n\ts.timers = make(map[int]*Timer)\n\n\tif err := s.restoreTimers(); err != nil {\n\t\tlog.Printf(\"Countdown package failed to restore timers: %s\", err.Error())\n\t}\n\n\tgo s.manageTimers()\n\n\treturn nil\n}", "func (m *Machine) Start(ctx context.Context) error {\n\tm.logger.Debug(\"Called Machine.Start()\")\n\talreadyStarted := true\n\tm.startOnce.Do(func() {\n\t\tm.logger.Debug(\"Marking Machine as Started\")\n\t\talreadyStarted = false\n\t})\n\tif alreadyStarted {\n\t\treturn ErrAlreadyStarted\n\t}\n\n\tvar err error\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cleanupErr := m.doCleanup(); cleanupErr != nil {\n\t\t\t\tm.Logger().Errorf(\n\t\t\t\t\t\"failed to cleanup VM after previous start failure: %v\", cleanupErr)\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = m.Handlers.Run(ctx, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = m.startInstance(ctx)\n\treturn err\n}", "func (e *Engine) Start(listenAddr string, addons []string, folder string) {\n\n\t// Listen for signals\n\tgo e.ListenForSignal()\n\n\t// Initialize and start the networking engine\n\te.Log.Debug(\"Initializing networking engine\")\n\tnet := netengine.NewEngine()\n\tgo net.ListenChannels()\n\te.NetEngine = net\n\n\te.AddNetHandlers()\n\n\tlistener := netengine.WebsocketListener{\n\t\tnet,\n\t\tlistenAddr,\n\t}\n\tgo net.AddListener(&listener)\n\n\te.Log.Debug(\"Running player id generation goroutine\")\n\n\t// The player id channel\n\tplyIdChan := make(chan int)\n\tidGen(plyIdChan)\n\te.plyIdChan = plyIdChan\n\n\t// Worker id channel\n\tworkerIdChan := make(chan int)\n\tidGen(workerIdChan)\n\te.workerIdChan = workerIdChan\n\n\te.Log.Debug(\"Adding javascript extensions\")\n\t// Adds the javascript extensions, sets e.JsContext\n\te.AddJsExtensions()\n\n\te.Log.Debug(\"Loading, compiling and running addons\")\n\t// Load all the addons, compile the scripts etc..\n\terr := e.LoadAddons(addons, folder)\n\tif err != nil {\n\t\te.Log.Error(\"Error loading addons: \", err)\n\t\treturn\n\t}\n\tgo e.ListenForClosedConnection()\n\n\t// Emit server loaded event\n\tevt := NewGeneralEvent(\"loaded\")\n\te.EmitEvent(evt)\n}", "func Start() {\n\tconfig, configErr := config.ParseArgsReturnConfig(os.Args[1:])\n\tif configErr != nil {\n\t\tfor _, err := range configErr {\n\t\t\tlog.Error(err)\n\t\t}\n\t\tos.Exit(1)\n\t}\n\tswitch {\n\tcase config.FlagVersion:\n\t\tfmt.Printf(\"DCOS Signal Service\\n Version: %s\\n Revision: %s\\n DC/OS Variant: %s\\n\", VERSION, REVISION, config.DCOSVariant)\n\t\tos.Exit(0)\n\tdefault:\n\t\tif config.Enabled == \"false\" {\n\t\t\tos.Exit(0)\n\t\t}\n\t\tif config.FlagVerbose {\n\t\t\tlog.SetLevel(log.DebugLevel)\n\t\t}\n\t\tif config.FlagTest {\n\t\t\tlog.SetLevel(log.ErrorLevel)\n\t\t}\n\t}\n\tif err := executeRunner(config); err != nil {\n\t\tlog.Error(err)\n\t\tos.Exit(1)\n\t}\n\tos.Exit(0)\n}", "func Start() {\n\tdefaultDaemon.Start()\n}", "func (self *app) Start() {\n\t// ctrl-c: listen removes binary package when application stopped.\n\tchannel := make(chan os.Signal, 2)\n\tsignal.Notify(channel, os.Interrupt, syscall.SIGTERM)\n\tgo func() {\n\t\t<-channel\n\t\t// remove the binary package on stop.\n\t\tos.Remove(self.binary)\n\t\tos.Exit(1)\n\t}()\n\n\t// start waiting the signal to start running.\n\tvar gorun = self.run()\n\tself.build()\n\tgorun <- true\n\n\twatcher := fs.NewWatcher(self.dir)\n\tlog.Infof(\"Start watching: %s\", self.dir)\n\twatcher.Add(watchList, func(filename string) {\n\t\trelpath, _ := filepath.Rel(self.dir, filename)\n\t\tlog.Infof(\"Changes on %s detected\", relpath)\n\t\tself.rerun(gorun)\n\t})\n\twatcher.Start()\n}", "func (um *Manager) Start(ctx context.Context) error {\n\tlog.Info(\"Starting Upgrade Manager\")\n\tdefer log.Info(\"Stopping upgrade manager workers\")\n\terrCh := make(chan error)\n\tgo func() { errCh <- um.upgrade(ctx) }()\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil\n\tcase err := <-errCh:\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// We must block indefinitely or manager will exit\n\t<-ctx.Done()\n\treturn nil\n}", "func (p *Plugin) Start() {\n\tp.running = true\n\tgo p.run()\n}", "func (g *Glutton) Start() (err error) {\n\n\tquit := make(chan struct{}) // stop monitor on shutdown\n\tdefer func() {\n\t\tquit <- struct{}{}\n\t\tg.Shutdown()\n\t}()\n\n\tg.startMonitor(quit)\n\terr = g.processor.Start()\n\treturn\n}", "func (e *Emulator) Start() {\n\tfor {\n\t\te.cpu.Exec()\n\t}\n}", "func (b *Bot) Start(stop <-chan struct{}) error {\n\tlog.Info(\"start the bot ...\")\n\n\t// Now start all of the components.\n\tif err := b.server.Start(stop); err != nil {\n\t\treturn err\n\t}\n\n\tb.waitForShutdown(stop)\n\n\tlog.Info(\"bot started\")\n\treturn nil\n}", "func (d *loadReporterDaemonImpl) Start() {\n\tif !atomic.CompareAndSwapInt32(&d.started, 0, 1) {\n\t\treturn\n\t}\n\n\td.shutdownWG.Add(1)\n\tgo d.reporterPump()\n\n\td.logger.Info(\"Load reporter started.\")\n}", "func Start() {\n\troot := NewRootCmd()\n\tif err := root.Execute(); err != nil {\n\t\tlogger.WithError(err).Fatal(\"error executing driverkit\")\n\t}\n}", "func (w *ServiceWriter) Start() {\n\tgo func() {\n\t\tdefer watchdog.LogOnPanic()\n\t\tw.Run()\n\t}()\n}", "func Start(args ...string) {\n runInstances(\"Start\", func(i int, id string) error {\n return runDaemon(\"run\", settingsToParams(i, true)...)\n })\n\n if cfg.UseNginx {\n UpdateNginxConf()\n }\n}", "func (cracker *Firecracker) Start() error {\n\treturn cracker.action(\"InstanceStart\", \"\")\n}", "func Start(context unsafe.Pointer, engine string, config string, callback KVStartFailureCallback) *KVEngineSys {\n\tccontext, _ := context, cgoAllocsUnknown\n\tcengine, _ := unpackPCharString(engine)\n\tcconfig, _ := unpackPCharString(config)\n\tccallback, _ := callback.PassRef()\n\t__ret := C.kvengine_start(ccontext, cengine, cconfig, ccallback)\n\t__v := *(**KVEngineSys)(unsafe.Pointer(&__ret))\n\treturn __v\n}", "func (mng *Manager) Start() {\n\tgo func() {\n\t\tif err := mng.srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {\n\t\t\tmng.lgr.Fatal(\"Error starting HTTP service: \" + err.Error())\n\t\t}\n\t}()\n}", "func (e *Engine) Start() {\n e.cmdStack = &Queue{onReceiveEmptyChan: make(chan bool)}\n e.onFinishChan = make(chan bool)\n go func() {\n for {\n cmd := e.cmdStack.Pull(&e.stopRequest)\n if cmd == nil {\n break\n }\n cmd.Execute(e)\n }\n e.onFinishChan <- true\n }()\n}", "func (c *ConfigManager) Start() {\n\tc.saveLoop()\n}", "func (p *Program) Start() error {\n\tvar err error\n\t// 连接数据库\n\terr = database.OpenMysql(global.ProjectConfig.MysqlCfgs...)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\terr = wallet.WalletService().LoadWallets()\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\t// 启动http服务\n\terr = p.htpServe.Start(global.ProjectConfig.Servers.Debug, global.ProjectConfig.Servers.Server)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (k *kubernetes) Start() error {\n\tk.Lock()\n\tdefer k.Unlock()\n\n\t// already running\n\tif k.running {\n\t\treturn nil\n\t}\n\n\t// set running\n\tk.running = true\n\tk.closed = make(chan bool)\n\n\tvar events <-chan runtime.Event\n\tif k.options.Notifier != nil {\n\t\tvar err error\n\t\tevents, err = k.options.Notifier.Notify()\n\t\tif err != nil {\n\t\t\t// TODO: should we bail here?\n\t\t\tlog.Debugf(\"Runtime failed to start update notifier\")\n\t\t}\n\t}\n\n\tgo k.run(events)\n\n\treturn nil\n}", "func Start() {\n\tLoadConf()\n\tDeviceProcessStart()\n}", "func (a *appImpl) Start() {\n\tfor _, operation := range a.operations {\n\t\ta.vehiclePark.ExecuteCmd(operation)\n\t}\n}", "func (s *Server) Start() error {\n\tlevel, ok := levelMap[s.opts.LogLevel]\n\tif !ok {\n\t\tallLevels := make([]string, 0, len(levelMap))\n\t\tfor level := range levelMap {\n\t\t\tallLevels = append(allLevels, level)\n\t\t}\n\t\treturn fmt.Errorf(\"%v is not a valid level. Valid levels are %v\", s.opts.LogLevel, strings.Join(allLevels, \", \"))\n\t}\n\n\tlog.SetLevel(level)\n\tif s.opts.LogFile != \"\" {\n\t\tlogFH, err := os.Create(s.opts.LogFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlog.SetOutput(logFH)\n\t\ts.logFH = logFH\n\t}\n\n\tregistry := plugin.NewRegistry()\n\tloadInternalPlugins(registry)\n\tif len(s.opts.ExternalPlugins) > 0 {\n\t\tloadExternalPlugins(registry, s.opts.ExternalPlugins)\n\t}\n\tif len(registry.Plugins()) == 0 {\n\t\treturn fmt.Errorf(\"No plugins loaded\")\n\t}\n\n\tplugin.InitCache()\n\n\tapiServerStopCh, apiServerStoppedCh, err := api.StartAPI(registry, s.mountpoint, s.socket)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.api = controlChannels{stopCh: apiServerStopCh, stoppedCh: apiServerStoppedCh}\n\n\tfuseServerStopCh, fuseServerStoppedCh, err := fuse.ServeFuseFS(registry, s.mountpoint)\n\tif err != nil {\n\t\ts.stopAPIServer()\n\t\treturn err\n\t}\n\ts.fuse = controlChannels{stopCh: fuseServerStopCh, stoppedCh: fuseServerStoppedCh}\n\n\tif s.opts.CPUProfilePath != \"\" {\n\t\tf, err := os.Create(s.opts.CPUProfilePath)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\terrz.Fatal(pprof.StartCPUProfile(f))\n\t}\n\treturn nil\n}", "func Start() {\n\tgo BlobServerStart()\n\tgo CollectionServerStart()\n\tgo UploadServerStart()\n}", "func (m *hostConfiguredContainer) Start() error {\n\treturn withHook(nil, func() error {\n\t\treturn m.withForwardedRuntime(m.container.Start)\n\t}, m.hooks.PostStart)\n}", "func (m *master) Start() {\n\tm.init()\n\tm.setupEtcd()\n\tm.startServer()\n\tgo m.startEventHandling()\n\tm.runUserTask()\n\tm.stop()\n}", "func Start() {\n\tdriver.Main(func(app oswin.App) {\n\t\tatomic.AddInt32(&started, 1)\n\t\t<-quit\n\t})\n}", "func (e *Engine) Run(ctx context.Context) error {\n\t// load container\n\tif err := e.load(); err != nil {\n\t\treturn err\n\t}\n\t// start status watcher\n\teventChan, errChan := e.initMonitor()\n\tgo e.monitor(eventChan)\n\n\t// start health check\n\tgo e.healthCheck(ctx)\n\n\t// start node heartbeat\n\tgo e.heartbeat(ctx)\n\n\tlog.Info(\"[Engine] Node activated\")\n\n\t// wait for signal\n\tselect {\n\tcase <-ctx.Done():\n\t\tlog.Info(\"[Engine] Agent caught system signal, exiting\")\n\t\treturn nil\n\tcase err := <-errChan:\n\t\tif err := e.crash(); err != nil {\n\t\t\tlog.Infof(\"[Engine] Mark node crash failed %v\", err)\n\t\t}\n\t\treturn err\n\t}\n}", "func (TelegramBotApp *TelegramBotApp) Start() {\n\tupdates, err := TelegramBotApp.getUpdates()\n\tif err != nil {\n\t\tlog.Fatal(\"[!] Error: Can't get updates\")\n\t}\n\tfmt.Println(\"[+] Initializating telegram bot\")\n\n\t// Start the cronjob\n\tgo TelegramBotApp.startCron()\n\n\t// Handle telegram api updates\n\tfor update := range updates {\n\t\tif update.Message != nil && update.Message.IsCommand() {\n\t\t\tgo func() {\n\t\t\t\tTelegramBotApp.handleCommand(&update)\n\t\t\t}()\n\t\t}\n\n\t}\n}", "func (svc *Service) Start(ctx context.Context, svcErrors chan error) {\n\n\t// Start kafka logging\n\tsvc.dataBakerProducer.Channels().LogErrors(ctx, \"error received from kafka data baker producer, topic: \"+svc.cfg.DatabakerImportTopic)\n\tsvc.inputFileAvailableProducer.Channels().LogErrors(ctx, \"error received from kafka input file available producer, topic: \"+svc.cfg.InputFileAvailableTopic)\n\n\t// Start healthcheck\n\tsvc.healthCheck.Start(ctx)\n\n\t// Run the http server in a new go-routine\n\tgo func() {\n\t\tlog.Event(ctx, \"Starting api...\", log.INFO)\n\t\tif err := svc.server.ListenAndServe(); err != nil {\n\t\t\tsvcErrors <- errors.Wrap(err, \"failure in http listen and serve\")\n\t\t}\n\t}()\n}", "func (p *GenericPlugin) Start(Args ...interface{}) error {\n\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\tswitch p.state {\n\tcase stateNotLoaded:\n\t\tif err := p.Load(); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase stateLoaded:\n\tcase stateActive:\n\t\tp.agent.Logger().Printf(\"Cannot Start() module [ %s ], already running\", p.Name())\n\t\treturn nil\n\t}\n\n\tif err := p.ReadStatus(); err != nil {\n\t\treturn err\n\t}\n\n\tp.state = stateActive\n\tp.started = time.Now()\n\n\tswitch {\n\tcase p.init != nil:\n\t\t{\n\t\t\tArgs = append(p.args, Args...)\n\t\t\tif err := p.init(Args...); err != nil {\n\t\t\t\tp.stop()\n\t\t\t\tp.state = stateLoaded\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"plugin error: No Init() function loaded for module [ %s ]\", p.Name())\n\t}\n\n\tp.agent.Logger().Printf(\"Started module [ %s ]\", p.Name())\n\n\treturn nil\n}", "func (b *Bot) Start() {\n\trtm := b.client.NewRTM()\n\tb.rtm = rtm\n\n\tgo rtm.ManageConnection()\n\n\tfor {\n\t\tselect {\n\t\tcase msg := <-rtm.IncomingEvents:\n\t\t\tswitch ev := msg.Data.(type) {\n\t\t\tcase *slack.HelloEvent:\n\t\t\t\tb.log(\"Hello\")\n\t\t\t\tb.handleHello()\n\t\t\tcase *slack.ConnectedEvent:\n\t\t\t\tb.info = ev.Info\n\t\t\t\tb.logf(\"Info : %v\\n\", ev.Info)\n\t\t\t\tb.logf(\"Connections : %v\\n\", ev.ConnectionCount)\n\t\t\tcase *slack.DisconnectedEvent:\n\t\t\t\tb.log(\"Disconnected\")\n\t\t\t\tif ev.Intentional {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase *slack.MessageEvent:\n\t\t\t\tb.handleMessage(ev)\n\t\t\t}\n\t\t}\n\t}\n}", "func Start(cmd *cobra.Command, args []string) error {\n\tvar err error\n\tcfg, err = config.BindWithCobra(cmd)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstartServices()\n\treturn nil\n}", "func Start(wl ...debugLevel) {\n\tif isStarted {\n\t\tcolorLog(\"[ERRO] Fail to start Bee Watch[ %s ]\",\n\t\t\t\"cannot start Bee Watch twice\")\n\t\treturn\n\t}\n\n\tisStarted = true\n\tcolorLog(\"[INIT] BW: Bee Watch v%s.\\n\", APP_VER)\n\n\twatchLevel = LevelTrace\n\tif len(wl) > 0 {\n\t\twatchLevel = wl[0]\n\t}\n\n\tApp.Name = \"Bee Watch\"\n\tApp.HttpPort = 23456\n\tApp.WatchEnabled = true\n\tApp.PrintStack = true\n\tApp.PrintSource = true\n\n\tloadJSON()\n\n\tif App.WatchEnabled {\n\t\tif App.CmdMode {\n\n\t\t} else {\n\t\t\tinitHTTP()\n\t\t}\n\t}\n}", "func (d *DockerWebHook) Start(ctx context.Context) error {\n\tserver := &http.Server{\n\t\tAddr: d.bind,\n\t\tHandler: d,\n\t}\n\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\t\tdefer cancel()\n\t\tif err := server.Shutdown(ctx); err != nil {\n\t\t\tklog.Errorf(\"error shutting down https server: %s\", err)\n\t\t}\n\t}()\n\n\tif err := server.ListenAndServe(); err != nil {\n\t\tif err == http.ErrServerClosed {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *SafeTestingTBOnStart) Start(t testing.TB) error {\n\ts.SetTestingTB(t)\n\treturn nil\n}", "func Start(opts ...StartOption) {\n\tif internal.Testing {\n\t\treturn // mock tracer active\n\t}\n\tt := newTracer(opts...)\n\tif !t.config.enabled {\n\t\treturn\n\t}\n\tinternal.SetGlobalTracer(t)\n\tif t.config.logStartup {\n\t\tlogStartup(t)\n\t}\n}", "func (m *Mainloop) Start() {\n\tsigs := make([]os.Signal, len(m.Bindings))\n\tfor s, _ := range m.Bindings {\n\t\tsigs = append(sigs, s)\n\t}\n\tsignal.Notify(m.sigchan, sigs...)\n\tfor {\n\t\tselect {\n\t\tcase sig := <-m.sigchan:\n\t\t\tm.Bindings[sig]()\n\t\tcase _ = <-m.termchan:\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func (e *Executor) Start() { go e.loop() }", "func (p *Prober) Start() {\n\t// Get static copy of the config object\n\tcfg := p.config.Copy()\n\n\tfor _, svc := range cfg.Monitor.Services {\n\t\t// Create new Probe Bot and start it\n\t\tif svc.Interval == 0 {\n\t\t\tsvc.Interval = cfg.Monitor.Interval\n\t\t}\n\n\t\tgo NewProbeBot(\n\t\t\tp.eb,\n\t\t\tsvc,\n\t\t\tp.status.Update,\n\t\t).Start()\n\t}\n}", "func (pr *PolicyReflector) Start() {\n\tpr.wg.Add(1)\n\tgo pr.run()\n}", "func Start() {\n\n\tlog.SetFormatter(&log.TextFormatter{\n\t\tDisableColors: true,\n\t\tFullTimestamp: true,\n\t})\n\n\tcfg := config{}\n\tif err := env.Parse(&cfg); err != nil {\n\t\tlog.Fatalf(\"Error parsing environment variables %+v\\n\", err)\n\n\t}\n\n\tfinish := make(chan bool)\n\n\tgo func() {\n\t\thttp.Handle(\"/metrics\", promhttp.Handler())\n\t\tlistenAddress := fmt.Sprintf(\"0.0.0.0:%d\", cfg.Port)\n\t\terr := http.ListenAndServe(listenAddress, nil)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error starting metrics server %+v\\n\", err)\n\t\t}\n\t}()\n\n\tgo func() {\n\t\texecuteCronJob(cfg)\n\t}()\n\n\t<-finish\n}", "func (s *Server) Start() {\n\tgo func() {\n\t\tlevel.Info(s.logger).Log(\"msg\", \"starting server\", \"addr\", s.server.Addr)\n\t\t// returns ErrServerClosed on graceful close\n\t\tif err := s.server.ListenAndServe(); err != http.ErrServerClosed {\n\t\t\t// NOTE: there is a chance that next line won't have time to run,\n\t\t\t// as main() doesn't wait for this goroutine to stop. don't use\n\t\t\t// code with race conditions like these for production. see post\n\t\t\t// comments below on more discussion on how to handle this.\n\t\t\t// TODO remove this log and return error instead.\n\t\t\tlevel.Error(s.logger).Log(\"msg\", \"ListenAndServe()\", \"err\", err)\n\t\t}\n\t}()\n}", "func (pier *Pier) Start() error {\n\tif pier.config.Mode.Type == repo.UnionMode {\n\t\tif err := pier.lite.Start(); err != nil {\n\t\t\tpier.logger.Errorf(\"lite start: %w\", err)\n\t\t\treturn err\n\t\t}\n\t\tif err := pier.exchanger.Start(); err != nil {\n\t\t\tpier.logger.Errorf(\"exchanger start: %w\", err)\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\tif err := pier.pierHA.Start(); err != nil {\n\t\treturn fmt.Errorf(\"pier ha start fail\")\n\t}\n\tgo pier.startPierHA()\n\treturn nil\n}", "func (m *mockService) Start() {\n\tif err := m.server.Bootstrap(); err != nil {\n\t\tpanic(err)\n\t}\n\tm.started = true\n}", "func (w *GitWatcher) Start() error {\n\tzap.L().Debug(\"git watcher initialising, waiting for first state to be set\")\n\n\t// wait for the first config event to set the initial state\n\tw.__waitpoint__start_wait_init()\n\n\tzap.L().Debug(\"git watcher initialised\", zap.Any(\"initial_state\", w.state))\n\n\tfor {\n\t\terr := w.__waitpoint__start_select_states()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "func Start(\n\tctx context.Context,\n\tconfig Config,\n\tdbConfig fw.DBConfig,\n\tdbConnector fw.DBConnector,\n\tdbMigrationTool fw.DBMigrationTool,\n\tsecurityPolicy fw.SecurityPolicy,\n\teventDispatcher fw.Dispatcher,\n) {\n\tdb, err := dbConnector.Connect(dbConfig)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = dbMigrationTool.MigrateUp(db, config.MigrationRoot)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tgRpcService, err := dep.InitGRpcService(\n\t\tconfig.ServiceName,\n\t\tconfig.LogLevel,\n\t\tprovider.ServiceEmailAddress(config.ServiceEmailAddress),\n\t\tdb,\n\t\tsecurityPolicy,\n\t\tprovider.SendGridAPIKey(config.SendGridAPIKey),\n\t\tprovider.TemplateRootDir(config.TemplateRootDir),\n\t\tprovider.CacheSize(config.CacheSize),\n\t\teventDispatcher,\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tgRpcService.Stop()\n\t}()\n\n\tgRpcService.Start(config.GRpcAPIPort)\n}", "func Start(ctx context.Context) {\n\tlog.Infow(\"startup\", \"message\", \"running initial background tasks\")\n\tmodel.LocationClean()\n\n\thourly := time.NewTicker(time.Hour)\n\tdefer hourly.Stop()\n\n\tweekly := time.NewTicker(time.Hour * 24 * 7)\n\tdefer weekly.Stop()\n\n\tif config.IsFirebaseRunning() {\n\t\twfb.Resubscribe() // prevent a crash if background starts before firebase\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Infow(\"shutdown\", \"message\", \"background tasks shutting down\")\n\t\t\treturn\n\t\tcase <-hourly.C:\n\t\t\tmodel.LocationClean()\n\t\t\twfb.ResetDefaultRateLimits()\n\t\tcase <-weekly.C:\n\t\t\twfb.Resubscribe()\n\t\t}\n\t}\n}", "func (s *Server) Start(ctx context.Context) {\n\tnewctx, cancel := contextWithSignal(ctx, os.Interrupt, syscall.SIGTERM)\n\ts.startGears(newctx, cancel)\n}", "func (c *CamSodaChecker) Start() { c.startFullCheckerDaemon(c) }", "func (self *manager) Start() error {\n\t// Register Docker container factory.\n\terr := docker.Register(self, self.fsInfo)\n\tif err != nil {\n\t\tlog.Printf(\"{Error] Docker container factory registration failed: %v.\", err)\n\t\treturn err\n\t}\n\n\t// Register the raw driver.\n\terr = raw.Register(self, self.fsInfo)\n\tif err != nil {\n\t\tlog.Printf(\"[Error] Registration of the raw container factory failed: %v\", err)\n\t\treturn err\n\t}\n\n\tself.DockerInfo()\n\tself.DockerImages()\n\n\tif enableLoadReader {\n\t\t// Create cpu load reader.\n\t\tcpuLoadReader, err := cpuload.New()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[Error] Could not initialize cpu load reader: %s\", err)\n\t\t} else {\n\t\t\terr = cpuLoadReader.Start()\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"[Error] Could not start cpu load stat collector: %s\", err)\n\t\t\t} else {\n\t\t\t\tself.loadReader = cpuLoadReader\n\t\t\t}\n\t\t}\n\t}\n\n\t// Watch for OOMs.\n\terr = self.watchForNewOoms()\n\tif err != nil {\n\t\tlog.Printf(\"[Error] Could not configure a source for OOM detection, disabling OOM events: %v\", err)\n\t}\n\n\t// If there are no factories, don't start any housekeeping and serve the information we do have.\n\tif !container.HasFactories() {\n\t\treturn nil\n\t}\n\n\t// Create root and then recover all containers.\n\terr = self.createContainer(\"/\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t//log.Printf(\"[Info] Starting recovery of all containers\")\n\n\terr = self.detectSubcontainers(\"/\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t//log.Printf(\"[Info] Recovery completed\")\n\n\t// Watch for new container.\n\tquitWatcher := make(chan error)\n\terr = self.watchForNewContainers(quitWatcher)\n\tif err != nil {\n\t\treturn err\n\t}\n\tself.quitChannels = append(self.quitChannels, quitWatcher)\n\n\t// Look for new containers in the main housekeeping thread.\n\tquitGlobalHousekeeping := make(chan error)\n\tself.quitChannels = append(self.quitChannels, quitGlobalHousekeeping)\n\tgo self.globalHousekeeping(quitGlobalHousekeeping)\n\n\treturn nil\n}", "func Start(config *model.Config) {\n\tlogger := config.Logger\n\ttgbotapi.SetLogger(logger)\n\n\tstore := memorystore.New()\n\tvar client *http.Client\n\tif config.Proxy != \"\" {\n\t\tproxy, err := url.Parse(config.Proxy)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tclient = &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxy)}}\n\t} else {\n\t\tclient = &http.Client{}\n\t}\n\n\tbot, err := tgbotapi.NewBotAPIWithClient(config.TelegramToken, client)\n\t// bot.Debug = true\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\tos.Exit(1)\n\t}\n\tsrv := newServer(store, *bot, config)\n\n\tsrv.Run()\n}", "func (sv *Unit) Start() (err error) {\n\te := log.WithField(\"ExecStart\", sv.Definition.Service.ExecStart)\n\n\te.Debug(\"sv.Start\")\n\n\tswitch sv.Definition.Service.Type {\n\tcase \"simple\":\n\t\tif err = sv.Cmd.Start(); err == nil {\n\t\t\tgo sv.Cmd.Wait()\n\t\t}\n\tcase \"oneshot\":\n\t\terr = sv.Cmd.Run()\n\tdefault:\n\t\tpanic(\"Unknown service type\")\n\t}\n\n\te.WithField(\"err\", err).Debug(\"started\")\n\treturn\n}", "func (m *mockAPI) Start() {\n\tif m.isServing() {\n\t\treturn\n\t}\n\n\tm.Server.Start()\n\tm.Lock()\n\tdefer m.Unlock()\n\tm.serving = true\n}", "func Start(debugMode bool) error {\n\tvar err error\n\n\t// since init has been done in cmd init\n\tconfigN := config.Get()\n\tlog := logger.Get()\n\n\t// fetch globalDir\n\tvar globalDir string\n\tif globalDir, err = configN.FindString(\"global.dir\"); err != nil {\n\t\treturn addTag(\"cfg\", err)\n\t}\n\n\t// make directory\n\tif err = os.MkdirAll(globalDir, os.ModePerm); err != nil {\n\t\treturn err\n\t}\n\n\t// init logFile & pidFile\n\tvar pidFile, logFile string\n\tif pidFile, err = configN.FindString(\"global.pidFile\"); err != nil {\n\t\treturn addTag(\"cfg\", err)\n\t}\n\tif logFile, err = configN.FindString(\"global.logFile\"); err != nil {\n\t\treturn addTag(\"cfg\", err)\n\t}\n\n\t// init context\n\tcntxt := &daemon.Context{\n\t\tPidFileName: pidFile,\n\t\tPidFilePerm: 0644,\n\t\tLogFileName: logFile,\n\t\tLogFilePerm: 0640,\n\t\tWorkDir: \"./\",\n\t\tUmask: 027,\n\t\tArgs: []string{},\n\t}\n\n\tvar p *os.Process\n\tp, err = cntxt.Reborn()\n\tif err != nil {\n\t\tlog.Debugf(\"[apm] daemon has started\")\n\t\treturn nil\n\t}\n\t// if fork process succeed, let the parent process\n\t// go and run the folllowing logic in the child process\n\tif p != nil {\n\t\treturn nil\n\t}\n\tdefer cntxt.Release()\n\n\t// CHILD PROCESS\n\treturn daemonHandler(debugMode)\n}", "func (h *HookbotTrigger) Start() error {\n\tfinishCh := make(chan struct{})\n\tmsgCh, errCh := listen.RetryingWatch(h.Endpoint, http.Header{}, finishCh)\n\tgo h.errorHandler(errCh)\n\tgo h.msgHandler(msgCh)\n\treturn nil\n}", "func (c *Component) Start() {\n\tc.Log.Info(\"Starting VolumeSeriesHandler\")\n\tc.oCrud = crud.NewClient(c.App.ClientAPI, c.Log)\n\tc.runCount = 0\n\tc.Animator.Start(c.oCrud, c.App.CrudeOps)\n}", "func (s *Server) Start() error {\n\tidleConnsClosed := make(chan struct{})\n\n\tgo func() {\n\t\tsigint := make(chan os.Signal, 1)\n\t\tsignal.Notify(sigint, syscall.SIGINT, syscall.SIGTERM)\n\t\t<-sigint\n\n\t\ts.logger.Info(\"Shutting down HTTP server\")\n\n\t\terr := s.httpServer.Shutdown()\n\t\tfailpoint.Inject(\"shutdownErr\", func() {\n\t\t\terr = errors.New(\"mock shutdown error\")\n\t\t})\n\t\tif err != nil {\n\t\t\ts.logger.Error(\"srv.Shutdown: %v\", zap.Error(err))\n\t\t}\n\t\ts.logger.Info(\"HTTP server is stopped\")\n\n\t\tclose(idleConnsClosed)\n\t}()\n\n\ts.logger.Info(\"Starting HTTP server\", zap.String(\"address\", s.addr))\n\terr := s.httpServer.ListenAndServe(s.addr)\n\tfailpoint.Inject(\"listenAndServeErr\", func() {\n\t\terr = errors.New(\"mock listen and serve error\")\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ListenAndServe error: %w\", err)\n\t}\n\n\t<-idleConnsClosed\n\n\tif err := s.afterShutdown(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}" ]
[ "0.70842016", "0.70279807", "0.6923318", "0.6841361", "0.6739894", "0.6596409", "0.6575987", "0.6469447", "0.64490694", "0.6430585", "0.64055973", "0.6379535", "0.6339723", "0.6337157", "0.6315934", "0.6285416", "0.62843764", "0.6270798", "0.62603813", "0.62498593", "0.6222911", "0.6200143", "0.6167275", "0.615359", "0.6140899", "0.61243474", "0.61211944", "0.61185414", "0.6115358", "0.6104151", "0.6101459", "0.60985905", "0.60935307", "0.6087295", "0.6087025", "0.6080841", "0.60606337", "0.6046862", "0.6039034", "0.6034408", "0.6031499", "0.60208845", "0.6018018", "0.60051614", "0.59946185", "0.5984861", "0.5983111", "0.5978189", "0.5974504", "0.59723604", "0.59669924", "0.5965412", "0.59640676", "0.5956073", "0.59493583", "0.5944476", "0.5940607", "0.59367293", "0.59344465", "0.5934103", "0.59305394", "0.59254605", "0.59159726", "0.59154004", "0.5907318", "0.59040314", "0.59038585", "0.59012514", "0.5897683", "0.58933395", "0.5881346", "0.5871922", "0.586916", "0.5864401", "0.586099", "0.5840079", "0.5835499", "0.583433", "0.5827639", "0.5826334", "0.58253545", "0.58200455", "0.5816487", "0.5812042", "0.5811024", "0.5807751", "0.5803552", "0.5802581", "0.5799637", "0.57929516", "0.5792205", "0.5791257", "0.57910687", "0.578722", "0.5783094", "0.57807225", "0.5773333", "0.57664675", "0.5765629", "0.57604545" ]
0.78836673
0
initDNSServer creates an instance of the dnsforward.Server Please note that we must do it even if we don't start it so that we had access to the query log and the stats
initDNSServer создает экземпляр dnsforward.Server Обратите внимание, что мы должны это сделать даже если не запускаем его, чтобы иметь доступ к журналу запросов и статистике
func initDNSServer(baseDir string) { err := os.MkdirAll(baseDir, 0755) if err != nil { log.Fatalf("Cannot create DNS data dir at %s: %s", baseDir, err) } dnsServer = dnsforward.NewServer(baseDir) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func runDNSServer() {\n\n\t// load the blocked domains\n\tblacklist := LoadBlacklistOrFail(blacklistPath)\n\tfmt.Printf(\"Loading list of %d blocked domains...\\n\", blacklist.Size())\n\n\t// make the custom handler function to reply to DNS queries\n\tupstream := getEnvOrDefault(\"UPSTREAM_DNS\", \"1.1.1.1:53\")\n\tlogging := getEnvOrDefault(\"DEBUG\", \"\") == \"true\"\n\thandler := makeDNSHandler(blacklist, upstream, logging)\n\n\t// start the server\n\tport := getEnvOrDefault(\"DNS_PORT\", \"53\")\n\tfmt.Printf(\"Starting DNS server on UDP port %s (logging = %t)...\\n\", port, logging)\n\tserver := &dns.Server{Addr: \":\" + port, Net: \"udp\"}\n\tdns.HandleFunc(\".\", handler)\n\terr := server.ListenAndServe()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func NewDNSServerDefault() (srv *dns.Server) {\n\tsrv = &dns.Server{Addr: \":\" + strconv.Itoa(53), Net: \"udp\"}\n\tconfig, _ := dns.ClientConfigFromFile(resolvFile)\n\n\tsrv.Handler = &server{config}\n\n\tlog.Info().Msgf(\"Successful load local \" + resolvFile)\n\tfor _, server := range config.Servers {\n\t\tlog.Info().Msgf(\"Success load nameserver %s\\n\", server)\n\t}\n\tfor _, domain := range config.Search {\n\t\tlog.Info().Msgf(\"Success load search %s\\n\", domain)\n\t}\n\treturn\n}", "func InitServer() Server {\n\tserver := Server{&goserver.GoServer{}, ssdp.MakeManager()}\n\tserver.Register = server\n\n\treturn server\n}", "func init() {\n\tos.RemoveAll(DataPath)\n\n\tdc := DatabaseConfig{\n\t\tDataPath: DataPath,\n\t\tIndexDepth: 4,\n\t\tPayloadSize: 16,\n\t\tBucketDuration: 3600000000000,\n\t\tResolution: 60000000000,\n\t\tSegmentSize: 100000,\n\t}\n\n\tcfg := &ServerConfig{\n\t\tVerboseLogs: true,\n\t\tRemoteDebug: true,\n\t\tListenAddress: Address,\n\t\tDatabases: map[string]DatabaseConfig{\n\t\t\tDatabase: dc,\n\t\t},\n\t}\n\n\tdbs := map[string]kdb.Database{}\n\tdb, err := dbase.New(dbase.Options{\n\t\tDatabaseName: Database,\n\t\tDataPath: dc.DataPath,\n\t\tIndexDepth: dc.IndexDepth,\n\t\tPayloadSize: dc.PayloadSize,\n\t\tBucketDuration: dc.BucketDuration,\n\t\tResolution: dc.Resolution,\n\t\tSegmentSize: dc.SegmentSize,\n\t})\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdbs[\"test\"] = db\n\td = db\n\to = dc\n\n\ts = NewServer(dbs, cfg)\n\tgo s.Listen()\n\n\t// wait for the server to start\n\ttime.Sleep(time.Second * 2)\n\n\tc = NewClient(Address)\n\tif err := c.Connect(); err != nil {\n\t\tpanic(err)\n\t}\n}", "func InitHttpSrv(addr string) {\n go func() {\n err := http.ListenAndServe(addr, nil)\n if err != nil {\n log.Error(err.Error())\n }\n }()\n}", "func (s *Server) init(renew bool) (err error) {\n\ts.Config.Operations.Metrics = s.Config.Metrics\n\ts.Operations = operations.NewSystem(s.Config.Operations)\n\ts.initMetrics()\n\n\tserverVersion := metadata.GetVersion()\n\terr = calog.SetLogLevel(s.Config.LogLevel, s.Config.Debug)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Infof(\"Server Version: %s\", serverVersion)\n\ts.levels, err = metadata.GetLevels(serverVersion)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Infof(\"Server Levels: %+v\", s.levels)\n\n\ts.mux = gmux.NewRouter()\n\t// Initialize the config\n\terr = s.initConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Initialize the default CA last\n\terr = s.initDefaultCA(renew)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Successful initialization\n\treturn nil\n}", "func InitServer() *Server {\n\ts := &Server{\n\t\t&goserver.GoServer{},\n\t\t\"logs\",\n\t\tmake(map[string]*logHolder),\n\t\t&sync.Mutex{},\n\t\ttime.Now(),\n\t\t&sync.Mutex{},\n\t\t0,\n\t\t0,\n\t\tmake(map[string]int),\n\t\t&sync.Mutex{},\n\t\t&pb.Config{},\n\t}\n\ts.Register = s\n\treturn s\n}", "func InitServer(addr string) *http.Server {\n\trouter := mux.NewRouter()\n\trouter.HandleFunc(\"/pokemon/{name}\", endpoints.PokemonHandler)\n\trouter.HandleFunc(\"/health\", endpoints.HealthHandler)\n\n\trouter.Use(middleware.LoggingMiddleware)\n\n\tsrv := &http.Server{\n\t\tHandler: router,\n\t\tAddr: \"0.0.0.0:8080\",\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\n\treturn srv\n}", "func StartDNSDaemon() (err error) {\n\tsrv := &dns.Server{Addr: \":\" + strconv.Itoa(53), Net: \"udp\"}\n\tsrv.Handler = &dnsHandler{}\n\n\tconfig, _ := dns.ClientConfigFromFile(\"/etc/resolv.conf\")\n\n\tlog.Info().Msgf(\"Successful load local /etc/resolv.conf\")\n\tfor _, server := range config.Servers {\n\t\tlog.Info().Msgf(\"Success load nameserver %s\\n\", server)\n\t}\n\n\tfmt.Printf(\"DNS Server Start At 53...\\n\")\n\terr = srv.ListenAndServe()\n\tif err != nil {\n\t\tlog.Error().Msgf(\"Failed to set udp listener %s\\n\", err.Error())\n\t}\n\treturn\n}", "func (s *StanServer) startNATSServer() error {\n\tif err := s.configureClusterOpts(); err != nil {\n\t\treturn err\n\t}\n\tif err := s.configureNATSServerTLS(); err != nil {\n\t\treturn err\n\t}\n\topts := s.natsOpts\n\ts.natsServer = server.New(opts)\n\tif s.natsServer == nil {\n\t\treturn fmt.Errorf(\"no NATS Server object returned\")\n\t}\n\ts.log.SetNATSServer(s.natsServer)\n\t// Run server in Go routine.\n\tgo s.natsServer.Start()\n\t// Wait for accept loop(s) to be started\n\tif !s.natsServer.ReadyForConnections(10 * time.Second) {\n\t\treturn fmt.Errorf(\"unable to start a NATS Server on %s:%d\", opts.Host, opts.Port)\n\t}\n\treturn nil\n}", "func (ds *DNSSuite) Init(flagSet *flag.FlagSet, args []string) error {\n\tvar typeStr string\n\n\tflagSet.StringVar(&ds.Protocol, \"protocol\", \"udp\", \"DNS server protocol, udp|tcp|tcp-tls\")\n\tflagSet.StringVar(&ds.Host, \"host\", \"127.0.0.1:53\", \"DNS server host, IP and port\")\n\tflagSet.StringVar(&typeStr, \"type\", \"A\", \"DNS Type, like A|AAAA|CNAME\")\n\tflagSet.Var(&ds.Records, \"record\", \"DNS record to test\")\n\n\tflagSet.Parse(args)\n\n\tif ds.Protocol != \"udp\" && ds.Protocol != \"tcp\" && ds.Protocol != \"tcp-tls\" {\n\t\treturn errors.New(\"protocol should be one of udp|tcp|tcp-tls\")\n\t}\n\tif !strings.ContainsRune(ds.Host, ':') {\n\t\tds.Host += \":53\"\n\t}\n\tif typeStr != \"A\" && typeStr != \"AAAA\" && typeStr != \"CNAME\" {\n\t\treturn errors.New(\"type should be one of udp|tcp|tcp-tls\")\n\t}\n\tif len(ds.Records) == 0 {\n\t\treturn errors.New(\"specify at least one record\")\n\t}\n\n\tfor idx, record := range ds.Records {\n\t\tif record[len(record)-1] != '.' {\n\t\t\tds.Records[idx] = record + \".\"\n\t\t}\n\t}\n\n\tswitch typeStr {\n\tcase \"A\":\n\t\tds.Type = dns.TypeA\n\tcase \"AAAA\":\n\t\tds.Type = dns.TypeAAAA\n\tcase \"CNAME\":\n\t\tds.Type = dns.TypeCNAME\n\t}\n\n\tclient.DNSClient.Net = ds.Protocol\n\n\treturn nil\n}", "func newDNSTestServer(server *dns.Server) *dnsTestServer {\n\treturn &dnsTestServer{Server: server, DNSDatabase: make(dnsDatabase), DNSDatabaseRetry: make(dnsDatabase)}\n}", "func NewServer(\n\taddr string,\n\tcontrollerNS string,\n\tidentityTrustDomain string,\n\tenableH2Upgrade bool,\n\tk8sAPI *k8s.API,\n\tshutdown <-chan struct{},\n) *grpc.Server {\n\tlog := logging.WithFields(logging.Fields{\n\t\t\"addr\": addr,\n\t\t\"component\": \"server\",\n\t})\n\tendpoints := watcher.NewEndpointsWatcher(k8sAPI, log)\n\tprofiles := watcher.NewProfileWatcher(k8sAPI, log)\n\ttrafficSplits := watcher.NewTrafficSplitWatcher(k8sAPI, log)\n\n\tsrv := server{\n\t\tendpoints,\n\t\tprofiles,\n\t\ttrafficSplits,\n\t\tenableH2Upgrade,\n\t\tcontrollerNS,\n\t\tidentityTrustDomain,\n\t\tlog,\n\t\tshutdown,\n\t}\n\n\ts := prometheus.NewGrpcServer()\n\t// linkerd2-proxy-api/destination.Destination (proxy-facing)\n\tpb.RegisterDestinationServer(s, &srv)\n\t// controller/discovery.Discovery (controller-facing)\n\tdiscoveryPb.RegisterDiscoveryServer(s, &srv)\n\treturn s\n}", "func NewServer(c *Config) (*Server, error) {\n\ts := &Server{}\n\n\tif c.Timeout != \"\" {\n\t\ttimeout, err := time.ParseDuration(c.Timeout)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"parse timeout: \" + err.Error())\n\t\t}\n\t\ts.dialer = &net.Dialer{Timeout: timeout}\n\t} else {\n\t\ts.dialer = &net.Dialer{Timeout: 20 * time.Second}\n\t}\n\n\tif c.Retries != nil {\n\t\ts.retries = *c.Retries\n\t} else {\n\t\ts.retries = 3\n\t}\n\n\ts.requireAuth = len(c.Accounts) > 0\n\tif s.requireAuth {\n\t\ts.account = make([]*internalAccount, len(c.Accounts))\n\t\tfor i, v := range c.Accounts {\n\t\t\ts.account[i] = &internalAccount{\n\t\t\t\tusername: []byte(v.Username),\n\t\t\t\tpassword: []byte(v.Password),\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(c.Upstreams) == 0 {\n\t\treturn nil, errors.New(\"no upstreams\")\n\t}\n\n\tupstreams := make([]*internalUpstream, len(c.Upstreams))\n\tfor i, v := range c.Upstreams {\n\t\taddr := v.Address\n\t\thost, port, err := net.SplitHostPort(addr)\n\t\tif err != nil {\n\t\t\taddr += \":80\"\n\t\t\thost, port, err = net.SplitHostPort(addr)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.New(\"invalid address \" + v.Address)\n\t\t\t}\n\t\t}\n\t\taddr = net.JoinHostPort(host, port)\n\n\t\ttlsConfig := (*tls.Config)(nil)\n\t\tif t := v.TLSConfig; t != nil {\n\t\t\ttlsConfig = &tls.Config{\n\t\t\t\tNextProtos: []string{\"http/1.1\"},\n\t\t\t}\n\n\t\t\tif t.ServerName != \"\" {\n\t\t\t\ttlsConfig.ServerName = t.ServerName\n\t\t\t} else {\n\t\t\t\tu, err := url.Parse(v.Address)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.New(\"tls: parse server name: \" + err.Error())\n\t\t\t\t}\n\t\t\t\ttlsConfig.ServerName = u.Hostname()\n\t\t\t}\n\n\t\t\ttlsConfig.InsecureSkipVerify = t.InsecureSkipVerify\n\t\t\tif t.SHA256Fingerprint != \"\" {\n\t\t\t\tfin, err := hex.DecodeString(t.SHA256Fingerprint)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.New(\"tls: failed to parse fingerprint\")\n\t\t\t\t}\n\t\t\t\tif len(fin) != 32 {\n\t\t\t\t\treturn nil, errors.New(\"tls: fingerprint: wrong length, not like a sha256 digest\")\n\t\t\t\t}\n\n\t\t\t\ttlsConfig.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {\n\t\t\t\t\tif len(rawCerts) < 1 {\n\t\t\t\t\t\treturn errors.New(\"server provides no cert\")\n\t\t\t\t\t}\n\n\t\t\t\t\tsum := sha256.Sum256(rawCerts[0])\n\t\t\t\t\tif !hmac.Equal(sum[:], fin) {\n\t\t\t\t\t\treturn errors.New(\"wrong fingerprint\")\n\t\t\t\t\t}\n\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif t.RootCA != \"\" {\n\t\t\t\tcertPool := x509.NewCertPool()\n\t\t\t\tpem, err := ioutil.ReadFile(t.RootCA)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.New(\"tls: read rootCAs: \" + err.Error())\n\t\t\t\t}\n\t\t\t\tif !certPool.AppendCertsFromPEM(pem) {\n\t\t\t\t\treturn nil, errors.New(\"tls: failed to load rootCAs\")\n\t\t\t\t}\n\t\t\t\ttlsConfig.RootCAs = certPool\n\t\t\t}\n\n\t\t\tif t.CertFile != \"\" && t.KeyFile != \"\" {\n\t\t\t\tcert, err := tls.LoadX509KeyPair(t.CertFile, t.KeyFile)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.New(\"tls: load key pair: \" + err.Error())\n\t\t\t\t}\n\t\t\t\ttlsConfig.Certificates = []tls.Certificate{cert}\n\t\t\t}\n\t\t}\n\n\t\tupstreams[i] = &internalUpstream{\n\t\t\taddress: addr,\n\t\t\theader: basicauth(v.Username, v.Password),\n\t\t\ttlsConfig: tlsConfig,\n\t\t}\n\t}\n\n\ts.next = make(chan *internalUpstream)\n\ts.stop = make(chan struct{})\n\tgo func() {\n\t\t// simple round-robin\n\t\tfor {\n\t\t\tfor _, v := range upstreams {\n\t\t\t\tselect {\n\t\t\t\tcase s.next <- v:\n\t\t\t\tcase <-s.stop:\n\t\t\t\t\tclose(s.next)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn s, nil\n}", "func runTestDNSServer(t *testing.T, port string) *dnsTestServer {\n\tlistener, err := net.ListenPacket(\"udp\", \"127.0.0.1:\"+port)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tmux := dns.NewServeMux()\n\tserver := &dns.Server{PacketConn: listener, Net: \"udp\", Handler: mux}\n\n\tgo func() {\n\t\tif err := server.ActivateAndServe(); err != nil {\n\t\t\tlog.Printf(\"Error in local DNS server: %s\", err)\n\t\t}\n\t}()\n\n\treturn newDNSTestServer(server)\n}", "func InitServer(dataDirectory string, showDash bool, logger *log.Logger) *MetaServer {\n\trouter := mux.NewRouter()\n\n\tdb, err := newMongoDB()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tserver := &MetaServer{\n\t\tdataDir: dataDirectory,\n\t\tdb: db,\n\t\trouter: router,\n\t\tlogger: logger,\n\t\tauthorizer: authorization.NewAuthorizer(logger),\n\t\tsigningKey: []byte(\"secret\"),\n\t}\n\n\tauthMiddleware := authorization.GetAuthMiddleware(server.signingKey)\n\n\trouter.Handle(\"/auth/provider\", server.authorizer.GetAuthChallengeHandler(\"providerID\")).Methods(\"GET\")\n\trouter.Handle(\"/auth/provider\", server.authorizer.GetRespondAuthChallengeHandler(\n\t\t\"providerID\", server.signingKey, server.getProviderPublicKey)).Methods(\"POST\")\n\n\trouter.Handle(\"/auth/renter\", server.authorizer.GetAuthChallengeHandler(\"renterID\")).Methods(\"GET\")\n\trouter.Handle(\"/auth/renter\", server.authorizer.GetRespondAuthChallengeHandler(\n\t\t\"renterID\", server.signingKey, server.getRenterPublicKey)).Methods(\"POST\")\n\n\trouter.Handle(\"/providers\", server.getProvidersHandler()).Methods(\"GET\")\n\trouter.Handle(\"/providers\", server.postProviderHandler()).Methods(\"POST\")\n\trouter.Handle(\"/providers/{id}\", server.getProviderHandler()).Methods(\"GET\")\n\trouter.Handle(\"/providers/{id}\", authMiddleware.Handler(server.putProviderHandler())).Methods(\"PUT\")\n\trouter.Handle(\"/providers/{id}\", authMiddleware.Handler(server.deleteProviderHandler())).Methods(\"DELETE\")\n\n\trouter.Handle(\"/providers/{providerID}/transactions\", authMiddleware.Handler(server.getProviderTransactionsHandler())).Methods(\"GET\")\n\n\trouter.Handle(\"/renters\", server.postRenterHandler()).Methods(\"POST\")\n\trouter.Handle(\"/renters\", server.getRenterByAliasHandler()).Queries(\"alias\", \"{alias}\").Methods(\"GET\")\n\trouter.Handle(\"/renters/{id}\", authMiddleware.Handler(server.getRenterHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{id}\", authMiddleware.Handler(server.putRenterHandler())).Methods(\"PUT\")\n\trouter.Handle(\"/renters/{id}\", authMiddleware.Handler(server.deleteRenterHandler())).Methods(\"DELETE\")\n\n\trouter.Handle(\"/renters/{renterID}/transactions\", authMiddleware.Handler(server.getRenterTransactionsHandler())).Methods(\"GET\")\n\n\trouter.Handle(\"/renters/{renterID}/contracts\", authMiddleware.Handler(server.getContractsHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/contracts\", authMiddleware.Handler(server.postContractHandler())).Methods(\"POST\")\n\trouter.Handle(\"/renters/{renterID}/contracts/{contractID}\", authMiddleware.Handler(server.getContractHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/contracts/{contractID}\", authMiddleware.Handler(server.putContractHandler())).Methods(\"PUT\")\n\trouter.Handle(\"/renters/{renterID}/contracts/{contractID}\", authMiddleware.Handler(server.deleteContractHandler())).Methods(\"DELETE\")\n\trouter.Handle(\"/renters/{renterID}/contracts/{contractID}/payment\", authMiddleware.Handler(server.getContractPaymentHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/contracts/{contractID}/payment\", authMiddleware.Handler(server.putContractPaymentHandler())).Methods(\"PUT\")\n\n\trouter.Handle(\"/renters/{renterID}/files\", authMiddleware.Handler(server.getFilesHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/files\", authMiddleware.Handler(server.postFileHandler())).Methods(\"POST\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}\", authMiddleware.Handler(server.getFileHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}\", authMiddleware.Handler(server.putFileHandler())).Methods(\"PUT\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}\", authMiddleware.Handler(server.deleteFileHandler())).Methods(\"DELETE\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/versions\", authMiddleware.Handler(server.getFileVersionsHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/versions\", authMiddleware.Handler(server.postFileVersionHandler())).Methods(\"POST\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/versions/{version}\", authMiddleware.Handler(server.getFileVersionHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/versions/{version}\", authMiddleware.Handler(server.putFileVersionHandler())).Methods(\"PUT\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/versions/{version}\", authMiddleware.Handler(server.deleteFileVersionHandler())).Methods(\"DELETE\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/permissions\", authMiddleware.Handler(server.getFilePermissionsHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/permissions\", authMiddleware.Handler(server.postFilePermissionHandler())).Methods(\"POST\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/permissions/{sharedID}\", authMiddleware.Handler(server.getFilePermissionHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/permissions/{sharedID}\", authMiddleware.Handler(server.putFilePermissionHandler())).Methods(\"PUT\")\n\trouter.Handle(\"/renters/{renterID}/files/{fileID}/permissions/{sharedID}\", authMiddleware.Handler(server.deleteFilePermissionHandler())).Methods(\"DELETE\")\n\n\trouter.Handle(\"/renters/{renterID}/shared\", authMiddleware.Handler(server.getSharedFilesHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/shared/{fileID}\", authMiddleware.Handler(server.getFileHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/shared/{fileID}\", authMiddleware.Handler(server.deleteSharedFileHandler())).Methods(\"DELETE\")\n\trouter.Handle(\"/renters/{renterID}/shared/{fileID}/versions\", authMiddleware.Handler(server.getFileVersionsHandler())).Methods(\"GET\")\n\trouter.Handle(\"/renters/{renterID}/shared/{fileID}/versions/{version}\", authMiddleware.Handler(server.getFileVersionHandler())).Methods(\"GET\")\n\n\trouter.Handle(\"/paypal/create\", authMiddleware.Handler(server.getCreatePaypalPaymentHandler())).Methods(\"POST\")\n\trouter.Handle(\"/paypal/execute\", authMiddleware.Handler(server.getExecutePaypalPaymentHandler())).Methods(\"POST\")\n\trouter.Handle(\"/paypal/renter-withdraw\", authMiddleware.Handler(server.getRenterPaypalWithdrawHandler())).Methods(\"POST\")\n\trouter.Handle(\"/paypal/provider-withdraw\", authMiddleware.Handler(server.getProviderPaypalWithdrawHandler())).Methods(\"POST\")\n\n\tif showDash {\n\t\trouter.Handle(\"/dashboard.json\", server.getDashboardDataHandler()).Methods(\"GET\")\n\t\trouter.Handle(\"/dashboard/audit/{fileID}/{blockID}\", server.getDashboardAuditHandler()).Methods(\"POST\")\n\n\t\tstaticPath, err := getStaticPath()\n\t\tif err != nil {\n\t\t\tserver.logger.Fatal(err)\n\t\t}\n\t\trouter.Handle(\"/{someFile}\", http.FileServer(http.Dir(staticPath)))\n\t}\n\n\tserver.startPaymentRunner()\n\n\treturn server\n}", "func (d *Daemon) Init() error {\n\tlistenerMap := make(map[string]net.Listener)\n\n\tif listener, err := getListener(d.normalSocketPath, listenerMap); err == nil {\n\t\td.generalListener = &ucrednetListener{Listener: listener}\n\t} else {\n\t\treturn fmt.Errorf(\"when trying to listen on %s: %v\", d.normalSocketPath, err)\n\t}\n\n\tif listener, err := getListener(d.untrustedSocketPath, listenerMap); err == nil {\n\t\t// This listener may also be nil if that socket wasn't among\n\t\t// the listeners, so check it before using it.\n\t\td.untrustedListener = &ucrednetListener{Listener: listener}\n\t} else {\n\t\tlogger.Debugf(\"cannot get listener for %q: %v\", d.untrustedSocketPath, err)\n\t}\n\n\td.addRoutes()\n\n\tlogger.Noticef(\"Started daemon.\")\n\treturn nil\n}", "func InitServer(ip string) Server {\n\tserver := Server{IP: ip, Port: 8090}\n\treturn server\n}", "func (s *UDPServer) Init(settings *ServerSettings) error {\n\turl := settings.URL\n\tport := settings.Port\n\tif port == \"\" {\n\t\treturn errors.New(\"udp_server_init: port required\")\n\t}\n\n\taddress := url + \":\" + port\n\n\tudpAddr, err := net.ResolveUDPAddr(\"udp4\", address)\n\tif err != nil {\n\t\treturn errors.New(\"udp_server_init: could not resolve address. err: \" + err.Error())\n\t}\n\n\ts.Conn, err = net.ListenUDP(\"udp\", udpAddr)\n\tif err != nil {\n\t\treturn errors.New(\"udp_server_init: could not start connection. err: \" + err.Error())\n\t}\n\n\treturn nil\n}", "func setupTestDNSServers(t *testing.T) (s1, s2 *dnsTestServer) {\n\ts1 = runTestDNSServer(t, \"0\")\n\ts2 = runTestDNSServer(t, \"0\")\n\n\tq := DNSQuery{\"NS\", testDomain}\n\ta := DNSAnswers{{\"NS\", s1.Address() + \".\"}, {\"NS\", s2.Address() + \".\"}}\n\ts1.AddEntryToDNSDatabase(q, a)\n\ts2.AddEntryToDNSDatabase(q, a)\n\n\ts1.Server.Handler.(*dns.ServeMux).HandleFunc(testDomain+\".\", func(w dns.ResponseWriter, r *dns.Msg) {\n\t\tstdDNSHandler(t, w, r, s1, false)\n\t})\n\ts2.Server.Handler.(*dns.ServeMux).HandleFunc(testDomain+\".\", func(w dns.ResponseWriter, r *dns.Msg) {\n\t\tstdDNSHandler(t, w, r, s2, true)\n\t})\n\n\treturn s1, s2\n}", "func NewServer(env dnsmgrenv.DNSMgrEnv, dnsService DNSService, db *sqlx.DB) *Server {\n\treturn &Server{env: env, dnsService: dnsService, db: db}\n}", "func initServer(ctx context.Context, n *Node) error {\n\n\tif n.index < int32(len(n.config.Nodes)) {\n\n\t\tle := n.config.Nodes[n.index]\n\t\tvar listener net.Listener\n\n\t\terr := backoff.Retry(\n\t\t\tfunc() error {\n\t\t\t\tvar err error\n\t\t\t\tlistener, err = net.Listen(\"tcp\", le)\n\t\t\t\treturn err\n\t\t\t},\n\t\t\tbackoff.WithMaxRetries(backoff.NewExponentialBackOff(), 3),\n\t\t)\n\n\t\t// listener, err := net.Listen(\"tcp\", le)\n\t\tif err != nil {\n\t\t\terr = raftErrorf(err, \"failed to acquire local TCP socket for gRPC\")\n\t\t\tn.logger.Errorw(\"initServer failed (some other application or previous instance still using socket?)\",\n\t\t\t\traftErrKeyword, err)\n\t\t\treturn err\n\t\t}\n\n\t\ts := &raftServer{\n\t\t\tnode: n,\n\t\t\tlocalListener: listener,\n\t\t\tlocalAddr: le,\n\t\t}\n\n\t\tn.messaging.server = s\n\t\tn.logger.Debugw(\"listener acquired local node address\", s.logKV()...)\n\n\t} else {\n\n\t\terr := raftErrorf(\n\t\t\tRaftErrorServerNotSetup, \"LocalNodeIndex in out of bounds of cluster Nodes configuration\")\n\t\tn.logger.Errorw(\"initServer failed\", raftErrKeyword, err)\n\t\treturn err\n\n\t}\n\n\treturn nil\n}", "func (s *Server) Init(addr string, db Store) error {\n\tvar err error\n\n\ts.l, err = net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error start server: %v\\n\", err)\n\t}\n\tlog.Println(\"Server start \", addr)\n\n\tif db == nil {\n\t\treturn fmt.Errorf(\"Store not initializate\\n\")\n\t}\n\ts.db = db\n\n\treturn err\n}", "func Init(c *conf.Config) {\n\tinitService(c)\n\tengine := bm.DefaultServer(c.HTTPServer)\n\tinnerRouter(engine)\n\t// init internal server\n\tif err := engine.Start(); err != nil {\n\t\tlog.Error(\"httpx.Serve error(%v)\", err)\n\t\tpanic(err)\n\t}\n}", "func (svr *Server) Init(maxConns int) (err error) {\n\tsvr.LineMgr, err = NewMLLineMgr(maxConns)\n\tif err != nil {\n\t\tutils.Logger.Error(\"New Magline Connection Pool Error!\")\n\t\treturn\n\t}\n\treturn\n}", "func NewServer(proxy *dns.Proxy, config Config) (*Server, error) {\n\tserver := &Server{\n\t\tConfig: config,\n\t\tdone: make(chan bool, 1),\n\t\tproxy: proxy,\n\t\thttpClient: &http.Client{Timeout: 10 * time.Second},\n\t}\n\tproxy.Handler = server.hijack\n\n\t// Periodically refresh hosts\n\tif interval := config.DNS.refreshInterval; interval > 0 {\n\t\tgo server.reloadHosts(interval)\n\t}\n\n\t// Load initial hosts\n\tgo server.loadHosts()\n\treturn server, nil\n}", "func init() {\r\n\tmux := http.NewServeMux()\r\n\trpcserver.RegisterRPCFuncs(mux, Routes)\r\n\twm := rpcserver.NewWebsocketManager(Routes, nil)\r\n\tmux.HandleFunc(websocketEndpoint, wm.WebsocketHandler)\r\n\tgo func() {\r\n\t\t_, err := rpcserver.StartHTTPServer(tcpAddr, mux)\r\n\t\tif err != nil {\r\n\t\t\tpanic(err)\r\n\t\t}\r\n\t}()\r\n\r\n\tmux2 := http.NewServeMux()\r\n\trpcserver.RegisterRPCFuncs(mux2, Routes)\r\n\twm = rpcserver.NewWebsocketManager(Routes, nil)\r\n\tmux2.HandleFunc(websocketEndpoint, wm.WebsocketHandler)\r\n\tgo func() {\r\n\t\t_, err := rpcserver.StartHTTPServer(unixAddr, mux2)\r\n\t\tif err != nil {\r\n\t\t\tpanic(err)\r\n\t\t}\r\n\t}()\r\n\r\n\t// wait for servers to start\r\n\ttime.Sleep(time.Second * 2)\r\n\r\n}", "func initMDNS(ctx context.Context, peerhost host.Host, rendezvous string) chan peer.AddrInfo {\n\t// An hour might be a long long period in practical applications. But this is fine for us\n\tser, err := discovery.NewMdnsService(ctx, peerhost, time.Hour, rendezvous)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t//register with service so that we get notified about peer discovery\n\tn := &discoveryNotifee{}\n\tn.PeerChan = make(chan peer.AddrInfo)\n\n\tser.RegisterNotifee(n)\n\treturn n.PeerChan\n}", "func NewServer(addr string, group []*Config) (*Server, error) {\n\ts := &Server{\n\t\tAddr: addr,\n\t\tzones: make(map[string][]*Config),\n\t\tgraceTimeout: 5 * time.Second,\n\t\tidleTimeout: 10 * time.Second,\n\t\treadTimeout: 3 * time.Second,\n\t\twriteTimeout: 5 * time.Second,\n\t\ttsigSecret: make(map[string]string),\n\t}\n\n\t// We have to bound our wg with one increment\n\t// to prevent a \"race condition\" that is hard-coded\n\t// into sync.WaitGroup.Wait() - basically, an add\n\t// with a positive delta must be guaranteed to\n\t// occur before Wait() is called on the wg.\n\t// In a way, this kind of acts as a safety barrier.\n\ts.dnsWg.Add(1)\n\n\tfor _, site := range group {\n\t\tif site.Debug {\n\t\t\ts.debug = true\n\t\t\tlog.D.Set()\n\t\t}\n\t\ts.stacktrace = site.Stacktrace\n\n\t\t// append the config to the zone's configs\n\t\ts.zones[site.Zone] = append(s.zones[site.Zone], site)\n\n\t\t// set timeouts\n\t\tif site.ReadTimeout != 0 {\n\t\t\ts.readTimeout = site.ReadTimeout\n\t\t}\n\t\tif site.WriteTimeout != 0 {\n\t\t\ts.writeTimeout = site.WriteTimeout\n\t\t}\n\t\tif site.IdleTimeout != 0 {\n\t\t\ts.idleTimeout = site.IdleTimeout\n\t\t}\n\n\t\t// copy tsig secrets\n\t\tfor key, secret := range site.TsigSecret {\n\t\t\ts.tsigSecret[key] = secret\n\t\t}\n\n\t\t// compile custom plugin for everything\n\t\tvar stack plugin.Handler\n\t\tfor i := len(site.Plugin) - 1; i >= 0; i-- {\n\t\t\tstack = site.Plugin[i](stack)\n\n\t\t\t// register the *handler* also\n\t\t\tsite.registerHandler(stack)\n\n\t\t\t// If the current plugin is a MetadataCollector, bookmark it for later use. This loop traverses the plugin\n\t\t\t// list backwards, so the first MetadataCollector plugin wins.\n\t\t\tif mdc, ok := stack.(MetadataCollector); ok {\n\t\t\t\tsite.metaCollector = mdc\n\t\t\t}\n\n\t\t\tif s.trace == nil && stack.Name() == \"trace\" {\n\t\t\t\t// we have to stash away the plugin, not the\n\t\t\t\t// Tracer object, because the Tracer won't be initialized yet\n\t\t\t\tif t, ok := stack.(trace.Trace); ok {\n\t\t\t\t\ts.trace = t\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Unblock CH class queries when any of these plugins are loaded.\n\t\t\tif _, ok := EnableChaos[stack.Name()]; ok {\n\t\t\t\ts.classChaos = true\n\t\t\t}\n\t\t}\n\t\tsite.pluginChain = stack\n\t}\n\n\tif !s.debug {\n\t\t// When reloading we need to explicitly disable debug logging if it is now disabled.\n\t\tlog.D.Clear()\n\t}\n\n\treturn s, nil\n}", "func startHttpServer(conn connectors.Clients) *http.Server {\n\n\t// set the server props\n\tsrv := &http.Server{Addr: \":\" + os.Getenv(\"SERVER_PORT\")}\n\n\t// set the router and endpoints\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/api/v1/streamdata\", func(w http.ResponseWriter, req *http.Request) {\n\t\thandlers.StreamHandler(w, req, conn)\n\t}).Methods(\"POST\", \"OPTIONS\")\n\n\tr.HandleFunc(\"/api/v2/sys/info/isalive\", handlers.IsAlive).Methods(\"GET\", \"OPTIONS\")\n\n\thttp.Handle(\"/\", r)\n\n\t// start our server (concurrent)\n\tif err := srv.ListenAndServe(); err != nil {\n\t\tconn.Error(\"Httpserver: ListenAndServe() error: %v\", err)\n\t\tos.Exit(0)\n\t}\n\n\t// return our srv object\n\treturn srv\n}", "func NewServer(\n\taddr string,\n\tcontrollerNS string,\n\tidentityTrustDomain string,\n\tenableH2Upgrade bool,\n\tenableEndpointSlices bool,\n\tk8sAPI *k8s.API,\n\tmetadataAPI *k8s.MetadataAPI,\n\tclusterStore *watcher.ClusterStore,\n\tclusterDomain string,\n\tdefaultOpaquePorts map[uint32]struct{},\n\tshutdown <-chan struct{},\n) (*grpc.Server, error) {\n\tlog := logging.WithFields(logging.Fields{\n\t\t\"addr\": addr,\n\t\t\"component\": \"server\",\n\t})\n\n\t// Initialize indexers that are used across watchers\n\terr := watcher.InitializeIndexers(k8sAPI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tendpoints, err := watcher.NewEndpointsWatcher(k8sAPI, metadataAPI, log, enableEndpointSlices, \"local\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\topaquePorts, err := watcher.NewOpaquePortsWatcher(k8sAPI, log, defaultOpaquePorts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprofiles, err := watcher.NewProfileWatcher(k8sAPI, log)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tservers, err := watcher.NewServerWatcher(k8sAPI, log)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsrv := server{\n\t\tpb.UnimplementedDestinationServer{},\n\t\tendpoints,\n\t\topaquePorts,\n\t\tprofiles,\n\t\tservers,\n\t\tclusterStore,\n\t\tenableH2Upgrade,\n\t\tcontrollerNS,\n\t\tidentityTrustDomain,\n\t\tclusterDomain,\n\t\tdefaultOpaquePorts,\n\t\tk8sAPI,\n\t\tmetadataAPI,\n\t\tlog,\n\t\tshutdown,\n\t}\n\n\ts := prometheus.NewGrpcServer()\n\t// linkerd2-proxy-api/destination.Destination (proxy-facing)\n\tpb.RegisterDestinationServer(s, &srv)\n\treturn s, nil\n}", "func DTLSServer(conn net.Conn, config *Config) *Conn {\n\tc := &Conn{config: config, isDTLS: true, conn: conn}\n\tc.init()\n\treturn c\n}", "func StartServer(ctx context.Context, t SimpleTB, debugMode bool) (client.Client, *net.UDPAddr) {\n\tmetrics := landns.NewMetrics(\"landns\")\n\tdyn, err := landns.NewSqliteResolver(\":memory:\", metrics)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to make sqlite resolver: %s\", err)\n\t}\n\n\ts := &landns.Server{\n\t\tMetrics: metrics,\n\t\tDynamicResolver: dyn,\n\t\tResolvers: dyn,\n\t\tDebugMode: debugMode,\n\t}\n\n\tapiAddr := &net.TCPAddr{IP: net.ParseIP(\"127.0.0.1\"), Port: FindEmptyPort()}\n\tdnsAddr := &net.UDPAddr{IP: net.ParseIP(\"127.0.0.1\"), Port: 3553}\n\tgo func() {\n\t\tif err := s.ListenAndServe(ctx, apiAddr, dnsAddr, \"udp\"); err != nil {\n\t\t\tt.Fatalf(\"failed to start server: %s\", err)\n\t\t}\n\t}()\n\n\tu, err := url.Parse(fmt.Sprintf(\"http://%s/api/v1/\", apiAddr))\n\tif err != nil {\n\t\tt.Fatalf(\"failed to parse URL: %s\", err)\n\t}\n\n\ttime.Sleep(10 * time.Millisecond) // wait for start server\n\n\treturn client.New(u), dnsAddr\n}", "func init() {\r\n// get the arguments to run the server\r\n\tflag.StringVar(&Host,\"httpserver\",DEFAULT_HOST,\"name of HTTP server\")\r\n\tflag.IntVar(&Port,\"port\",DEFAULT_PORT,\"port number\")\r\n\tflag.StringVar(&UrlPath,\"urlpath\",DEFAULT_URLPATH,\"relative url path\")\r\n\tflag.StringVar(&SecretKey,\"key\",DEFAULT_KEY,\"secret key to terminate program via TCP/UDP port\")\r\n\tflag.BoolVar(&isVerbose,\"verbose\",false,\"enable verbose logging output\")\r\n\tflag.Parse()\r\n\tlogger.Print(\"Starting servers on Port:\"+strconv.Itoa(Port)+\" HTTP-server:\"+Host+\" urlpath:\"+UrlPath+\" Key:\"+SecretKey)\r\n\tinitConf()\r\n}", "func Init() {\n\tlog.Debug().Caller().Msg(\"initialize server\")\n\tr := router()\n\tr.Run()\n}", "func Init(c *conf.Config, s *service.Service) {\n\tsrv = s\n\t// init inner router\n\teng := bm.DefaultServer(c.BM)\n\tinitRouter(eng)\n\t// init inner server\n\tif err := eng.Start(); err != nil {\n\t\tlog.Error(\"bm.DefaultServer error(%v)\", err)\n\t\tpanic(err)\n\t}\n}", "func (s *Server) Init(c Configuration) (o *Server, err error) {\n\to = s\n\n\t// Init UDP server\n\tif err = o.serverUDP.Init(c); err != nil {\n\t\treturn\n\t}\n\n\t// Init HTTP server\n\tif err = o.serverHTTP.Init(c); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (client *LANHostConfigManagement1) SetDNSServer(NewDNSServers string) (err error) {\n\treturn client.SetDNSServerCtx(context.Background(),\n\t\tNewDNSServers,\n\t)\n}", "func StartServer(listener net.Listener, dsServer *DSServer) *grpc.Server {\n\tserver := grpc.NewServer()\n\tds_grpc.RegisterDSServiceServer(server, dsServer)\n\n\tgo func() {\n\t\tdsServer.isStarted = true\n\t\tif err := server.Serve(listener); err != nil {\n\t\t\tpanic(err) // should not happen during running application, after start\n\t\t}\n\t}()\n\n\treturn server\n}", "func initServer() {\n\trouter := mux.NewRouter()\n\trouter.HandleFunc(\"/consumables\", consumablesListHandler).Methods(\"GET\")\n\trouter.HandleFunc(\"/consumables\", optionsHandler).Methods(\"OPTIONS\")\n\trouter.HandleFunc(\"/consumables\", consumablesCreateHandler).Methods(\"POST\")\n\trouter.HandleFunc(\"/ingest\", optionsHandler).Methods(\"OPTIONS\")\n\trouter.HandleFunc(\"/ingest\", ingestHandler).Methods(\"POST\")\n\trouter.HandleFunc(\"/status/now\", statusHandler).Methods(\"GET\")\n\trouter.HandleFunc(\"/status/time\", statusTimeHandler).Methods(\"GET\")\n\thttp.Handle(\"/\", router)\n\thttp.ListenAndServe(fmt.Sprintf(\":%s\", os.Getenv(\"CAFFEINE_PORT\")), nil)\n}", "func (s *DnsServer) Run() error {\n\tmux := dns.NewServeMux()\n\tfor _, domain := range s.Domains {\n\t\tmux.HandleFunc(dns.Fqdn(domain), s.HandleIncoming)\n\t}\n\ts.dnsServer = &dns.Server{Handler: mux}\n\ts.dnsServer.Net = \"udp\"\n\tif s.Flags.Listener != nil {\n\t\ts.dnsServer.Listener = s.Flags.Listener\n\t\ts.dnsServer.Addr = s.Flags.Listener.Addr().String()\n\t} else {\n\t\tl, err := net.Listen(net.JoinHostPort(s.host, strconv.Itoa(s.Port)), \"tcp\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.dnsServer.Listener = l\n\t}\n\tif s.Port != 0 {\n\t\ts.dnsServer.Addr = net.JoinHostPort(s.host, strconv.Itoa(s.Port))\n\t}\n\tgo s.HandleControllers()\n\ts.Logger.Infof(\"Serving Dns on %s for domains %v\", s.dnsServer.Addr, s.Domains )\n\treturn s.dnsServer.ListenAndServe()\n}", "func (s *Server) initListener() error {\n\tlistener, err := net.Listen(\"tcp\", s.cfg.ProxyServer.Addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.listener = listener\n\treturn nil\n}", "func dInit() error {\n\tvar err error\n\tdial, err = grpc.Dial(address, grpc.WithInsecure(), grpc.WithTimeout(10*time.Second))\n\tif err != nil {\n\t\tgrpclog.Printf(\"Fail to dial: %v\", err)\n\t\treturn err\n\t}\n\n\tdemoClient = NewDemonstratorClient(dial)\n\treturn nil\n}", "func Init(c *conf.Config) {\n\tinitService(c)\n\t// init inner router\n\tengine := bm.DefaultServer(c.HTTPServer)\n\tinnerRouter(engine)\n\t// init inner server\n\tif err := engine.Start(); err != nil {\n\t\tlog.Error(\"engine.Start error(%v)\", err)\n\t\tpanic(err)\n\t}\n}", "func InitializeServer(host string) (server *network.WebServer) {\n\trand.Seed(time.Now().UTC().UnixNano())\n\t// Make sure folders exist that we want:\n\tif err := ensureBindDirs(); err != nil {\n\t\tLog.Error(\"Failed to have home working dir to put the files into at ~/Desktop/bind, err: \", err)\n\t} else {\n\t\tLog.Info(\"bind dirs ensured!\")\n\t}\n\tif os.Args[0] != \"d\" { //development mode\n\t\tgin.SetMode(gin.ReleaseMode)\n\t}\n\tr := gin.New()\n\tr.LoadHTMLGlob(\"public/tmpl/*.html\")\n\tr.StaticFS(\"/videos\", http.Dir(basePath+\"/videos\"))\n\tr.StaticFS(\"/frames\", http.Dir(basePath+\"/frames\"))\n\tr.Static(\"/public\", \"./public\")\n\tr.GET(\"/\", getIndex)\n\tr.POST(\"/g\", postIndex)\n\tr.GET(\"/g\", getIndex)\n\tr.GET(\"/about\", getAbout)\n\tr.GET(\"/jobs\", getJobs)\n\tr.GET(\"/code\", getCode)\n\tmel = melody.New() // melody middleware\n\n\t// websocket route\n\tr.GET(\"/ws\",func(ctx *gin.Context){\n\t\t// handle request with Melody\n\t\tmel.HandleRequest(ctx.Writer,ctx.Request)\n\t})\n\n\t// Melody message handler\n\tmel.HandleMessage(func(ses *melody.Session,msg []byte){\n\t\t// broadcast message to connected sockets\n\t\tmel.Broadcast(msg)\n\t})\n\n\n\tr.GET(\"/openframes\", func(c *gin.Context) {\n\t\topen.Run(basePath + \"/frames\")\n\t})\n\tr.GET(\"/openvideos\", func(c *gin.Context) {\n\t\topen.Run(basePath + \"/videos\")\n\t})\n\tr.GET(\"/openlogs\", func(c *gin.Context) {\n\t\topen.Run(basePath + \"/logs\")\n\t})\n\tr.GET(\"/toggleClipYt\", func(c *gin.Context) {\n\t\topen.Run(basePath + \"/logs\")\n\t})\n\t// go requests(mel)\n\t// go jobUpdates(mel)\n\n\treturn network.InitializeWebServer(r, host)\n}", "func (ks *KerbServer) Init(srv string) error {\n\tservice := C.CString(srv)\n\tdefer C.free(unsafe.Pointer(service))\n\n\tresult := 0\n\n\tks.state = C.new_gss_server_state()\n\tif ks.state == nil {\n\t\treturn errors.New(\"Failed to allocate memory for gss_server_state\")\n\t}\n\n\tresult = int(C.authenticate_gss_server_init(service, ks.state))\n\n\tif result == C.AUTH_GSS_ERROR {\n\t\treturn ks.GssError()\n\t}\n\n\treturn nil\n}", "func Init(d *db.Database, c config.Config) *Server {\n\tr := mux.NewRouter()\n\th := &http.Server{\n\t\tHandler: r,\n\t\tAddr: c.Web.Addr,\n\t\tWriteTimeout: 15 * time.Second,\n\t\tReadTimeout: 15 * time.Second,\n\t}\n\tsrv := &Server{\n\t\tDB: d,\n\t\trouter: r,\n\t\tHS: h,\n\t\tConfig: c,\n\t}\n\treturn srv\n}", "func init() {\r\n\r\n\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Init the web server now.`)\r\n\tdefer Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Done init the web server.`)\r\n\r\n\t// Public web server: use the servers public facing IP address and the configured port:\r\n\tserverPublicAddressPort = Tools.LocalIPAddressAndPort()\r\n\r\n\t// Private web server: use the configured end point:\r\n\tserverAdminAddressPort = ConfigurationDB.Read(`AdminWebServerBinding`)\r\n\r\n\t// Setup the public web server:\r\n\tserverPublic = &http.Server{}\r\n\tserverPublic.Addr = serverPublicAddressPort\r\n\tserverPublic.Handler = Handlers.GetPublicMux()\r\n\tserverPublic.SetKeepAlivesEnabled(true)\r\n\r\n\t// Public Web Server: Read Timeout\r\n\tif readTimeoutSeconds, errTimeout := strconv.Atoi(ConfigurationDB.Read(`PublicWebServerReadTimeoutSeconds`)); errTimeout != nil {\r\n\r\n\t\t// Case: Error! Use a default timeout:\r\n\t\tLog.LogFull(senderName, LM.CategorySYSTEM, LM.LevelWARN, LM.SeverityLow, LM.ImpactLow, LM.MessageNameCONFIGURATION, `Was not able to read the public server's read timeout value. Use the default of 10 seconds instead.`, errTimeout.Error())\r\n\t\tserverPublic.ReadTimeout = 10 * time.Second\r\n\t} else {\r\n\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameCONFIGURATION, fmt.Sprintf(\"The public web server's read timeout was set to %d seconds.\", readTimeoutSeconds))\r\n\t\tserverPublic.ReadTimeout = time.Duration(readTimeoutSeconds) * time.Second\r\n\t}\r\n\r\n\t// Public Web Server: Write Timeout\r\n\tif writeTimeoutSeconds, errTimeout := strconv.Atoi(ConfigurationDB.Read(`PublicWebServerWriteTimeoutSeconds`)); errTimeout != nil {\r\n\r\n\t\t// Case: Error! Use a default timeout:\r\n\t\tLog.LogFull(senderName, LM.CategorySYSTEM, LM.LevelWARN, LM.SeverityLow, LM.ImpactLow, LM.MessageNameCONFIGURATION, `Was not able to read the public server's write timeout value. Use the default of 10 seconds instead.`, errTimeout.Error())\r\n\t\tserverPublic.WriteTimeout = 10 * time.Second\r\n\t} else {\r\n\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameCONFIGURATION, fmt.Sprintf(\"The public web server's write timeout was set to %d seconds.\", writeTimeoutSeconds))\r\n\t\tserverPublic.WriteTimeout = time.Duration(writeTimeoutSeconds) * time.Second\r\n\t}\r\n\r\n\t// Public Web Server: Max. Header Size\r\n\tif maxHeaderBytes, errHeaderBytes := strconv.Atoi(ConfigurationDB.Read(`PublicWebServerMaxHeaderLenBytes`)); errHeaderBytes != nil {\r\n\r\n\t\t// Case: Error! Use a default threshold for the header size:\r\n\t\tLog.LogFull(senderName, LM.CategorySYSTEM, LM.LevelWARN, LM.SeverityLow, LM.ImpactLow, LM.MessageNameCONFIGURATION, `Was not able to read the public server's max. header size. Use the default of 1048576 bytes instead.`, errHeaderBytes.Error())\r\n\t\tserverPublic.MaxHeaderBytes = 1048576\r\n\t} else {\r\n\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameCONFIGURATION, fmt.Sprintf(\"The public web server's max. header size was set to %d bytes.\", maxHeaderBytes))\r\n\t\tserverPublic.MaxHeaderBytes = maxHeaderBytes\r\n\t}\r\n\r\n\t// Is TLS configured?\r\n\tif publicTLSEnabled := ConfigurationDB.Read(`PublicWebServerUseTLS`); strings.ToLower(publicTLSEnabled) == `true` {\r\n\r\n\t\t// TLS is enabled. Copy the certificate and private key to the source directory.\r\n\t\tpublicTLSCertificate := StaticFiles.FindAndReadFileINTERNAL(ConfigurationDB.Read(`PublicWebServerTLSCertificateName`))\r\n\t\tpublicTLSPrivateKey := StaticFiles.FindAndReadFileINTERNAL(ConfigurationDB.Read(`PublicWebServerTLSPrivateKey`))\r\n\r\n\t\t// Access to the working directory?\r\n\t\tcurrentDir, dirError := os.Getwd()\r\n\t\tif dirError != nil {\r\n\t\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.MessageNameCONFIGURATION, `Was not able to read the working directory. Thus, cannot store the TLS certificates!`, dirError.Error())\r\n\t\t} else {\r\n\t\t\t// Build the filenames:\r\n\t\t\tpathCertificate := filepath.Join(currentDir, ConfigurationDB.Read(`PublicWebServerTLSCertificateName`))\r\n\t\t\tpathPrivateKey := filepath.Join(currentDir, ConfigurationDB.Read(`PublicWebServerTLSPrivateKey`))\r\n\r\n\t\t\t// Write the files:\r\n\t\t\tif writeError := ioutil.WriteFile(pathCertificate, publicTLSCertificate, 0660); writeError != nil {\r\n\t\t\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.MessageNameCONFIGURATION, `Was not able to write the TLS certificate to the working directory.`, writeError.Error())\r\n\t\t\t}\r\n\t\t\tif writeError := ioutil.WriteFile(pathPrivateKey, publicTLSPrivateKey, 0660); writeError != nil {\r\n\t\t\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.MessageNameCONFIGURATION, `Was not able to write the TLS private key to the working directory.`, writeError.Error())\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Is the private web server (i.e. administration server) enabled?\r\n\tif strings.ToLower(ConfigurationDB.Read(`AdminWebServerEnabled`)) == `true` {\r\n\r\n\t\t// Setup the private web server:\r\n\t\tserverAdmin = &http.Server{}\r\n\t\tserverAdmin.Addr = serverAdminAddressPort\r\n\t\tserverAdmin.Handler = Handlers.GetAdminMux()\r\n\t\tserverAdmin.SetKeepAlivesEnabled(true)\r\n\r\n\t\t// Admin Web Server: Read Timeout\r\n\t\tif readTimeoutSeconds, errTimeout := strconv.Atoi(ConfigurationDB.Read(`AdminWebServerReadTimeoutSeconds`)); errTimeout != nil {\r\n\r\n\t\t\t// Case: Error! Use a default timeout:\r\n\t\t\tLog.LogFull(senderName, LM.CategorySYSTEM, LM.LevelWARN, LM.SeverityLow, LM.ImpactLow, LM.MessageNameCONFIGURATION, `Was not able to read the admin server's read timeout value. Use the default of 10 seconds instead.`, errTimeout.Error())\r\n\t\t\tserverAdmin.ReadTimeout = 10 * time.Second\r\n\t\t} else {\r\n\t\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameCONFIGURATION, fmt.Sprintf(\"The admin web server's read timeout was set to %d seconds.\", readTimeoutSeconds))\r\n\t\t\tserverAdmin.ReadTimeout = time.Duration(readTimeoutSeconds) * time.Second\r\n\t\t}\r\n\r\n\t\t// Admin Web Server: Write Timeout\r\n\t\tif writeTimeoutSeconds, errTimeout := strconv.Atoi(ConfigurationDB.Read(`AdminWebServerWriteTimeoutSeconds`)); errTimeout != nil {\r\n\r\n\t\t\t// Case: Error! Use a default timeout:\r\n\t\t\tLog.LogFull(senderName, LM.CategorySYSTEM, LM.LevelWARN, LM.SeverityLow, LM.ImpactLow, LM.MessageNameCONFIGURATION, `Was not able to read the admin server's write timeout value. Use the default of 10 seconds instead.`, errTimeout.Error())\r\n\t\t\tserverAdmin.WriteTimeout = 10 * time.Second\r\n\t\t} else {\r\n\t\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameCONFIGURATION, fmt.Sprintf(\"The admin web server's write timeout was set to %d seconds.\", writeTimeoutSeconds))\r\n\t\t\tserverAdmin.WriteTimeout = time.Duration(writeTimeoutSeconds) * time.Second\r\n\t\t}\r\n\r\n\t\t// Admin Web Server: Max. Header Size\r\n\t\tif maxHeaderBytes, errHeaderBytes := strconv.Atoi(ConfigurationDB.Read(`AdminWebServerMaxHeaderLenBytes`)); errHeaderBytes != nil {\r\n\r\n\t\t\t// Case: Error! Use a default threshold for the header size:\r\n\t\t\tLog.LogFull(senderName, LM.CategorySYSTEM, LM.LevelWARN, LM.SeverityLow, LM.ImpactLow, LM.MessageNameCONFIGURATION, `Was not able to read the admin server's max. header size. Use the default of 1048576 bytes instead.`, errHeaderBytes.Error())\r\n\t\t\tserverAdmin.MaxHeaderBytes = 1048576\r\n\t\t} else {\r\n\t\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameCONFIGURATION, fmt.Sprintf(\"The admin web server's max. header size was set to %d bytes.\", maxHeaderBytes))\r\n\t\t\tserverAdmin.MaxHeaderBytes = maxHeaderBytes\r\n\t\t}\r\n\r\n\t\t// Is TLS configured?\r\n\t\tif adminTLSEnabled := ConfigurationDB.Read(`AdminWebServerUseTLS`); strings.ToLower(adminTLSEnabled) == `true` {\r\n\r\n\t\t\t// TLS is enabled. Copy the certificate and private key to the source directory.\r\n\t\t\tadminTLSCertificate := StaticFiles.FindAndReadFileINTERNAL(ConfigurationDB.Read(`AdminWebServerTLSCertificateName`))\r\n\t\t\tadminTLSPrivateKey := StaticFiles.FindAndReadFileINTERNAL(ConfigurationDB.Read(`AdminWebServerTLSPrivateKey`))\r\n\r\n\t\t\t// Access to the working directory?\r\n\t\t\tcurrentDir, dirError := os.Getwd()\r\n\t\t\tif dirError != nil {\r\n\t\t\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.MessageNameCONFIGURATION, `Was not able to read the working directory. Thus, cannot store the TLS certificates!`, dirError.Error())\r\n\t\t\t} else {\r\n\t\t\t\t// Build the filenames:\r\n\t\t\t\tpathCertificate := filepath.Join(currentDir, ConfigurationDB.Read(`AdminWebServerTLSCertificateName`))\r\n\t\t\t\tpathPrivateKey := filepath.Join(currentDir, ConfigurationDB.Read(`AdminWebServerTLSPrivateKey`))\r\n\r\n\t\t\t\t// Write the files:\r\n\t\t\t\tif writeError := ioutil.WriteFile(pathCertificate, adminTLSCertificate, 0660); writeError != nil {\r\n\t\t\t\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.MessageNameCONFIGURATION, `Was not able to write the TLS certificate to the working directory.`, writeError.Error())\r\n\t\t\t\t}\r\n\t\t\t\tif writeError := ioutil.WriteFile(pathPrivateKey, adminTLSPrivateKey, 0660); writeError != nil {\r\n\t\t\t\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.MessageNameCONFIGURATION, `Was not able to write the TLS private key to the working directory.`, writeError.Error())\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\t// Private web server is disabled:\r\n\t\tLog.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `The admin web server is disabled.`)\r\n\t}\r\n}", "func New(backend Backend,domains[]string ,addr,ipMonitorPath string,forwardNameServers []string, subDomainServers map[string][]string,cacheSize int ,random,hold bool) *server {\n\ts := new (server)\n\ts. backend = backend\n\ttimeOut := 30 * time.Second\n\ts.dnsUDPclient= &dns.Client{Net: \"udp\", ReadTimeout: timeOut, WriteTimeout: timeOut, SingleInflight: true}\n\ts.dnsTCPclient= &dns.Client{Net: \"tcp\", ReadTimeout: timeOut, WriteTimeout: timeOut, SingleInflight: true}\n\ts.dnsDomains = domains[:]\n\ts.dnsAddr = addr\n\ts.ipMonitorPath= ipMonitorPath\n\ts.msgPool = queue.QueueNew()\n\ts.msgPool.Reset = cacheMsgRest\n\ts.syncPeriod = 10 * time.Minute\n\ts.minTtl = 60\n\ts.rcache = NewMsgCache(cacheSize,random, hold,s.minTtl)\n\ts.forwardNameServers = forwardNameServers[:]\n\ts.subDomainServers = subDomainServers\n\treturn s\n}", "func (s *Server) init() (err error) {\n\tif err = s.Close(); err != nil {\n\t\treturn\n\t}\n\n\tif s.Hostname == \"\" {\n\t\tif s.Hostname, err = os.Hostname(); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func New(ctx context.Context, opts ...Option) *Server {\n\tctx, span := trace.StartSpan(ctx, \"server_init\")\n\tdefer span.End()\n\n\tlog := common.Logger(ctx)\n\tengine := gin.New()\n\ts := &Server{\n\t\tRouter: engine,\n\t\tAdminRouter: engine,\n\t\tsvcConfigs: map[string]*http.Server{\n\t\t\tWebServer: &http.Server{\n\t\t\t\tMaxHeaderBytes: getEnvInt(EnvMaxHeaderSize, http.DefaultMaxHeaderBytes),\n\t\t\t\tReadHeaderTimeout: getEnvDuration(EnvReadHeaderTimeout, 0),\n\t\t\t\tReadTimeout: getEnvDuration(EnvReadTimeout, 0),\n\t\t\t\tWriteTimeout: getEnvDuration(EnvWriteTimeout, 0),\n\t\t\t\tIdleTimeout: getEnvDuration(EnvHTTPIdleTimeout, 0),\n\t\t\t},\n\t\t\tAdminServer: &http.Server{},\n\t\t\tGRPCServer: &http.Server{},\n\t\t},\n\t\t// MUST initialize these before opts\n\t\tappListeners: new(appListeners),\n\t\tfnListeners: new(fnListeners),\n\t\ttriggerListeners: new(triggerListeners),\n\n\t\t// Almost everything else is configured through opts (see NewFromEnv for ex.) or below\n\t}\n\n\tfor _, opt := range opts {\n\t\tif opt == nil {\n\t\t\tcontinue\n\t\t}\n\t\terr := opt(ctx, s)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Fatal(\"Error during server opt initialization.\")\n\t\t}\n\t}\n\n\tif s.svcConfigs[WebServer].Addr == \"\" {\n\t\ts.svcConfigs[WebServer].Addr = fmt.Sprintf(\":%d\", DefaultPort)\n\t}\n\tif s.svcConfigs[AdminServer].Addr == \"\" {\n\t\ts.svcConfigs[AdminServer].Addr = fmt.Sprintf(\":%d\", DefaultPort)\n\t}\n\tif s.svcConfigs[GRPCServer].Addr == \"\" {\n\t\ts.svcConfigs[GRPCServer].Addr = fmt.Sprintf(\":%d\", DefaultGRPCPort)\n\t}\n\n\trequireConfigSet := func(id string, val interface{}) {\n\t\tif val == nil {\n\t\t\tlog.Fatalf(\"Invalid configuration for server type %s, %s must be configured during startup\", s.nodeType, id)\n\t\t}\n\t}\n\trequireConfigNotSet := func(id string, val interface{}) {\n\t\tif val != nil {\n\t\t\tlog.Fatalf(\"Invalid configuration for server type %s, %s must not be configured during startup\", s.nodeType, id)\n\t\t}\n\t}\n\n\t// Check that WithAgent options have been processed correctly.\n\t// Yuck the yuck - server should really be split into several interfaces (LB, Runner, API) and each should be instantiated separately\n\tswitch s.nodeType {\n\tcase ServerTypeAPI:\n\t\trequireConfigNotSet(\"agent\", s.agent)\n\t\trequireConfigSet(\"datastore\", s.datastore)\n\t\trequireConfigSet(\"triggerAnnotator\", s.triggerAnnotator)\n\tcase ServerTypeFull:\n\t\trequireConfigSet(\"agent\", s.agent)\n\t\trequireConfigSet(\"lbReadAccess\", s.lbReadAccess)\n\t\trequireConfigSet(\"datastore\", s.datastore)\n\t\trequireConfigSet(\"triggerAnnotator\", s.triggerAnnotator)\n\n\tcase ServerTypeLB:\n\t\trequireConfigSet(\"lbReadAccess\", s.lbReadAccess)\n\t\trequireConfigSet(\"agent\", s.agent)\n\n\tcase ServerTypePureRunner:\n\t\trequireConfigSet(\"agent\", s.agent)\n\n\tdefault:\n\n\t\tlog.Fatal(\"unknown server type %d\", s.nodeType)\n\n\t}\n\n\ts.Router.Use(loggerWrap, traceWrap) // TODO should be opts\n\toptionalCorsWrap(s.Router) // TODO should be an opt\n\tapiMetricsWrap(s)\n\t// panicWrap is last, specifically so that logging, tracing, cors, metrics, etc wrappers run\n\ts.Router.Use(panicWrap)\n\ts.AdminRouter.Use(panicWrap)\n\ts.bindHandlers(ctx)\n\n\treturn s\n}", "func setupServer() (*http.Server, error) {\n\t// get parameters and initialize the server\n\thost := os.Getenv(\"MESSAGES_SERVER_HOST\")\n\tport := os.Getenv(\"MESSAGES_SERVER_PORT\")\n\tif host == \"\" || port == \"\" {\n\t\treturn nil, errors.New(\"main: host or port not set\")\n\t}\n\t// make sure port is a number\n\tintPort, err := strconv.ParseInt(port, 10, 64)\n\tif err != nil {\n\t\treturn nil, errors.New(\"port must be a number\")\n\t}\n\n\tserver := &http.Server{\n\t\tAddr: fmt.Sprintf(\"%s:%d\", host, intPort),\n\t\tHandler: api.Container,\n\t}\n\treturn server, nil\n}", "func InitLDAP(config map[string]string) {\n\tldapServer = config[\"url\"]\n\tbaseDN = config[\"baseDN\"]\n\tlog.Debugf(\"Initialized Ldap server: %s with baseDN: %s\", ldapServer, baseDN)\n}", "func NewServer(logger zerolog.Logger, l listing.Service, s storemanagement.Service,\n\tauth authetication.Service, addr string) Server {\n\tif l == nil || s == nil || auth == nil || addr == \"\" {\n\t\tlog.Println(\"Unable to start server because services were not configured\")\n\t\tos.Exit(1)\n\t}\n\n\trouter := chi.NewRouter()\n\tserver := Server{\n\t\tlisting: l,\n\t\tsManager: s,\n\t\trouter: router,\n\t\tauth: auth,\n\t\tServer: &http.Server{\n\t\t\tAddr: addr,\n\t\t\tHandler: router,\n\t\t},\n\t}\n\trouter.Use(httplog.RequestLogger(logger))\n\tserver.Routes()\n\treturn server\n}", "func NewServer(addr net.Addr, opts ...DebugOption) serverz.Server {\n\to := newOptions(opts...)\n\n\tif o.debug {\n\t\t// This is probably okay, as this service should not be exposed to public in the first place.\n\t\ttrace.SetAuth(trace.NoAuth)\n\n\t\texpvar.RegisterRoutes(o.handler)\n\t\tpprof.RegisterRoutes(o.handler)\n\t\ttrace.RegisterRoutes(o.handler)\n\t}\n\n\treturn &serverz.AppServer{\n\t\tServer: &http.Server{\n\t\t\tHandler: o.handler,\n\t\t\tErrorLog: stdlog.New(log.NewStdlibAdapter(level.Error(log.With(o.logger, \"server\", \"debug\"))), \"\", 0),\n\t\t},\n\t\tName: \"debug\",\n\t\tAddr: addr,\n\t\tLogger: o.logger,\n\t}\n}", "func initialiseServer() {\n\tport := \":8090\"\n\tlog.Printf(\"Starting HTTP server at http://localhost:%s\", port)\n\n\t// Attach request handlers\n\thttp.HandleFunc(\"/api/v1/vehicles\", liveDataRequestHandler)\n\thttp.HandleFunc(\"/health\", healthEndpoint)\n\thttp.HandleFunc(\"/\", healthEndpoint)\n\n\t// Start HTTP server\n\tlog.Fatal(http.ListenAndServe(port, nil))\n}", "func InitServer(store *store.Store) *Handler {\n\th := &Handler{Store: store}\n\th.Router = echo.New()\n\n\treturn h\n}", "func InitClient() (*Client, error) {\n\tconn, err := net.Dial(\"udp\", *dnsServerAddrFlagVal)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\tconn: conn,\n\t\trespBuf: make([]byte, maxUDPMsgSize),\n\t}, nil\n}", "func InitServer(svc *service.Service) *echo.Echo {\n\tmapper := mapper.New()\n\tsvm := service.NewServiceManager()\n\tsrv := echo.New()\n\n\tuserService := svm.UserService(svc)\n\thealthCheckService := svm.HealthCheckService(svc)\n\tcloudVisionService := svm.CloudVisionService(svc)\n\tuploadService := svm.UploadService(svc, cloudVisionService)\n\n\t//CORS\n\tsrv.Use(middleware.CORSWithConfig(middleware.CORSConfig{\n\t\tAllowOrigins: []string{\"*\"},\n\t\tAllowMethods: []string{echo.GET, echo.HEAD, echo.PUT, echo.PATCH, echo.POST, echo.DELETE},\n\t}))\n\n\treturn setupRoutes(srv, &controller{\n\t\tpingController: pingroute.NewController(),\n\t\tuserController: userroute.NewController(userService, mapper),\n\t\tuploadController: uploadroute.NewController(uploadService),\n\t\thealthcheckController: healthcheckroute.NewController(healthCheckService, mapper),\n\t})\n}", "func init() {\n\tprometheus.MustRegister(uptime, reqCount, reqCountPerEndpoint, userCPU, systemCPU, memUsage, diskUsage)\n\tinitStat, err := stat.GetServerStat()\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\tgo recordServerMetrics(initStat)\n}", "func startServer() error {\n\n\tc, err := config()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// checking if a router is defined\n\tif cfgRouter == nil {\n\t\treturn ErrNoRouterConfig\n\t}\n\n\t// HTTPS Server\n\tcfgServer := http.Server{}\n\tcfgServer.Addr = fmt.Sprint(\":\", c.Server.HTTPPort)\n\n\t//TODO write own cors middleware\n\tcorsManager := cors.New(cors.Options{\n\t\tAllowCredentials: true,\n\t\tAllowedOrigins: []string{\"http://localhost:8080\"},\n\t\tAllowedMethods: []string{\"GET\", \"POST\", \"PUT\", \"DELETE\"},\n\t\tAllowedHeaders: []string{\"Authorization\", \"Origin\", \"Cache-Control\", \"Accept\", \"Content-Type\", \"X-Requested-With\"},\n\t\tDebug: true,\n\t})\n\n\t//\tcfgRouter.Handler()\n\tcfgServer.Handler = corsManager.Handler(cfgRouter.Handler())\n\t//cfgServer.Handler = cfgRouter.Handler()\n\n\terr = cfgServer.ListenAndServe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer cfgServer.Close()\n\n\treturn nil\n}", "func newServer(ctx context.Context, dexDir string, port int32, environment string, ldap *ldaptest.TestLDAP) (*TestDex, error) {\n\tcertFile, keyFile := ssltest.CreateCertificates(\"localhost\", dexDir)\n\treturn newServerWithTLS(ctx, certFile, keyFile, port, environment, ldap)\n}", "func NewServer(options *Options) (s Server, err error) {\n\tdefer Logger.Time(time.Now(), time.Second, \"NewServer\")\n\tdbs := make(map[string]kadiyadb.Database)\n\tsrv := &server{\n\t\toptions: options,\n\t\tdatabases: dbs,\n\t}\n\n\terr = os.MkdirAll(options.Path, DataPerm)\n\tif err != nil {\n\t\treturn nil, goerr.Wrap(err, 0)\n\t}\n\n\tfiles, err := ioutil.ReadDir(options.Path)\n\tif err != nil {\n\t\treturn nil, goerr.Wrap(err, 0)\n\t}\n\n\tnow := time.Now().UnixNano()\n\tfields := []string{`¯\\_(ツ)_/¯`}\n\n\tfor _, finfo := range files {\n\t\tfname := finfo.Name()\n\t\tdbPath := path.Join(options.Path, fname)\n\n\t\tif fname == InitFile {\n\t\t\tcontinue\n\t\t}\n\n\t\tdb, err := kadiyadb.Open(dbPath, options.Recovery)\n\t\tif err != nil {\n\t\t\tLogger.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tinfo, err := db.Info()\n\t\tif err != nil {\n\t\t\tLogger.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar i uint32\n\t\tfor i = 0; i < info.MaxRWEpochs; i++ {\n\t\t\tii64 := int64(i)\n\t\t\tstart := now - ii64*info.Duration\n\t\t\tend := start + info.Resolution\n\n\t\t\t// this will trigger a epoch load\n\t\t\t// also acts as a db health check\n\t\t\t_, err = db.One(start, end, fields)\n\t\t\tif err != nil {\n\n\t\t\t\tif err := db.Close(); err != nil {\n\t\t\t\t\tLogger.Error(err)\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tdbs[fname] = db\n\t}\n\n\treturn srv, nil\n}", "func InitServer(srv *server.Server, opt Options) {\n\tpb.RegisterRecorderServer(srv.PRPC, &pb.DecoratedRecorder{\n\t\tService: &recorderServer{Options: &opt},\n\t\tPrelude: internal.CommonPrelude,\n\t\tPostlude: internal.CommonPostlude,\n\t})\n}", "func (g *GateKeeper) initSSHServer() error {\n\tif g.srv != nil {\n\t\treturn errors.New(\"SSH server already initialized\")\n\t}\n\taddr := fmt.Sprintf(\"%s:%d\", g.Meta.SSHAddr, g.Meta.SSHPort)\n\tserver := ssh.Server{\n\t\tAddr: addr,\n\t\tHandler: ssh.Handler(g.proxyCommandHandler()),\n\t\tReversePortForwardingCallback: ssh.ReversePortForwardingCallback(g.reversePortForwardHandler()),\n\t}\n\tg.srv = &server\n\tlog.Info().\n\t\tStr(\"addr\", g.Meta.SSHAddr).\n\t\tUint16(\"port\", g.Meta.SSHPort).\n\t\tMsg(\"starting SSH server\")\n\treturn server.ListenAndServe()\n}", "func NewServer(routinesPool *safe.Pool, entryPoints TCPEntryPoints, entryPointsUDP UDPEntryPoints, watcher *ConfigurationWatcher,\n\tchainBuilder *middleware.ChainBuilder, accessLoggerMiddleware *accesslog.Handler,\n) *Server {\n\tsrv := &Server{\n\t\twatcher: watcher,\n\t\ttcpEntryPoints: entryPoints,\n\t\tchainBuilder: chainBuilder,\n\t\taccessLoggerMiddleware: accessLoggerMiddleware,\n\t\tsignals: make(chan os.Signal, 1),\n\t\tstopChan: make(chan bool, 1),\n\t\troutinesPool: routinesPool,\n\t\tudpEntryPoints: entryPointsUDP,\n\t}\n\n\tsrv.configureSignals()\n\n\treturn srv\n}", "func (g *Server) Start() error {\n\tif len(g.registrars) == 0 {\n\t\treturn errors.New(\"No registration method added. impossible to boot\")\n\t}\n\tlisten, err := net.Listen(\"tcp\", \":\"+g.config.Port)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// The code below is to bootstrap a multiplexed server\n\t// this is necessary to create healthcheck endpoint from regular LoadBalancers\n\t// as they generate only use HTTP or TCP\n\n\t// creating multiplexed server\n\tmux := cmux.New(listen)\n\n\t// Matching connections by priority order\n\tgrpcListener := mux.Match(cmux.HTTP2HeaderField(\"content-type\", \"application/grpc\"))\n\t// used for health checks\n\thttpListener := mux.Match(cmux.Any())\n\n\t// initiating grpc server\n\tgrpcServer := grpc.NewServer()\n\t// registering handlers\n\tfor _, r := range g.registrars {\n\t\tr(grpcServer)\n\t}\n\treflection.Register(grpcServer)\n\n\t// creating http server\n\thttpServer := http.NewServeMux()\n\thttpServer.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"OK\")\n\t})\n\n\thttpS := &http.Server{\n\t\tHandler: httpServer,\n\t}\n\n\t// starting it all\n\tgo grpcServer.Serve(grpcListener)\n\tgo httpS.Serve(httpListener)\n\t// will periodically free memory if set\n\tif g.config.PeriodicMemory > 0 {\n\t\tgo g.PeriodicFree(g.config.PeriodicMemory)\n\t}\n\n\t// Start serving...\n\treturn mux.Serve()\n}", "func Init(c *conf.Config, s *service.Service) {\n\trelationSvc = s\n\tverify = v.New(c.Verify)\n\tanti = antispam.New(c.Antispam)\n\taddFollowingRate = rate.New(c.AddFollowingRate)\n\t// init inner router\n\tengine := bm.DefaultServer(c.BM)\n\tsetupInnerEngine(engine)\n\tif err := engine.Start(); err != nil {\n\t\tlog.Error(\"engine.Start() error(%v)\", err)\n\t\tpanic(err)\n\t}\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 NewServer(config domain.ServerConfig) *Server {\n\tdebugger := logger.New(log.New(ioutil.Discard, \"\", 0))\n\tif config.Debug {\n\t\tdebugger = logger.New(log.New(os.Stderr, \"[debug] \", log.Flags()|log.Lshortfile))\n\t}\n\n\tdb, err := bolt.Open(config.BoltPath, 0644, nil)\n\tif err != nil {\n\t\tlog.Fatal(\"failed to start bolt db\")\n\t}\n\tdefer db.Close()\n\n\ts := &Server{\n\t\tConfig: config,\n\t\ti: uc.NewInteractor(\n\t\t\tconfig,\n\t\t\tcookies.New(config.CookieAge),\n\t\t\tdebugger,\n\t\t\tresources.New(encoder.New()),\n\t\t\thttpCaller.New(),\n\t\t\tmail.New(domain.EmailConfig{}),\n\t\t\tpathInfo.New(config),\n\t\t\tencoder.New(),\n\t\t\tsparql.New(),\n\t\t\tpages.New(config.DataRoot),\n\t\t\ttokenStorer.New(db),\n\t\t\tdomain.URIHandler{},\n\t\t\tuuid.New(),\n\t\t\tauthentication.New(httpCaller.New()),\n\t\t\tspkac.New(),\n\t\t),\n\t\tlogger: debugger,\n\t\tcookieManager: cookies.New(config.CookieAge),\n\t\tpathInformer: pathInfo.New(config),\n\t\turiManipulator: domain.URIHandler{},\n\t}\n\n\tmime.AddRDFExtension(s.Config.ACLSuffix)\n\tmime.AddRDFExtension(s.Config.MetaSuffix)\n\n\ts.logger.Debug(\"---- starting server ----\")\n\ts.logger.Debug(\"config: %#v\\n\", s.Config)\n\treturn s\n}", "func (as *ArgocdServer) Init() error {\n\tfor _, f := range []func() error{\n\t\tas.initClientSet,\n\t\tas.initTLSConfig,\n\t\tas.initRegistry,\n\t\tas.initDiscovery,\n\t\tas.initMicro,\n\t\tas.initHTTPService,\n\t\tas.initProxyAgent,\n\t\t//as.initMetric,\n\t} {\n\t\tif err := f(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *WServer) Start() error {\n\tl, err := net.Listen(\"tcp\", fmt.Sprintf(\":%v\", s.srv.Port))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuseTLS := func() bool {\n\t\tif len(s.certFile) > 0 && len(s.keyFile) > 0 {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}()\n\tsvcInfo := &wconsul.SvcInfo{\n\t\tID: s.srv.UniqID,\n\t\tName: s.srv.Name,\n\t\tHost: s.srv.Host,\n\t\tPort: s.srv.Port,\n\t\tTags: append([]string{}, s.srv.Tags...),\n\t\tChecker: wconsul.NewGrpcSvcCheck(s.srv.Host, s.srv.Port, \"5s\", \"3s\", useTLS),\n\t}\n\tif err := wconsul.SvcRegistration(svcInfo); err != nil {\n\t\t// s.Server.Stop()\n\t\txlog.Warn(\"===> WServer.Start.SvcRegistration uniqID=%v err=%v\", s.srv.UniqID, err)\n\t}\n\tdefer func() {\n\t\txlog.Info(\"===> WServer.Start.SvcDeregistration uniqID=%v ready\", svcInfo.ID)\n\t\twconsul.SvcDeregistration(svcInfo.ID)\n\t}()\n\n\tregistHealthSvc(s.Server)\n\treflection.Register(s.Server)\n\n\treturn s.Serve(l)\n}", "func InitializeHTTPServer(cfg *HTTPServerConfig) (*http.Server, error) {\n\t// create http server\n\tsrv := &http.Server{\n\t\tAddr: string(cfg.HTTPServerAddr),\n\t\tHandler: cfg.Router,\n\t}\n\n\treturn srv, nil\n}", "func SetupServer(opts Options) (\n\twwrSrv *Server,\n\thttpServer *http.Server,\n\taddr string,\n\trunFunc func() error,\n\terr error,\n) {\n\twwrSrv = NewServer(opts)\n\n\t// Initialize HTTP server\n\thttpServer = &http.Server{\n\t\tAddr: opts.Addr,\n\t\tHandler: wwrSrv,\n\t}\n\n\t// Determine final address\n\taddr = httpServer.Addr\n\tif addr == \"\" {\n\t\taddr = \":http\"\n\t}\n\n\t// Initialize TCP/IP listener\n\tlistener, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, nil, \"\", nil, fmt.Errorf(\"Failed setting up TCP/IP listener: %s\", err)\n\t}\n\n\trunFunc = func() (err error) {\n\t\t// Launch server\n\t\terr = httpServer.Serve(\n\t\t\ttcpKeepAliveListener{listener.(*net.TCPListener)},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"HTTP Server failure: %s\", err)\n\t\t}\n\t\treturn nil\n\t}\n\n\taddr = listener.Addr().String()\n\n\treturn wwrSrv, httpServer, addr, runFunc, nil\n}", "func NewServer(dev Device, loc *url.URL) (*Server, error) {\n\taddr, err := net.ResolveUDPAddr(\"udp\", MulticastIPv4Addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Server{dev: dev, loc: loc, addr: addr}, nil\n}", "func (g *authzProxyDaemon) Init(ctx context.Context) error {\n\treturn g.athenz.Init(ctx)\n}", "func NewSdns(cfg SdnsConfig) (s Sdns, err error) {\n\tif cfg.Port == 0 {\n\t\terr = errors.Errorf(\"a port must be specified\")\n\t\treturn\n\t}\n\n\tif cfg.Debug {\n\t\ts.logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr})\n\t} else {\n\t\ts.logger = zerolog.New(os.Stderr)\n\t}\n\n\terr = s.Load(cfg)\n\tif err != nil {\n\t\terr = errors.Wrapf(err,\n\t\t\t\"couldn't load internal configurations using config supplied.\")\n\t\treturn\n\t}\n\n\ts.client = &dns.Client{SingleInflight: true}\n\ts.recursors = cfg.Recursors\n\ts.address = fmt.Sprintf(\"%s:%d\", cfg.Address, cfg.Port)\n\n\treturn\n}", "func (s *Server) InitRouters(d *config.Daemon) {\n\ts.addRouter(host.NewRouter(d))\n\t//s.addRouter(xxx.NewRouter(d))\n}", "func (s *Server) Init() {\n\tif s.isInitialized {\n\t\tpanic(ErrAlreadyInitialized)\n\t}\n\n\t// If the repos are still missing, use the default implementation: AWS\n\tif s.options.documentRepo == nil || s.options.projectRepo == nil {\n\t\ts.With(AWS(\"eu-west-1\"))\n\t}\n\n\ts.projectHandler = project.Handler{\n\t\tProjectRepository: s.options.projectRepo,\n\t\tDocumentRepository: s.options.documentRepo,\n\t}\n\n\ts.documentHandler = document.Handler{\n\t\tDocumentRepository: s.options.documentRepo,\n\t}\n\n\t// Create router.\n\ts.router = chi.NewRouter()\n\n\t// Add middlewares.\n\ts.router.Use(cors.Handler(cors.Options{\n\t\tAllowedOrigins: []string{\"*\"},\n\t\tAllowedMethods: []string{\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\"},\n\t\tAllowedHeaders: []string{\"*\"},\n\t\tExposedHeaders: []string{\"Link\"},\n\t\tAllowCredentials: false,\n\t\tMaxAge: 300, // Maximum value not ignored by any of major browsers\n\t}))\n\ts.router.Use(middleware.Logger)\n\n\t// Add routes.\n\ts.setupRoutes()\n\ts.isInitialized = true\n}", "func newServer(listenAddrs []string) (*server, error) {\n\tlogin := cfg.Username + \":\" + cfg.Password\n\tauth := \"Basic \" + base64.StdEncoding.EncodeToString([]byte(login))\n\ts := server{\n\t\tauthsha: sha256.Sum256([]byte(auth)),\n\t}\n\n\t// Check for existence of cert file and key file\n\tif !fileExists(cfg.RPCKey) && !fileExists(cfg.RPCCert) {\n\t\t// if both files do not exist, we generate them.\n\t\terr := genCertPair(cfg.RPCCert, cfg.RPCKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tkeypair, err := tls.LoadX509KeyPair(cfg.RPCCert, cfg.RPCKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttlsConfig := tls.Config{\n\t\tCertificates: []tls.Certificate{keypair},\n\t}\n\n\tipv4ListenAddrs, ipv6ListenAddrs, err := parseListeners(listenAddrs)\n\tlisteners := make([]net.Listener, 0,\n\t\tlen(ipv6ListenAddrs)+len(ipv4ListenAddrs))\n\tfor _, addr := range ipv4ListenAddrs {\n\t\tlistener, err := tls.Listen(\"tcp4\", addr, &tlsConfig)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"RPCS: Can't listen on %s: %v\", addr,\n\t\t\t\terr)\n\t\t\tcontinue\n\t\t}\n\t\tlisteners = append(listeners, listener)\n\t}\n\n\tfor _, addr := range ipv6ListenAddrs {\n\t\tlistener, err := tls.Listen(\"tcp6\", addr, &tlsConfig)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"RPCS: Can't listen on %s: %v\", addr,\n\t\t\t\terr)\n\t\t\tcontinue\n\t\t}\n\t\tlisteners = append(listeners, listener)\n\t}\n\tif len(listeners) == 0 {\n\t\treturn nil, errors.New(\"no valid listen address\")\n\t}\n\n\ts.listeners = listeners\n\n\treturn &s, nil\n}", "func StartServer(lis net.Listener) (*Server, func(), error) {\n\tif lis == nil {\n\t\tvar err error\n\t\tlis, err = net.Listen(\"tcp\", \"localhost:0\")\n\t\tif err != nil {\n\t\t\treturn nil, func() {}, fmt.Errorf(\"net.Listen() failed: %v\", err)\n\t\t}\n\t}\n\n\ts := NewServer(lis.Addr().String())\n\twp := &wrappedListener{\n\t\tListener: lis,\n\t\tserver: s,\n\t}\n\n\tserver := grpc.NewServer()\n\tv3lrsgrpc.RegisterLoadReportingServiceServer(server, s)\n\tv3discoverygrpc.RegisterAggregatedDiscoveryServiceServer(server, s)\n\tgo server.Serve(wp)\n\n\treturn s, func() { server.Stop() }, nil\n}", "func Init() error {\n\tconfigServerURL, err := GetConfigServerEndpoint()\n\tif err != nil {\n\t\topenlog.Warn(\"can not get config server endpoint: \" + err.Error())\n\t\treturn err\n\t}\n\n\tvar enableSSL bool\n\ttlsConfig, tlsError := getTLSForClient(configServerURL)\n\tif tlsError != nil {\n\t\topenlog.Error(fmt.Sprintf(\"Get %s.%s TLS config failed, err:[%s]\",\n\t\t\tconfigServerName, common.Consumer, tlsError.Error()))\n\t\treturn tlsError\n\t}\n\n\t/*This condition added because member discovery can have multiple ip's with IsHTTPS\n\thaving both true and false value.*/\n\tif tlsConfig != nil {\n\t\tenableSSL = true\n\t}\n\n\tinterval := config.GetConfigServerConf().RefreshInterval\n\tif interval == 0 {\n\t\tinterval = 30\n\t}\n\n\terr = initConfigServer(configServerURL, enableSSL, tlsConfig, interval)\n\tif err != nil {\n\t\topenlog.Error(\"failed to init config server: \" + err.Error())\n\t\treturn err\n\t}\n\n\topenlog.Warn(\"config server init success\")\n\treturn nil\n}", "func init() {\n\tif e, ok := os.LookupEnv(EnvConsul); ok && e != \"\" {\n\t\tconsulAddr = e\n\t}\n\tif consulAddr == \"--\" {\n\t\treturn\n\t}\n\tif consulAddr == \"-\" || (env.InTest() && consulAddr == localConsulAdr) {\n\t\tnoConsulTestMode()\n\t\treturn\n\t}\n\tif _, _, err := net.SplitHostPort(consulAddr); err != nil {\n\t\tconsulAddr = consulAddr + \":8500\"\n\t}\n\tif e, ok := os.LookupEnv(EnvFederatedDcs); ok {\n\t\tfederatedDcs = strings.Fields(e)\n\t}\n\trand.Seed(time.Now().UTC().UnixNano())\n\n\tmustConnect()\n\tupdateEnv()\n}", "func startHttpServer(s *Server, cfg *HttpConfig) (hs *http.Server, err error) {\n\n\tlogger := s.log // promlog.New(&cfg.promlogConfig)\n\n\thttpServer := &http.Server{\n\t\tAddr: cfg.Listen,\n\t\tHandler: nil,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 5 * time.Second,\n\t\tMaxHeaderBytes: 1 << 13,\n\t}\n\thttpServer.RegisterOnShutdown(func() {\n\t\tlogger.Debugf(\"Http Server shutdown at %v\\n\", time.Now())\n\t})\n\n\tgo func() {\n\t\terr := httpServer.ListenAndServe()\n\t\tif err != http.ErrServerClosed {\n\t\t\tlogger.Printf(\"Http Server fatal error: %v\\n\", err)\n\t\t\ts.Shutdown()\n\t\t}\n\t}()\n\treturn httpServer, nil\n}", "func NewDSServer(keeper *Keeper) *DSServer {\n\treturn &DSServer{\n\t\tkeeper: keeper,\n\t}\n}", "func InitWebServer() {\n\thttp.ListenAndServe(\":8080\", initRouter())\n}", "func (g *Gateway) init(bootstrap bool) error {\n\tlogger.Debugf(\"Initializing database gateway\")\n\tg.stopCh = make(chan struct{})\n\n\tinfo, err := loadInfo(g.db, g.networkCert)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to create raft factory: %w\", err)\n\t}\n\n\tdir := filepath.Join(g.db.Dir(), \"global\")\n\tif shared.PathExists(filepath.Join(dir, \"logs.db\")) {\n\t\treturn fmt.Errorf(\"Unsupported upgrade path, please first upgrade to LXD 4.0\")\n\t}\n\n\t// If the resulting raft instance is not nil, it means that this node\n\t// should serve as database node, so create a dqlite driver possibly\n\t// exposing it over the network.\n\tif info != nil {\n\t\t// Use the autobind feature of abstract unix sockets to get a\n\t\t// random unused address.\n\t\tlistener, err := net.Listen(\"unix\", \"\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to autobind unix socket: %w\", err)\n\t\t}\n\n\t\tg.bindAddress = listener.Addr().String()\n\t\t_ = listener.Close()\n\n\t\toptions := []dqlite.Option{\n\t\t\tdqlite.WithBindAddress(g.bindAddress),\n\t\t}\n\n\t\tif info.Address == \"1\" {\n\t\t\tif info.ID != 1 {\n\t\t\t\tpanic(\"unexpected server ID\")\n\t\t\t}\n\n\t\t\tg.memoryDial = dqliteMemoryDial(g.bindAddress)\n\t\t\tg.store.inMemory = client.NewInmemNodeStore()\n\t\t\terr = g.store.Set(context.Background(), []client.NodeInfo{info.NodeInfo})\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed setting node info in store: %w\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tgo runDqliteProxy(g.stopCh, g.bindAddress, g.acceptCh)\n\t\t\tg.store.inMemory = nil\n\t\t\toptions = append(options, dqlite.WithDialFunc(g.raftDial()))\n\t\t}\n\n\t\tserver, err := dqlite.New(\n\t\t\tinfo.ID,\n\t\t\tinfo.Address,\n\t\t\tdir,\n\t\t\toptions...,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to create dqlite server: %w\", err)\n\t\t}\n\n\t\t// Force the correct configuration into the bootstrap node, this is needed\n\t\t// when the raft node already has log entries, in which case a regular\n\t\t// bootstrap fails, resulting in the node containing outdated configuration.\n\t\tif bootstrap {\n\t\t\tlogger.Debugf(\"Bootstrap database gateway ID:%v Address:%v\",\n\t\t\t\tinfo.ID, info.Address)\n\t\t\tcluster := []dqlite.NodeInfo{\n\t\t\t\t{ID: uint64(info.ID), Address: info.Address},\n\t\t\t}\n\n\t\t\terr = server.Recover(cluster)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to recover database state: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\terr = server.Start()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to start dqlite server: %w\", err)\n\t\t}\n\n\t\tg.lock.Lock()\n\t\tg.server = server\n\t\tg.info = info\n\t\tg.lock.Unlock()\n\t} else {\n\t\tg.lock.Lock()\n\t\tg.server = nil\n\t\tg.info = nil\n\t\tg.store.inMemory = nil\n\t\tg.lock.Unlock()\n\t}\n\n\tg.lock.Lock()\n\tg.store.onDisk = client.NewNodeStore(\n\t\tg.db.DB(), \"main\", \"raft_nodes\", \"address\")\n\tg.lock.Unlock()\n\n\treturn nil\n}", "func (s *Server) Initialize(log logging.Logger, factory logging.Factory, host string, port uint16) {\n\ts.log = log\n\ts.factory = factory\n\ts.listenAddress = fmt.Sprintf(\"%s:%d\", host, port)\n\ts.router = newRouter()\n}", "func InitializeServer(wg *sync.WaitGroup) {\n\n\tServerLoggerInitialize(\"seelog.xml\")\n\n\tConfigInitialize(\"config.ini\")\n\n\tHandlerInitialize()\n\n\tWorkerInitialize()\n\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\n\t//초기화 완료 처리\n\twg.Done()\n}", "func init() {\n\tlis = bufconn.Listen(bufSize)\n\tlog.Println(\"server is started\")\n\tserver := grpc.NewServer()\n\tapi.RegisterUserServiceServer(server, &GRPCServer{})\n\n\tdbConnection := postgres.OpenDataBaseConnection()\n\tpostgres.StorageInstance = postgres.NewStorage(dbConnection)\n\tgo func() {\n\t\tif err := server.Serve(lis); err != nil {\n\t\t\tlog.Fatalf(\"Server exited with error: %v\", err)\n\t\t}\n\t}()\n}", "func (instance *DBSyncSlave) init() {\n\tif nil != instance {\n\t\tif len(instance.Config.Uuid) > 0 {\n\t\t\tinstance.UID = instance.Config.Uuid\n\t\t} else {\n\t\t\tinstance.UID, _ = lygo_sys.ID()\n\t\t}\n\t\tif nil == instance.client {\n\t\t\tinstance.client = lygo_nio.NewNioClient(instance.Config.Host(), instance.Config.Port())\n\t\t\tinstance.client.OnConnect(instance.doConnect)\n\t\t\tinstance.client.OnDisconnect(instance.doDisconnect)\n\t\t}\n\t}\n}", "func (srv *Server) initAPI(addr string) {\n\tmux := http.NewServeMux()\n\n\t// 404 Calls\n\thandleHTTPRequest(mux, \"/\", srv.unrecognizedCallHandler)\n\n\t// Consensus API Calls\n\thandleHTTPRequest(mux, \"/consensus/status\", srv.consensusStatusHandler)\n\thandleHTTPRequest(mux, \"/consensus/synchronize\", srv.consensusSynchronizeHandler)\n\n\t// Daemon API Calls\n\thandleHTTPRequest(mux, \"/daemon/stop\", srv.daemonStopHandler)\n\thandleHTTPRequest(mux, \"/daemon/updates/apply\", srv.daemonUpdatesApplyHandler)\n\thandleHTTPRequest(mux, \"/daemon/updates/check\", srv.daemonUpdatesCheckHandler)\n\n\t// Debugging API Calls\n\thandleHTTPRequest(mux, \"/debug/constants\", srv.debugConstantsHandler)\n\thandleHTTPRequest(mux, \"/debug/mutextest\", srv.mutexTestHandler)\n\n\t// Gateway API Calls\n\thandleHTTPRequest(mux, \"/gateway/status\", srv.gatewayStatusHandler)\n\thandleHTTPRequest(mux, \"/gateway/peers/add\", srv.gatewayPeersAddHandler)\n\thandleHTTPRequest(mux, \"/gateway/peers/remove\", srv.gatewayPeersRemoveHandler)\n\n\t// Host API Calls\n\thandleHTTPRequest(mux, \"/host/announce\", srv.hostAnnounceHandler)\n\thandleHTTPRequest(mux, \"/host/configure\", srv.hostConfigureHandler)\n\thandleHTTPRequest(mux, \"/host/status\", srv.hostStatusHandler)\n\n\t// HostDB API Calls\n\thandleHTTPRequest(mux, \"/hostdb/hosts/active\", srv.hostdbHostsActiveHandler)\n\thandleHTTPRequest(mux, \"/hostdb/hosts/all\", srv.hostdbHostsAllHandler)\n\n\t// Miner API Calls\n\thandleHTTPRequest(mux, \"/miner/start\", srv.minerStartHandler)\n\thandleHTTPRequest(mux, \"/miner/status\", srv.minerStatusHandler)\n\thandleHTTPRequest(mux, \"/miner/stop\", srv.minerStopHandler)\n\thandleHTTPRequest(mux, \"/miner/blockforwork\", srv.minerBlockforworkHandler) // Deprecated\n\thandleHTTPRequest(mux, \"/miner/submitblock\", srv.minerSubmitblockHandler) // Deprecated\n\thandleHTTPRequest(mux, \"/miner/headerforwork\", srv.minerHeaderforworkHandler)\n\thandleHTTPRequest(mux, \"/miner/submitheader\", srv.minerSubmitheaderHandler)\n\n\t// Renter API Calls\n\thandleHTTPRequest(mux, \"/renter/downloadqueue\", srv.renterDownloadqueueHandler)\n\thandleHTTPRequest(mux, \"/renter/files/delete\", srv.renterFilesDeleteHandler)\n\thandleHTTPRequest(mux, \"/renter/files/download\", srv.renterFilesDownloadHandler)\n\thandleHTTPRequest(mux, \"/renter/files/list\", srv.renterFilesListHandler)\n\thandleHTTPRequest(mux, \"/renter/files/load\", srv.renterFilesLoadHandler)\n\thandleHTTPRequest(mux, \"/renter/files/loadascii\", srv.renterFilesLoadAsciiHandler)\n\thandleHTTPRequest(mux, \"/renter/files/rename\", srv.renterFilesRenameHandler)\n\thandleHTTPRequest(mux, \"/renter/files/share\", srv.renterFilesShareHandler)\n\thandleHTTPRequest(mux, \"/renter/files/shareascii\", srv.renterFilesShareAsciiHandler)\n\thandleHTTPRequest(mux, \"/renter/files/upload\", srv.renterFilesUploadHandler)\n\thandleHTTPRequest(mux, \"/renter/status\", srv.renterStatusHandler) // TODO: alter\n\n\t// TransactionPool API Calls\n\thandleHTTPRequest(mux, \"/transactionpool/transactions\", srv.transactionpoolTransactionsHandler)\n\n\t// Wallet API Calls\n\thandleHTTPRequest(mux, \"/wallet/address\", srv.walletAddressHandler)\n\thandleHTTPRequest(mux, \"/wallet/send\", srv.walletSendHandler)\n\thandleHTTPRequest(mux, \"/wallet/status\", srv.walletStatusHandler)\n\n\t// create graceful HTTP server\n\tsrv.apiServer = &graceful.Server{\n\t\tTimeout: apiTimeout,\n\t\tServer: &http.Server{Addr: addr, Handler: mux},\n\t}\n}", "func (m *Manager) startNorthboundServer() error {\n\ts := northbound.NewServer(northbound.NewServerCfg(\n\t\tm.Config.CAPath,\n\t\tm.Config.KeyPath,\n\t\tm.Config.CertPath,\n\t\tint16(m.Config.GRPCPort),\n\t\ttrue,\n\t\tnorthbound.SecurityConfig{}))\n\n\tif m.Config.AtomixClient == nil {\n\t\tm.Config.AtomixClient = client.NewClient()\n\t}\n\n\ttopoStore, err := store.NewAtomixStore(m.Config.AtomixClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.AddService(logging.Service{})\n\ts.AddService(service.NewService(topoStore))\n\n\tdoneCh := make(chan error)\n\tgo func() {\n\t\terr := s.Serve(func(started string) {\n\t\t\tlog.Info(\"Started NBI on \", started)\n\t\t\tclose(doneCh)\n\t\t})\n\t\tif err != nil {\n\t\t\tdoneCh <- err\n\t\t}\n\t}()\n\treturn <-doneCh\n}", "func NewServer(diagSet *Set) *Server {\n\tif diagSet == nil {\n\t\tdiagSet = DefaultDiagSet\n\t}\n\treturn &Server{ds: diagSet}\n}", "func InitServer(svc *service.Service) *gin.Engine {\n\tmapper := mapper.New()\n\tsvm := service.NewServiceManager()\n\tsrv := gin.Default()\n\n\tqrcodeService := svm.QRCodeService(svc)\n\tuserService := svm.UserService(svc)\n\tsafraService := svm.SafraService(svc)\n\n\tsrv.Use(cors.Default())\n\n\treturn setupRoutes(srv, &controller{\n\t\tpingController: pingroute.NewController(),\n\t\tqrcodeController: qrcoderoute.NewController(qrcodeService, mapper),\n\t\tuserController: userroute.NewController(userService, mapper),\n\t\tsafraController: safraroute.NewController(safraService),\n\t})\n}", "func StartServer() {\n\tif server == nil {\n\t\tGetInstance()\n\t}\n\n\tlog.Println(\"starting server on http://localhost\" + defaultPort)\n\tserver.Run(defaultPort)\n}", "func InitClient(host string, port string, prefix string, globalTags []string) error {\n\tvar err error\n\t// WithMaxBytesPerPayload optimal value is 1432, stacktrace is bigger than that, so remove it for keeping safe\n\tc, err = statsd.New(host+\":\"+port, statsd.WithMaxBytesPerPayload(maxBytesPerPayload))\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Tags = append(c.Tags, globalTags...)\n\tc.Namespace = prefix + \".\"\n\tc.Incr(\"server_start\", []string(nil), 1)\n\treturn nil\n}", "func NewServer(aggregator *aggregator.BufferedAggregator) (*Server, error) {\n\tvar stats *util.Stats\n\tif config.Datadog.GetBool(\"dogstatsd_stats_enable\") == true {\n\t\tbuff := config.Datadog.GetInt(\"dogstatsd_stats_buffer\")\n\t\ts, err := util.NewStats(uint32(buff))\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Dogstatsd: unable to start statistics facilities\")\n\t\t}\n\t\tstats = s\n\t\tdogstatsdExpvars.Set(\"PacketsLastSecond\", &dogstatsdPacketsLastSec)\n\t}\n\n\tvar metricsStatsEnabled uint64 // we're using an uint64 for its atomic capacity\n\tif config.Datadog.GetBool(\"dogstatsd_metrics_stats_enable\") == true {\n\t\tlog.Info(\"Dogstatsd: metrics statistics will be stored.\")\n\t\tmetricsStatsEnabled = 1\n\t}\n\n\tpacketsChannel := make(chan listeners.Packets, config.Datadog.GetInt(\"dogstatsd_queue_size\"))\n\ttmpListeners := make([]listeners.StatsdListener, 0, 2)\n\n\t// sharedPacketPool is used by the packet assembler to retrieve already allocated\n\t// buffer in order to avoid allocation. The packets are pushed back by the server.\n\tsharedPacketPool := listeners.NewPacketPool(config.Datadog.GetInt(\"dogstatsd_buffer_size\"))\n\n\tsocketPath := config.Datadog.GetString(\"dogstatsd_socket\")\n\tif len(socketPath) > 0 {\n\t\tunixListener, err := listeners.NewUDSListener(packetsChannel, sharedPacketPool)\n\t\tif err != nil {\n\t\t\tlog.Errorf(err.Error())\n\t\t} else {\n\t\t\ttmpListeners = append(tmpListeners, unixListener)\n\t\t}\n\t}\n\tif config.Datadog.GetInt(\"dogstatsd_port\") > 0 {\n\t\tudpListener, err := listeners.NewUDPListener(packetsChannel, sharedPacketPool)\n\t\tif err != nil {\n\t\t\tlog.Errorf(err.Error())\n\t\t} else {\n\t\t\ttmpListeners = append(tmpListeners, udpListener)\n\t\t}\n\t}\n\n\tpipeName := config.Datadog.GetString(\"dogstatsd_windows_pipe_name\")\n\tif len(pipeName) > 0 {\n\t\tnamedPipeListener, err := listeners.NewNamedPipeListener(pipeName, packetsChannel, sharedPacketPool)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"named pipe error: %v\", err.Error())\n\t\t} else {\n\t\t\ttmpListeners = append(tmpListeners, namedPipeListener)\n\t\t}\n\t}\n\n\tif len(tmpListeners) == 0 {\n\t\treturn nil, fmt.Errorf(\"listening on neither udp nor socket, please check your configuration\")\n\t}\n\n\t// check configuration for custom namespace\n\tmetricPrefix := config.Datadog.GetString(\"statsd_metric_namespace\")\n\tif metricPrefix != \"\" && !strings.HasSuffix(metricPrefix, \".\") {\n\t\tmetricPrefix = metricPrefix + \".\"\n\t}\n\tmetricPrefixBlacklist := config.Datadog.GetStringSlice(\"statsd_metric_namespace_blacklist\")\n\n\tdefaultHostname, err := util.GetHostname()\n\tif err != nil {\n\t\tlog.Errorf(\"Dogstatsd: unable to determine default hostname: %s\", err.Error())\n\t}\n\n\thistToDist := config.Datadog.GetBool(\"histogram_copy_to_distribution\")\n\thistToDistPrefix := config.Datadog.GetString(\"histogram_copy_to_distribution_prefix\")\n\n\textraTags := config.Datadog.GetStringSlice(\"dogstatsd_tags\")\n\n\tentityIDPrecedenceEnabled := config.Datadog.GetBool(\"dogstatsd_entity_id_precedence\")\n\n\ts := &Server{\n\t\tStarted: true,\n\t\tStatistics: stats,\n\t\tpacketsIn: packetsChannel,\n\t\tsharedPacketPool: sharedPacketPool,\n\t\taggregator: aggregator,\n\t\tlisteners: tmpListeners,\n\t\tstopChan: make(chan bool),\n\t\thealth: health.RegisterLiveness(\"dogstatsd-main\"),\n\t\tmetricPrefix: metricPrefix,\n\t\tmetricPrefixBlacklist: metricPrefixBlacklist,\n\t\tdefaultHostname: defaultHostname,\n\t\thistToDist: histToDist,\n\t\thistToDistPrefix: histToDistPrefix,\n\t\textraTags: extraTags,\n\t\ttelemetryEnabled: telemetry_utils.IsEnabled(),\n\t\tentityIDPrecedenceEnabled: entityIDPrecedenceEnabled,\n\t\tdisableVerboseLogs: config.Datadog.GetBool(\"dogstatsd_disable_verbose_logs\"),\n\t\tDebug: &dsdServerDebug{\n\t\t\tStats: make(map[ckey.ContextKey]metricStat),\n\t\t\tmetricsCounts: metricsCountBuckets{\n\t\t\t\tcounts: [5]uint64{0, 0, 0, 0, 0},\n\t\t\t\tmetricChan: make(chan struct{}),\n\t\t\t\tcloseChan: make(chan struct{}),\n\t\t\t},\n\t\t\tkeyGen: ckey.NewKeyGenerator(),\n\t\t},\n\t}\n\n\t// packets forwarding\n\t// ----------------------\n\n\tforwardHost := config.Datadog.GetString(\"statsd_forward_host\")\n\tforwardPort := config.Datadog.GetInt(\"statsd_forward_port\")\n\tif forwardHost != \"\" && forwardPort != 0 {\n\t\tforwardAddress := fmt.Sprintf(\"%s:%d\", forwardHost, forwardPort)\n\t\tcon, err := net.Dial(\"udp\", forwardAddress)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Could not connect to statsd forward host : %s\", err)\n\t\t} else {\n\t\t\ts.packetsIn = make(chan listeners.Packets, config.Datadog.GetInt(\"dogstatsd_queue_size\"))\n\t\t\tgo s.forwarder(con, packetsChannel)\n\t\t}\n\t}\n\n\t// start the workers processing the packets read on the socket\n\t// ----------------------\n\n\ts.handleMessages()\n\n\t// start the debug loop\n\t// ----------------------\n\n\tif metricsStatsEnabled == 1 {\n\t\ts.EnableMetricsStats()\n\t}\n\n\t// map some metric name\n\t// ----------------------\n\n\tcacheSize := config.Datadog.GetInt(\"dogstatsd_mapper_cache_size\")\n\n\tmappings, err := config.GetDogstatsdMappingProfiles()\n\tif err != nil {\n\t\tlog.Warnf(\"Could not parse mapping profiles: %v\", err)\n\t} else if len(mappings) != 0 {\n\t\tmapperInstance, err := mapper.NewMetricMapper(mappings, cacheSize)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Could not create metric mapper: %v\", err)\n\t\t} else {\n\t\t\ts.mapper = mapperInstance\n\t\t}\n\t}\n\treturn s, nil\n}", "func Init() *Server {\n\ts := &Server{\n\t\t&goserver.GoServer{},\n\t\t0,\n\t}\n\treturn s\n}", "func StartHTTPServer(healthz http.HandlerFunc, port int, mux *http.ServeMux) error {\n\thttpSrv, err := buildServer(healthz, port, mux)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to prepare server prior to serving: %s\", err.Error())\n\t}\n\tlis, err := buildListener(port)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to prepare net.listener prior to serving: %s\", err.Error())\n\t}\n\treturn httpSrv.Serve(*lis)\n}" ]
[ "0.6577117", "0.61836004", "0.58856076", "0.5873448", "0.58571017", "0.5849781", "0.58205044", "0.5788006", "0.5765969", "0.5757338", "0.57560205", "0.57468", "0.5746392", "0.57075214", "0.5705852", "0.56903404", "0.5686891", "0.56743336", "0.5671335", "0.5657342", "0.56538653", "0.5646904", "0.56295526", "0.5591786", "0.55871993", "0.5569353", "0.55399513", "0.5537839", "0.55328166", "0.5530941", "0.5524769", "0.5492583", "0.54920727", "0.5488693", "0.5473374", "0.54700714", "0.5453051", "0.54346335", "0.5428007", "0.540884", "0.54080945", "0.5406098", "0.53952324", "0.5387264", "0.5384138", "0.5382628", "0.5375872", "0.5374102", "0.5360617", "0.5357242", "0.53429866", "0.5334781", "0.5327673", "0.53239185", "0.5322616", "0.53173476", "0.5303496", "0.52995014", "0.52955544", "0.5294501", "0.52897274", "0.52889633", "0.52863264", "0.5284668", "0.5275343", "0.52620727", "0.5257614", "0.5255664", "0.52541274", "0.5251027", "0.523429", "0.5231276", "0.5228843", "0.52268225", "0.52118057", "0.5204468", "0.51942104", "0.5190443", "0.51863986", "0.5182038", "0.5180406", "0.51796335", "0.51734513", "0.51727754", "0.5169849", "0.516597", "0.5165743", "0.5164224", "0.5163836", "0.515523", "0.51490307", "0.5142616", "0.51400465", "0.5138427", "0.5132764", "0.51209575", "0.5116223", "0.5114109", "0.5114099", "0.5112505" ]
0.7915286
0
checkIfBackupInNewOrProgress check whether there are backups created by this schedule still in New or InProgress state
checkIfBackupInNewOrProgress проверяет, есть ли резервные копии, созданные этим расписанием, в состоянии New или InProgress
func (c *scheduleReconciler) checkIfBackupInNewOrProgress(schedule *velerov1.Schedule) bool { log := c.logger.WithField("schedule", kube.NamespaceAndName(schedule)) backupList := &velerov1.BackupList{} options := &client.ListOptions{ Namespace: schedule.Namespace, LabelSelector: labels.Set(map[string]string{ velerov1.ScheduleNameLabel: schedule.Name, }).AsSelector(), } err := c.List(context.Background(), backupList, options) if err != nil { log.Errorf("fail to list backup for schedule %s/%s: %s", schedule.Namespace, schedule.Name, err.Error()) return true } for _, backup := range backupList.Items { if backup.Status.Phase == velerov1.BackupPhaseNew || backup.Status.Phase == velerov1.BackupPhaseInProgress { log.Debugf("%s/%s still has backups that are in InProgress or New...", schedule.Namespace, schedule.Name) return true } } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Task) hasBackupCompleted(backup *velero.Backup) (bool, []string) {\n\tcompleted := false\n\treasons := []string{}\n\tprogress := []string{}\n\n\tpvbs := t.getPodVolumeBackupsForBackup(backup)\n\n\tswitch backup.Status.Phase {\n\tcase velero.BackupPhaseNew:\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Backup %s/%s: Not started\",\n\t\t\t\tbackup.Namespace,\n\t\t\t\tbackup.Name))\n\tcase velero.BackupPhaseInProgress:\n\t\titemsBackedUp, totalItems := getBackupStats(backup)\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Backup %s/%s: %d out of estimated total of %d objects backed up%s\",\n\t\t\t\tbackup.Namespace,\n\t\t\t\tbackup.Name,\n\t\t\t\titemsBackedUp,\n\t\t\t\ttotalItems,\n\t\t\t\tgetBackupDuration(backup)))\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tgetPodVolumeBackupsProgress(pvbs)...)\n\tcase velero.BackupPhaseCompleted:\n\t\tcompleted = true\n\t\titemsBackedUp, totalItems := getBackupStats(backup)\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Backup %s/%s: %d out of estimated total of %d objects backed up%s\",\n\t\t\t\tbackup.Namespace,\n\t\t\t\tbackup.Name,\n\t\t\t\titemsBackedUp,\n\t\t\t\ttotalItems,\n\t\t\t\tgetBackupDuration(backup)))\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tgetPodVolumeBackupsProgress(pvbs)...)\n\tcase velero.BackupPhaseFailed:\n\t\tcompleted = true\n\t\tmessage := fmt.Sprintf(\n\t\t\t\"Backup %s/%s: failed.\",\n\t\t\tbackup.Namespace,\n\t\t\tbackup.Name)\n\t\treasons = append(reasons, message)\n\t\titemsBackedUp, totalItems := getBackupStats(backup)\n\t\tmessage = fmt.Sprintf(\n\t\t\t\"%s %d out of estimated total of %d objects backed up%s\",\n\t\t\tmessage,\n\t\t\titemsBackedUp,\n\t\t\ttotalItems,\n\t\t\tgetBackupDuration(backup))\n\t\tprogress = append(progress, message)\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tgetPodVolumeBackupsProgress(pvbs)...)\n\tcase velero.BackupPhasePartiallyFailed:\n\t\tcompleted = true\n\t\titemsBackedUp, totalItems := getBackupStats(backup)\n\t\tmessage := fmt.Sprintf(\n\t\t\t\"Backup %s/%s: partially failed. %d out of estimated total of %d objects backed up%s\",\n\t\t\tbackup.Namespace,\n\t\t\tbackup.Name,\n\t\t\titemsBackedUp,\n\t\t\ttotalItems,\n\t\t\tgetBackupDuration(backup))\n\t\tprogress = append(progress, message)\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tgetPodVolumeBackupsProgress(pvbs)...)\n\tcase velero.BackupPhaseFailedValidation:\n\t\treasons = backup.Status.ValidationErrors\n\t\treasons = append(\n\t\t\treasons,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Backup %s/%s: validation failed.\",\n\t\t\t\tbackup.Namespace,\n\t\t\t\tbackup.Name))\n\t\tcompleted = true\n\t}\n\tt.Log.Info(\"Velero Backup progress report\",\n\t\t\"backup\", path.Join(backup.Namespace, backup.Name),\n\t\t\"backupProgress\", progress)\n\n\tt.setProgress(progress)\n\treturn completed, reasons\n}", "func backupScheduleFound(repo v1beta1.PGBackRestRepo, backupType string) bool {\n\tif repo.BackupSchedules != nil {\n\t\tswitch backupType {\n\t\tcase full:\n\t\t\treturn repo.BackupSchedules.Full != nil\n\t\tcase differential:\n\t\t\treturn repo.BackupSchedules.Differential != nil\n\t\tcase incremental:\n\t\t\treturn repo.BackupSchedules.Incremental != nil\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "func (c *Context) IsBackup() bool {\n\treturn c.MyIndex >= 0 && !c.IsPrimary()\n}", "func (t *Task) isBackupReplicated(backup *velero.Backup) (bool, error) {\n\tclient, err := t.getDestinationClient()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treplicated := velero.Backup{}\n\tt.Log.Info(\"Checking if Velero Backup has been replicated to destination cluster\",\n\t\t\"backup\", path.Join(backup.Namespace, backup.Name))\n\terr = client.Get(\n\t\tcontext.TODO(),\n\t\ttypes.NamespacedName{\n\t\t\tNamespace: backup.Namespace,\n\t\t\tName: backup.Name,\n\t\t},\n\t\t&replicated)\n\tif err == nil {\n\t\tt.Log.Info(\"FOUND Velero Backup has been replicated to destination cluster\",\n\t\t\t\"backup\", path.Join(replicated.Namespace, replicated.Name))\n\t\treturn true, nil\n\t}\n\tif k8serrors.IsNotFound(err) {\n\t\terr = nil\n\t}\n\treturn false, err\n}", "func IsInProgressStatus(bkp *apis.CStorBackup) bool {\n\tif string(bkp.Status) == string(apis.BKPCStorStatusInProgress) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (backupWrapper *v1BackupWrapper) isBackupCompleted() bool {\n\tif backupWrapper.backup.IsFailed() ||\n\t\tbackupWrapper.backup.IsSucceeded() {\n\t\treturn true\n\t}\n\treturn false\n}", "func (c *CleanupStatusTracker) InProgress(bdName string) bool {\n\treturn c.JobController.IsCleaningJobRunning(bdName)\n}", "func (r *ReconcileBackup) isAllCreated(bkp *v1alpha1.Backup) error {\n\n\t// Check if was possible found the DB Pod\n\tif !r.isDbPodFound() {\n\t\terr := fmt.Errorf(\"Error: Database Pod is missing\")\n\t\treturn err\n\t}\n\n\t// Check if was possible found the DB Service\n\tif !r.isDbServiceFound() {\n\t\terr := fmt.Errorf(\"Error: Database Service is missing\")\n\t\treturn err\n\t}\n\n\t// Check if DB secret was created\n\tdbSecretName := utils.DbSecretPrefix + bkp.Name\n\t_, err := service.FetchSecret(bkp.Namespace, dbSecretName, r.client)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error: DB Secret is missing. (%v)\", dbSecretName)\n\t\treturn err\n\t}\n\n\t// Check if AWS secret was created\n\tawsSecretName := utils.GetAWSSecretName(bkp)\n\tawsSecretNamespace := utils.GetAwsSecretNamespace(bkp)\n\t_, err = service.FetchSecret(awsSecretNamespace, awsSecretName, r.client)\n\tif err != nil {\n\t\terr := fmt.Errorf(\"Error: AWS Secret is missing. (name:%v,namespace:%v)\", awsSecretName, awsSecretNamespace)\n\t\treturn err\n\t}\n\n\t// Check if Enc secret was created (if was configured to be used)\n\tif utils.IsEncryptionKeyOptionConfig(bkp) {\n\t\tencSecretName := utils.GetEncSecretName(bkp)\n\t\tencSecretNamespace := utils.GetEncSecretNamespace(bkp)\n\t\t_, err := service.FetchSecret(encSecretNamespace, encSecretName, r.client)\n\t\tif err != nil {\n\t\t\terr := fmt.Errorf(\"Error: Encript Key Secret is missing. (name:%v,namespace:%v)\", encSecretName, encSecretNamespace)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t//check if the cronJob was created\n\t_, err = service.FetchCronJob(bkp.Name, bkp.Namespace, r.client)\n\tif err != nil {\n\t\terr := fmt.Errorf(\"Error: CronJob is missing\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func IsBackup(options []*commonpb.KeyValuePair) bool {\n\tisBackup, err := funcutil.GetAttrByKeyFromRepeatedKV(BackupFlag, options)\n\tif err != nil || strings.ToLower(isBackup) != \"true\" {\n\t\treturn false\n\t}\n\treturn true\n}", "func (s StackStatus) InProgress() bool {\n\treturn strings.HasSuffix(string(s), \"IN_PROGRESS\")\n}", "func isNewWorker(worker *workerv1.Worker, currentDeployment *appsv1.Deployment) bool {\n\treturn currentDeployment == nil && worker.DeletionTimestamp == nil\n}", "func (w *CrawlerWorker) HasPendingJobs() bool { return len(w.pending) > 0 }", "func (a *actionRebuildOutSyncedShards) CheckProgress(ctx context.Context) (bool, bool, error) {\n\tif !features.RebuildOutSyncedShards().Enabled() {\n\t\t// RebuildOutSyncedShards feature is not enabled\n\t\treturn true, false, nil\n\t}\n\n\tclientSync, err := a.actionCtx.GetMembersState().GetMemberClient(a.action.MemberID)\n\tif err != nil {\n\t\treturn false, false, errors.Wrapf(err, \"Unable to create client (SyncMode)\")\n\t}\n\n\tclientAsync, err := a.actionCtx.GetServerAsyncClient(a.action.MemberID)\n\tif err != nil {\n\t\treturn false, false, errors.Wrapf(err, \"Unable to create client (AsyncMode)\")\n\t}\n\n\tjobID, ok := a.actionCtx.Get(a.action, actionRebuildOutSyncedShardsLocalJobID)\n\tif !ok {\n\t\treturn false, true, errors.Newf(\"Local Key is missing in action: %s\", actionRebuildOutSyncedShardsLocalJobID)\n\t}\n\n\tbatchID, ok := a.actionCtx.Get(a.action, actionRebuildOutSyncedShardsBatchID)\n\tif !ok {\n\t\treturn false, true, errors.Newf(\"Local Key is missing in action: %s\", actionRebuildOutSyncedShardsBatchID)\n\t}\n\n\tdatabase, ok := a.actionCtx.Get(a.action, actionRebuildOutSyncedShardsLocalDatabase)\n\tif !ok {\n\t\treturn false, true, errors.Newf(\"Local Key is missing in action: %s\", actionRebuildOutSyncedShardsLocalDatabase)\n\t}\n\n\tshardID, ok := a.actionCtx.Get(a.action, actionRebuildOutSyncedShardsLocalShard)\n\tif !ok {\n\t\treturn false, true, errors.Newf(\"Local Key is missing in action: %s\", actionRebuildOutSyncedShardsLocalShard)\n\t}\n\n\t// check first if there is rebuild job running\n\trebuildInProgress, err := a.checkRebuildShardProgress(ctx, clientAsync, clientSync, shardID, database, jobID, batchID)\n\tif err != nil {\n\t\tif rebuildInProgress {\n\t\t\ta.log.Err(err).Error(\"Rebuild job failed but we will retry\", shardID, database, a.action.MemberID)\n\t\t\treturn false, false, err\n\t\t} else {\n\t\t\ta.log.Err(err).Error(\"Rebuild job failed\", shardID, database, a.action.MemberID)\n\t\t\treturn false, true, err\n\t\t}\n\n\t}\n\tif rebuildInProgress {\n\t\ta.log.Debug(\"Rebuild job is still in progress\", shardID, database, a.action.MemberID)\n\t\treturn false, false, nil\n\t}\n\n\t// rebuild job is done\n\ta.log.Info(\"Rebuild Shard Tree is done\", shardID, database, a.action.MemberID)\n\treturn true, false, nil\n}", "func (t *Task) hasAllProgressReportingCompleted() (bool, error) {\n\tt.Owner.Status.RunningPods = []*migapi.PodProgress{}\n\tt.Owner.Status.FailedPods = []*migapi.PodProgress{}\n\tt.Owner.Status.SuccessfulPods = []*migapi.PodProgress{}\n\tt.Owner.Status.PendingPods = []*migapi.PodProgress{}\n\tunknownPods := []*migapi.PodProgress{}\n\tvar pendingSinceTimeLimitPods []string\n\tpvcMap := t.getPVCNamespaceMap()\n\tfor bothNs, vols := range pvcMap {\n\t\tns := getSourceNs(bothNs)\n\t\tfor _, vol := range vols {\n\t\t\toperation := t.Owner.Status.GetRsyncOperationStatusForPVC(&corev1.ObjectReference{\n\t\t\t\tNamespace: ns,\n\t\t\t\tName: vol.Name,\n\t\t\t})\n\t\t\tdvmp := migapi.DirectVolumeMigrationProgress{}\n\t\t\terr := t.Client.Get(context.TODO(), types.NamespacedName{\n\t\t\t\tName: getMD5Hash(t.Owner.Name + vol.Name + ns),\n\t\t\t\tNamespace: migapi.OpenshiftMigrationNamespace,\n\t\t\t}, &dvmp)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tpodProgress := &migapi.PodProgress{\n\t\t\t\tObjectReference: &corev1.ObjectReference{\n\t\t\t\t\tNamespace: ns,\n\t\t\t\t\tName: dvmp.Status.PodName,\n\t\t\t\t},\n\t\t\t\tPVCReference: &corev1.ObjectReference{\n\t\t\t\t\tNamespace: ns,\n\t\t\t\t\tName: vol.Name,\n\t\t\t\t},\n\t\t\t\tLastObservedProgressPercent: dvmp.Status.TotalProgressPercentage,\n\t\t\t\tLastObservedTransferRate: dvmp.Status.LastObservedTransferRate,\n\t\t\t\tTotalElapsedTime: dvmp.Status.RsyncElapsedTime,\n\t\t\t}\n\t\t\tswitch {\n\t\t\tcase dvmp.Status.PodPhase == corev1.PodRunning:\n\t\t\t\tt.Owner.Status.RunningPods = append(t.Owner.Status.RunningPods, podProgress)\n\t\t\tcase operation.Failed:\n\t\t\t\tt.Owner.Status.FailedPods = append(t.Owner.Status.FailedPods, podProgress)\n\t\t\tcase dvmp.Status.PodPhase == corev1.PodSucceeded:\n\t\t\t\tt.Owner.Status.SuccessfulPods = append(t.Owner.Status.SuccessfulPods, podProgress)\n\t\t\tcase dvmp.Status.PodPhase == corev1.PodPending:\n\t\t\t\tt.Owner.Status.PendingPods = append(t.Owner.Status.PendingPods, podProgress)\n\t\t\t\tif dvmp.Status.CreationTimestamp != nil {\n\t\t\t\t\tif time.Now().UTC().Sub(dvmp.Status.CreationTimestamp.Time.UTC()) > PendingPodWarningTimeLimit {\n\t\t\t\t\t\tpendingSinceTimeLimitPods = append(pendingSinceTimeLimitPods, fmt.Sprintf(\"%s/%s\", podProgress.Namespace, podProgress.Name))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase dvmp.Status.PodPhase == \"\":\n\t\t\t\tunknownPods = append(unknownPods, podProgress)\n\t\t\tcase !operation.Failed:\n\t\t\t\tt.Owner.Status.RunningPods = append(t.Owner.Status.RunningPods, podProgress)\n\t\t\t}\n\t\t}\n\t}\n\n\tisCompleted := len(t.Owner.Status.SuccessfulPods)+len(t.Owner.Status.FailedPods) == len(t.Owner.Spec.PersistentVolumeClaims)\n\tisAnyPending := len(t.Owner.Status.PendingPods) > 0\n\tisAnyRunning := len(t.Owner.Status.RunningPods) > 0\n\tisAnyUnknown := len(unknownPods) > 0\n\tif len(pendingSinceTimeLimitPods) > 0 {\n\t\tpendingMessage := fmt.Sprintf(\"Rsync Client Pods [%s] are stuck in Pending state for more than 10 mins\", strings.Join(pendingSinceTimeLimitPods[:], \", \"))\n\t\tt.Log.Info(pendingMessage)\n\t\tt.Owner.Status.SetCondition(migapi.Condition{\n\t\t\tType: RsyncClientPodsPending,\n\t\t\tStatus: migapi.True,\n\t\t\tReason: \"PodStuckInContainerCreating\",\n\t\t\tCategory: migapi.Warn,\n\t\t\tMessage: pendingMessage,\n\t\t})\n\t}\n\treturn !isAnyRunning && !isAnyPending && !isAnyUnknown && isCompleted, nil\n}", "func WaitForScheduledBackup(backupScheduleName string, retryInterval time.Duration, timeout time.Duration) (*api.BackupObject, error) {\n\tbeginTime := time.Now()\n\tbeginTimeSec := beginTime.Unix()\n\n\tt := func() (interface{}, bool, error) {\n\t\tlogrus.Infof(\"Enumerating backups\")\n\t\tbkpEnumerateReq := &api.BackupEnumerateRequest{\n\t\t\tOrgId: OrgID}\n\t\t//ctx, err := backup.GetPxCentralAdminCtx()\n\t\tctx, err := backup.GetAdminCtxFromSecret()\n\t\tif err != nil {\n\t\t\treturn nil, true, err\n\t\t}\n\t\tcurBackups, err := Inst().Backup.EnumerateBackup(ctx, bkpEnumerateReq)\n\t\tif err != nil {\n\t\t\treturn nil, true, err\n\t\t}\n\t\tfor _, bkp := range curBackups.GetBackups() {\n\t\t\tcreateTime := bkp.GetCreateTime()\n\t\t\tif beginTimeSec > createTime.GetSeconds() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif (bkp.GetStatus().GetStatus() == api.BackupInfo_StatusInfo_Success ||\n\t\t\t\tbkp.GetStatus().GetStatus() == api.BackupInfo_StatusInfo_PartialSuccess) &&\n\t\t\t\tbkp.GetBackupSchedule().GetName() == backupScheduleName {\n\t\t\t\treturn bkp, false, nil\n\t\t\t}\n\t\t}\n\t\terr = fmt.Errorf(\"unable to find backup from backup schedule with name %s after time %v\",\n\t\t\tbackupScheduleName, beginTime)\n\t\treturn nil, true, err\n\t}\n\n\tbkpInterface, err := task.DoRetryWithTimeout(t, timeout, retryInterval)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbkp := bkpInterface.(*api.BackupObject)\n\treturn bkp, nil\n\n}", "func (o *HyperflexVmSnapshotInfoAllOf) HasVmBackupInfo() bool {\n\tif o != nil && o.VmBackupInfo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func CheckFsCreationInProgress(device model.Device) (inProgress bool, err error) {\n\treturn false, fmt.Errorf(\"FS progress check is not implemented for Mac\")\n}", "func checkState() {\n\tlist := listContainers()\n\tallup := true\n\tfor _, cfgCon := range clusterConfig {\n\t\tfound := false\n\t\tfor _, con := range list {\n\t\t\tif con.Name == cfgCon.Name {\n\t\t\t\tif !con.State.Running {\n\t\t\t\t\tallup = false\n\t\t\t\t}\n\t\t\t\tcheckContainerState(con, cfgCon)\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tlog.Println(\"No container found for\", cfgCon.Name)\n\t\t\tcreateContainer(cfgCon)\n\t\t\tupdateConfig()\n\t\t}\n\t}\n\tif allup {\n\t\tlog.Println(\"All containers are up\")\n\t}\n}", "func (pr *Progress) maybeSnapshotAbort() bool {\n\treturn pr.State == ProgressStateSnapshot && pr.Match >= pr.PendingSnapshot\n}", "func IsPendingStatus(bkp *apis.CStorBackup) bool {\n\tif string(bkp.Status) == string(apis.BKPCStorStatusPending) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (queryRunner *GpQueryRunner) IsInBackup() (isInBackupByContentID map[int]bool, err error) {\n\tconn := queryRunner.pgQueryRunner.Connection\n\n\trows, err := conn.Query(queryRunner.buildIsInBackup())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"QueryRunner IsInBackup: query failed\")\n\t}\n\n\tdefer rows.Close()\n\tresults := make(map[int]bool)\n\tfor rows.Next() {\n\t\tvar contentID int\n\t\tvar isInBackup bool\n\t\tif err := rows.Scan(&isInBackup, &contentID); err != nil {\n\t\t\ttracelog.WarningLogger.Printf(\"QueryRunner IsInBackup: %v\\n\", err.Error())\n\t\t}\n\t\tresults[contentID] = isInBackup\n\t}\n\n\tif rows.Err() != nil {\n\t\treturn nil, rows.Err()\n\t}\n\n\treturn results, nil\n}", "func (b *Bar) InProgress() bool {\n\treturn !isClosed(b.done)\n}", "func (c *ClusterStateImpl) instanceUpdateInProgress(asgName, instanceId string) bool {\n\treturn c.getInstanceState(asgName, instanceId) == updateInProgress\n}", "func (ti TaskInstance) IsScheduled() bool {\n\tvar disabledCount int\n\n\tfor _, status := range ti.Statuses {\n\t\tif status == statuses.TaskInstanceDisabled {\n\t\t\tdisabledCount++\n\t\t\tcontinue\n\t\t}\n\n\t\tif status == statuses.TaskInstanceScheduled {\n\t\t\t// FIX: RMM-36676\n\t\t\treturn true\n\t\t}\n\t\tbreak\n\t}\n\treturn len(ti.Statuses) == disabledCount\n}", "func (o *RequestsDeploymentScheduledBackup) HasBackupTargetId() bool {\n\tif o != nil && o.BackupTargetId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsOnlyStatusChange(oldbkp, newbkp *apis.CStorBackup) bool {\n\tif reflect.DeepEqual(oldbkp.Spec, newbkp.Spec) &&\n\t\t!reflect.DeepEqual(oldbkp.Status, newbkp.Status) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (r *Reconciler) reconcileScheduledBackups(\n\tctx context.Context, cluster *v1beta1.PostgresCluster, sa *corev1.ServiceAccount,\n\tcronjobs []*batchv1.CronJob,\n) bool {\n\tlog := logging.FromContext(ctx).WithValues(\"reconcileResource\", \"repoCronJob\")\n\t// requeue if there is an error during creation\n\tvar requeue bool\n\n\tfor _, repo := range cluster.Spec.Backups.PGBackRest.Repos {\n\t\t// if the repo level backup schedules block has not been created,\n\t\t// there are no schedules defined\n\t\tif repo.BackupSchedules != nil {\n\t\t\t// next if the repo level schedule is not nil, create the CronJob.\n\t\t\tif repo.BackupSchedules.Full != nil {\n\t\t\t\tif err := r.reconcilePGBackRestCronJob(ctx, cluster, repo,\n\t\t\t\t\tfull, repo.BackupSchedules.Full, sa, cronjobs); err != nil {\n\t\t\t\t\tlog.Error(err, \"unable to reconcile Full backup for \"+repo.Name)\n\t\t\t\t\trequeue = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif repo.BackupSchedules.Differential != nil {\n\t\t\t\tif err := r.reconcilePGBackRestCronJob(ctx, cluster, repo,\n\t\t\t\t\tdifferential, repo.BackupSchedules.Differential, sa, cronjobs); err != nil {\n\t\t\t\t\tlog.Error(err, \"unable to reconcile Differential backup for \"+repo.Name)\n\t\t\t\t\trequeue = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif repo.BackupSchedules.Incremental != nil {\n\t\t\t\tif err := r.reconcilePGBackRestCronJob(ctx, cluster, repo,\n\t\t\t\t\tincremental, repo.BackupSchedules.Incremental, sa, cronjobs); err != nil {\n\t\t\t\t\tlog.Error(err, \"unable to reconcile Incremental backup for \"+repo.Name)\n\t\t\t\t\trequeue = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn requeue\n}", "func TestBackupBefore(t *testing.T) {\n\tb := backup{t: time.Unix(2, 0)}\n\tif b.before(time.Unix(1, 0)) {\n\t\tt.Errorf(\"b.before(time.Unix(1, 0)) returns false\")\n\t}\n\n\tif b.before(time.Unix(2, 0)) {\n\t\tt.Errorf(\"b.before(time.Unix(2, 0)) returns false\")\n\t}\n}", "func (t *Task) ensureInitialBackup() (*velero.Backup, error) {\n\tbackup, err := t.getInitialBackup()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tif backup != nil {\n\t\treturn backup, nil\n\t}\n\n\tclient, err := t.getSourceClient()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tnewBackup, err := t.buildBackup(client, \"initial\")\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tuserIncludedResources, _, err := t.PlanResources.MigPlan.GetIncludedResourcesList(client)\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\n\tnewBackup.Labels[migapi.InitialBackupLabel] = t.UID()\n\tnewBackup.Labels[migapi.MigMigrationDebugLabel] = t.Owner.Name\n\tnewBackup.Labels[migapi.MigPlanDebugLabel] = t.Owner.Spec.MigPlanRef.Name\n\tnewBackup.Labels[migapi.MigMigrationLabel] = string(t.Owner.UID)\n\tnewBackup.Labels[migapi.MigPlanLabel] = string(t.PlanResources.MigPlan.UID)\n\tnewBackup.Spec.IncludedResources = toStringSlice(settings.IncludedInitialResources.Difference(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.IncludedResources = append(newBackup.Spec.IncludedResources, userIncludedResources...)\n\tnewBackup.Spec.ExcludedResources = toStringSlice(settings.ExcludedInitialResources.Union(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.LabelSelector = t.PlanResources.MigPlan.Spec.LabelSelector\n\tdelete(newBackup.Annotations, migapi.QuiesceAnnotation)\n\n\tif Settings.DisImgCopy {\n\t\tif newBackup.Annotations == nil {\n\t\t\tnewBackup.Annotations = map[string]string{}\n\t\t}\n\t\tnewBackup.Annotations[migapi.DisableImageCopy] = strconv.FormatBool(Settings.DisImgCopy)\n\t}\n\n\terr = client.Create(context.TODO(), newBackup)\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\treturn newBackup, nil\n}", "func (t *Task) ensureStageBackup() (*velero.Backup, error) {\n\tbackup, err := t.getStageBackup()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tif backup != nil {\n\t\treturn backup, nil\n\t}\n\n\tclient, err := t.getSourceClient()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tt.Log.Info(\"Building Stage Velero Backup resource definition\")\n\tnewBackup, err := t.buildBackup(client, \"stage\")\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tlabelSelector := metav1.LabelSelector{\n\t\tMatchLabels: map[string]string{\n\t\t\tmigapi.IncludedInStageBackupLabel: t.UID(),\n\t\t},\n\t}\n\tnewBackup.Labels[migapi.StageBackupLabel] = t.UID()\n\tnewBackup.Labels[migapi.MigMigrationDebugLabel] = t.Owner.Name\n\tnewBackup.Labels[migapi.MigPlanDebugLabel] = t.Owner.Spec.MigPlanRef.Name\n\tnewBackup.Labels[migapi.MigMigrationLabel] = string(t.Owner.UID)\n\tnewBackup.Labels[migapi.MigPlanLabel] = string(t.PlanResources.MigPlan.UID)\n\tvar includedResources mapset.Set\n\n\tif (t.indirectImageMigration() || Settings.DisImgCopy) && !t.migrateState() {\n\t\tincludedResources = settings.IncludedStageResources\n\t} else {\n\t\tincludedResources = settings.IncludedStageResources.Difference(mapset.NewSetFromSlice([]interface{}{settings.ISResource}))\n\t}\n\tnewBackup.Spec.IncludedResources = toStringSlice(includedResources.Difference(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.ExcludedResources = toStringSlice(settings.ExcludedStageResources.Union(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.LabelSelector = &labelSelector\n\tif Settings.DisImgCopy {\n\t\tif newBackup.Annotations == nil {\n\t\t\tnewBackup.Annotations = map[string]string{}\n\t\t}\n\t\tnewBackup.Annotations[migapi.DisableImageCopy] = strconv.FormatBool(Settings.DisImgCopy)\n\t}\n\tt.Log.Info(\"Creating Stage Velero Backup on source cluster.\",\n\t\t\"backup\", path.Join(newBackup.Namespace, newBackup.Name))\n\terr = client.Create(context.TODO(), newBackup)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newBackup, nil\n}", "func (o *NetworkElementSummaryAllOf) HasConfModTsBackup() bool {\n\tif o != nil && o.ConfModTsBackup != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (es *EventuallyFileOnlySnapshot) hasTransitioned() bool {\n\tes.mu.Lock()\n\tdefer es.mu.Unlock()\n\treturn es.mu.vers != nil\n}", "func (r *BackupReconciler) instReady(ctx context.Context, ns, instName string, inst *v1alpha1.Instance) error {\n\tif err := r.Get(ctx, types.NamespacedName{Namespace: ns, Name: instName}, inst); err != nil {\n\t\tr.Log.Error(err, \"error finding instance for backup validation\")\n\t\treturn fmt.Errorf(\"error finding instance - %v\", err)\n\t}\n\tif !k8s.ConditionStatusEquals(k8s.FindCondition(inst.Status.Conditions, k8s.Ready), v1.ConditionTrue) {\n\t\tr.Log.Error(fmt.Errorf(\"instance not in ready state\"), \"Instance not in ready state for backup\", \"inst.Status.Conditions\", inst.Status.Conditions)\n\t\treturn errors.New(\"instance is not in a ready state\")\n\t}\n\treturn nil\n}", "func checkJobStatus(jobQueue *jobqueue.Client, t *jobqueue.Task) (bool, error) {\n\tif t.Job.Status != jobqueue.JobStatusNew {\n\t\treturn true, fmt.Errorf(\"bad job status: %s\", t.Job.Status)\n\t}\n\tif t.Job.Action != \"select-hypervisor\" {\n\t\treturn true, fmt.Errorf(\"bad action: %s\", t.Job.Action)\n\t}\n\treturn false, nil\n}", "func (h *Handler) reconcileBackupStatus(vmBackup *harvesterv1.VirtualMachineBackup) error {\n\tvar deletedSnapshots, skippedSnapshots []string\n\n\tvar backupReady = isBackupReady(vmBackup)\n\tvar backupError = isBackupError(vmBackup)\n\n\t// create CSI volume snapshots\n\tfor i, volumeBackup := range vmBackup.Status.VolumeBackups {\n\t\tif volumeBackup.Name == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar vsName = *volumeBackup.Name\n\n\t\tvolumeSnapshot, err := h.getVolumeSnapshot(vmBackup.Namespace, vsName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif volumeSnapshot == nil {\n\t\t\t// check if snapshot was deleted\n\t\t\tif backupReady {\n\t\t\t\tlogrus.Warningf(\"VolumeSnapshot %s no longer exists\", vsName)\n\t\t\t\th.recorder.Eventf(\n\t\t\t\t\tvmBackup,\n\t\t\t\t\tcorev1.EventTypeWarning,\n\t\t\t\t\tvolumeSnapshotMissingEvent,\n\t\t\t\t\t\"VolumeSnapshot %s no longer exists\",\n\t\t\t\t\tvsName,\n\t\t\t\t)\n\t\t\t\tdeletedSnapshots = append(deletedSnapshots, vsName)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif backupError {\n\t\t\t\tlogrus.Infof(\"Not creating snapshot %s because content in error state\", vsName)\n\t\t\t\tskippedSnapshots = append(skippedSnapshots, vsName)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvolumeSnapshot, err = h.createVolumeSnapshot(vmBackup, volumeBackup)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif volumeSnapshot.Status != nil {\n\t\t\tvmBackup.Status.VolumeBackups[i].ReadyToUse = volumeSnapshot.Status.ReadyToUse\n\t\t\tvmBackup.Status.VolumeBackups[i].CreationTime = volumeSnapshot.Status.CreationTime\n\t\t\tvmBackup.Status.VolumeBackups[i].Error = translateError(volumeSnapshot.Status.Error)\n\t\t}\n\n\t}\n\n\tvar ready = true\n\tvar errorMessage = \"\"\n\tbackupCpy := vmBackup.DeepCopy()\n\tif len(deletedSnapshots) > 0 {\n\t\tready = false\n\t\terrorMessage = fmt.Sprintf(\"volumeSnapshots (%s) missing\", strings.Join(deletedSnapshots, \",\"))\n\t} else if len(skippedSnapshots) > 0 {\n\t\tready = false\n\t\terrorMessage = fmt.Sprintf(\"volumeSnapshots (%s) skipped because in error state\", strings.Join(skippedSnapshots, \",\"))\n\t} else {\n\t\tfor _, vb := range vmBackup.Status.VolumeBackups {\n\t\t\tif vb.ReadyToUse == nil || !*vb.ReadyToUse {\n\t\t\t\tready = false\n\t\t\t}\n\n\t\t\tif vb.Error != nil {\n\t\t\t\terrorMessage = \"VolumeSnapshot in error state\"\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif ready && (backupCpy.Status.ReadyToUse == nil || !*backupCpy.Status.ReadyToUse) {\n\t\tbackupCpy.Status.CreationTime = currentTime()\n\t\tupdateBackupCondition(backupCpy, newProgressingCondition(corev1.ConditionFalse, \"Operation complete\"))\n\t\tupdateBackupCondition(backupCpy, newReadyCondition(corev1.ConditionTrue, \"Operation complete\"))\n\t}\n\n\t// check if the status need to update the error status\n\tif errorMessage != \"\" && (backupCpy.Status.Error == nil || backupCpy.Status.Error.Message == nil || *backupCpy.Status.Error.Message != errorMessage) {\n\t\tbackupCpy.Status.Error = &harvesterv1.Error{\n\t\t\tTime: currentTime(),\n\t\t\tMessage: &errorMessage,\n\t\t}\n\t}\n\n\tbackupCpy.Status.ReadyToUse = &ready\n\n\tif !reflect.DeepEqual(vmBackup.Status, backupCpy.Status) {\n\t\tif _, err := h.vmBackups.Update(backupCpy); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func isScheduleStillInUse(s models.Schedule) (bool, error) {\n\tvar scheduleEvents []models.ScheduleEvent\n\tif err := dbClient.GetScheduleEventsByScheduleName(&scheduleEvents, s.Name); err != nil {\n\t\treturn false, err\n\t}\n\tif len(scheduleEvents) > 0 {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (solver *MapSolver)HasScheduled(arc *data.Arc) bool{\n\tfor _, cap := range arc.Capacity {\n\t\tif cap > 0 { // if dstNode is not machineNode, we can assume that if capacity > 0, then this task still not scheduled\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func HasPendingRestoreRequest(statusRecords []*ProcessStatus) (bool) {\n\tfor _, record := range statusRecords {\n\t\tif record.Action == ActionRestore &&\n\t\t\t(record.Status == StatusStarted || record.Status == StatusPending) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func isNewSnapshotRequest(id string, status *types.AppInstanceStatus) bool {\n\t// Check if the snapshot is already present in the list of the snapshots to be taken.\n\tfor _, snapRequest := range status.SnapStatus.RequestedSnapshots {\n\t\tif snapRequest.Snapshot.SnapshotID == id {\n\t\t\treturn false\n\t\t}\n\t}\n\t// Check if the snapshot is already present in the list of the available snapshots.\n\tfor _, snapAvailable := range status.SnapStatus.AvailableSnapshots {\n\t\tif snapAvailable.Snapshot.SnapshotID == id {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func backup(\n\tctx context.Context,\n\tdb *client.DB,\n\tgossip *gossip.Gossip,\n\tsettings *cluster.Settings,\n\texportStore storageccl.ExportStorage,\n\tjob *jobs.Job,\n\tbackupDesc *BackupDescriptor,\n\tcheckpointDesc *BackupDescriptor,\n\tresultsCh chan<- tree.Datums,\n) (roachpb.BulkOpSummary, error) {\n\t// TODO(dan): Figure out how permissions should work. #6713 is tracking this\n\t// for grpc.\n\n\tmu := struct {\n\t\tsyncutil.Mutex\n\t\tfiles []BackupDescriptor_File\n\t\texported roachpb.BulkOpSummary\n\t\tlastCheckpoint time.Time\n\t}{}\n\n\tvar checkpointMu syncutil.Mutex\n\n\tvar ranges []roachpb.RangeDescriptor\n\tif err := db.Txn(ctx, func(ctx context.Context, txn *client.Txn) error {\n\t\tvar err error\n\t\t// TODO(benesch): limit the range descriptors we fetch to the ranges that\n\t\t// are actually relevant in the backup to speed up small backups on large\n\t\t// clusters.\n\t\tranges, err = allRangeDescriptors(ctx, txn)\n\t\treturn err\n\t}); err != nil {\n\t\treturn mu.exported, errors.Wrap(err, \"fetching range descriptors\")\n\t}\n\n\tvar completedSpans, completedIntroducedSpans []roachpb.Span\n\tif checkpointDesc != nil {\n\t\t// TODO(benesch): verify these files, rather than accepting them as truth\n\t\t// blindly.\n\t\t// No concurrency yet, so these assignments are safe.\n\t\tmu.files = checkpointDesc.Files\n\t\tmu.exported = checkpointDesc.EntryCounts\n\t\tfor _, file := range checkpointDesc.Files {\n\t\t\tif file.StartTime.IsEmpty() && !file.EndTime.IsEmpty() {\n\t\t\t\tcompletedIntroducedSpans = append(completedIntroducedSpans, file.Span)\n\t\t\t} else {\n\t\t\t\tcompletedSpans = append(completedSpans, file.Span)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Subtract out any completed spans and split the remaining spans into\n\t// range-sized pieces so that we can use the number of completed requests as a\n\t// rough measure of progress.\n\tspans := splitAndFilterSpans(backupDesc.Spans, completedSpans, ranges)\n\tintroducedSpans := splitAndFilterSpans(backupDesc.IntroducedSpans, completedIntroducedSpans, ranges)\n\n\tallSpans := make([]spanAndTime, 0, len(spans)+len(introducedSpans))\n\tfor _, s := range introducedSpans {\n\t\tallSpans = append(allSpans, spanAndTime{span: s, start: hlc.Timestamp{}, end: backupDesc.StartTime})\n\t}\n\tfor _, s := range spans {\n\t\tallSpans = append(allSpans, spanAndTime{span: s, start: backupDesc.StartTime, end: backupDesc.EndTime})\n\t}\n\n\tprogressLogger := jobs.ProgressLogger{\n\t\tJob: job,\n\t\tTotalChunks: len(spans),\n\t\tStartFraction: job.Payload().FractionCompleted,\n\t}\n\n\t// We're already limiting these on the server-side, but sending all the\n\t// Export requests at once would fill up distsender/grpc/something and cause\n\t// all sorts of badness (node liveness timeouts leading to mass leaseholder\n\t// transfers, poor performance on SQL workloads, etc) as well as log spam\n\t// about slow distsender requests. Rate limit them here, too.\n\t//\n\t// Each node limits the number of running Export & Import requests it serves\n\t// to avoid overloading the network, so multiply that by the number of nodes\n\t// in the cluster and use that as the number of outstanding Export requests\n\t// for the rate limiting. This attempts to strike a balance between\n\t// simplicity, not getting slow distsender log spam, and keeping the server\n\t// side limiter full.\n\t//\n\t// TODO(dan): Make this limiting per node.\n\t//\n\t// TODO(dan): See if there's some better solution than rate-limiting #14798.\n\tmaxConcurrentExports := clusterNodeCount(gossip) * int(storage.ExportRequestsLimit.Get(&settings.SV))\n\texportsSem := make(chan struct{}, maxConcurrentExports)\n\n\tg, gCtx := errgroup.WithContext(ctx)\n\n\trequestFinishedCh := make(chan struct{}, len(spans)) // enough buffer to never block\n\n\t// Only start the progress logger if there are spans, otherwise this will\n\t// block forever. This is needed for TestBackupRestoreResume which doesn't\n\t// have any spans. Users should never hit this.\n\tif len(spans) > 0 {\n\t\tg.Go(func() error {\n\t\t\treturn progressLogger.Loop(gCtx, requestFinishedCh)\n\t\t})\n\t}\n\n\tfor i := range allSpans {\n\t\tselect {\n\t\tcase exportsSem <- struct{}{}:\n\t\tcase <-ctx.Done():\n\t\t\treturn mu.exported, ctx.Err()\n\t\t}\n\n\t\tspan := allSpans[i]\n\t\tg.Go(func() error {\n\t\t\tdefer func() { <-exportsSem }()\n\t\t\theader := roachpb.Header{Timestamp: span.end}\n\t\t\treq := &roachpb.ExportRequest{\n\t\t\t\tSpan: span.span,\n\t\t\t\tStorage: exportStore.Conf(),\n\t\t\t\tStartTime: span.start,\n\t\t\t\tMVCCFilter: roachpb.MVCCFilter(backupDesc.MVCCFilter),\n\t\t\t}\n\t\t\trawRes, pErr := client.SendWrappedWith(gCtx, db.GetSender(), header, req)\n\t\t\tif pErr != nil {\n\t\t\t\treturn pErr.GoError()\n\t\t\t}\n\t\t\tres := rawRes.(*roachpb.ExportResponse)\n\n\t\t\tmu.Lock()\n\t\t\tif backupDesc.RevisionStartTime.Less(res.StartTime) {\n\t\t\t\tbackupDesc.RevisionStartTime = res.StartTime\n\t\t\t}\n\t\t\tfor _, file := range res.Files {\n\t\t\t\tf := BackupDescriptor_File{\n\t\t\t\t\tSpan: file.Span,\n\t\t\t\t\tPath: file.Path,\n\t\t\t\t\tSha512: file.Sha512,\n\t\t\t\t\tEntryCounts: file.Exported,\n\t\t\t\t}\n\t\t\t\tif span.start != backupDesc.StartTime {\n\t\t\t\t\tf.StartTime = span.start\n\t\t\t\t\tf.EndTime = span.end\n\t\t\t\t}\n\t\t\t\tmu.files = append(mu.files, f)\n\t\t\t\tmu.exported.Add(file.Exported)\n\t\t\t}\n\t\t\tvar checkpointFiles BackupFileDescriptors\n\t\t\tif timeutil.Since(mu.lastCheckpoint) > BackupCheckpointInterval {\n\t\t\t\t// We optimistically assume the checkpoint will succeed to prevent\n\t\t\t\t// multiple threads from attempting to checkpoint.\n\t\t\t\tmu.lastCheckpoint = timeutil.Now()\n\t\t\t\tcheckpointFiles = append(checkpointFiles, mu.files...)\n\t\t\t}\n\t\t\tmu.Unlock()\n\n\t\t\trequestFinishedCh <- struct{}{}\n\n\t\t\tif checkpointFiles != nil {\n\t\t\t\tcheckpointMu.Lock()\n\t\t\t\tbackupDesc.Files = checkpointFiles\n\t\t\t\terr := writeBackupDescriptor(\n\t\t\t\t\tctx, exportStore, BackupDescriptorCheckpointName, backupDesc,\n\t\t\t\t)\n\t\t\t\tcheckpointMu.Unlock()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(ctx, \"unable to checkpoint backup descriptor: %+v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}\n\n\tif err := g.Wait(); err != nil {\n\t\treturn mu.exported, errors.Wrapf(err, \"exporting %d ranges\", len(spans))\n\t}\n\n\t// No more concurrency, so no need to acquire locks below.\n\n\tbackupDesc.Files = mu.files\n\tbackupDesc.EntryCounts = mu.exported\n\n\tif err := writeBackupDescriptor(ctx, exportStore, BackupDescriptorName, backupDesc); err != nil {\n\t\treturn mu.exported, err\n\t}\n\n\treturn mu.exported, nil\n}", "func (b *Backup) Status() BackupStatus {\n\treturn BackupStatus{int(C.sqlite3_backup_remaining(b.sb)), int(C.sqlite3_backup_pagecount(b.sb))}\n}", "func isWorkerUpdated(worker *workerv1.Worker, currentDeployment *appsv1.Deployment) bool {\n\tdeployment := generateDeploymentFromWorker(worker)\n\tres := !isSameDeploymentSpecs(deployment, currentDeployment)\n\treturn res\n}", "func Test_getLastSuccessBySchedule(t *testing.T) {\n\tbuildBackup := func(phase velerov1api.BackupPhase, completion time.Time, schedule string) velerov1api.Backup {\n\t\tb := builder.ForBackup(\"\", \"\").\n\t\t\tObjectMeta(builder.WithLabels(velerov1api.ScheduleNameLabel, schedule)).\n\t\t\tPhase(phase)\n\n\t\tif !completion.IsZero() {\n\t\t\tb.CompletionTimestamp(completion)\n\t\t}\n\n\t\treturn *b.Result()\n\t}\n\n\t// create a static \"base time\" that can be used to easily construct completion timestamps\n\t// by using the .Add(...) method.\n\tbaseTime, err := time.Parse(time.RFC1123, time.RFC1123)\n\trequire.NoError(t, err)\n\n\ttests := []struct {\n\t\tname string\n\t\tbackups []velerov1api.Backup\n\t\twant map[string]time.Time\n\t}{\n\t\t{\n\t\t\tname: \"when backups is nil, an empty map is returned\",\n\t\t\tbackups: nil,\n\t\t\twant: map[string]time.Time{},\n\t\t},\n\t\t{\n\t\t\tname: \"when backups is empty, an empty map is returned\",\n\t\t\tbackups: []velerov1api.Backup{},\n\t\t\twant: map[string]time.Time{},\n\t\t},\n\t\t{\n\t\t\tname: \"when multiple completed backups for a schedule exist, the latest one is returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime, \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(time.Second), \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"schedule-1\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{\n\t\t\t\t\"schedule-1\": baseTime.Add(time.Second),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"when the most recent backup for a schedule is Failed, the timestamp of the most recent Completed one is returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime, \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Second), \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"schedule-1\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{\n\t\t\t\t\"schedule-1\": baseTime,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"when there are no Completed backups for a schedule, it's not returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseInProgress, baseTime, \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Second), \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhasePartiallyFailed, baseTime.Add(-time.Second), \"schedule-1\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{},\n\t\t},\n\t\t{\n\t\t\tname: \"when backups exist without a schedule, the most recent Completed one is returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime, \"\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Second), \"\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{\n\t\t\t\t\"\": baseTime,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"when backups exist for multiple schedules, the most recent Completed timestamp for each schedule is returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\t// ad-hoc backups (no schedule)\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(30*time.Minute), \"\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Hour), \"\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"\"),\n\n\t\t\t\t// schedule-1\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime, \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Second), \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"schedule-1\"),\n\n\t\t\t\t// schedule-2\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(24*time.Hour), \"schedule-2\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(48*time.Hour), \"schedule-2\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(72*time.Hour), \"schedule-2\"),\n\n\t\t\t\t// schedule-3\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseNew, baseTime, \"schedule-3\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseInProgress, baseTime.Add(time.Minute), \"schedule-3\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhasePartiallyFailed, baseTime.Add(2*time.Minute), \"schedule-3\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{\n\t\t\t\t\"\": baseTime.Add(30 * time.Minute),\n\t\t\t\t\"schedule-1\": baseTime,\n\t\t\t\t\"schedule-2\": baseTime.Add(72 * time.Hour),\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tassert.Equal(t, tc.want, getLastSuccessBySchedule(tc.backups))\n\t\t})\n\t}\n}", "func checkNotActive() error {\n\toperationDetails := activeOperation\n\tif operationDetails != nil {\n\t\tselect {\n\t\tcase <-operationDetails.exportDone:\n\t\t\t// nil-out any stale operation\n\t\t\tactiveOperation = nil\n\t\tdefault:\n\t\t\tif operationDetails.isRestore {\n\t\t\t\treturn fmt.Errorf(\"restore operation already in progress for height %d\", operationDetails.blockHeight)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"export operation already in progress for height %d\", operationDetails.blockHeight)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Controller) validateBackupAnnotations(key string, volumeMissing prometheus.GaugeVec, excludeAnnotation string, backupAnnotation string) error {\n\n\tobj, exists, err := c.indexer.GetByKey(key)\n\tif err != nil {\n\t\tklog.Errorf(\"fetching object with key %s from store failed with %v\", key, err)\n\t\treturn err\n\t}\n\tif !exists {\n\t\tklog.Infof(\"pod %s does not exist anymore\", key)\n\t\tif obj, exists, err = c.deletedIndexer.GetByKey(key); err == nil && exists {\n\n\t\t\tpod := obj.(*v1.Pod)\n\t\t\townerInfo := getPodOwnerInfo(pod)\n\t\t\tklog.Infof(\"disabling metric %s\", ownerInfo.name)\n\t\t\tc.disableMetric(ownerInfo)\n\t\t\t_ = c.deletedIndexer.Delete(key)\n\t\t}\n\n\t} else {\n\t\tpod := obj.(*v1.Pod)\n\t\townerInfo := getPodOwnerInfo(pod)\n\n\t\tif _, ok := c.podCache[ownerInfo.name]; !ok {\n\t\t\tc.podCache[ownerInfo.name] = map[VolumeName]bool{}\n\t\t}\n\t\tklog.Infof(\"controlling backup config for %s\", pod.GetName())\n\t\tmissings := c.getMissingBackups(pod)\n\t\tif len(missings) > 0 {\n\t\t\tklog.Infof(\"backup missing enable metric for %s\", ownerInfo.name)\n\t\t\tc.enableMetric(ownerInfo, missings)\n\t\t}\n\t}\n\n\treturn nil\n}", "func IsCatchingUp(b bazooka.Bazooka, db db.DB) (bool, error) {\n\ttotalBatches, err := b.TotalBatches()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\ttotalBatchedStored, err := db.GetBatchCount()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// if total batchse are greater than what we recorded we are still catching up\n\tif totalBatches > uint64(totalBatchedStored) {\n\t\treturn true, err\n\t}\n\n\treturn false, nil\n}", "func (alloc *Alloc) CheckTaskStates(state string) bool {\n\tfor k := range alloc.Tasks {\n\t\ttask := alloc.Tasks[k]\n\t\tif task.State != state {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func checkExistingState() error {\n\n\t// In case any previous volumes are present\n\t// clean up is needed\n\n\tvols, err := client.ListVolumes()\n\tif err != nil {\n\t\trwolog.Error(\"Error while listing volumes \", err)\n\t\treturn err\n\t}\n\n\tpeers, err := client.PeerStatus()\n\tif err != nil {\n\t\trwolog.Error(\"Error while checking gluster Pool list\", err.Error())\n\t\treturn err\n\t}\n\n\tif len(vols) >= 1 || len(peers) >= 1 {\n\t\t// check if the current member has any previous volumes/peers associated with it.\n\t\t// if yes, then check if the member is joining previous cluster,\n\t\t// else remove the volumes and join the cluster\n\t\terr = checkOldStateOfGluster()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func (queryRunner *GpQueryRunner) buildIsInBackup() string {\n\treturn `\nSELECT pg_is_in_backup(), gp_segment_id FROM gp_dist_random('gp_id')\nUNION ALL\nSELECT pg_is_in_backup(), -1;\n`\n}", "func (o *ModelsBackupSchedule) HasSchedule() bool {\n\tif o != nil && o.Schedule != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (nd *Node) MigrationInProgress() (bool, error) {\n\tvalues, err := RequestNodeStats(nd)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// if the migration_progress_send exists and is not `0`, then migration is in progress\n\tif migration, exists := values[\"migrate_progress_send\"]; exists && migration != \"0\" {\n\t\treturn true, nil\n\t}\n\n\t// migration not in progress\n\treturn false, nil\n}", "func (a *actionRebuildOutSyncedShards) checkRebuildShardProgress(ctx context.Context, clientAsync, clientSync driver.Client, shardID, database, jobID, batchID string) (bool, error) {\n\treq, err := a.createShardRebuildRequest(clientAsync, shardID, database, batchID)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tresp, err := clientAsync.Connection().Do(conn.WithAsyncID(ctx, jobID), req)\n\tif err != nil {\n\t\tif _, ok := conn.IsAsyncJobInProgress(err); ok {\n\t\t\treturn true, nil\n\t\t}\n\n\t\t// Add wait grace period\n\t\tif ok := conn.IsAsyncErrorNotFound(err); ok {\n\t\t\tif s := a.action.StartTime; s != nil && !s.Time.IsZero() {\n\t\t\t\tif time.Since(s.Time) < 10*time.Second {\n\t\t\t\t\t// Retry\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false, errors.Wrapf(err, \"check rebuild progress error\")\n\t}\n\n\t// cleanup batch\n\t_ = a.deleteBatch(ctx, clientSync, batchID)\n\n\tif resp.StatusCode() == http.StatusNoContent {\n\t\treturn false, nil\n\t} else {\n\t\treturn false, errors.Wrapf(err, \"rebuild progress failed with status code %d\", resp.StatusCode())\n\t}\n}", "func (t *Task) deleteStaleBackupsOnCluster(cluster *migapi.MigCluster) (int, int, error) {\n\tt.Log.Info(\"Checking for stale Velero Backups on MigCluster\",\n\t\t\"migCluster\", path.Join(cluster.Namespace, cluster.Name))\n\tnDeleted := 0\n\tnInProgressDeleted := 0\n\n\tclusterClient, err := cluster.GetClient(t.Client)\n\tif err != nil {\n\t\treturn 0, 0, liberr.Wrap(err)\n\t}\n\n\tlist := velero.BackupList{}\n\terr = clusterClient.List(\n\t\tcontext.TODO(),\n\t\t&list,\n\t\tk8sclient.InNamespace(migapi.VeleroNamespace))\n\tif err != nil {\n\t\treturn 0, 0, liberr.Wrap(err)\n\t}\n\tfor _, backup := range list.Items {\n\t\t// Skip delete unless phase is \"\", \"New\" or \"InProgress\"\n\t\tif backup.Status.Phase != velero.BackupPhaseNew &&\n\t\t\tbackup.Status.Phase != velero.BackupPhaseInProgress &&\n\t\t\tbackup.Status.Phase != \"\" {\n\t\t\tt.Log.V(4).Info(\"Backup phase is not 'New' or 'InProgress'. Skipping deletion.\",\n\t\t\t\t\"backup\", path.Join(backup.Namespace, backup.Name),\n\t\t\t\t\"backupPhase\", backup.Status.Phase)\n\t\t\tcontinue\n\t\t}\n\t\t// Skip if missing a migmigration correlation label (only delete our own CRs)\n\t\tmigMigrationUID, ok := backup.ObjectMeta.Labels[migapi.MigMigrationLabel]\n\t\tif !ok {\n\t\t\tt.Log.V(4).Info(\"Backup does not have an attached label \"+\n\t\t\t\t\"associating it with a MigMigration. Skipping deletion.\",\n\t\t\t\t\"backup\", path.Join(backup.Namespace, backup.Name),\n\t\t\t\t\"backupPhase\", backup.Status.Phase,\n\t\t\t\t\"associationLabel\", migapi.MigMigrationLabel)\n\t\t\tcontinue\n\t\t}\n\t\t// Skip if correlation label points to an existing, running migration\n\t\tisRunning, err := t.migrationUIDisRunning(migMigrationUID)\n\t\tif err != nil {\n\t\t\treturn nDeleted, nInProgressDeleted, liberr.Wrap(err)\n\t\t}\n\t\tif isRunning {\n\t\t\tt.Log.Info(\"Backup is running. Skipping deletion.\",\n\t\t\t\t\"backup\", path.Join(backup.Namespace, backup.Name),\n\t\t\t\t\"backupPhase\", backup.Status.Phase)\n\t\t\tcontinue\n\t\t}\n\t\t// Submit a request to remove backup assets from storage\n\t\t// Note, this will probably be a no-op. See velero backup_deletion_controller.go\n\t\tdeleteBackupRequest := &velero.DeleteBackupRequest{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tNamespace: migapi.VeleroNamespace,\n\t\t\t\tGenerateName: backup.Name + \"-\",\n\t\t\t},\n\t\t\tSpec: velero.DeleteBackupRequestSpec{\n\t\t\t\tBackupName: backup.Name,\n\t\t\t},\n\t\t}\n\t\tt.Log.Info(\"CREATING Velero DeleteBackupRequest for Backup on MigCluster\",\n\t\t\t\"backup\", path.Join(backup.Namespace, backup.Name),\n\t\t\t\"backupPhase\", backup.Status.Phase,\n\t\t\t\"migCluster\", path.Join(cluster.Namespace, cluster.Name))\n\t\terr = clusterClient.Create(context.TODO(), deleteBackupRequest)\n\t\tif err != nil {\n\t\t\treturn nDeleted, nInProgressDeleted, liberr.Wrap(err)\n\t\t}\n\t\t// Also delete the backup CR directly\n\t\t// This should work since backup is still in-progress.\n\t\tt.Log.Info(\"DELETING stale Velero Backup from MigCluster\",\n\t\t\t\"backup\", path.Join(backup.Namespace, backup.Name),\n\t\t\t\"backupPhase\", backup.Status.Phase,\n\t\t\t\"migCluster\", path.Join(cluster.Namespace, cluster.Name))\n\t\terr = clusterClient.Delete(context.TODO(), &backup)\n\t\tif err != nil && !k8serrors.IsNotFound(err) {\n\t\t\treturn nDeleted, nInProgressDeleted, liberr.Wrap(err)\n\t\t}\n\t\tnDeleted++\n\t\t// Separate count for InProgress, used to determine if restart needed\n\t\tif backup.Status.Phase == velero.BackupPhaseInProgress {\n\t\t\tnInProgressDeleted++\n\t\t}\n\t}\n\n\treturn nDeleted, nInProgressDeleted, err\n}", "func (s *Scheduler) CheckJobsToExecute(now time.Time) {\n\tif rdb.Available() {\n\t\t// TODO: Pensar em um jeito de impedir threads diferentes pegarem a mesma instância de job\n\t\tjobInstances := []JobInstance{}\n\t\tjobInstanceTable := constants.TableCoreJobInstances\n\n\t\terr := db.SelectStruct(jobInstanceTable, &jobInstances, &db.Options{\n\t\t\tConditions: builder.Equal(\"status\", constants.JobStatusCreated),\n\t\t})\n\t\tif err != nil {\n\t\t\t// TODO: Pensar em como tratar esse erro\n\t\t\tfmt.Println(err.Error())\n\t\t\ts.WG.Done()\n\t\t\treturn\n\t\t}\n\n\t\tjobInstanceIDColumn := fmt.Sprintf(\"%s.id\", jobInstanceTable)\n\n\t\tfor _, jobInstance := range jobInstances {\n\t\t\tjobInstance.Status = constants.JobStatusInQueue\n\t\t\tjobInstance.UpdatedAt = time.Now()\n\n\t\t\terr := rdb.LPush(\"queue:jobs\", jobInstance.ID)\n\n\t\t\tif err != nil {\n\t\t\t\tjobInstance.Status = constants.JobStatusCreated\n\t\t\t\tfmt.Printf(\"JOB Instance ID: %s | Error trying to send to queue: %s\\n\", jobInstance.ID, err.Error())\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"JOB Instance ID: %s | Sent to queue successfully\\n\", jobInstance.ID)\n\t\t\t}\n\n\t\t\t// TODO: change to transaction\n\t\t\terr = db.UpdateStruct(jobInstanceTable, &jobInstance, &db.Options{\n\t\t\t\tConditions: builder.Equal(jobInstanceIDColumn, jobInstance.ID),\n\t\t\t}, \"status\", \"updated_at\")\n\t\t\tif err != nil {\n\t\t\t\t// TODO: Pensar em como tratar esse erro\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t}\n\t\t}\n\t}\n\ts.WG.Done()\n}", "func (c *Checkpoint) IsNew() bool {\n\treturn c.State == ActiveState && c.ID == 0 && c.EndTime == nil &&\n\t\tc.UUID == nil && len(c.Resources) == 0 && len(c.Metadata) == 0\n}", "func (r *Reservation) IsSuccessfullyDeployed() bool {\n\tsucceeded := false\n\tif len(r.Results) >= len(r.Workloads(\"\")) {\n\t\tsucceeded = true\n\t\tfor _, result := range r.Results {\n\t\t\tif result.State != generated.ResultStateOK {\n\t\t\t\tsucceeded = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn succeeded\n}", "func (b *gsDBBackup) getBackupMetrics(now time.Time) (time.Time, int64, error) {\n\tlastTime := time.Time{}\n\tvar count int64 = 0\n\tcountAfter := now.Add(-24 * time.Hour)\n\terr := gs.AllFilesInDir(b.gsClient, b.gsBucket, DB_BACKUP_DIR, func(item *storage.ObjectAttrs) {\n\t\tif item.Updated.After(lastTime) {\n\t\t\tlastTime = item.Updated\n\t\t}\n\t\tif item.Updated.After(countAfter) {\n\t\t\tcount++\n\t\t}\n\t})\n\treturn lastTime, count, err\n}", "func (b *gsDBBackup) maybeBackupDB(now time.Time) {\n\tb.maybeBackupDBLiveness.Reset()\n\t// Look for a trigger file written by task-scheduler-db-backup.service\n\t// or a previous automatic backup attempt.\n\tbasename, attemptCount, err := b.findAndParseTriggerFile()\n\tif err != nil {\n\t\tglog.Error(err)\n\t}\n\tif basename == \"\" {\n\t\treturn\n\t}\n\tattemptCount++\n\tif attemptCount == 1 {\n\t\tglog.Infof(\"Beginning automatic DB backup.\")\n\t} else {\n\t\tglog.Infof(\"Retrying automatic DB backup -- attempt %d.\", attemptCount)\n\t}\n\tif err := b.backupDB(now, basename); err != nil {\n\t\tglog.Errorf(\"Automatic DB backup failed: %s\", err)\n\t\tif attemptCount >= RETRY_COUNT {\n\t\t\tglog.Errorf(\"Automatic DB backup failed after %d attempts. Retries exhausted.\", attemptCount)\n\t\t\tif err := b.deleteTriggerFile(basename); err != nil {\n\t\t\t\tglog.Error(err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err := b.writeTriggerFile(basename, attemptCount); err != nil {\n\t\t\t\tglog.Error(err)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tglog.Infof(\"Completed automatic DB backup.\")\n\t\tif err := b.deleteTriggerFile(basename); err != nil {\n\t\t\tglog.Error(err)\n\t\t}\n\t}\n}", "func (r *BackupReconciler) reconcileVerifyExists(ctx context.Context, backup *v1alpha1.Backup) (ctrl.Result, error) {\n\tvar errMsgs []string\n\tif backup.Spec.Type != commonv1alpha1.BackupTypePhysical {\n\t\terrMsgs = append(errMsgs, fmt.Sprintf(\"%v backup does not support VerifyExists mode\", backup.Spec.Type))\n\t}\n\n\tif backup.Spec.GcsPath == \"\" {\n\t\terrMsgs = append(errMsgs, fmt.Sprintf(\".spec.gcsPath must be specified, VerifyExists mode only support GCS based physical backup\"))\n\t}\n\n\tif len(errMsgs) > 0 {\n\t\tbackup.Status.Phase = commonv1alpha1.BackupFailed\n\t\tmsg := strings.Join(errMsgs, \"; \")\n\t\tr.Recorder.Event(backup, corev1.EventTypeWarning, k8s.NotSupported, msg)\n\t\tbackup.Status.Conditions = k8s.Upsert(backup.Status.Conditions, k8s.Ready, v1.ConditionFalse, k8s.NotSupported, msg)\n\t\treturn ctrl.Result{}, r.Status().Update(ctx, backup)\n\t}\n\n\t// controller can run in different namespaces, hence different k8s service account.\n\t// it is better to verify physical backup in data plane.\n\t// In the future, we may consider deploying an independent pod to help verify a backup,\n\t// so that verification does not depend on the instance pod.\n\tinst := &v1alpha1.Instance{}\n\t// ensure data plane is ready\n\tif err := r.instReady(ctx, backup.Namespace, backup.Spec.Instance, inst); err != nil {\n\t\tr.Log.Error(err, \"instance not ready\")\n\t\treturn ctrl.Result{RequeueAfter: time.Second}, nil\n\t}\n\tr.Log.Info(\"Verifying the existence of a backup\")\n\n\tcaClient, closeConn, err := r.ClientFactory.New(ctx, r, backup.Namespace, inst.Name)\n\tif err != nil {\n\t\treturn ctrl.Result{}, fmt.Errorf(\"failed to create config agent client: %w\", err)\n\t}\n\tdefer closeConn()\n\tresp, err := caClient.VerifyPhysicalBackup(ctx, &capb.VerifyPhysicalBackupRequest{\n\t\tGcsPath: backup.Spec.GcsPath,\n\t})\n\tif err != nil {\n\t\tr.Log.Error(err, \"failed to verify a physical backup\")\n\t\t// retry\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t}\n\tif len(resp.ErrMsgs) == 0 {\n\t\tbackup.Status.Phase = commonv1alpha1.BackupSucceeded\n\t\tmsg := \"verified the existence of a physical backup\"\n\t\tr.Recorder.Event(backup, corev1.EventTypeNormal, \"BackupVerified\", msg)\n\t\tbackup.Status.Conditions = k8s.Upsert(backup.Status.Conditions, k8s.Ready, v1.ConditionTrue, k8s.BackupReady, msg)\n\t} else {\n\t\tbackup.Status.Phase = commonv1alpha1.BackupFailed\n\t\tmsg := fmt.Sprintf(\"Failed to verify the existence of a physical backup: %s\", strings.Join(resp.GetErrMsgs(), \"; \"))\n\t\tr.Recorder.Event(backup, corev1.EventTypeWarning, \"BackupVerifyFailed\", msg)\n\t\tbackup.Status.Conditions = k8s.Upsert(backup.Status.Conditions, k8s.Ready, v1.ConditionFalse, k8s.BackupFailed, msg)\n\t}\n\treturn ctrl.Result{RequeueAfter: verifyExistsInterval}, r.Status().Update(ctx, backup)\n}", "func isDuplicateStateUpdate(\n\ttaskInfo *pb_task.TaskInfo,\n\tupdateEvent *statusupdate.Event,\n) bool {\n\tif updateEvent.State() != taskInfo.GetRuntime().GetState() {\n\t\treturn false\n\t}\n\n\tmesosTaskStatus := updateEvent.MesosTaskStatus()\n\tpodEvent := updateEvent.PodEvent()\n\n\tif updateEvent.State() != pb_task.TaskState_RUNNING {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"db_task_runtime\": taskInfo.GetRuntime(),\n\t\t\t\"task_status_event\": mesosTaskStatus,\n\t\t\t\"pod_event\": podEvent,\n\t\t}).Debug(\"skip same status update if state is not RUNNING\")\n\t\treturn true\n\t}\n\n\tif taskInfo.GetConfig().GetHealthCheck() == nil ||\n\t\t!taskInfo.GetConfig().GetHealthCheck().GetEnabled() {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"db_task_runtime\": taskInfo.GetRuntime(),\n\t\t\t\"task_status_event\": mesosTaskStatus,\n\t\t\t\"pod_event\": podEvent,\n\t\t}).Debug(\"skip same status update if health check is not configured or \" +\n\t\t\t\"disabled\")\n\t\treturn true\n\t}\n\n\tnewStateReason := updateEvent.Reason()\n\t// TODO p2k: not sure which kubelet reason matches this.\n\t// Should we skip some status updates from kubelets?\n\tif newStateReason != mesos.TaskStatus_REASON_TASK_HEALTH_CHECK_STATUS_UPDATED.String() {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"db_task_runtime\": taskInfo.GetRuntime(),\n\t\t\t\"task_status_event\": mesosTaskStatus,\n\t\t\t\"pod_event\": podEvent,\n\t\t}).Debug(\"skip same status update if status update reason is not from health check\")\n\t\treturn true\n\t}\n\n\t// Current behavior will log consecutive negative health check results\n\t// ToDo (varung): Evaluate if consecutive negative results should be logged or not\n\tisPreviousStateHealthy := taskInfo.GetRuntime().GetHealthy() == pb_task.HealthState_HEALTHY\n\tif !isPreviousStateHealthy {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"db_task_runtime\": taskInfo.GetRuntime(),\n\t\t\t\"task_status_event\": mesosTaskStatus,\n\t\t\t\"pod_event\": podEvent,\n\t\t}).Debug(\"log each negative health check result\")\n\t\treturn false\n\t}\n\n\tif updateEvent.Healthy() == isPreviousStateHealthy {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"db_task_runtime\": taskInfo.GetRuntime(),\n\t\t\t\"task_status_event\": mesosTaskStatus,\n\t\t\t\"pod_event\": podEvent,\n\t\t}).Debug(\"skip same status update if health check result is positive consecutively\")\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (b *Backtest) IsRunning() (ret bool) {\n\treturn b.running\n}", "func isStepRunning(index int, stageSteps []v1.CoreActivityStep) bool {\n\tif len(stageSteps) > 0 {\n\t\tpreviousStep := stageSteps[index-1]\n\t\treturn previousStep.CompletedTimestamp != nil\n\t}\n\treturn true\n}", "func CheckFsCreationInProgress(device model.Device) (inProgress bool, err error) {\n\treturn linux.CheckFsCreationInProgress(device)\n}", "func (sp SnapshotPolicy) IsAllNew() bool { return sp == SnapshotPolicyAllNew || sp == \"\" }", "func (o *UcsdBackupInfoAllOf) HasBackupSize() bool {\n\tif o != nil && o.BackupSize != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func notRunning(statuses []v1.ContainerStatus) bool {\n\tfor _, status := range statuses {\n\t\tif status.State.Terminated == nil && status.State.Waiting == nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func statefulSetProgressing(ss *appsv1.StatefulSet) bool {\n\tstatus := ss.Status\n\n\t// Copy-pasted from status_manager: Determine if a DaemonSet is progressing\n\tprogressing := (status.ReadyReplicas < status.Replicas ||\n\t\tstatus.AvailableReplicas == 0 ||\n\t\tss.Generation > status.ObservedGeneration)\n\n\ts := \"progressing\"\n\tif !progressing {\n\t\ts = \"complete\"\n\t}\n\tklog.V(2).Infof(\"statefulset %s/%s rollout %s; %d/%d scheduled; %d available; generation %d -> %d\",\n\t\tss.Namespace, ss.Name, s, status.ReadyReplicas, status.Replicas,\n\t\tstatus.AvailableReplicas, ss.Generation, status.ObservedGeneration)\n\n\tif !progressing {\n\t\tklog.V(2).Infof(\"statefulset %s/%s rollout complete\", ss.Namespace, ss.Name)\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (tp *Tableprov) checkForChanges(file string) (usesBackup, bool, error) {\n\tf, err := os.Stat(file)\n\t_, bErr := os.Stat(bak(file))\n\ttf, tErr := os.Stat(tmp(file))\n\n\t// Does the file even exist?\n\tif err != nil { // No\n\t\t// Check for a backup file\n\t\tif bErr != nil {\n\t\t\treturn false, false, err\n\t\t}\n\t\treturn true, false, nil\n\t}\n\n\t// Does a tmpfile exist?\n\tif tErr == nil { // Yes, we probably crashed while reading this file.\n\t\t// Has a new file arrived?\n\t\tif f.ModTime().After(tf.ModTime()) {\n\t\t\t// Yes\n\t\t\treturn false, true, nil\n\t\t}\n\t\t// No, check for a backup file\n\t\tif bErr != nil {\n\t\t\treturn false, false, bErr\n\t\t}\n\t\treturn true, false, nil\n\t}\n\n\t// Does the backup file exist?\n\tif bErr != nil { // No\n\t\treturn false, true, nil\n\t}\n\n\t// Check if the table file has been modified\n\tif f.ModTime() == tp.Tables[file].timestamp {\n\t\t// No, use the backup file\n\t\treturn true, false, nil\n\t}\n\treturn false, true, nil\n}", "func (o *ModelsBackupSchedule) HasRetentionCount() bool {\n\tif o != nil && o.RetentionCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (b *BackuPOT) needBackup(remotePath remotePath, newFileInfo *RemoteFileInfo) (bool, error) {\n // get remote file info\n fileInfo, err := b.getRemoteFileInfo(remotePath, -1)\n if err != nil {\n // check err kind.\n if !strings.HasPrefix(err.Error(), \"The key doesn't exist.\") {\n return false, backupotDebug.Error(err)\n } else {\n return true, nil\n }\n }\n if fileInfo.EncodedHash != newFileInfo.EncodedHash {\n return true, nil\n }\n return false, nil\n}", "func getBackupStats(backup *velero.Backup) (itemsBackedUp int, totalItems int) {\n\tif backup == nil || backup.Status.Progress == nil {\n\t\treturn\n\t}\n\ttotalItems = backup.Status.Progress.TotalItems\n\titemsBackedUp = backup.Status.Progress.ItemsBackedUp\n\treturn\n}", "func (j *ScheduledJob) IsPaused() bool {\n\treturn j.rec.NextRun == time.Time{}\n}", "func (p PodStatusInformation) IsNew(lastSeen PodStatusInformation, timeSince int) bool {\n\n\t// assume not a failure\n\tif p.Image == \"\" || p.ContainerName == \"\" || p.FinishedAt.IsZero() {\n\t\treturn false\n\t}\n\n\t// Check to see if its been over 'x' minutes, if so its new yet again.\n\tif ok := p.timeCheck(lastSeen, timeSince); ok {\n\t\treturn true\n\t}\n\n\t// Identical\n\tif reflect.DeepEqual(p, lastSeen) {\n\n\t\treturn false\n\t}\n\n\tif p.PodName == lastSeen.PodName && p.ContainerName == lastSeen.PodName {\n\n\t\treturn false\n\t}\n\n\t// Same pod, same start time\n\tif p.PodName == lastSeen.PodName && p.StartedAt == lastSeen.StartedAt {\n\n\t\treturn false\n\t}\n\n\t// same container, same exit code\n\tif p.ContainerName == lastSeen.ContainerName && p.ExitCode == lastSeen.ExitCode {\n\n\t\treturn false\n\t}\n\n\t// same container, same exit code\n\tif p.PodName == lastSeen.PodName && p.ExitCode == lastSeen.ExitCode {\n\n\t\treturn false\n\t}\n\n\treturn true\n}", "func ArchInBackup(arch Archive, backup *Backup) bool {\n\tbackupStart := backup.MongoMeta.Before.LastMajTS\n\tbackupEnd := backup.MongoMeta.After.LastMajTS\n\treturn TimestampInInterval(arch.Start, backupStart, backupEnd) ||\n\t\tTimestampInInterval(arch.End, backupStart, backupEnd) ||\n\t\tTimestampInInterval(backupStart, arch.Start, arch.End) ||\n\t\tTimestampInInterval(backupEnd, arch.Start, arch.End)\n}", "func (s *Step) IsNew() bool {\n\treturn s.State == ActiveState && s.EndTime == nil && len(s.Metrics) == 0\n}", "func (f *fwUpdater) isChecking(imsi int64) bool {\n\tf.mutex.Lock()\n\tdefer f.mutex.Unlock()\n\tcheck, ret := f.inProgress[imsi]\n\tif check && ret {\n\t\treturn true\n\t}\n\treturn false\n}", "func (t *Task) deleteStalePVBsOnCluster(cluster *migapi.MigCluster) (int, error) {\n\tt.Log.Info(\"Checking for stale PodVolumeBackups on MigCluster\",\n\t\t\"migCluster\", path.Join(cluster.Namespace, cluster.Name))\n\tnDeleted := 0\n\tclusterClient, err := cluster.GetClient(t.Client)\n\tif err != nil {\n\t\treturn 0, liberr.Wrap(err)\n\t}\n\n\tlist := velero.PodVolumeBackupList{}\n\terr = clusterClient.List(\n\t\tcontext.TODO(),\n\t\t&list,\n\t\tk8sclient.InNamespace(migapi.VeleroNamespace))\n\tif err != nil {\n\t\treturn 0, liberr.Wrap(err)\n\t}\n\tfor _, pvb := range list.Items {\n\t\t// Skip delete unless phase is \"\", \"New\" or \"InProgress\"\n\t\tif pvb.Status.Phase != velero.PodVolumeBackupPhaseNew &&\n\t\t\tpvb.Status.Phase != velero.PodVolumeBackupPhaseInProgress &&\n\t\t\tpvb.Status.Phase != \"\" {\n\t\t\tt.Log.V(4).Info(\"PodVolumeBackup with is not 'New' or 'InProgress'. Skipping deletion.\",\n\t\t\t\t\"podVolumeBackup\", path.Join(pvb.Namespace, pvb.Name),\n\t\t\t\t\"podVolumeBackupPhase\", pvb.Status.Phase)\n\t\t\tcontinue\n\t\t}\n\t\t// Skip delete if PVB is associated with running migration\n\t\tpvbHasRunningMigration := false\n\t\tfor _, ownerRef := range pvb.OwnerReferences {\n\t\t\tif ownerRef.Kind != \"Backup\" {\n\t\t\t\tt.Log.V(4).Info(\"PodVolumeBackup does not have an OwnerRef associated \"+\n\t\t\t\t\t\"with a Velero Backup. Skipping deletion.\",\n\t\t\t\t\t\"podVolumeBackup\", path.Join(pvb.Namespace, pvb.Name),\n\t\t\t\t\t\"podVolumeBackupPhase\", pvb.Status.Phase)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbackup := velero.Backup{}\n\t\t\terr := clusterClient.Get(\n\t\t\t\tcontext.TODO(),\n\t\t\t\ttypes.NamespacedName{\n\t\t\t\t\tNamespace: migapi.VeleroNamespace,\n\t\t\t\t\tName: ownerRef.Name,\n\t\t\t\t},\n\t\t\t\t&backup,\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn nDeleted, liberr.Wrap(err)\n\t\t\t}\n\t\t\t// Skip delete if missing a migmigration correlation label (only delete our own CRs)\n\t\t\tmigMigrationUID, ok := backup.ObjectMeta.Labels[migapi.MigMigrationLabel]\n\t\t\tif !ok {\n\t\t\t\tt.Log.V(4).Info(\"PodVolumeBackup does not have an attached label \"+\n\t\t\t\t\t\"associating it with a MigMigration. Skipping deletion.\",\n\t\t\t\t\t\"podVolumeBackup\", path.Join(pvb.Namespace, pvb.Name),\n\t\t\t\t\t\"podVolumeBackupPhase\", pvb.Status.Phase,\n\t\t\t\t\t\"associationLabel\", migapi.MigMigrationLabel)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tisRunning, err := t.migrationUIDisRunning(migMigrationUID)\n\t\t\tif err != nil {\n\t\t\t\treturn nDeleted, liberr.Wrap(err)\n\t\t\t}\n\t\t\tif isRunning {\n\t\t\t\tpvbHasRunningMigration = true\n\t\t\t}\n\t\t}\n\t\tif pvbHasRunningMigration == true {\n\t\t\tt.Log.Info(\"PodVolumeBackup with is associated with a running migration. Skipping deletion.\",\n\t\t\t\t\"podVolumeBackup\", path.Join(pvb.Namespace, pvb.Name),\n\t\t\t\t\"podVolumeBackupPhase\", pvb.Status.Phase)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Delete the PVB\n\t\tt.Log.Info(\"DELETING stale Velero PodVolumeBackup from MigCluster\",\n\t\t\t\"podVolumeBackup\", path.Join(pvb.Namespace, pvb.Name),\n\t\t\t\"podVolumeBackupPhase\", pvb.Status.Phase,\n\t\t\t\"migCluster\", path.Join(cluster.Namespace, cluster.Name))\n\t\terr = clusterClient.Delete(context.TODO(), &pvb)\n\t\tif err != nil && !k8serrors.IsNotFound(err) {\n\t\t\treturn nDeleted, liberr.Wrap(err)\n\t\t}\n\t\tnDeleted++\n\t}\n\n\treturn nDeleted, nil\n}", "func (tk *timekeeper) checkPendingTS(streamId common.StreamId, bucket string) {\n\n\t//if there is a flush already in progress for this stream and bucket\n\t//or flush is disabled, nothing to be done\n\tbucketFlushInProgressMap := tk.streamBucketFlushInProgressMap[streamId]\n\tbucketFlushEnabledMap := tk.streamBucketFlushEnabledMap[streamId]\n\n\tif (*bucketFlushInProgressMap)[bucket] == true ||\n\t\t(*bucketFlushEnabledMap)[bucket] == false {\n\t\treturn\n\t}\n\n\t//if there are pending TS for this bucket, send New TS\n\tbucketTsListMap := tk.streamBucketTsListMap[streamId]\n\ttsList := (*bucketTsListMap)[bucket]\n\tif tsList.Len() > 0 {\n\t\te := tsList.Front()\n\t\tts := e.Value.(Timestamp)\n\t\ttsList.Remove(e)\n\t\tcommon.Debugf(\"Timekeeper::checkPendingTS \\n\\tFound Pending Stability TS Bucket: %v \"+\n\t\t\t\"Stream: %v TS: %v\", bucket, streamId, ts)\n\t\tgo tk.sendNewStabilityTS(ts, bucket, streamId)\n\t}\n}", "func TestBackup(t *testing.T) {\n\tt.Run(\"with failing operations\", func(t *testing.T) {\n\t\texec, bctx, _ := testBackupExecutor(t, testFailSyncSpec)\n\n\t\terr := exec.Backup(bctx)\n\n\t\trequire.Error(t, err, \"returns an error of a sync operation fails\")\n\t\tassert.Contains(t, \"test operation failed\", err.Error())\n\t})\n\n\tt.Run(\"with successful operations\", func(t *testing.T) {\n\t\texec, bctx, _ := testBackupExecutor(t, testSuccessSpec)\n\n\t\trequire.NoError(t, exec.Backup(bctx))\n\t})\n\n\tt.Run(\"timeout doesn't hang\", func(t *testing.T) {\n\t\texec, bctx, _ := testBackupExecutorWithTimeout(t, testSuccessSpec, 0)\n\n\t\terr := exec.Backup(bctx)\n\t\trequire.Error(t, err, \"a timeout has happened\")\n\t\tassert.Contains(t, err.Error(), \"context deadline exceeded\")\n\t})\n}", "func (cs *CrawlerSupervisor) HasPending() bool {\n\treturn len(cs.pending) > 0\n}", "func (w *WaitTask) skipped(taskContext *TaskContext, id object.ObjMetadata) bool {\n\tim := taskContext.InventoryManager()\n\tif w.Condition == AllCurrent &&\n\t\tim.IsFailedApply(id) || im.IsSkippedApply(id) {\n\t\treturn true\n\t}\n\tif w.Condition == AllNotFound &&\n\t\tim.IsFailedDelete(id) || im.IsSkippedDelete(id) {\n\t\treturn true\n\t}\n\treturn false\n}", "func findWinChkBackUpToggled() {\n\topt.MakeBackup = obj.findWinChkBackUp.GetActive()\n}", "func (s *trialWorkloadSequencer) UpToDate() bool {\n\t// If all operations for the last asked-for step are done, then the trial has no more workloads\n\t// to run at the moment. We check len(s.ops) <= s.CurOpIdx for the case when in restart\n\t// the trial has been recreated from a snapshot but not received its current operations.\n\treturn len(s.ops) <= s.CurOpIdx && !s.hasSearcherValidation() ||\n\t\ts.ExitingEarly && !s.postGracefulStopCheckpointNeeded()\n}", "func (s *SegmentUpdateWorker) IsRunning() bool {\n\treturn s.lifecycle.IsRunning()\n}", "func (q *ExecutionBroker) notConfirmedPending() bool {\n\treturn q.pending == insolar.InPending && !q.PendingConfirmed\n}", "func (o *RequestsDeploymentScheduledBackup) HasBackupPolicyId() bool {\n\tif o != nil && o.BackupPolicyId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Operator) onStartBackup(stop <-chan struct{}) {\n\tfor {\n\t\tif err := o.waitForCRD(false, false, false, true); err == nil {\n\t\t\tbreak\n\t\t} else {\n\t\t\tlog.Error().Err(err).Msg(\"Resource initialization failed\")\n\t\t\tlog.Info().Msgf(\"Retrying in %s...\", initRetryWaitTime)\n\t\t\ttime.Sleep(initRetryWaitTime)\n\t\t}\n\t}\n\toperatorName := \"arangodb-backup-operator\"\n\toperator := backupOper.NewOperator(operatorName, o.Namespace)\n\n\trand.Seed(time.Now().Unix())\n\n\tzerolog.SetGlobalLevel(zerolog.DebugLevel)\n\n\trestClient, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tarangoClientSet, err := arangoClientSet.NewForConfig(restClient)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tkubeClientSet, err := kubernetes.NewForConfig(restClient)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\teventRecorder := event.NewEventRecorder(operatorName, kubeClientSet)\n\n\tarangoInformer := arangoInformer.NewSharedInformerFactoryWithOptions(arangoClientSet, 10*time.Second, arangoInformer.WithNamespace(o.Namespace))\n\n\tif err = backup.RegisterInformer(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err = policy.RegisterInformer(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err = operator.RegisterStarter(arangoInformer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tprometheus.MustRegister(operator)\n\n\toperator.Start(8, stop)\n\to.Dependencies.BackupProbe.SetReady()\n\n\t<-stop\n}", "func (r *OpenedxReconciler) isMysqlUp(instance *cachev1.Openedx) bool {\n\tdeployment := &appsv1.Deployment{}\n\n\terr := r.Client.Get(context.TODO(), types.NamespacedName{\n\t\tName: mysqlDeploymentName(instance),\n\t\tNamespace: instance.Namespace,\n\t}, deployment)\n\n\tif err != nil {\n\t\tlog.Error(err, \"Deployment mysql not found\")\n\t\treturn false\n\t}\n\n\tif deployment.Status.ReadyReplicas == 1 {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func TearDownBackupRestoreAll() {\n\tlogrus.Infof(\"Enumerating scheduled backups\")\n\tbkpScheduleEnumerateReq := &api.BackupScheduleEnumerateRequest{\n\t\tOrgId: OrgID,\n\t\tLabels: make(map[string]string),\n\t\tBackupLocationRef: &api.ObjectRef{\n\t\t\tName: backupLocationName,\n\t\t\tUid: BackupLocationUID,\n\t\t},\n\t}\n\tctx, err := backup.GetPxCentralAdminCtx()\n\texpect(err).NotTo(haveOccurred())\n\tenumBkpScheduleResponse, _ := Inst().Backup.EnumerateBackupSchedule(ctx, bkpScheduleEnumerateReq)\n\tbkpSchedules := enumBkpScheduleResponse.GetBackupSchedules()\n\tfor _, bkpSched := range bkpSchedules {\n\t\tschedPol := bkpSched.GetSchedulePolicyRef()\n\t\tDeleteScheduledBackup(bkpSched.GetName(), bkpSched.GetUid(), schedPol.GetName(), schedPol.GetUid())\n\t}\n\n\tlogrus.Infof(\"Enumerating backups\")\n\tbkpEnumerateReq := &api.BackupEnumerateRequest{\n\t\tOrgId: OrgID,\n\t}\n\tctx, err = backup.GetPxCentralAdminCtx()\n\texpect(err).NotTo(haveOccurred())\n\tenumBkpResponse, _ := Inst().Backup.EnumerateBackup(ctx, bkpEnumerateReq)\n\tbackups := enumBkpResponse.GetBackups()\n\tfor _, bkp := range backups {\n\t\tDeleteBackup(bkp.GetName(), OrgID)\n\t}\n\n\tlogrus.Infof(\"Enumerating restores\")\n\trestoreEnumerateReq := &api.RestoreEnumerateRequest{\n\t\tOrgId: OrgID}\n\tctx, err = backup.GetPxCentralAdminCtx()\n\texpect(err).NotTo(haveOccurred())\n\tenumRestoreResponse, _ := Inst().Backup.EnumerateRestore(ctx, restoreEnumerateReq)\n\trestores := enumRestoreResponse.GetRestores()\n\tfor _, restore := range restores {\n\t\tDeleteRestore(restore.GetName(), OrgID)\n\t}\n\n\tfor _, bkp := range backups {\n\t\tInst().Backup.WaitForBackupDeletion(ctx, bkp.GetName(), OrgID,\n\t\t\tBackupRestoreCompletionTimeoutMin*time.Minute,\n\t\t\tRetrySeconds*time.Second)\n\t}\n\tfor _, restore := range restores {\n\t\tInst().Backup.WaitForRestoreDeletion(ctx, restore.GetName(), OrgID,\n\t\t\tBackupRestoreCompletionTimeoutMin*time.Minute,\n\t\t\tRetrySeconds*time.Second)\n\t}\n\tprovider := GetProvider()\n\tDeleteCluster(destinationClusterName, OrgID)\n\tDeleteCluster(sourceClusterName, OrgID)\n\tDeleteBackupLocation(backupLocationName, OrgID)\n\tDeleteCloudCredential(CredName, OrgID, CloudCredUID)\n\tDeleteBucket(provider, BucketName)\n}", "func (r *BackupItem) IsArchived() bool {\n\treturn r.Status&StatusArchived == StatusArchived\n}", "func (r *BackupItem) IsArchived() bool {\n\treturn r.Status&StatusArchived == StatusArchived\n}", "func (dn *DNode) HasPendingSync() bool {\n\tvar retVal bool\n\tdn.tshards.Range(func(key interface{}, value interface{}) bool {\n\t\tshard := value.(*TshardState)\n\t\tshard.syncLock.Lock()\n\t\tdefer shard.syncLock.Unlock()\n\t\tif shard.syncPending {\n\t\t\tdn.logger.Infof(\"Datanode %s tstore shard %d replica %d has sync pending\", dn.nodeUUID, shard.shardID, shard.replicaID)\n\t\t\tretVal = true\n\t\t}\n\t\treturn true\n\t})\n\treturn retVal\n}", "func (e *etcdCacheEntry) IsWatching() bool {\n e.RLock()\n defer e.RUnlock()\n return e.watching\n}", "func (r *BackupReconciler) updateBackupStatus(ctx context.Context, backup *v1alpha1.Backup, inst *v1alpha1.Instance) error {\n\treadyCond := k8s.FindCondition(backup.Status.Conditions, k8s.Ready)\n\tif k8s.ConditionReasonEquals(readyCond, k8s.BackupInProgress) {\n\t\tbackup.Status.Phase = commonv1alpha1.BackupInProgress\n\t} else if k8s.ConditionReasonEquals(readyCond, k8s.BackupFailed) {\n\t\tbackup.Status.Phase = commonv1alpha1.BackupFailed\n\t} else if k8s.ConditionReasonEquals(readyCond, k8s.BackupReady) {\n\t\tbackup.Status.Phase = commonv1alpha1.BackupSucceeded\n\t\tif err := r.Status().Update(ctx, backup); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tinst.Status.BackupID = backup.Status.BackupID\n\t\treturn r.Status().Update(ctx, inst)\n\t} else {\n\t\t// No handlers found for current set of conditions\n\t\tbackup.Status.Phase = \"\"\n\t}\n\n\treturn r.Status().Update(ctx, backup)\n}", "func (o *UcsdBackupInfoAllOf) HasStatus() bool {\n\tif o != nil && o.Status != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsFileReadyToUpload(regex, fname string, now time.Time) (ok bool, err error) {\n\tr := regexp.MustCompile(regex)\n\tsubS := r.FindStringSubmatch(fname)\n\n\tif len(subS) < 2 {\n\t\treturn false, nil\n\t}\n\n\tlastFinishedBackupFileBeforeHours := 35.0 // 24 + 11,last flush occurred at 10:00 CST\n\tt, err := time.Parse(\"20060102-0700\", subS[1]+\"+0800\")\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"parse file time error\")\n\t}\n\n\tif now.Sub(t).Hours() <= lastFinishedBackupFileBeforeHours {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "func (o *InstanceStatusKubernetes) HasBackoffSeconds() bool {\n\tif o != nil && o.BackoffSeconds != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Job) GetProgressValid(ctx context.Context) (progressValid bool, err error) {\n\terr = o.object.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.Get\", 0, InterfaceJob, \"ProgressValid\").Store(&progressValid)\n\treturn\n}", "func (v Repository) IsRebaseInProgress() bool {\n\tgitDir := v.RepoDir()\n\treturn path.Exist(filepath.Join(gitDir, \"rebase-apply\")) ||\n\t\tpath.Exist(filepath.Join(gitDir, \"rebase-merge\")) ||\n\t\tpath.Exist(filepath.Join(gitDir, \".dotest\"))\n}", "func (container *container) HasPendingUpdates() (bool, error) {\r\n\treturn false, nil\r\n}" ]
[ "0.65107685", "0.60924333", "0.6047755", "0.59358364", "0.5879894", "0.58064044", "0.579322", "0.5754999", "0.546307", "0.54417455", "0.54404837", "0.54389805", "0.5420077", "0.54141295", "0.53390694", "0.5332677", "0.5270624", "0.52638215", "0.5197946", "0.51915765", "0.5188692", "0.518613", "0.51734096", "0.51526904", "0.51204026", "0.5119891", "0.51149327", "0.5106044", "0.50971216", "0.50916773", "0.5086276", "0.5050972", "0.5048553", "0.5035914", "0.50099075", "0.50032455", "0.50003695", "0.4999434", "0.49806356", "0.49684638", "0.4967716", "0.49625465", "0.4953621", "0.49534264", "0.4943557", "0.49427876", "0.493359", "0.49321347", "0.49201253", "0.4917584", "0.48944977", "0.4886191", "0.48658758", "0.48606896", "0.48600587", "0.48474264", "0.4831539", "0.4821781", "0.48055243", "0.48051438", "0.48013893", "0.47989595", "0.47914934", "0.4780901", "0.4769014", "0.47627932", "0.47615236", "0.47590736", "0.47547832", "0.4749101", "0.4746854", "0.47459584", "0.47450823", "0.47401175", "0.47356316", "0.4728575", "0.47149613", "0.46990344", "0.46956274", "0.46857315", "0.46716258", "0.4663764", "0.46586007", "0.4656676", "0.46536118", "0.46445355", "0.4643809", "0.4641672", "0.46354857", "0.46341377", "0.46341377", "0.46334267", "0.4632463", "0.46300542", "0.4627788", "0.46260625", "0.46117908", "0.46082082", "0.46078554", "0.4606219" ]
0.8554207
0
ifDue check whether schedule is due to create a new backup.
еслиDue проверьте, нужно ли создать новый резервную копию.
func (c *scheduleReconciler) ifDue(schedule *velerov1.Schedule, cronSchedule cron.Schedule) bool { isDue, nextRunTime := getNextRunTime(schedule, cronSchedule, c.clock.Now()) log := c.logger.WithField("schedule", kube.NamespaceAndName(schedule)) if !isDue { log.WithField("nextRunTime", nextRunTime).Debug("Schedule is not due, skipping") return false } return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *scheduleReconciler) checkIfBackupInNewOrProgress(schedule *velerov1.Schedule) bool {\n\tlog := c.logger.WithField(\"schedule\", kube.NamespaceAndName(schedule))\n\tbackupList := &velerov1.BackupList{}\n\toptions := &client.ListOptions{\n\t\tNamespace: schedule.Namespace,\n\t\tLabelSelector: labels.Set(map[string]string{\n\t\t\tvelerov1.ScheduleNameLabel: schedule.Name,\n\t\t}).AsSelector(),\n\t}\n\n\terr := c.List(context.Background(), backupList, options)\n\tif err != nil {\n\t\tlog.Errorf(\"fail to list backup for schedule %s/%s: %s\", schedule.Namespace, schedule.Name, err.Error())\n\t\treturn true\n\t}\n\n\tfor _, backup := range backupList.Items {\n\t\tif backup.Status.Phase == velerov1.BackupPhaseNew || backup.Status.Phase == velerov1.BackupPhaseInProgress {\n\t\t\tlog.Debugf(\"%s/%s still has backups that are in InProgress or New...\", schedule.Namespace, schedule.Name)\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func backupScheduleFound(repo v1beta1.PGBackRestRepo, backupType string) bool {\n\tif repo.BackupSchedules != nil {\n\t\tswitch backupType {\n\t\tcase full:\n\t\t\treturn repo.BackupSchedules.Full != nil\n\t\tcase differential:\n\t\t\treturn repo.BackupSchedules.Differential != nil\n\t\tcase incremental:\n\t\t\treturn repo.BackupSchedules.Incremental != nil\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "func DueDate(project_name, project_owner, task_name, dueDate string, db *sql.DB) bool {\n\tsqlStatement1 := `SELECT id FROM projects WHERE owner = $1 AND name = $2;`\n\n\tvar parentID string\n\terr = db.QueryRow(sqlStatement1, project_owner, project_name).Scan(&parentID)\n\n\tif err == sql.ErrNoRows {\n\t\treturn false\n\t} else if err != nil {\n\t\treturn false\n\t}\n\n\tsqlStatement := `UPDATE tasks\n \tSET due_date = $1\n \tWHERE project = $2 AND name = $3;`\n\n\t_, err = db.Exec(sqlStatement, dueDate, parentID, task_name)\n\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (solver *MapSolver)HasScheduled(arc *data.Arc) bool{\n\tfor _, cap := range arc.Capacity {\n\t\tif cap > 0 { // if dstNode is not machineNode, we can assume that if capacity > 0, then this task still not scheduled\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (o *TransactionSplit) HasDueDate() bool {\n\tif o != nil && o.DueDate.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *Job) canDo() {\n\tdiff := int64(time.Now().Sub(c.nextTime) / time.Millisecond /*1000000*/)\n\tif diff >= 0 {\n\t\tif c.unit == delay || c.timingMode == beforeExecuteTask {\n\t\t\tc.fiber.EnqueueWithTask(c.task)\n\t\t} else {\n\t\t\td := c.task.Run()\n\t\t\tc.nextTime = c.nextTime.Add(d)\n\t\t}\n\t\tswitch c.unit {\n\t\tcase delay:\n\t\t\treturn\n\t\tcase weeks:\n\t\t\tc.nextTime = c.nextTime.AddDate(0, 0, 7)\n\t\tcase days:\n\t\t\tc.nextTime = c.nextTime.AddDate(0, 0, int(c.interval))\n\t\tcase hours:\n\t\t\tc.nextTime = c.nextTime.Add(time.Duration(c.interval) * time.Hour)\n\t\tcase minutes:\n\t\t\tc.nextTime = c.nextTime.Add(time.Duration(c.interval) * time.Minute)\n\t\tcase seconds:\n\t\t\tc.nextTime = c.nextTime.Add(time.Duration(c.interval) * time.Second)\n\t\tcase milliseconds:\n\t\t\tc.nextTime = c.nextTime.Add(time.Duration(c.interval) * time.Millisecond)\n\t\t}\n\t}\n\n\tc.taskDisposer.Dispose()\n\tadjustTime := int64(c.nextTime.Sub(time.Now()) / time.Millisecond /*1000000*/)\n\tc.taskDisposer = c.fiber.Schedule(adjustTime, c.canDo)\n}", "func (c *Circuit) allowNewRun(now time.Time) bool {\n\tif !c.IsOpen() {\n\t\treturn true\n\t}\n\tif c.OpenToClose.Allow(now) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (e *ExternalServiceStore) SyncDue(ctx context.Context, intIDs []int64, d time.Duration) (bool, error) {\n\tif len(intIDs) == 0 {\n\t\treturn false, nil\n\t}\n\tids := make([]*sqlf.Query, 0, len(intIDs))\n\tfor _, id := range intIDs {\n\t\tids = append(ids, sqlf.Sprintf(\"%s\", id))\n\t}\n\tidFilter := sqlf.Sprintf(\"IN (%s)\", sqlf.Join(ids, \",\"))\n\tdeadline := time.Now().Add(d)\n\n\tq := sqlf.Sprintf(`\nSELECT TRUE\nWHERE EXISTS(\n SELECT\n FROM external_services\n WHERE id %s\n AND (\n next_sync_at IS NULL\n OR next_sync_at <= %s)\n )\n OR EXISTS(\n SELECT\n FROM external_service_sync_jobs\n WHERE external_service_id %s\n AND state IN ('queued', 'processing')\n );\n`, idFilter, deadline, idFilter)\n\n\tv, exists, err := basestore.ScanFirstBool(e.Query(ctx, q))\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn v && exists, nil\n}", "func (c *scheduleReconciler) submitBackup(ctx context.Context, schedule *velerov1.Schedule) error {\n\tc.logger.WithField(\"schedule\", schedule.Namespace+\"/\"+schedule.Name).Info(\"Schedule is due, going to submit backup.\")\n\n\tnow := c.clock.Now()\n\t// Don't attempt to \"catch up\" if there are any missed or failed runs - simply\n\t// trigger a Backup if it's time.\n\tbackup := getBackup(schedule, now)\n\tif err := c.Create(ctx, backup); err != nil {\n\t\treturn errors.Wrap(err, \"error creating Backup\")\n\t}\n\n\toriginal := schedule.DeepCopy()\n\tschedule.Status.LastBackup = &metav1.Time{Time: now}\n\n\tif err := c.Patch(ctx, schedule, client.MergeFrom(original)); err != nil {\n\t\treturn errors.Wrapf(err, \"error updating Schedule's LastBackup time to %v\", schedule.Status.LastBackup)\n\t}\n\n\treturn nil\n}", "func (o *InlineResponse20051TodoItems) HasDueDateBase() bool {\n\tif o != nil && o.DueDateBase != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (b *gsDBBackup) maybeBackupDB(now time.Time) {\n\tb.maybeBackupDBLiveness.Reset()\n\t// Look for a trigger file written by task-scheduler-db-backup.service\n\t// or a previous automatic backup attempt.\n\tbasename, attemptCount, err := b.findAndParseTriggerFile()\n\tif err != nil {\n\t\tglog.Error(err)\n\t}\n\tif basename == \"\" {\n\t\treturn\n\t}\n\tattemptCount++\n\tif attemptCount == 1 {\n\t\tglog.Infof(\"Beginning automatic DB backup.\")\n\t} else {\n\t\tglog.Infof(\"Retrying automatic DB backup -- attempt %d.\", attemptCount)\n\t}\n\tif err := b.backupDB(now, basename); err != nil {\n\t\tglog.Errorf(\"Automatic DB backup failed: %s\", err)\n\t\tif attemptCount >= RETRY_COUNT {\n\t\t\tglog.Errorf(\"Automatic DB backup failed after %d attempts. Retries exhausted.\", attemptCount)\n\t\t\tif err := b.deleteTriggerFile(basename); err != nil {\n\t\t\t\tglog.Error(err)\n\t\t\t}\n\t\t} else {\n\t\t\tif err := b.writeTriggerFile(basename, attemptCount); err != nil {\n\t\t\t\tglog.Error(err)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tglog.Infof(\"Completed automatic DB backup.\")\n\t\tif err := b.deleteTriggerFile(basename); err != nil {\n\t\t\tglog.Error(err)\n\t\t}\n\t}\n}", "func (o *InlineResponse20051TodoItems) HasDueDate() bool {\n\tif o != nil && o.DueDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (id Job) Due() Time {\n\treturn ksuid.KSUID(id).Time()\n}", "func (o *ModelsBackupSchedule) HasSchedule() bool {\n\tif o != nil && o.Schedule != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TransactionSplit) GetDueDateOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DueDate.Get(), o.DueDate.IsSet()\n}", "func (_BREMICO *BREMICOCaller) IsOverdue(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _BREMICO.contract.Call(opts, out, \"isOverdue\")\n\treturn *ret0, err\n}", "func (tbbsd TimeBasedBackupScheduleDescription) AsBackupScheduleDescription() (*BackupScheduleDescription, bool) {\n\treturn nil, false\n}", "func AssertRetentionSchedule(ctx context.Context, db *sql.DB, queueName string, taskType queue.TaskType, status queue.TaskStatus, age time.Duration) (err error) {\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"AssertRetentionSchedule\")\n\tspan.SetTag(\"pkg.name\", \"postgres\")\n\n\tspec := createRetentionSpec(queueName, taskType, status, age)\n\tspecBytes, err := json.Marshal(spec)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can not build retention task spec: %w\", err)\n\t}\n\t// randomly distribute the retention tasks throughout the hour\n\twhen := rand.Intn(60)\n\tretentionSchedule := queue.TaskScheduleRequest{\n\t\tTaskBase: queue.TaskBase{\n\t\t\tQueue: MaintenanceTaskQueue,\n\t\t\tType: RetentionTask,\n\t\t\tSpec: specBytes,\n\t\t},\n\t\tCronSchedule: fmt.Sprintf(\"%d * * * *\", when), // every hour at minute \"when\"\n\t}\n\ttx, err := db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can not start transaction for scheduling: %w\", err)\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t_ = tx.Rollback()\n\t\t\treturn\n\t\t}\n\t\terr = tx.Commit()\n\t}()\n\n\t_, err = tx.ExecContext(ctx, `LOCK TABLE schedules IN ACCESS EXCLUSIVE MODE;`)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to lock `schedules`: %w\", err)\n\t}\n\n\tbuilder := squirrel.StatementBuilder.\n\t\tPlaceholderFormat(squirrel.Dollar).\n\t\tRunWith(cdb.WrapWithTracing(tx))\n\n\tvar exists int\n\t// use a unique error name here otherwise the sql.ErrNoRows might shadow\n\t// us and things will break. This is also handled by the named error return\n\t// variable, but this makes the code easier to copy and paste\n\texistsErr := builder.Select(\"1\").\n\t\tFrom(\"schedules\").\n\t\tWhere(squirrel.Eq{\n\t\t\t\"task_queue\": MaintenanceTaskQueue,\n\t\t\t\"task_type\": RetentionTask,\n\t\t\t\"task_spec->>'queueName'\": queueName,\n\t\t\t\"task_spec->>'taskType'\": taskType,\n\t\t\t\"task_spec->>'status'\": status,\n\t\t}).ScanContext(ctx, &exists)\n\tif existsErr != nil && existsErr != sql.ErrNoRows {\n\t\treturn fmt.Errorf(\"can not verify existing schedule: %w\", existsErr)\n\t}\n\n\t// will only non-zero if err is nil and task is not found\n\tif exists == 0 {\n\t\tspan.SetTag(\"created\", true)\n\t\t// pass nil db because it doesn't need the raw db\n\t\treturn NewScheduler(nil).Schedule(ctx, builder, retentionSchedule)\n\t}\n\n\tspan.SetTag(\"updated\", true)\n\tres, err := builder.Update(\"schedules\").\n\t\tWhere(squirrel.Eq{\n\t\t\t\"task_queue\": MaintenanceTaskQueue,\n\t\t\t\"task_type\": RetentionTask,\n\t\t\t\"task_spec->>'queueName'\": queueName,\n\t\t\t\"task_spec->>'taskType'\": taskType,\n\t\t\t\"task_spec->>'status'\": status,\n\t\t}).\n\t\tSet(\"updated_at\", time.Now()).\n\t\tSet(\"task_spec\", retentionSchedule.Spec).\n\t\tSet(\"cron_schedule\", retentionSchedule.CronSchedule).\n\t\tSet(\"next_execution_time\", time.Now()).\n\t\tExecContext(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can not update existing schdule: %w\", err)\n\t}\n\n\tupdated, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can not determine the number of rows affected: %w\", err)\n\t}\n\n\tspan.SetTag(\"affected\", updated)\n\n\treturn nil\n}", "func assert_schedule_improved(w map[int]float64, final, init vrp.Allocation) bool {\n\treturn weighted_reward(w, final) >= weighted_reward(w, init)\n}", "func (w *Week) shouldStartNewWeek(time string) bool {\n\treturn w.canAddNewDay(time) && len(w.days) == 7\n}", "func (f *FakeInstance) GetBackupSchedule(_ context.Context, _ string) (*govultr.BackupSchedule, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func WaitForScheduledBackup(backupScheduleName string, retryInterval time.Duration, timeout time.Duration) (*api.BackupObject, error) {\n\tbeginTime := time.Now()\n\tbeginTimeSec := beginTime.Unix()\n\n\tt := func() (interface{}, bool, error) {\n\t\tlogrus.Infof(\"Enumerating backups\")\n\t\tbkpEnumerateReq := &api.BackupEnumerateRequest{\n\t\t\tOrgId: OrgID}\n\t\t//ctx, err := backup.GetPxCentralAdminCtx()\n\t\tctx, err := backup.GetAdminCtxFromSecret()\n\t\tif err != nil {\n\t\t\treturn nil, true, err\n\t\t}\n\t\tcurBackups, err := Inst().Backup.EnumerateBackup(ctx, bkpEnumerateReq)\n\t\tif err != nil {\n\t\t\treturn nil, true, err\n\t\t}\n\t\tfor _, bkp := range curBackups.GetBackups() {\n\t\t\tcreateTime := bkp.GetCreateTime()\n\t\t\tif beginTimeSec > createTime.GetSeconds() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif (bkp.GetStatus().GetStatus() == api.BackupInfo_StatusInfo_Success ||\n\t\t\t\tbkp.GetStatus().GetStatus() == api.BackupInfo_StatusInfo_PartialSuccess) &&\n\t\t\t\tbkp.GetBackupSchedule().GetName() == backupScheduleName {\n\t\t\t\treturn bkp, false, nil\n\t\t\t}\n\t\t}\n\t\terr = fmt.Errorf(\"unable to find backup from backup schedule with name %s after time %v\",\n\t\t\tbackupScheduleName, beginTime)\n\t\treturn nil, true, err\n\t}\n\n\tbkpInterface, err := task.DoRetryWithTimeout(t, timeout, retryInterval)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbkp := bkpInterface.(*api.BackupObject)\n\treturn bkp, nil\n\n}", "func (task *Task) IsScheduled() bool {\n\tif task.State != statuses.TaskStateActive {\n\t\treturn false\n\t}\n\treturn task.IsRecurringlyScheduled() || task.Schedule.Regularity == apiModels.OneTime\n}", "func isOldEnough(pr *github.PullRequest) bool {\n\treturn time.Now().Unix()-pr.CreatedAt.Unix() > config.TimeForCreatingJIRATicket\n}", "func (t *Task) ensureInitialBackup() (*velero.Backup, error) {\n\tbackup, err := t.getInitialBackup()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tif backup != nil {\n\t\treturn backup, nil\n\t}\n\n\tclient, err := t.getSourceClient()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tnewBackup, err := t.buildBackup(client, \"initial\")\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tuserIncludedResources, _, err := t.PlanResources.MigPlan.GetIncludedResourcesList(client)\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\n\tnewBackup.Labels[migapi.InitialBackupLabel] = t.UID()\n\tnewBackup.Labels[migapi.MigMigrationDebugLabel] = t.Owner.Name\n\tnewBackup.Labels[migapi.MigPlanDebugLabel] = t.Owner.Spec.MigPlanRef.Name\n\tnewBackup.Labels[migapi.MigMigrationLabel] = string(t.Owner.UID)\n\tnewBackup.Labels[migapi.MigPlanLabel] = string(t.PlanResources.MigPlan.UID)\n\tnewBackup.Spec.IncludedResources = toStringSlice(settings.IncludedInitialResources.Difference(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.IncludedResources = append(newBackup.Spec.IncludedResources, userIncludedResources...)\n\tnewBackup.Spec.ExcludedResources = toStringSlice(settings.ExcludedInitialResources.Union(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.LabelSelector = t.PlanResources.MigPlan.Spec.LabelSelector\n\tdelete(newBackup.Annotations, migapi.QuiesceAnnotation)\n\n\tif Settings.DisImgCopy {\n\t\tif newBackup.Annotations == nil {\n\t\t\tnewBackup.Annotations = map[string]string{}\n\t\t}\n\t\tnewBackup.Annotations[migapi.DisableImageCopy] = strconv.FormatBool(Settings.DisImgCopy)\n\t}\n\n\terr = client.Create(context.TODO(), newBackup)\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\treturn newBackup, nil\n}", "func (r *Release) isConsideredToRun() bool {\n\tif r == nil {\n\t\treturn false\n\t}\n\treturn !r.disabled\n}", "func (me TEventType) IsAssignmentAbandoned() bool { return me.String() == \"AssignmentAbandoned\" }", "func canModify(now int64, clientID int32, task *Task) bool {\n\treturn task.AT <= now || clientID == task.OwnerID\n}", "func (f *FakeInstance) SetBackupSchedule(_ context.Context, _ string, _ *govultr.BackupScheduleReq) (*http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (o *ModelsBackupSchedule) GetScheduleOk() (*string, bool) {\n\tif o == nil || o.Schedule == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Schedule, true\n}", "func (s *Scheduler) DeploymentCheck(ns string, name string, recover bool) {\n\n\tblog.Info(\"deployment(%s.%s) check begin\", ns, name)\n\tif recover == true {\n\t\tif s.Role != SchedulerRoleMaster {\n\t\t\tblog.Warn(\"deployment(%s.%s) check exit, because scheduler is not master now\", ns, name)\n\t\t\treturn\n\t\t}\n\t\tfinish := s.deploymentCheckTick(ns, name, true)\n\t\tif finish == true {\n\t\t\tblog.Info(\"deployment(%s.%s) check finish\", ns, name)\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\n\tfor {\n\t\tif s.Role != SchedulerRoleMaster {\n\t\t\tblog.Warn(\"deployment(%s.%s) check exit, because scheduler is not master now\", ns, name)\n\t\t\treturn\n\t\t}\n\t\tfinish := s.deploymentCheckTick(ns, name, false)\n\t\tif finish == true {\n\t\t\tblog.Info(\"deployment(%s.%s) check finish\", ns, name)\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n}", "func isScheduleStillInUse(s models.Schedule) (bool, error) {\n\tvar scheduleEvents []models.ScheduleEvent\n\tif err := dbClient.GetScheduleEventsByScheduleName(&scheduleEvents, s.Name); err != nil {\n\t\treturn false, err\n\t}\n\tif len(scheduleEvents) > 0 {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (d *dmaasBackup) cleanupOldSchedule(dbkp *v1alpha1.DMaaSBackup) error {\n\t// TODO\n\treturn nil\n}", "func (t *Task) hasBackupCompleted(backup *velero.Backup) (bool, []string) {\n\tcompleted := false\n\treasons := []string{}\n\tprogress := []string{}\n\n\tpvbs := t.getPodVolumeBackupsForBackup(backup)\n\n\tswitch backup.Status.Phase {\n\tcase velero.BackupPhaseNew:\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Backup %s/%s: Not started\",\n\t\t\t\tbackup.Namespace,\n\t\t\t\tbackup.Name))\n\tcase velero.BackupPhaseInProgress:\n\t\titemsBackedUp, totalItems := getBackupStats(backup)\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Backup %s/%s: %d out of estimated total of %d objects backed up%s\",\n\t\t\t\tbackup.Namespace,\n\t\t\t\tbackup.Name,\n\t\t\t\titemsBackedUp,\n\t\t\t\ttotalItems,\n\t\t\t\tgetBackupDuration(backup)))\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tgetPodVolumeBackupsProgress(pvbs)...)\n\tcase velero.BackupPhaseCompleted:\n\t\tcompleted = true\n\t\titemsBackedUp, totalItems := getBackupStats(backup)\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Backup %s/%s: %d out of estimated total of %d objects backed up%s\",\n\t\t\t\tbackup.Namespace,\n\t\t\t\tbackup.Name,\n\t\t\t\titemsBackedUp,\n\t\t\t\ttotalItems,\n\t\t\t\tgetBackupDuration(backup)))\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tgetPodVolumeBackupsProgress(pvbs)...)\n\tcase velero.BackupPhaseFailed:\n\t\tcompleted = true\n\t\tmessage := fmt.Sprintf(\n\t\t\t\"Backup %s/%s: failed.\",\n\t\t\tbackup.Namespace,\n\t\t\tbackup.Name)\n\t\treasons = append(reasons, message)\n\t\titemsBackedUp, totalItems := getBackupStats(backup)\n\t\tmessage = fmt.Sprintf(\n\t\t\t\"%s %d out of estimated total of %d objects backed up%s\",\n\t\t\tmessage,\n\t\t\titemsBackedUp,\n\t\t\ttotalItems,\n\t\t\tgetBackupDuration(backup))\n\t\tprogress = append(progress, message)\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tgetPodVolumeBackupsProgress(pvbs)...)\n\tcase velero.BackupPhasePartiallyFailed:\n\t\tcompleted = true\n\t\titemsBackedUp, totalItems := getBackupStats(backup)\n\t\tmessage := fmt.Sprintf(\n\t\t\t\"Backup %s/%s: partially failed. %d out of estimated total of %d objects backed up%s\",\n\t\t\tbackup.Namespace,\n\t\t\tbackup.Name,\n\t\t\titemsBackedUp,\n\t\t\ttotalItems,\n\t\t\tgetBackupDuration(backup))\n\t\tprogress = append(progress, message)\n\t\tprogress = append(\n\t\t\tprogress,\n\t\t\tgetPodVolumeBackupsProgress(pvbs)...)\n\tcase velero.BackupPhaseFailedValidation:\n\t\treasons = backup.Status.ValidationErrors\n\t\treasons = append(\n\t\t\treasons,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Backup %s/%s: validation failed.\",\n\t\t\t\tbackup.Namespace,\n\t\t\t\tbackup.Name))\n\t\tcompleted = true\n\t}\n\tt.Log.Info(\"Velero Backup progress report\",\n\t\t\"backup\", path.Join(backup.Namespace, backup.Name),\n\t\t\"backupProgress\", progress)\n\n\tt.setProgress(progress)\n\treturn completed, reasons\n}", "func (t *Task) MarkDoneForToday() {\n t.SnoozedUntil = floorDate(time.Now().Add(time.Hour * 24))\n}", "func (backupWrapper *v1BackupWrapper) isBackupCompleted() bool {\n\tif backupWrapper.backup.IsFailed() ||\n\t\tbackupWrapper.backup.IsSucceeded() {\n\t\treturn true\n\t}\n\treturn false\n}", "func (task *Task) IsTrigger() bool {\n\tswitch task.Schedule.Regularity {\n\tcase apiModels.Trigger:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func (n *NodeBlockMaker) checkGoodTimeToMakeBlock() bool {\n\treturn true\n}", "func (o *ViewMilestone) HasOriginalDueDate() bool {\n\tif o != nil && o.OriginalDueDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *ReconcileBackup) isAllCreated(bkp *v1alpha1.Backup) error {\n\n\t// Check if was possible found the DB Pod\n\tif !r.isDbPodFound() {\n\t\terr := fmt.Errorf(\"Error: Database Pod is missing\")\n\t\treturn err\n\t}\n\n\t// Check if was possible found the DB Service\n\tif !r.isDbServiceFound() {\n\t\terr := fmt.Errorf(\"Error: Database Service is missing\")\n\t\treturn err\n\t}\n\n\t// Check if DB secret was created\n\tdbSecretName := utils.DbSecretPrefix + bkp.Name\n\t_, err := service.FetchSecret(bkp.Namespace, dbSecretName, r.client)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error: DB Secret is missing. (%v)\", dbSecretName)\n\t\treturn err\n\t}\n\n\t// Check if AWS secret was created\n\tawsSecretName := utils.GetAWSSecretName(bkp)\n\tawsSecretNamespace := utils.GetAwsSecretNamespace(bkp)\n\t_, err = service.FetchSecret(awsSecretNamespace, awsSecretName, r.client)\n\tif err != nil {\n\t\terr := fmt.Errorf(\"Error: AWS Secret is missing. (name:%v,namespace:%v)\", awsSecretName, awsSecretNamespace)\n\t\treturn err\n\t}\n\n\t// Check if Enc secret was created (if was configured to be used)\n\tif utils.IsEncryptionKeyOptionConfig(bkp) {\n\t\tencSecretName := utils.GetEncSecretName(bkp)\n\t\tencSecretNamespace := utils.GetEncSecretNamespace(bkp)\n\t\t_, err := service.FetchSecret(encSecretNamespace, encSecretName, r.client)\n\t\tif err != nil {\n\t\t\terr := fmt.Errorf(\"Error: Encript Key Secret is missing. (name:%v,namespace:%v)\", encSecretName, encSecretNamespace)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t//check if the cronJob was created\n\t_, err = service.FetchCronJob(bkp.Name, bkp.Namespace, r.client)\n\tif err != nil {\n\t\terr := fmt.Errorf(\"Error: CronJob is missing\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (_BREMICO *BREMICOCallerSession) IsOverdue() (bool, error) {\n\treturn _BREMICO.Contract.IsOverdue(&_BREMICO.CallOpts)\n}", "func (bsd BackupScheduleDescription) AsBackupScheduleDescription() (*BackupScheduleDescription, bool) {\n\treturn &bsd, true\n}", "func (t Task) IsDoneNow() bool {\n return t.Complete || time.Now().Before(t.SnoozedUntil)\n}", "func (e *CronJob) effectiveSchedule() string {\n\tif e.Paused {\n\t\treturn \"manual\"\n\t}\n\treturn e.Schedule\n}", "func (t *Task) ensureStageBackup() (*velero.Backup, error) {\n\tbackup, err := t.getStageBackup()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tif backup != nil {\n\t\treturn backup, nil\n\t}\n\n\tclient, err := t.getSourceClient()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tt.Log.Info(\"Building Stage Velero Backup resource definition\")\n\tnewBackup, err := t.buildBackup(client, \"stage\")\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tlabelSelector := metav1.LabelSelector{\n\t\tMatchLabels: map[string]string{\n\t\t\tmigapi.IncludedInStageBackupLabel: t.UID(),\n\t\t},\n\t}\n\tnewBackup.Labels[migapi.StageBackupLabel] = t.UID()\n\tnewBackup.Labels[migapi.MigMigrationDebugLabel] = t.Owner.Name\n\tnewBackup.Labels[migapi.MigPlanDebugLabel] = t.Owner.Spec.MigPlanRef.Name\n\tnewBackup.Labels[migapi.MigMigrationLabel] = string(t.Owner.UID)\n\tnewBackup.Labels[migapi.MigPlanLabel] = string(t.PlanResources.MigPlan.UID)\n\tvar includedResources mapset.Set\n\n\tif (t.indirectImageMigration() || Settings.DisImgCopy) && !t.migrateState() {\n\t\tincludedResources = settings.IncludedStageResources\n\t} else {\n\t\tincludedResources = settings.IncludedStageResources.Difference(mapset.NewSetFromSlice([]interface{}{settings.ISResource}))\n\t}\n\tnewBackup.Spec.IncludedResources = toStringSlice(includedResources.Difference(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.ExcludedResources = toStringSlice(settings.ExcludedStageResources.Union(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.LabelSelector = &labelSelector\n\tif Settings.DisImgCopy {\n\t\tif newBackup.Annotations == nil {\n\t\t\tnewBackup.Annotations = map[string]string{}\n\t\t}\n\t\tnewBackup.Annotations[migapi.DisableImageCopy] = strconv.FormatBool(Settings.DisImgCopy)\n\t}\n\tt.Log.Info(\"Creating Stage Velero Backup on source cluster.\",\n\t\t\"backup\", path.Join(newBackup.Namespace, newBackup.Name))\n\terr = client.Create(context.TODO(), newBackup)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newBackup, nil\n}", "func TestInitialDateTimeChecks4(t *testing.T) {\n\n\texpected := true\n\n\tcurrDate := time.Now().Add(24 * time.Hour).Format(\"2006-01-02\")\n\tactual, _ := restaurantBooking.InitialDateTimeChecks(currDate, \"15:00\")\n\n\tif actual != expected {\n\t\tt.Fail()\n\t}\n\n}", "func isPlanUpdate(old *PhoneNumberInfo, new *PhoneNumberInfo) bool {\n\tnewActivationDate := *(new.getActivationDate())\n\toldActivationDate := *(old.getActivationDate())\n\n\tif newActivationDate.After(oldActivationDate) && old.DeactivationDate == new.ActivationDate {\n\t\treturn true\n\t}\n\treturn false\n}", "func (a *Scheduler) processDueJobs(ctx context.Context, nowTime time.Time) {\n\tdueJobs, err := a.scanner.GetDueJobs(nowTime)\n\tif err != nil {\n\t\tlogrus.Errorf(\"unable to retrieve due jobs: %s\", err.Error())\n\t\treturn\n\t}\n\tif len(dueJobs) > 0 {\n\t\tlogrus.Debugf(\"processDueJobs, %d recurring jobs are due for running...\", len(dueJobs))\n\t}\n\tfor _, job := range dueJobs {\n\t\terr := a.pushWorkflow(job, false)\n\t\tif err != nil {\n\t\t\tif err == cereal.ErrWorkflowInstanceExists {\n\t\t\t\tlogrus.Infof(\"Job %q is still/already running\", job.Id)\n\t\t\t} else {\n\t\t\t\tlogrus.Errorf(\"Error handling job %q: %v\", job.Id, err)\n\t\t\t}\n\t\t}\n\t}\n}", "func shouldDeploy(currentEnvironment, newEnvironment *bitesize.Environment, serviceName string) bool {\n\tcurrentService := currentEnvironment.Services.FindByName(serviceName)\n\tupdatedService := newEnvironment.Services.FindByName(serviceName)\n\n\tif (currentService != nil && currentService.Status.DeployedAt != \"\") || (updatedService != nil && updatedService.Version != \"\") {\n\t\tif diff.ServiceChanged(serviceName) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func newCron(schedule string) (chan bool, *cron.Cron) {\n\tchannel := make(chan bool)\n\tcj := cron.New()\n\tcj.AddFunc(schedule, func() { cronTriggered(channel) })\n\tglog.Info(\"db backup schedule: \" + schedule)\n\treturn channel, cj\n}", "func (o *Run) GetScheduledForOk() (*time.Time, bool) {\n\tif o == nil || o.ScheduledFor == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ScheduledFor, true\n}", "func (w *Week) canAddNewDay(time string) bool {\n\tfor _, v := range w.days {\n\t\tif v == time {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (r *RenewalInfoResponse) ShouldRenewAt(now time.Time, willingToSleep time.Duration) *time.Time {\n\t// Explicitly convert all times to UTC.\n\tnow = now.UTC()\n\tstart := r.SuggestedWindow.Start.UTC()\n\tend := r.SuggestedWindow.End.UTC()\n\n\t// Select a uniform random time within the suggested window.\n\twindow := end.Sub(start)\n\trandomDuration := time.Duration(rand.Int63n(int64(window)))\n\trt := start.Add(randomDuration)\n\n\t// If the selected time is in the past, attempt renewal immediately.\n\tif rt.Before(now) {\n\t\treturn &now\n\t}\n\n\t// Otherwise, if the client can schedule itself to attempt renewal at exactly the selected time, do so.\n\twillingToSleepUntil := now.Add(willingToSleep)\n\tif willingToSleepUntil.After(rt) || willingToSleepUntil.Equal(rt) {\n\t\treturn &rt\n\t}\n\n\t// TODO: Otherwise, if the selected time is before the next time that the client would wake up normally, attempt renewal immediately.\n\n\t// Otherwise, sleep until the next normal wake time, re-check ARI, and return to Step 1.\n\treturn nil\n}", "func (e ScheduledDateValidationError) Reason() string { return e.reason }", "func (_BREMICO *BREMICOSession) IsOverdue() (bool, error) {\n\treturn _BREMICO.Contract.IsOverdue(&_BREMICO.CallOpts)\n}", "func (fbbsd FrequencyBasedBackupScheduleDescription) AsBackupScheduleDescription() (*BackupScheduleDescription, bool) {\n\treturn nil, false\n}", "func (tbbsd TimeBasedBackupScheduleDescription) AsBasicBackupScheduleDescription() (BasicBackupScheduleDescription, bool) {\n\treturn &tbbsd, true\n}", "func isUndoneTaskOFDeployByRelease(piplineDetail *pipelinepb.PipelineDetailDTO) bool {\n\tif len(piplineDetail.PipelineStages) == 0 || len(piplineDetail.PipelineStages[0].PipelineTasks) == 0 {\n\t\treturn false\n\t}\n\n\ttask := piplineDetail.PipelineStages[0].PipelineTasks[0]\n\treturn task.Type == \"dice-deploy-release\" && !apistructs.PipelineStatus(task.Status).IsEndStatus()\n}", "func TestBackupBefore(t *testing.T) {\n\tb := backup{t: time.Unix(2, 0)}\n\tif b.before(time.Unix(1, 0)) {\n\t\tt.Errorf(\"b.before(time.Unix(1, 0)) returns false\")\n\t}\n\n\tif b.before(time.Unix(2, 0)) {\n\t\tt.Errorf(\"b.before(time.Unix(2, 0)) returns false\")\n\t}\n}", "func (task *Task) IsExpired() bool {\n\tswitch task.Schedule.Regularity {\n\tcase apiModels.OneTime, apiModels.Trigger:\n\t\treturn common.ValidTime(time.Now().UTC(), task.RunTimeUTC)\n\tcase apiModels.Recurrent:\n\t\treturn !common.ValidTime(task.Schedule.EndRunTime.UTC(), task.RunTimeUTC)\n\t}\n\treturn true\n}", "func (task *Task) IsRecurringlyScheduled() bool {\n\treturn task.Schedule.Regularity == apiModels.Recurrent && common.ValidTime(task.Schedule.EndRunTime.UTC(), task.RunTimeUTC)\n}", "func (m *MigrateManager) mayRecover() error {\n\t// It may be not need to do anything now.\n\treturn nil\n}", "func (c *VolumeController) shouldRestoreRecurringJobs(v *longhorn.Volume) bool {\n\tif v.Spec.FromBackup == \"\" || v.Spec.Standby || v.Status.RestoreInitiated {\n\t\treturn false\n\t}\n\n\tif v.Spec.RestoreVolumeRecurringJob == longhorn.RestoreVolumeRecurringJobEnabled {\n\t\treturn true\n\t}\n\n\tif v.Spec.RestoreVolumeRecurringJob == longhorn.RestoreVolumeRecurringJobDisabled {\n\t\treturn false\n\t}\n\n\t// Avoid recurring job restoration overrides the new recurring jobs added by users.\n\texistingJobs := datastore.MarshalLabelToVolumeRecurringJob(v.Labels)\n\tfor jobName, job := range existingJobs {\n\t\tif !job.IsGroup || jobName != longhorn.RecurringJobGroupDefault {\n\t\t\tc.logger.Warn(\"User already specified recurring jobs for this volume, cannot continue restoring recurring jobs from the backup volume labels\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\trestoringRecurringJobs, err := c.ds.GetSettingAsBool(types.SettingNameRestoreVolumeRecurringJobs)\n\tif err != nil {\n\t\tc.logger.WithError(err).Warnf(\"Failed to get %v setting\", types.SettingNameRestoreVolumeRecurringJobs)\n\t}\n\n\treturn restoringRecurringJobs\n}", "func immediateBackupBasename(now time.Time) string {\n\treturn \"task-scheduler-\" + now.UTC().Format(\"15:04:05\")\n}", "func (me TEventType) IsAssignmentRejected() bool { return me.String() == \"AssignmentRejected\" }", "func (c *Controller) shouldSkipProcessingChange(change client.ChangeInfo, lastProjectSyncTime time.Time) bool {\n\trevision := change.Revisions[change.CurrentRevision]\n\tif revision.Created.After(lastProjectSyncTime) {\n\t\treturn false\n\t}\n\n\tfor _, message := range currentMessages(change, lastProjectSyncTime) {\n\t\tif c.messageContainsJobTriggeringCommand(message) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (d *dmaasBackup) updateScheduleInfo(dbkp *v1alpha1.DMaaSBackup) error {\n\t// TODO\n\treturn nil\n}", "func (o *PaymentInitiationPayment) HasSchedule() bool {\n\tif o != nil && o.Schedule.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *BackupReconciler) instReady(ctx context.Context, ns, instName string, inst *v1alpha1.Instance) error {\n\tif err := r.Get(ctx, types.NamespacedName{Namespace: ns, Name: instName}, inst); err != nil {\n\t\tr.Log.Error(err, \"error finding instance for backup validation\")\n\t\treturn fmt.Errorf(\"error finding instance - %v\", err)\n\t}\n\tif !k8s.ConditionStatusEquals(k8s.FindCondition(inst.Status.Conditions, k8s.Ready), v1.ConditionTrue) {\n\t\tr.Log.Error(fmt.Errorf(\"instance not in ready state\"), \"Instance not in ready state for backup\", \"inst.Status.Conditions\", inst.Status.Conditions)\n\t\treturn errors.New(\"instance is not in a ready state\")\n\t}\n\treturn nil\n}", "func (q *UniqueQueue) trySchedule() {\n\tselect {\n\tcase q.readyChan <- struct{}{}:\n\tdefault:\n\t\tscope.Warnf(\"queue could not be scheduled (head=%v tail=%v depth=%v)\",\n\t\t\tq.head, q.tail, q.maxDepth)\n\t}\n}", "func checkExisting(ctx context.Context, rc *runcreator.Creator, combo combo, useTrigger func(*run.Triggers) *run.Trigger) (bool, time.Time, error) {\n\t// Check if Run about to be created already exists in order to detect avoid\n\t// infinite retries if CL triggers are somehow re-used.\n\texisting := run.Run{ID: rc.ExpectedRunID()}\n\tswitch err := datastore.Get(ctx, &existing); {\n\tcase err == datastore.ErrNoSuchEntity:\n\t\t// This is the expected case.\n\t\t// NOTE: actual creation may still fail due to a race, and that's fine.\n\t\treturn false, time.Time{}, nil\n\tcase err != nil:\n\t\treturn false, time.Time{}, errors.Annotate(err, \"failed to check for existing Run %q\", existing.ID).Tag(transient.Tag).Err()\n\tcase !run.IsEnded(existing.Status):\n\t\t// The Run already exists. Most likely another triager called from another\n\t\t// TQ was first. Check again in a few seconds, at which point PM should\n\t\t// incorporate existing Run into its state.\n\t\tlogging.Warningf(ctx, \"Run %q already exists. If this warning persists, there is a bug in PM which appears to not see this Run\", existing.ID)\n\t\treturn true, clock.Now(ctx).Add(5 * time.Second), nil\n\tdefault:\n\t\tsince := clock.Since(ctx, existing.EndTime)\n\t\tif since < time.Minute {\n\t\t\tlogging.Warningf(ctx, \"Recently finalized Run %q already exists, will check later\", existing.ID)\n\t\t\treturn true, existing.EndTime.Add(time.Minute), nil\n\t\t}\n\t\tlogging.Warningf(ctx, \"Run %q already exists, finalized %s ago; will purge CLs with reused triggers\", existing.ID, since)\n\t\tfor _, info := range combo.all {\n\t\t\tinfo.addPurgeReason(useTrigger(info.pcl.Triggers), &changelist.CLError{\n\t\t\t\tKind: &changelist.CLError_ReusedTrigger_{\n\t\t\t\t\tReusedTrigger: &changelist.CLError_ReusedTrigger{\n\t\t\t\t\t\tRun: string(existing.ID),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\treturn true, time.Time{}, nil\n\t}\n}", "func (me TEventType) IsAssignmentApproved() bool { return me.String() == \"AssignmentApproved\" }", "func CreateScheduledBackup(backupScheduleName, backupScheduleUID, schedulePolicyName, schedulePolicyUID string,\n\tinterval time.Duration, namespaces []string) (err error) {\n\tvar ctx context1.Context\n\tlabelSelectors := make(map[string]string)\n\tStep(fmt.Sprintf(\"Create scheduled backup %s of namespaces %v on cluster %s in organization %s\",\n\t\tbackupScheduleNamePrefix+backupScheduleName, namespaces, sourceClusterName, OrgID), func() {\n\t\tbackupDriver := Inst().Backup\n\n\t\t// Create a schedule policy\n\t\tschedulePolicyCreateRequest := &api.SchedulePolicyCreateRequest{\n\t\t\tCreateMetadata: &api.CreateMetadata{\n\t\t\t\tName: schedulePolicyName,\n\t\t\t\tUid: schedulePolicyUID,\n\t\t\t\tOrgId: OrgID,\n\t\t\t},\n\n\t\t\tSchedulePolicy: &api.SchedulePolicyInfo{\n\t\t\t\tInterval: &api.SchedulePolicyInfo_IntervalPolicy{\n\t\t\t\t\t// Retain 5 backups at a time for ease of inspection\n\t\t\t\t\tRetain: 5,\n\t\t\t\t\tMinutes: int64(interval / time.Minute),\n\t\t\t\t\tIncrementalCount: &api.SchedulePolicyInfo_IncrementalCount{\n\t\t\t\t\t\tCount: 0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\t//ctx, err = backup.GetPxCentralAdminCtx()\n\t\tctx, err = backup.GetAdminCtxFromSecret()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t_, err = backupDriver.CreateSchedulePolicy(ctx, schedulePolicyCreateRequest)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t// Create a backup schedule\n\t\tbkpScheduleCreateRequest := &api.BackupScheduleCreateRequest{\n\t\t\tCreateMetadata: &api.CreateMetadata{\n\t\t\t\tName: backupScheduleNamePrefix + backupScheduleName,\n\t\t\t\tUid: backupScheduleUID,\n\t\t\t\tOrgId: OrgID,\n\t\t\t},\n\n\t\t\tNamespaces: namespaces,\n\n\t\t\tReclaimPolicy: api.BackupScheduleInfo_Delete,\n\t\t\t// Name of Cluster\n\t\t\tCluster: sourceClusterName,\n\t\t\t// Label selectors to choose resources\n\t\t\tLabelSelectors: labelSelectors,\n\n\t\t\tSchedulePolicyRef: &api.ObjectRef{\n\t\t\t\tName: schedulePolicyName,\n\t\t\t\tUid: schedulePolicyUID,\n\t\t\t},\n\t\t\tBackupLocationRef: &api.ObjectRef{\n\t\t\t\tName: backupLocationName,\n\t\t\t\tUid: BackupLocationUID,\n\t\t\t},\n\t\t}\n\t\t//ctx, err = backup.GetPxCentralAdminCtx()\n\t\tctx, err = backup.GetAdminCtxFromSecret()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t_, err = backupDriver.CreateBackupSchedule(ctx, bkpScheduleCreateRequest)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t})\n\treturn err\n}", "func (m *EducationAssignment) GetDueDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.dueDateTime\n}", "func (scw *JobFuncWrapper) ensureNooneElseRunning(job *que.Job, tx *pgx.Tx, key string) (bool, error) {\n\tvar lastCompleted time.Time\n\tvar nextScheduled time.Time\n\terr := tx.QueryRow(\"SELECT last_completed, next_scheduled FROM cron_metadata WHERE id = $1 FOR UPDATE\", key).Scan(&lastCompleted, &nextScheduled)\n\tif err != nil {\n\t\tif err == pgx.ErrNoRows {\n\t\t\t_, err = tx.Exec(\"INSERT INTO cron_metadata (id) VALUES ($1)\", key)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\treturn false, ErrImmediateReschedule\n\t\t}\n\t\treturn false, err\n\t}\n\n\tif time.Now().Before(nextScheduled) {\n\t\tvar futureJobs int\n\t\t// make sure we don't regard ourself as a future job. Sometimes clock skew makes us think we can't run yet.\n\t\terr = tx.QueryRow(\"SELECT count(*) FROM que_jobs WHERE job_class = $1 AND args::jsonb = $2::jsonb AND run_at >= $3 AND job_id != $4\", job.Type, job.Args, nextScheduled, job.ID).Scan(&futureJobs)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tif futureJobs > 0 {\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn false, scw.QC.EnqueueInTx(&que.Job{\n\t\t\tType: job.Type,\n\t\t\tArgs: job.Args,\n\t\t\tRunAt: nextScheduled,\n\t\t}, tx)\n\t}\n\n\t// Continue\n\treturn true, nil\n}", "func (b bot) scheduleNotify(id int64) {\n\tif b.notifyTimers == nil {\n\t\treturn\n\t}\n\n\tisSubscribed, err := b.store.IsSubscribed(id)\n\tif err != nil {\n\t\tb.err.Println(err)\n\t\treturn\n\t}\n\tif !isSubscribed {\n\t\treturn\n\t}\n\n\tif timer := b.notifyTimers[id]; timer != nil {\n\t\t// Don't care if timer is active or not\n\t\t_ = timer.Stop()\n\t}\n\tu := b.getUser(id)\n\td, count, err := b.store.GetNotifyTime(id, u.Timezone())\n\tif err != nil {\n\t\tb.err.Println(err)\n\t\treturn\n\t}\n\tif count <= 1 {\n\t\treturn\n\t}\n\n\tb.info.Printf(\"Notify %d in %s with %d due studies\", id, d.String(), count)\n\tb.notifyTimers[id] = time.AfterFunc(d, func() {\n\t\tb.notify(id, count)\n\t})\n}", "func (o *PaymentInitiationPayment) GetScheduleOk() (*ExternalPaymentScheduleGet, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Schedule.Get(), o.Schedule.IsSet()\n}", "func (o *Run) HasScheduledFor() bool {\n\tif o != nil && o.ScheduledFor != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func wasRunAfter(p1 PlanStatus, p2 PlanStatus) bool {\n\tif p1.Status == ExecutionNeverRun || p2.Status == ExecutionNeverRun || p1.LastUpdatedTimestamp == nil || p2.LastUpdatedTimestamp == nil {\n\t\treturn false\n\t}\n\treturn p1.LastUpdatedTimestamp.Time.After(p2.LastUpdatedTimestamp.Time)\n}", "func (m *EducationAssignment) SetDueDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n m.dueDateTime = value\n}", "func (b *BackuPOT) needBackup(remotePath remotePath, newFileInfo *RemoteFileInfo) (bool, error) {\n // get remote file info\n fileInfo, err := b.getRemoteFileInfo(remotePath, -1)\n if err != nil {\n // check err kind.\n if !strings.HasPrefix(err.Error(), \"The key doesn't exist.\") {\n return false, backupotDebug.Error(err)\n } else {\n return true, nil\n }\n }\n if fileInfo.EncodedHash != newFileInfo.EncodedHash {\n return true, nil\n }\n return false, nil\n}", "func (action *scheduleRoutineAction) CanHandle(build *v1.Build) bool {\n\treturn build.Status.Phase == v1.BuildPhaseScheduling\n}", "func isNewWorker(worker *workerv1.Worker, currentDeployment *appsv1.Deployment) bool {\n\treturn currentDeployment == nil && worker.DeletionTimestamp == nil\n}", "func (o *InlineResponse20051TodoItems) SetDueDateBase(v string) {\n\to.DueDateBase = &v\n}", "func (tbbsd TimeBasedBackupScheduleDescription) AsFrequencyBasedBackupScheduleDescription() (*FrequencyBasedBackupScheduleDescription, bool) {\n\treturn nil, false\n}", "func (me TAssignmentStatus) IsRejected() bool { return me.String() == \"Rejected\" }", "func TestInitialDateTimeChecks3(t *testing.T) {\n\n\texpected := false\n\n\tcurrDate := time.Now().Format(\"2006-01-02\")\n\tbeforeRestaurantOpenCheck, _ := restaurantBooking.InitialDateTimeChecks(currDate, \"12:00\")\n\tafterRestaurantOpenCheck, _ := restaurantBooking.InitialDateTimeChecks(currDate, \"22:00\")\n\n\tif (beforeRestaurantOpenCheck && afterRestaurantOpenCheck) != expected {\n\t\tt.Fail()\n\t}\n}", "func (a *account) managedNeedsToRefill(target types.Currency) bool {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\treturn a.availableBalance().Cmp(target) < 0\n}", "func (d *Deleter) ShouldSkipThis(workItem *registry.WorkItem) bool {\n\n\t// It's possible that another worker recently marked this as\n\t// \"do not retry.\" If that's the case, skip it.\n\tif !d.ShouldRetry(workItem) {\n\t\treturn true\n\t}\n\n\t// Definitely don't delete this if it's not a deletion request.\n\tif HasWrongAction(d.Context, workItem, constants.ActionDelete) {\n\t\treturn true\n\t}\n\n\t// Do not proceed without the approval of institutional admin.\n\tif d.MissingRequiredApproval(workItem) {\n\t\treturn true\n\t}\n\n\t// Occasionally, NSQ will think an item has timed out because\n\t// it took a long time to record. NSQ sends it to a new worker\n\t// after the original worker has completed it.\n\tif workItem.ProcessingHasCompleted() {\n\t\tmessage := fmt.Sprintf(\"Rejecting WorkItem %d because status is %s\", workItem.ID, workItem.Status)\n\t\td.Context.Logger.Info(message)\n\t\treturn true\n\t}\n\n\t// Note that returning nil tells NSQ that a worker is\n\t// working on this item, even if it's not us. We don't\n\t// want to requeue duplicates, and we don't want to return\n\t// an error, because that's equivalent to FIN/failed.\n\tif d.OtherWorkerIsHandlingThis(workItem) {\n\t\treturn true\n\t}\n\n\t// See if this worker is already processing this item.\n\t// This happens sometimes when NSQ thinks the item has\n\t// timed out while a worker is validating or storing\n\t// an object.\n\tif d.ImAlreadyProcessingThis(workItem) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (obj *expense) HasRemaining() bool {\n\treturn obj.remaining != nil\n}", "func waitForDeployToProcess(currentVersion time.Time, name, ip string) bool {\n\tebo := backoff.NewExponentialBackOff()\n\tebo.MaxElapsedTime = 10 * time.Second\n\tdeployError := backoff.Retry(safe.OperationWithRecover(func() error {\n\t\t// Configuration should have deployed successfully, confirm version match.\n\t\tnewVersion, exists, newErr := getDeployedVersion(ip)\n\t\tif newErr != nil {\n\t\t\treturn fmt.Errorf(\"could not get newly deployed configuration version: %v\", newErr)\n\t\t}\n\t\tif exists {\n\t\t\tif currentVersion.Equal(newVersion) {\n\t\t\t\t// The version we are trying to deploy is confirmed.\n\t\t\t\t// Return nil, to break out of the ebo.\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"deployment was not successful\")\n\t}), ebo)\n\n\tif deployError == nil {\n\t\t// The version we are trying to deploy is confirmed.\n\t\t// Return true, so that it will be removed from the deploy queue.\n\t\tlog.Debugf(\"Successfully deployed version for pod %s: %s\", name, currentVersion)\n\t\treturn true\n\t}\n\treturn false\n}", "func (m *AgedAccountsPayable) SetBalanceDue(value *float64)() {\n err := m.GetBackingStore().Set(\"balanceDue\", value)\n if err != nil {\n panic(err)\n }\n}", "func (bsd BackupScheduleDescription) AsBasicBackupScheduleDescription() (BasicBackupScheduleDescription, bool) {\n\treturn &bsd, true\n}", "func (dt DefaultTrigger) IsTriggered(times interface{}, user interface{}) bool {\n\treturn true\n}", "func (dispatcher *Dispatcher) shouldPublish(update StatusUpdate) bool {\n\tpingerName := update.Name\n\t// state transistions are always to be published\n\tif statusChanged(update.Status) {\n\t\tlog.Debugf(\"state transition on [%s]\", pingerName)\n\t\treturn true\n\t}\n\n\t// if not a state transition, we only alert of error states in\n\t// case the reminder delay has passed since the last alert.\n\tif update.Status.LatestResult.Status == ping.StatusNOK {\n\t\tif lastAlert, ok := dispatcher.alertHistory[pingerName]; ok {\n\t\t\ttimeUntilReminder := dispatcher.reminderDelay - time.Since(lastAlert)\n\t\t\tlog.Debugf(\"time until reminder for [%s]: %s\", pingerName, timeUntilReminder.String())\n\t\t\treturn timeUntilReminder <= 0\n\t\t}\n\t}\n\n\treturn false\n}", "func IsFileReadyToUpload(regex, fname string, now time.Time) (ok bool, err error) {\n\tr := regexp.MustCompile(regex)\n\tsubS := r.FindStringSubmatch(fname)\n\n\tif len(subS) < 2 {\n\t\treturn false, nil\n\t}\n\n\tlastFinishedBackupFileBeforeHours := 35.0 // 24 + 11,last flush occurred at 10:00 CST\n\tt, err := time.Parse(\"20060102-0700\", subS[1]+\"+0800\")\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"parse file time error\")\n\t}\n\n\tif now.Sub(t).Hours() <= lastFinishedBackupFileBeforeHours {\n\t\treturn false, nil\n\t}\n\n\treturn true, nil\n}", "func (m *Manager) currentShouldChange(milestonePayload *iotago.Milestone) bool {\n\tm.pendingLock.RLock()\n\tdefer m.pendingLock.RUnlock()\n\n\tif len(m.pending) == 0 {\n\t\treturn false\n\t}\n\n\tnext := m.pending[0]\n\n\tswitch {\n\tcase next.TargetMilestoneIndex == milestonePayload.Index+1:\n\t\tif !m.SupportedVersions().Supports(next.ProtocolVersion) {\n\t\t\tm.Events.NextMilestoneUnsupported.Trigger(next)\n\t\t}\n\n\t\treturn false\n\tcase next.TargetMilestoneIndex > milestonePayload.Index:\n\t\treturn false\n\tdefault:\n\t\treturn true\n\t}\n}", "func (cl *Client) prepareToday() error {\n\tboard, err := BoardFor(cl.Member, \"Kanban daily/weekly\")\n\tif err != nil {\n\t\t// handle error\n\t\treturn err\n\t}\n\tfmt.Println(\"Kanban board is \", board.ID)\n\tfor _, boardlist := range []string{\"Today\"} {\n\t\tfmt.Printf(\"move items from %s to backlog based on label color\\n\", boardlist)\n\n\t\tlist, err := ListFor(cl, \"Kanban daily/weekly\", boardlist)\n\t\tif err != nil {\n\t\t\t// handle error\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"kanban/%s is %v\", boardlist, list)\n\t\tcards, err := list.GetCards(trello.Defaults())\n\t\tif err != nil {\n\t\t\t// handle error\n\t\t\treturn err\n\t\t}\n\t\tfor _, card := range cards {\n\t\t\tfmt.Println(card.Name, card.Labels)\n\t\t\tmoveBackCard(cl, card)\n\t\t}\n\t}\n\treturn nil\n}", "func (ti TaskInstance) IsScheduled() bool {\n\tvar disabledCount int\n\n\tfor _, status := range ti.Statuses {\n\t\tif status == statuses.TaskInstanceDisabled {\n\t\t\tdisabledCount++\n\t\t\tcontinue\n\t\t}\n\n\t\tif status == statuses.TaskInstanceScheduled {\n\t\t\t// FIX: RMM-36676\n\t\t\treturn true\n\t\t}\n\t\tbreak\n\t}\n\treturn len(ti.Statuses) == disabledCount\n}", "func wasShootRescheduledToNewSeed(shoot *gardencorev1beta1.Shoot) bool {\n\treturn shoot.Status.LastOperation != nil &&\n\t\tshoot.Status.LastOperation.Type != gardencorev1beta1.LastOperationTypeMigrate &&\n\t\tshoot.Spec.SeedName != nil &&\n\t\tshoot.Status.SeedName != nil &&\n\t\t*shoot.Spec.SeedName != *shoot.Status.SeedName\n}" ]
[ "0.5760196", "0.5610772", "0.52594167", "0.5190598", "0.51561713", "0.5043613", "0.4985795", "0.4985035", "0.49514583", "0.4903711", "0.49007374", "0.4899634", "0.48967138", "0.48667654", "0.485368", "0.4840095", "0.48217595", "0.4819338", "0.4814378", "0.48026362", "0.4792456", "0.47820652", "0.47527525", "0.47492683", "0.47130176", "0.47026676", "0.46930146", "0.46923906", "0.46807578", "0.46673527", "0.4664804", "0.46602824", "0.46538973", "0.4647935", "0.46400768", "0.4635183", "0.46338716", "0.46294338", "0.46153674", "0.4613282", "0.46092772", "0.46034703", "0.46007493", "0.45896587", "0.4581455", "0.45787677", "0.45760038", "0.4571078", "0.45403713", "0.4530912", "0.4529411", "0.4527197", "0.45231557", "0.45179525", "0.4512306", "0.45114574", "0.44921428", "0.44918483", "0.44900033", "0.44836354", "0.44797194", "0.44788036", "0.4459191", "0.44477752", "0.44425923", "0.44338495", "0.44337702", "0.44268695", "0.44227886", "0.44213346", "0.44201908", "0.4419723", "0.44168484", "0.44162926", "0.44124776", "0.44090563", "0.4407962", "0.43979472", "0.4397493", "0.43956506", "0.43932888", "0.4391585", "0.43850753", "0.43828523", "0.43727493", "0.4370326", "0.43623298", "0.43578392", "0.4354537", "0.43525562", "0.43515486", "0.43446803", "0.43428105", "0.43420082", "0.4340055", "0.43398383", "0.43324184", "0.43319032", "0.43279403", "0.4323148" ]
0.7543842
0
submitBackup create a backup from schedule.
submitBackup создает резервную копию по расписанию.
func (c *scheduleReconciler) submitBackup(ctx context.Context, schedule *velerov1.Schedule) error { c.logger.WithField("schedule", schedule.Namespace+"/"+schedule.Name).Info("Schedule is due, going to submit backup.") now := c.clock.Now() // Don't attempt to "catch up" if there are any missed or failed runs - simply // trigger a Backup if it's time. backup := getBackup(schedule, now) if err := c.Create(ctx, backup); err != nil { return errors.Wrap(err, "error creating Backup") } original := schedule.DeepCopy() schedule.Status.LastBackup = &metav1.Time{Time: now} if err := c.Patch(ctx, schedule, client.MergeFrom(original)); err != nil { return errors.Wrapf(err, "error updating Schedule's LastBackup time to %v", schedule.Status.LastBackup) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func createBackup(w http.ResponseWriter, r *http.Request) {\n\tlogrus.Infof(\">>>>CreateBackup r=%s\", r)\n\n\tif RunningBackupAPIID != \"\" {\n\t\tlogrus.Infof(\"Another backup id %s is already running. Aborting.\", RunningBackupAPIID)\n\t\thttp.Error(w, fmt.Sprintf(\"Another backup id %s is already running. Aborting.\", RunningBackupAPIID), http.StatusConflict)\n\t\treturn\n\t}\n\n\tRunningBackupAPIID = createAPIID()\n\tCurrentBackupStartTime = time.Now()\n\n\t//run backup assyncronouslly\n\tgo runBackup(RunningBackupAPIID)\n\n\tsendSchellyResponse(RunningBackupAPIID, \"\", \"running\", \"backup triggered\", -1, http.StatusAccepted, w)\n}", "func CreateScheduledBackup(backupScheduleName, backupScheduleUID, schedulePolicyName, schedulePolicyUID string,\n\tinterval time.Duration, namespaces []string) (err error) {\n\tvar ctx context1.Context\n\tlabelSelectors := make(map[string]string)\n\tStep(fmt.Sprintf(\"Create scheduled backup %s of namespaces %v on cluster %s in organization %s\",\n\t\tbackupScheduleNamePrefix+backupScheduleName, namespaces, sourceClusterName, OrgID), func() {\n\t\tbackupDriver := Inst().Backup\n\n\t\t// Create a schedule policy\n\t\tschedulePolicyCreateRequest := &api.SchedulePolicyCreateRequest{\n\t\t\tCreateMetadata: &api.CreateMetadata{\n\t\t\t\tName: schedulePolicyName,\n\t\t\t\tUid: schedulePolicyUID,\n\t\t\t\tOrgId: OrgID,\n\t\t\t},\n\n\t\t\tSchedulePolicy: &api.SchedulePolicyInfo{\n\t\t\t\tInterval: &api.SchedulePolicyInfo_IntervalPolicy{\n\t\t\t\t\t// Retain 5 backups at a time for ease of inspection\n\t\t\t\t\tRetain: 5,\n\t\t\t\t\tMinutes: int64(interval / time.Minute),\n\t\t\t\t\tIncrementalCount: &api.SchedulePolicyInfo_IncrementalCount{\n\t\t\t\t\t\tCount: 0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\t//ctx, err = backup.GetPxCentralAdminCtx()\n\t\tctx, err = backup.GetAdminCtxFromSecret()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t_, err = backupDriver.CreateSchedulePolicy(ctx, schedulePolicyCreateRequest)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\t// Create a backup schedule\n\t\tbkpScheduleCreateRequest := &api.BackupScheduleCreateRequest{\n\t\t\tCreateMetadata: &api.CreateMetadata{\n\t\t\t\tName: backupScheduleNamePrefix + backupScheduleName,\n\t\t\t\tUid: backupScheduleUID,\n\t\t\t\tOrgId: OrgID,\n\t\t\t},\n\n\t\t\tNamespaces: namespaces,\n\n\t\t\tReclaimPolicy: api.BackupScheduleInfo_Delete,\n\t\t\t// Name of Cluster\n\t\t\tCluster: sourceClusterName,\n\t\t\t// Label selectors to choose resources\n\t\t\tLabelSelectors: labelSelectors,\n\n\t\t\tSchedulePolicyRef: &api.ObjectRef{\n\t\t\t\tName: schedulePolicyName,\n\t\t\t\tUid: schedulePolicyUID,\n\t\t\t},\n\t\t\tBackupLocationRef: &api.ObjectRef{\n\t\t\t\tName: backupLocationName,\n\t\t\t\tUid: BackupLocationUID,\n\t\t\t},\n\t\t}\n\t\t//ctx, err = backup.GetPxCentralAdminCtx()\n\t\tctx, err = backup.GetAdminCtxFromSecret()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t_, err = backupDriver.CreateBackupSchedule(ctx, bkpScheduleCreateRequest)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t})\n\treturn err\n}", "func (p *AuroraAdminClient) PerformBackup(ctx context.Context) (r *Response, err error) {\n var _args321 AuroraAdminPerformBackupArgs\n var _result322 AuroraAdminPerformBackupResult\n if err = p.Client_().Call(ctx, \"performBackup\", &_args321, &_result322); err != nil {\n return\n }\n return _result322.GetSuccess(), nil\n}", "func (p *AuroraAdminClient) PerformBackup(ctx context.Context) (r *Response, err error) {\n var _args371 AuroraAdminPerformBackupArgs\n var _result372 AuroraAdminPerformBackupResult\n var meta thrift.ResponseMeta\n meta, err = p.Client_().Call(ctx, \"performBackup\", &_args371, &_result372)\n p.SetLastResponseMeta_(meta)\n if err != nil {\n return\n }\n return _result372.GetSuccess(), nil\n}", "func (f *FakeInstance) SetBackupSchedule(_ context.Context, _ string, _ *govultr.BackupScheduleReq) (*http.Response, error) {\n\tpanic(\"implement me\")\n}", "func CreateBackup(serviceID string, settings *models.Settings) *models.Task {\n\tbackup := map[string]string{\n\t\t\"archiveType\": \"cf\",\n\t\t\"encryptionType\": \"aes\",\n\t}\n\tb, err := json.Marshal(backup)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\tresp := httpclient.Post(b, fmt.Sprintf(\"%s/v1/environments/%s/services/%s/backup\", settings.PaasHost, settings.EnvironmentID, serviceID), true, settings)\n\tvar m map[string]string\n\tjson.Unmarshal(resp, &m)\n\treturn &models.Task{\n\t\tID: m[\"taskId\"],\n\t}\n}", "func (i *InstanceServiceHandler) SetBackupSchedule(ctx context.Context, instanceID string, backup *BackupScheduleReq) error {\n\turi := fmt.Sprintf(\"%s/%s/backup-schedule\", instancePath, instanceID)\n\treq, err := i.client.NewRequest(ctx, http.MethodPost, uri, backup)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn i.client.DoWithContext(ctx, req, nil)\n}", "func CreateBackup(service *pgCommon.PostgresServiceInformations) error {\n\tresp, err := service.PgoApi.CreateBackup(&msgs.CreateBackrestBackupRequest{\n\t\tNamespace: service.ClusterInstance.Namespace,\n\t\tSelector: \"name=\" + service.ClusterInstance.Name,\n\t})\n\n\tif err != nil {\n\t\tlogger.RError(err, \"Unable to progress create backup action for database \"+service.ClusterInstance.Name)\n\t}\n\n\t_ = resp\n\treturn err\n}", "func (ctl Controller) Backup() *pitr.Error {\n\tstdout, stderr, err := ctl.runner.Run(\"sudo --login --user postgres wal-g backup-push %s\", ctl.cluster.DataDirectory())\n\n\tif err != nil {\n\t\treturn &pitr.Error{\n\t\t\tMessage: err.Error(),\n\t\t\tStdout: stdout,\n\t\t\tStderr: stderr,\n\t\t}\n\t}\n\n\treturn nil\n}", "func CreateBackupAction(service *pgCommon.PostgresServiceInformations) action.IAction {\n\treturn action.FormAction{\n\t\tName: \"Backup\",\n\t\tUniqueCommand: \"cmd_pg_create_backup\",\n\t\tPlaceholder: nil,\n\t\tActionExecuteCallback: func(placeholder interface{}) (interface{}, error) {\n\t\t\treturn nil, CreateBackup(service)\n\t\t},\n\t}\n}", "func (client CloudEndpointsClient) PostBackupSender(req *http.Request) (future CloudEndpointsPostBackupFuture, err error) {\n\tvar resp *http.Response\n\tfuture.FutureAPI = &azure.Future{}\n\tresp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n\tif err != nil {\n\t\treturn\n\t}\n\tvar azf azure.Future\n\tazf, err = azure.NewFutureFromResponse(resp)\n\tfuture.FutureAPI = &azf\n\tfuture.Result = future.result\n\treturn\n}", "func (t *Task) buildBackup(client k8sclient.Client, backupTypePrefix string) (*velero.Backup, error) {\n\tvar includeClusterResources *bool = nil\n\tannotations, err := t.getAnnotations(client)\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tbackupLocation, err := t.getBSL()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tsnapshotLocation, err := t.getVSL()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\n\t// Construct a restore name like \"$migrationname-54823-initial\" or \"$migrationname-54823-stage\".\n\t// This will produce a 57 character string max. Note that generateName gracefully handles strings >63 char.\n\tfmtString := fmt.Sprintf(\"%%.%ds\", 55-len(backupTypePrefix))\n\tmigrationNameTruncated := fmt.Sprintf(fmtString, t.Owner.GetName())\n\ttruncatedGenerateName := fmt.Sprintf(\"%s-%s-\", migrationNameTruncated, backupTypePrefix)\n\n\tbackup := &velero.Backup{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tLabels: t.Owner.GetCorrelationLabels(),\n\t\t\tGenerateName: truncatedGenerateName,\n\t\t\tNamespace: migapi.VeleroNamespace,\n\t\t\tAnnotations: annotations,\n\t\t},\n\t\tSpec: velero.BackupSpec{\n\t\t\tIncludeClusterResources: includeClusterResources,\n\t\t\tStorageLocation: backupLocation.Name,\n\t\t\tVolumeSnapshotLocations: []string{snapshotLocation.Name},\n\t\t\tTTL: metav1.Duration{Duration: 720 * time.Hour},\n\t\t\tIncludedNamespaces: t.sourceNamespaces(),\n\t\t\tHooks: velero.BackupHooks{\n\t\t\t\tResources: []velero.BackupResourceHookSpec{},\n\t\t\t},\n\t\t},\n\t}\n\treturn backup, nil\n}", "func (f *FakeInstance) GetBackupSchedule(_ context.Context, _ string) (*govultr.BackupSchedule, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (client CloudEndpointsClient) PostBackup(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest) (result CloudEndpointsPostBackupFuture, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/CloudEndpointsClient.PostBackup\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.FutureAPI != nil && result.FutureAPI.Response() != nil {\n\t\t\t\tsc = result.FutureAPI.Response().StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"storagesync.CloudEndpointsClient\", \"PostBackup\", err.Error())\n\t}\n\n\treq, err := client.PostBackupPreparer(ctx, resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"storagesync.CloudEndpointsClient\", \"PostBackup\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresult, err = client.PostBackupSender(req)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"storagesync.CloudEndpointsClient\", \"PostBackup\", result.Response(), \"Failure sending request\")\n\t\treturn\n\t}\n\n\treturn\n}", "func CreateBackup(conTimeout, reqTimeout time.Duration, _ cli.FormatWriter) (*api.CreateBackupResponse, error) {\n\tcon, ctx, cancel, err := newCon(conTimeout, reqTimeout)\n\tdefer cancel()\n\n\tif err != nil {\n\t\treturn &api.CreateBackupResponse{}, status.Wrap(\n\t\t\terr,\n\t\t\tstatus.DeploymentServiceUnreachableError,\n\t\t\t\"Connection to deployment-service failed\",\n\t\t)\n\t}\n\n\tres, err := con.CreateBackup(ctx, &api.CreateBackupRequest{})\n\tif err != nil {\n\t\terr = status.Wrap(\n\t\t\terr,\n\t\t\tstatus.DeploymentServiceCallError,\n\t\t\t\"Request to create a backup failed\",\n\t\t)\n\t}\n\n\treturn res, err\n}", "func SetupBackup(testName string) {\n\tlogrus.Infof(\"Backup driver: %v\", Inst().Backup)\n\tprovider := GetProvider()\n\tlogrus.Infof(\"Run Setup backup with object store provider: %s\", provider)\n\tOrgID = \"default\"\n\tBucketName = fmt.Sprintf(\"%s-%s\", BucketNamePrefix, Inst().InstanceID)\n\tCloudCredUID = uuid.New()\n\t//cloudCredUID = \"5a48be84-4f63-40ae-b7f1-4e4039ab7477\"\n\tBackupLocationUID = uuid.New()\n\t//backupLocationUID = \"64d908e7-40cf-4c9e-a5cf-672e955fd0ca\"\n\n\tCreateBucket(provider, BucketName)\n\tCreateOrganization(OrgID)\n\tCreateCloudCredential(provider, CredName, CloudCredUID, OrgID)\n\tCreateBackupLocation(provider, backupLocationName, BackupLocationUID, CredName, CloudCredUID, BucketName, OrgID)\n\tCreateSourceAndDestClusters(CredName, OrgID)\n}", "func (b *gsDBBackup) backupDB(now time.Time, basename string) (err error) {\n\t// We expect TMPDIR to be set to a location that can store a large file at\n\t// high throughput.\n\ttempdir, err := ioutil.TempDir(\"\", \"dbbackup\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer util.RemoveAll(tempdir)\n\ttempfilename := path.Join(tempdir, fmt.Sprintf(\"%s.%s\", basename, DB_FILE_NAME_EXTENSION))\n\n\tmodTime, err := b.db.GetIncrementalBackupTime()\n\tif err != nil {\n\t\tglog.Warningf(\"Error getting DB incremental backup time; using current time instead. %s\", err)\n\t\tmodTime = now\n\t}\n\tif err := b.writeDBBackupToFile(tempfilename); err != nil {\n\t\treturn err\n\t}\n\tbucket := b.gsClient.Bucket(b.gsBucket)\n\tobjectname := fmt.Sprintf(\"%s/%s/%s.%s\", DB_BACKUP_DIR, now.UTC().Format(\"2006/01/02\"), basename, DB_FILE_NAME_EXTENSION)\n\tif err := uploadFile(b.ctx, tempfilename, bucket, objectname, modTime); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func performBackup() (int, error) {\n\ttime.Sleep(1 * time.Second)\n\treturn 42, nil\n}", "func (t *Task) ensureStageBackup() (*velero.Backup, error) {\n\tbackup, err := t.getStageBackup()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tif backup != nil {\n\t\treturn backup, nil\n\t}\n\n\tclient, err := t.getSourceClient()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tt.Log.Info(\"Building Stage Velero Backup resource definition\")\n\tnewBackup, err := t.buildBackup(client, \"stage\")\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tlabelSelector := metav1.LabelSelector{\n\t\tMatchLabels: map[string]string{\n\t\t\tmigapi.IncludedInStageBackupLabel: t.UID(),\n\t\t},\n\t}\n\tnewBackup.Labels[migapi.StageBackupLabel] = t.UID()\n\tnewBackup.Labels[migapi.MigMigrationDebugLabel] = t.Owner.Name\n\tnewBackup.Labels[migapi.MigPlanDebugLabel] = t.Owner.Spec.MigPlanRef.Name\n\tnewBackup.Labels[migapi.MigMigrationLabel] = string(t.Owner.UID)\n\tnewBackup.Labels[migapi.MigPlanLabel] = string(t.PlanResources.MigPlan.UID)\n\tvar includedResources mapset.Set\n\n\tif (t.indirectImageMigration() || Settings.DisImgCopy) && !t.migrateState() {\n\t\tincludedResources = settings.IncludedStageResources\n\t} else {\n\t\tincludedResources = settings.IncludedStageResources.Difference(mapset.NewSetFromSlice([]interface{}{settings.ISResource}))\n\t}\n\tnewBackup.Spec.IncludedResources = toStringSlice(includedResources.Difference(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.ExcludedResources = toStringSlice(settings.ExcludedStageResources.Union(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.LabelSelector = &labelSelector\n\tif Settings.DisImgCopy {\n\t\tif newBackup.Annotations == nil {\n\t\t\tnewBackup.Annotations = map[string]string{}\n\t\t}\n\t\tnewBackup.Annotations[migapi.DisableImageCopy] = strconv.FormatBool(Settings.DisImgCopy)\n\t}\n\tt.Log.Info(\"Creating Stage Velero Backup on source cluster.\",\n\t\t\"backup\", path.Join(newBackup.Namespace, newBackup.Name))\n\terr = client.Create(context.TODO(), newBackup)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newBackup, nil\n}", "func WaitForScheduledBackup(backupScheduleName string, retryInterval time.Duration, timeout time.Duration) (*api.BackupObject, error) {\n\tbeginTime := time.Now()\n\tbeginTimeSec := beginTime.Unix()\n\n\tt := func() (interface{}, bool, error) {\n\t\tlogrus.Infof(\"Enumerating backups\")\n\t\tbkpEnumerateReq := &api.BackupEnumerateRequest{\n\t\t\tOrgId: OrgID}\n\t\t//ctx, err := backup.GetPxCentralAdminCtx()\n\t\tctx, err := backup.GetAdminCtxFromSecret()\n\t\tif err != nil {\n\t\t\treturn nil, true, err\n\t\t}\n\t\tcurBackups, err := Inst().Backup.EnumerateBackup(ctx, bkpEnumerateReq)\n\t\tif err != nil {\n\t\t\treturn nil, true, err\n\t\t}\n\t\tfor _, bkp := range curBackups.GetBackups() {\n\t\t\tcreateTime := bkp.GetCreateTime()\n\t\t\tif beginTimeSec > createTime.GetSeconds() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif (bkp.GetStatus().GetStatus() == api.BackupInfo_StatusInfo_Success ||\n\t\t\t\tbkp.GetStatus().GetStatus() == api.BackupInfo_StatusInfo_PartialSuccess) &&\n\t\t\t\tbkp.GetBackupSchedule().GetName() == backupScheduleName {\n\t\t\t\treturn bkp, false, nil\n\t\t\t}\n\t\t}\n\t\terr = fmt.Errorf(\"unable to find backup from backup schedule with name %s after time %v\",\n\t\t\tbackupScheduleName, beginTime)\n\t\treturn nil, true, err\n\t}\n\n\tbkpInterface, err := task.DoRetryWithTimeout(t, timeout, retryInterval)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbkp := bkpInterface.(*api.BackupObject)\n\treturn bkp, nil\n\n}", "func TestBackup(t *testing.T) {\n\tt.Run(\"with failing operations\", func(t *testing.T) {\n\t\texec, bctx, _ := testBackupExecutor(t, testFailSyncSpec)\n\n\t\terr := exec.Backup(bctx)\n\n\t\trequire.Error(t, err, \"returns an error of a sync operation fails\")\n\t\tassert.Contains(t, \"test operation failed\", err.Error())\n\t})\n\n\tt.Run(\"with successful operations\", func(t *testing.T) {\n\t\texec, bctx, _ := testBackupExecutor(t, testSuccessSpec)\n\n\t\trequire.NoError(t, exec.Backup(bctx))\n\t})\n\n\tt.Run(\"timeout doesn't hang\", func(t *testing.T) {\n\t\texec, bctx, _ := testBackupExecutorWithTimeout(t, testSuccessSpec, 0)\n\n\t\terr := exec.Backup(bctx)\n\t\trequire.Error(t, err, \"a timeout has happened\")\n\t\tassert.Contains(t, err.Error(), \"context deadline exceeded\")\n\t})\n}", "func (b *BackupJob) Run() {\n\tb.Log.Info(fmt.Sprintf(\"Kick off backup job for %s/%s...\", b.Instance.Namespace, b.Instance.Name))\n\tctx := context.Background()\n\tinstance := mysqlv1alpha1.Instance{}\n\tif err := b.Client.Get(ctx, b.Instance, &instance); err != nil {\n\t\tb.Log.Info(fmt.Sprintf(\"job for %s/%s failed. Could not access instance...\", b.Instance.Namespace, b.Instance.Name))\n\t\treturn\n\t}\n\tb.Log.Info(fmt.Sprintf(\"job for %s/%s succeeded...\", b.Instance.Namespace, b.Instance.Name))\n\tbackupName := fmt.Sprintf(\"%s-backup-%s\", instance.Name, time.Now().Format(\"20060102-150405\"))\n\tbackup := &mysqlv1alpha1.Backup{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: backupName,\n\t\t\tNamespace: instance.Namespace,\n\t\t},\n\t\tSpec: mysqlv1alpha1.BackupSpec{\n\t\t\tStore: instance.Spec.BackupSchedule.Store,\n\t\t\tInstance: instance.Name,\n\t\t},\n\t}\n\tif err := controllerutil.SetControllerReference(&instance, backup, b.Scheme); err != nil {\n\t\tb.Log.Info(fmt.Sprintf(\"Error registering backup %s/%s with instance %s\", instance.Namespace, backupName, instance.Name))\n\t\treturn\n\t}\n\tif err := b.Client.Create(ctx, backup); err != nil {\n\t\tb.Log.Info(fmt.Sprintf(\"Error creating backup %s/%s for instance %s\", instance.Namespace, backupName, instance.Name))\n\t\treturn\n\t}\n\tb.Log.Info(fmt.Sprintf(\"Backup %s/%s for instance %s successfully created\", instance.Namespace, backupName, instance.Name))\n}", "func generateBackupJobSpecIntent(postgresCluster *v1beta1.PostgresCluster,\n\trepo v1beta1.PGBackRestRepo, serviceAccountName string,\n\tlabels, annotations map[string]string, opts ...string) (*batchv1.JobSpec, error) {\n\n\tselector, containerName, err := getPGBackRestExecSelector(postgresCluster, repo)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\trepoIndex := regexRepoIndex.FindString(repo.Name)\n\tcmdOpts := []string{\n\t\t\"--stanza=\" + pgbackrest.DefaultStanzaName,\n\t\t\"--repo=\" + repoIndex,\n\t}\n\tcmdOpts = append(cmdOpts, opts...)\n\n\tcontainer := corev1.Container{\n\t\tCommand: []string{\"/opt/crunchy/bin/pgbackrest\"},\n\t\tEnv: []corev1.EnvVar{\n\t\t\t{Name: \"COMMAND\", Value: \"backup\"},\n\t\t\t{Name: \"COMMAND_OPTS\", Value: strings.Join(cmdOpts, \" \")},\n\t\t\t{Name: \"COMPARE_HASH\", Value: \"true\"},\n\t\t\t{Name: \"CONTAINER\", Value: containerName},\n\t\t\t{Name: \"NAMESPACE\", Value: postgresCluster.GetNamespace()},\n\t\t\t{Name: \"SELECTOR\", Value: selector.String()},\n\t\t},\n\t\tImage: config.PGBackRestContainerImage(postgresCluster),\n\t\tImagePullPolicy: postgresCluster.Spec.ImagePullPolicy,\n\t\tName: naming.PGBackRestRepoContainerName,\n\t\tSecurityContext: initialize.RestrictedSecurityContext(),\n\t}\n\n\tif postgresCluster.Spec.Backups.PGBackRest.Jobs != nil {\n\t\tcontainer.Resources = postgresCluster.Spec.Backups.PGBackRest.Jobs.Resources\n\t}\n\n\tjobSpec := &batchv1.JobSpec{\n\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\tObjectMeta: metav1.ObjectMeta{Labels: labels, Annotations: annotations},\n\t\t\tSpec: corev1.PodSpec{\n\t\t\t\tContainers: []corev1.Container{container},\n\n\t\t\t\t// Disable environment variables for services other than the Kubernetes API.\n\t\t\t\t// - https://docs.k8s.io/concepts/services-networking/connect-applications-service/#accessing-the-service\n\t\t\t\t// - https://releases.k8s.io/v1.23.0/pkg/kubelet/kubelet_pods.go#L553-L563\n\t\t\t\tEnableServiceLinks: initialize.Bool(false),\n\n\t\t\t\t// Set RestartPolicy to \"Never\" since we want a new Pod to be created by the Job\n\t\t\t\t// controller when there is a failure (instead of the container simply restarting).\n\t\t\t\t// This will ensure the Job always has the latest configs mounted following a\n\t\t\t\t// failure as needed to successfully verify config hashes and run the Job.\n\t\t\t\tRestartPolicy: corev1.RestartPolicyNever,\n\t\t\t\tSecurityContext: initialize.PodSecurityContext(),\n\t\t\t\tServiceAccountName: serviceAccountName,\n\t\t\t},\n\t\t},\n\t}\n\n\tif jobs := postgresCluster.Spec.Backups.PGBackRest.Jobs; jobs != nil {\n\t\tjobSpec.TTLSecondsAfterFinished = jobs.TTLSecondsAfterFinished\n\t}\n\n\t// set the priority class name, tolerations, and affinity, if they exist\n\tif postgresCluster.Spec.Backups.PGBackRest.Jobs != nil {\n\t\tif postgresCluster.Spec.Backups.PGBackRest.Jobs.PriorityClassName != nil {\n\t\t\tjobSpec.Template.Spec.PriorityClassName =\n\t\t\t\t*postgresCluster.Spec.Backups.PGBackRest.Jobs.PriorityClassName\n\t\t}\n\t\tjobSpec.Template.Spec.Tolerations = postgresCluster.Spec.Backups.PGBackRest.Jobs.Tolerations\n\t\tjobSpec.Template.Spec.Affinity = postgresCluster.Spec.Backups.PGBackRest.Jobs.Affinity\n\t}\n\n\t// Set the image pull secrets, if any exist.\n\t// This is set here rather than using the service account due to the lack\n\t// of propagation to existing pods when the CRD is updated:\n\t// https://github.com/kubernetes/kubernetes/issues/88456\n\tjobSpec.Template.Spec.ImagePullSecrets = postgresCluster.Spec.ImagePullSecrets\n\n\t// add pgBackRest configs to template\n\tif containerName == naming.PGBackRestRepoContainerName {\n\t\tpgbackrest.AddConfigToRepoPod(postgresCluster, &jobSpec.Template.Spec)\n\t} else {\n\t\tpgbackrest.AddConfigToInstancePod(postgresCluster, &jobSpec.Template.Spec)\n\t}\n\n\treturn jobSpec, nil\n}", "func (client *WebAppsClient) backupCreateRequest(ctx context.Context, resourceGroupName string, name string, request BackupRequest, options *WebAppsBackupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup\"\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.MethodPost, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, request)\n}", "func NewModelsBackupSchedule() *ModelsBackupSchedule {\n\tthis := ModelsBackupSchedule{}\n\treturn &this\n}", "func (o *Operator) onStartBackup(stop <-chan struct{}) {\n\tfor {\n\t\tif err := o.waitForCRD(false, false, false, true); err == nil {\n\t\t\tbreak\n\t\t} else {\n\t\t\tlog.Error().Err(err).Msg(\"Resource initialization failed\")\n\t\t\tlog.Info().Msgf(\"Retrying in %s...\", initRetryWaitTime)\n\t\t\ttime.Sleep(initRetryWaitTime)\n\t\t}\n\t}\n\toperatorName := \"arangodb-backup-operator\"\n\toperator := backupOper.NewOperator(operatorName, o.Namespace)\n\n\trand.Seed(time.Now().Unix())\n\n\tzerolog.SetGlobalLevel(zerolog.DebugLevel)\n\n\trestClient, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tarangoClientSet, err := arangoClientSet.NewForConfig(restClient)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tkubeClientSet, err := kubernetes.NewForConfig(restClient)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\teventRecorder := event.NewEventRecorder(operatorName, kubeClientSet)\n\n\tarangoInformer := arangoInformer.NewSharedInformerFactoryWithOptions(arangoClientSet, 10*time.Second, arangoInformer.WithNamespace(o.Namespace))\n\n\tif err = backup.RegisterInformer(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err = policy.RegisterInformer(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err = operator.RegisterStarter(arangoInformer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tprometheus.MustRegister(operator)\n\n\toperator.Start(8, stop)\n\to.Dependencies.BackupProbe.SetReady()\n\n\t<-stop\n}", "func deleteBackup(w http.ResponseWriter, r *http.Request) {\n\tlogrus.Debugf(\"DeleteBackup r=%s\", r)\n\tparams := mux.Vars(r)\n\n\tapiID := params[\"id\"]\n\n\tif RunningBackupAPIID == apiID {\n\t\tif currentBackupContext.CmdRef != nil {\n\t\t\tlogrus.Debugf(\"Canceling currently running backup %s\", RunningBackupAPIID)\n\t\t\terr := (*currentBackupContext.CmdRef).Stop()\n\t\t\tif err != nil {\n\t\t\t\tsendSchellyResponse(apiID, \"\", \"running\", \"Couldn't cancel current running backup task. err=\"+err.Error(), -1, http.StatusInternalServerError, w)\n\t\t\t} else {\n\t\t\t\tsendSchellyResponse(apiID, \"\", \"deleted\", \"Running backup task was cancelled successfuly\", -1, http.StatusOK, w)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tbk, err := currentBackuper.GetBackup(apiID)\n\tif err != nil {\n\t\tlogrus.Warnf(\"Error calling deleteBackup() with id %s\", apiID)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t} else if bk == nil {\n\t\tlogrus.Warnf(\"Backup %s not found\", apiID)\n\t\thttp.Error(w, fmt.Sprintf(\"Backup %s not found\", apiID), http.StatusNotFound)\n\t\treturn\n\t}\n\n\terr = currentBackuper.DeleteBackup(apiID)\n\tif err != nil {\n\t\tlogrus.Warnf(\"Error calling deleteBackup() with id %s\", apiID)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlogrus.Debugf(\"Backup %s deleted\", apiID)\n\n\tsendSchellyResponse(apiID, bk.DataID, \"deleted\", \"backup deleted successfuly\", -1, http.StatusOK, w)\n}", "func NewBackupJob(client client.Client, instance types.NamespacedName, log logr.Logger, scheme *runtime.Scheme) *BackupJob {\n\treturn &BackupJob{\n\t\tClient: client,\n\t\tInstance: instance,\n\t\tLog: log,\n\t\tScheme: scheme,\n\t}\n}", "func backupExecutor(args prompter.CmdArgs) error {\n\tfmt.Println(\"inside backupExecutor\")\n\tfmt.Printf(\"args: %v\\n\", args)\n\tif args.Contains(\"-file\") {\n\t\tfilename, err := args.GetFirstValue(\"-file\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn config.Backup(filename)\n\t}\n\treturn config.Backup(\"\")\n}", "func newCron(schedule string) (chan bool, *cron.Cron) {\n\tchannel := make(chan bool)\n\tcj := cron.New()\n\tcj.AddFunc(schedule, func() { cronTriggered(channel) })\n\tglog.Info(\"db backup schedule: \" + schedule)\n\treturn channel, cj\n}", "func makeBackUp(params [2]string, ip string, port int, login string, pass string, bkp bool) {\n\t//Снятие бэкапов с перечисленных роутеров\n\n\t//dbconfig := params[0]\n\t//savepath := params[1]\n\n\t//sftpRouter(sshRouter(login, pass, ip, port), bkp, params[1])\n}", "func (device *Device) CreateBackup() error {\n\tif err := device.Device.CreateBackup(); err != nil {\n\t\treturn err\n\t}\n\tdevice.Notify(observable.Event{\n\t\tSubject: fmt.Sprintf(\"devices/bitbox02/%s/backups/list\", device.deviceID),\n\t\tAction: action.Reload,\n\t})\n\treturn nil\n}", "func (t *Task) ensureInitialBackup() (*velero.Backup, error) {\n\tbackup, err := t.getInitialBackup()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tif backup != nil {\n\t\treturn backup, nil\n\t}\n\n\tclient, err := t.getSourceClient()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tnewBackup, err := t.buildBackup(client, \"initial\")\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tuserIncludedResources, _, err := t.PlanResources.MigPlan.GetIncludedResourcesList(client)\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\n\tnewBackup.Labels[migapi.InitialBackupLabel] = t.UID()\n\tnewBackup.Labels[migapi.MigMigrationDebugLabel] = t.Owner.Name\n\tnewBackup.Labels[migapi.MigPlanDebugLabel] = t.Owner.Spec.MigPlanRef.Name\n\tnewBackup.Labels[migapi.MigMigrationLabel] = string(t.Owner.UID)\n\tnewBackup.Labels[migapi.MigPlanLabel] = string(t.PlanResources.MigPlan.UID)\n\tnewBackup.Spec.IncludedResources = toStringSlice(settings.IncludedInitialResources.Difference(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.IncludedResources = append(newBackup.Spec.IncludedResources, userIncludedResources...)\n\tnewBackup.Spec.ExcludedResources = toStringSlice(settings.ExcludedInitialResources.Union(toSet(t.PlanResources.MigPlan.Status.ExcludedResources)))\n\tnewBackup.Spec.LabelSelector = t.PlanResources.MigPlan.Spec.LabelSelector\n\tdelete(newBackup.Annotations, migapi.QuiesceAnnotation)\n\n\tif Settings.DisImgCopy {\n\t\tif newBackup.Annotations == nil {\n\t\t\tnewBackup.Annotations = map[string]string{}\n\t\t}\n\t\tnewBackup.Annotations[migapi.DisableImageCopy] = strconv.FormatBool(Settings.DisImgCopy)\n\t}\n\n\terr = client.Create(context.TODO(), newBackup)\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\treturn newBackup, nil\n}", "func (scheduler *BackupJobScheduler) Schedule(namespace string, pvcName string) {\n\tscheduler.inputChannel <- &BackupJobInput{\n\t\tNamespace: namespace,\n\t\tPVCName: pvcName,\n\t}\n}", "func (tbbsd TimeBasedBackupScheduleDescription) AsBackupScheduleDescription() (*BackupScheduleDescription, bool) {\n\treturn nil, false\n}", "func NewBackup() *Backup {\n\treturn &Backup{\n\t\tExec: \"mysqldump\",\n\t}\n}", "func Test_getLastSuccessBySchedule(t *testing.T) {\n\tbuildBackup := func(phase velerov1api.BackupPhase, completion time.Time, schedule string) velerov1api.Backup {\n\t\tb := builder.ForBackup(\"\", \"\").\n\t\t\tObjectMeta(builder.WithLabels(velerov1api.ScheduleNameLabel, schedule)).\n\t\t\tPhase(phase)\n\n\t\tif !completion.IsZero() {\n\t\t\tb.CompletionTimestamp(completion)\n\t\t}\n\n\t\treturn *b.Result()\n\t}\n\n\t// create a static \"base time\" that can be used to easily construct completion timestamps\n\t// by using the .Add(...) method.\n\tbaseTime, err := time.Parse(time.RFC1123, time.RFC1123)\n\trequire.NoError(t, err)\n\n\ttests := []struct {\n\t\tname string\n\t\tbackups []velerov1api.Backup\n\t\twant map[string]time.Time\n\t}{\n\t\t{\n\t\t\tname: \"when backups is nil, an empty map is returned\",\n\t\t\tbackups: nil,\n\t\t\twant: map[string]time.Time{},\n\t\t},\n\t\t{\n\t\t\tname: \"when backups is empty, an empty map is returned\",\n\t\t\tbackups: []velerov1api.Backup{},\n\t\t\twant: map[string]time.Time{},\n\t\t},\n\t\t{\n\t\t\tname: \"when multiple completed backups for a schedule exist, the latest one is returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime, \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(time.Second), \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"schedule-1\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{\n\t\t\t\t\"schedule-1\": baseTime.Add(time.Second),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"when the most recent backup for a schedule is Failed, the timestamp of the most recent Completed one is returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime, \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Second), \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"schedule-1\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{\n\t\t\t\t\"schedule-1\": baseTime,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"when there are no Completed backups for a schedule, it's not returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseInProgress, baseTime, \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Second), \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhasePartiallyFailed, baseTime.Add(-time.Second), \"schedule-1\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{},\n\t\t},\n\t\t{\n\t\t\tname: \"when backups exist without a schedule, the most recent Completed one is returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime, \"\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Second), \"\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{\n\t\t\t\t\"\": baseTime,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"when backups exist for multiple schedules, the most recent Completed timestamp for each schedule is returned\",\n\t\t\tbackups: []velerov1api.Backup{\n\t\t\t\t// ad-hoc backups (no schedule)\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(30*time.Minute), \"\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Hour), \"\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"\"),\n\n\t\t\t\t// schedule-1\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime, \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseFailed, baseTime.Add(time.Second), \"schedule-1\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(-time.Second), \"schedule-1\"),\n\n\t\t\t\t// schedule-2\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(24*time.Hour), \"schedule-2\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(48*time.Hour), \"schedule-2\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseCompleted, baseTime.Add(72*time.Hour), \"schedule-2\"),\n\n\t\t\t\t// schedule-3\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseNew, baseTime, \"schedule-3\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhaseInProgress, baseTime.Add(time.Minute), \"schedule-3\"),\n\t\t\t\tbuildBackup(velerov1api.BackupPhasePartiallyFailed, baseTime.Add(2*time.Minute), \"schedule-3\"),\n\t\t\t},\n\t\t\twant: map[string]time.Time{\n\t\t\t\t\"\": baseTime.Add(30 * time.Minute),\n\t\t\t\t\"schedule-1\": baseTime,\n\t\t\t\t\"schedule-2\": baseTime.Add(72 * time.Hour),\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tassert.Equal(t, tc.want, getLastSuccessBySchedule(tc.backups))\n\t\t})\n\t}\n}", "func (a *Client) BackupDatabase(params *BackupDatabaseParams) (*BackupDatabaseOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewBackupDatabaseParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"backupDatabase\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/sdx/{name}/backupDatabase\",\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: &BackupDatabaseReader{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.(*BackupDatabaseOK), nil\n\n}", "func (client *Client) CreateBackup(request *CreateBackupRequest) (_result *CreateBackupResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &CreateBackupResponse{}\n\t_body, _err := client.CreateBackupWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (client *Client) CreateBackupWithOptions(request *CreateBackupRequest, runtime *util.RuntimeOptions) (_result *CreateBackupResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.InstanceId)) {\n\t\tquery[\"InstanceId\"] = request.InstanceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerAccount)) {\n\t\tquery[\"OwnerAccount\"] = request.OwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerAccount)) {\n\t\tquery[\"ResourceOwnerAccount\"] = request.ResourceOwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerId)) {\n\t\tquery[\"ResourceOwnerId\"] = request.ResourceOwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.SecurityToken)) {\n\t\tquery[\"SecurityToken\"] = request.SecurityToken\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"CreateBackup\"),\n\t\tVersion: tea.String(\"2015-01-01\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &CreateBackupResponse{}\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 BackupAPI(rotation int, folder string, db *models.DB) {\n\n\tapi := NewAPI(db)\n\tid := time.Now().Format(\"2006-01-02_150405\")\n\n\tfmt.Println(\"backuped tables:\")\n\ttableNames := []string{\"rates\", \"projects\", \"reported_records\", \"consultants\", \"holidays\"}\n\tfor _, baseFileName := range tableNames {\n\t\terr := rotateBackupFile(rotation, folder, baseFileName)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"not able to rotate %s backup files, backups stopped, handle the error: %s\\n\", baseFileName, err)\n\t\t}\n\n\t\tfileName := baseFileName + \"_\" + id + \".csv\"\n\t\tfilePath := filepath.Join(folder, fileName)\n\t\tn := 0\n\t\tswitch baseFileName {\n\t\tcase \"projects\": n, err = api.projects.ProjectBackup(filePath)\n\t\tcase \"rates\": n, err = api.rates.RateBackup(filePath)\n\t\tcase \"consultants\": n, err = api.consultants.ConsultantBackup(filePath)\n\t\tcase \"holidays\": n, err = api.holidays.HolidayBackup(filePath)\n\t\tcase \"reported_records\": n, err = api.reportedRecords.ReportedRecordBackup(filePath)\n\t\t}\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"error during %s backup: %s\\n\", baseFileName, err)\n\t\t} else {\n\t\t\tfmt.Printf(\"- %s, %d records\\n\", baseFileName, n)\n\t\t}\n\t}\n}", "func NewBackupJobScheduler(\n\tjob BackupJobRunner,\n\tclientSet *kubernetes.Clientset,\n\tcsiClient *csiV1.Clientset,\n\tstorageClassName string,\n\ts3Url string,\n\ts3Bucket string,\n\ts3AccessKey string,\n\ts3SecretKey string) *BackupJobScheduler {\n\n\tscheduler := BackupJobScheduler{\n\t\tjobFunc: \t\tjob,\n\t\twaitGroup: \t\tsync.WaitGroup{},\n\t\tinputChannel: \t\tmake(chan *BackupJobInput),\n\t\toutputChannel: \t\tmake(chan error),\n\t\tstorageClassName: \tstorageClassName,\n\t\tclientSet: \t\t\tclientSet,\n\t\tcsiClient: \t\t\tcsiClient,\n\t\ts3Url:\t\t\t\ts3Url,\n\t\ts3Bucket: \t\t\ts3Bucket,\n\t\ts3AccessKey: \t\ts3AccessKey,\n\t\ts3SecretKey:\t\ts3SecretKey,\n\t}\n\tgo scheduler.Run()\n\treturn &scheduler\n}", "func BackupInitInstance() {\n\tvar err error\n\tvar token string\n\tvar commitID string\n\tlog.Infof(\"Inside BackupInitInstance\")\n\terr = Inst().S.Init(scheduler.InitOptions{\n\t\tSpecDir: Inst().SpecDir,\n\t\tVolDriverName: Inst().V.String(),\n\t\tStorageProvisioner: Inst().Provisioner,\n\t\tNodeDriverName: Inst().N.String(),\n\t})\n\tlog.FailOnError(err, \"Error occurred while Scheduler Driver Initialization\")\n\terr = Inst().N.Init(node.InitOptions{\n\t\tSpecDir: Inst().SpecDir,\n\t})\n\tlog.FailOnError(err, \"Error occurred while Node Driver Initialization\")\n\terr = Inst().V.Init(Inst().S.String(), Inst().N.String(), token, Inst().Provisioner, Inst().CsiGenericDriverConfigMap)\n\tlog.FailOnError(err, \"Error occurred while Volume Driver Initialization\")\n\tif Inst().Backup != nil {\n\t\terr = Inst().Backup.Init(Inst().S.String(), Inst().N.String(), Inst().V.String(), token)\n\t\tlog.FailOnError(err, \"Error occurred while Backup Driver Initialization\")\n\t}\n\tSetupTestRail()\n\n\t// Getting Px version info\n\tpxVersion, err := Inst().V.GetDriverVersion()\n\tlog.FailOnError(err, \"Error occurred while getting PX version\")\n\tif len(strings.Split(pxVersion, \"-\")) > 1 {\n\t\tcommitID = strings.Split(pxVersion, \"-\")[1]\n\t} else {\n\t\tcommitID = \"NA\"\n\t}\n\tt := Inst().Dash.TestSet\n\tt.CommitID = commitID\n\tif pxVersion != \"\" {\n\t\tt.Tags[\"px-version\"] = pxVersion\n\t}\n\n\t// Getting Px-Backup server version info and setting Aetos Dashboard tags\n\tPxBackupVersion, err = GetPxBackupVersionString()\n\tlog.FailOnError(err, \"Error getting Px Backup version\")\n\tPxBackupBuildDate, err := GetPxBackupBuildDate()\n\tlog.FailOnError(err, \"Error getting Px Backup build date\")\n\tt.Tags[\"px-backup-version\"] = PxBackupVersion\n\tt.Tags[\"px-backup-build-date\"] = PxBackupBuildDate\n\tt.Tags[\"storageProvisioner\"] = Inst().Provisioner\n\tt.Tags[\"pureVolume\"] = fmt.Sprintf(\"%t\", Inst().PureVolumes)\n\tt.Tags[\"pureSANType\"] = Inst().PureSANType\n\n\tInst().Dash.TestSetUpdate(t)\n\t// Setting the common password\n\tcommonPassword = backup.PxCentralAdminPwd + RandomString(4)\n\t// Dumping source and destination kubeconfig to file system path\n\tlog.Infof(\"Dumping source and destination kubeconfig to file system path\")\n\tkubeconfigs := os.Getenv(\"KUBECONFIGS\")\n\tdash.VerifyFatal(kubeconfigs != \"\", true, \"Getting KUBECONFIGS Environment variable\")\n\tkubeconfigList := strings.Split(kubeconfigs, \",\")\n\tdash.VerifyFatal(len(kubeconfigList) < 2, false, \"minimum 2 kubeconfigs are required for source and destination cluster\")\n\tDumpKubeconfigs(kubeconfigList)\n\tif os.Getenv(\"CLUSTER_PROVIDER\") == drivers.ProviderRke {\n\t\t// Switch context to destination cluster to update RancherMap with destination cluster details\n\t\terr = SetDestinationKubeConfig()\n\t\tlog.FailOnError(err, \"Switching context to destination cluster failed\")\n\t\t// Switch context to destination cluster to update RancherMap with source cluster details\n\t\terr = SetSourceKubeConfig()\n\t\tlog.FailOnError(err, \"Switching context to source cluster failed\")\n\t}\n}", "func NewBackup() *Backup {\n\treturn &Backup{}\n}", "func (r *Repo) RunBackup(source string, tags []string) error {\n\tcmd := exec.Command(resticCmd, \"-r\", r.Path, \"-p\", r.Passwordfile,\n\t\t\"backup\", \"--exclude-caches\")\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\n\tfor _, t := range tags {\n\t\tcmd.Args = append(cmd.Args, \"--tag\", t)\n\t}\n\tcmd.Args = append(cmd.Args, source)\n\n\treturn cmd.Run()\n}", "func NewBackup(ctx *pulumi.Context,\n\tname string, args *BackupArgs, opts ...pulumi.ResourceOption) (*Backup, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.BackupId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'BackupId'\")\n\t}\n\tif args.EncryptionConfigEncryptionType == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'EncryptionConfigEncryptionType'\")\n\t}\n\tif args.InstanceId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'InstanceId'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"backupId\",\n\t\t\"encryptionConfigEncryptionType\",\n\t\t\"instanceId\",\n\t\t\"project\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Backup\n\terr := ctx.RegisterResource(\"google-native:spanner/v1:Backup\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func LogBackupSchedule(schedule *crv1.MySQLBackupSchedule) *logrus.Entry {\n\treturn logrus.WithFields(logrus.Fields{\n\t\t\"backupSchedule\": schedule.Name,\n\t})\n}", "func (s *API) CreateDatabaseBackup(req *CreateDatabaseBackupRequest, opts ...scw.RequestOption) (*DatabaseBackup, error) {\n\tvar err error\n\n\tif req.Region == \"\" {\n\t\tdefaultRegion, _ := s.client.GetDefaultRegion()\n\t\treq.Region = defaultRegion\n\t}\n\n\tif req.Name == \"\" {\n\t\treq.Name = namegenerator.GetRandomName(\"bkp\")\n\t}\n\n\tif fmt.Sprint(req.Region) == \"\" {\n\t\treturn nil, errors.New(\"field Region cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"POST\",\n\t\tPath: \"/rdb/v1/regions/\" + fmt.Sprint(req.Region) + \"/backups\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = scwReq.SetBody(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp DatabaseBackup\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func getBackup(w http.ResponseWriter, r *http.Request) {\n\tlogrus.Debugf(\"GetBackup r=%s\", r)\n\tparams := mux.Vars(r)\n\n\tapiID := params[\"id\"]\n\n\tif RunningBackupAPIID == apiID {\n\t\tsendSchellyResponse(apiID, \"\", \"running\", \"backup is running\", -1, http.StatusOK, w)\n\t\treturn\n\t}\n\n\tresp, err := currentBackuper.GetBackup(apiID)\n\tif err != nil {\n\t\tlogrus.Warnf(\"Error calling getBackup() for id %s. err=%s\", apiID, err)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t} else if resp == nil {\n\t\tlogrus.Debugf(\"Backup %s not found\", apiID)\n\t\thttp.Error(w, fmt.Sprintf(\"Backup %s not found\", apiID), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tsendSchellyResponse(apiID, resp.DataID, resp.Status, resp.Message, resp.SizeMB, http.StatusOK, w)\n}", "func Backup(action *recipe.Action, tmpDir string) error {\n\tpath, err := action.GetS(0)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tisSafePath, err := checkPathSafety(action.Command.Recipe, path)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch {\n\tcase !isSafePath:\n\t\treturn fmt.Errorf(\"Path is unsafe (%s)\", path)\n\tcase !fsutil.IsExist(path):\n\t\treturn fmt.Errorf(\"File %s does not exist\", path)\n\tcase !fsutil.IsRegular(path):\n\t\treturn fmt.Errorf(\"Object %s is not a file\", path)\n\t}\n\n\tpathCRC32 := calcCRC32Q(path)\n\n\terr = fsutil.CopyFile(path, tmpDir+\"/\"+pathCRC32)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Can't backup file: %v\", err)\n\t}\n\n\terr = fsutil.CopyAttr(path, tmpDir+\"/\"+pathCRC32)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Can't copy attributes: %v\", err)\n\t}\n\n\treturn nil\n}", "func backupEtcd(mgr *manager.Manager, node *kubekeyapiv1alpha1.HostCfg) error {\n\t_, err := mgr.Runner.ExecuteCmd(fmt.Sprintf(\"sudo -E /bin/sh -c \\\"mkdir -p %s\\\"\", mgr.Cluster.Kubernetes.EtcdBackupScriptDir), 0, false)\n\tif err != nil {\n\t\treturn errors.Wrap(errors.WithStack(err), \"Failed to create etcd backup\")\n\t}\n\ttmpDir := \"/tmp/kubekey\"\n\tetcdBackupScript, _ := tmpl.EtcdBackupScript(mgr, node)\n\tetcdBackupScriptBase64 := base64.StdEncoding.EncodeToString([]byte(etcdBackupScript))\n\t_, err2 := mgr.Runner.ExecuteCmd(fmt.Sprintf(\"sudo -E /bin/sh -c \\\"echo %s | base64 -d > %s/etcd-backup.sh && chmod +x %s/etcd-backup.sh\\\"\", etcdBackupScriptBase64, tmpDir, tmpDir), 1, false)\n\tif err2 != nil {\n\t\treturn errors.Wrap(errors.WithStack(err2), \"Failed to generate etcd backup\")\n\t}\n\t_, err3 := mgr.Runner.ExecuteCmd(fmt.Sprintf(\"sudo cp %s/etcd-backup.sh %s &&sudo %s/etcd-backup.sh\", tmpDir, mgr.Cluster.Kubernetes.EtcdBackupScriptDir, mgr.Cluster.Kubernetes.EtcdBackupScriptDir), 1, false)\n\tif err3 != nil {\n\t\treturn errors.Wrap(errors.WithStack(err3), \"Failed to run the etcd-backup.sh\")\n\t}\n\treturn nil\n}", "func (c *calcium) Backup(id, srcPath string) (*types.BackupMessage, error) {\n\tif c.config.BackupDir == \"\" {\n\t\tlog.Infof(\"[Backup] This core has no BackupDir set in config, skip backup for container %s\", id)\n\t\treturn nil, errors.New(\"BackupDir not set\")\n\t}\n\tlog.Debugf(\"[Backup] Backup %s for container %s\", srcPath, id)\n\tcontainer, err := c.GetContainer(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnode, err := c.GetNode(container.Podname, container.Nodename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tctx := utils.ToDockerContext(node.Engine)\n\n\tresp, stat, err := node.Engine.CopyFromContainer(ctx, container.ID, srcPath)\n\tdefer resp.Close()\n\tlog.Debugf(\"[Backup] Docker cp stat: %v\", stat)\n\tif err != nil {\n\t\tlog.Errorf(\"[Backup] Error during CopyFromContainer: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tappname, entrypoint, ident, err := utils.ParseContainerName(container.Name)\n\tif err != nil {\n\t\tlog.Errorf(\"[Backup] Error during ParseContainerName: %v\", err)\n\t\treturn nil, err\n\t}\n\tnow := time.Now().Format(\"2006.01.02.15.04.05\")\n\tbaseDir := filepath.Join(c.config.BackupDir, appname, entrypoint)\n\terr = os.MkdirAll(baseDir, os.FileMode(0700)) // drwx------\n\tif err != nil {\n\t\tlog.Errorf(\"[Backup] Error during mkdir %s, %v\", baseDir, err)\n\t\treturn nil, err\n\t}\n\n\tfilename := fmt.Sprintf(\"%s-%s-%s-%s.tar.gz\", stat.Name, container.ShortID(), ident, now)\n\tbackupFile := filepath.Join(baseDir, filename)\n\tlog.Debugf(\"[Backup] Creating %s\", backupFile)\n\tfile, err := os.Create(backupFile)\n\tif err != nil {\n\t\tlog.Errorf(\"[Backup] Error during create backup file %s: %v\", backupFile, err)\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tgw := gzip.NewWriter(file)\n\tdefer gw.Close()\n\n\t_, err = io.Copy(gw, resp)\n\tif err != nil {\n\t\tlog.Errorf(\"[Backup] Error during copy resp: %v\", err)\n\t\treturn nil, err\n\t}\n\n\treturn &types.BackupMessage{\n\t\tStatus: \"ok\",\n\t\tSize: stat.Size,\n\t\tPath: backupFile,\n\t}, nil\n}", "func RegisterBackup(ctx context.Context, management *config.Management, opts config.Options) error {\n\tvmBackups := management.HarvesterFactory.Harvesterhci().V1beta1().VirtualMachineBackup()\n\tpvc := management.CoreFactory.Core().V1().PersistentVolumeClaim()\n\tvms := management.VirtFactory.Kubevirt().V1().VirtualMachine()\n\tvolumes := management.LonghornFactory.Longhorn().V1beta1().Volume()\n\tsnapshots := management.SnapshotFactory.Snapshot().V1beta1().VolumeSnapshot()\n\tsnapshotClass := management.SnapshotFactory.Snapshot().V1beta1().VolumeSnapshotClass()\n\n\tvmBackupController := &Handler{\n\t\tvmBackups: vmBackups,\n\t\tvmBackupController: vmBackups,\n\t\tvmBackupCache: vmBackups.Cache(),\n\t\tpvcCache: pvc.Cache(),\n\t\tvms: vms,\n\t\tvmsCache: vms.Cache(),\n\t\tvolumeCache: volumes.Cache(),\n\t\tvolumes: volumes,\n\t\tsnapshots: snapshots,\n\t\tsnapshotCache: snapshots.Cache(),\n\t\tsnapshotClassCache: snapshotClass.Cache(),\n\t\trecorder: management.NewRecorder(backupControllerName, \"\", \"\"),\n\t}\n\n\tvmBackups.OnChange(ctx, backupControllerName, vmBackupController.OnBackupChange)\n\tsnapshots.OnChange(ctx, backupControllerName, vmBackupController.updateVolumeSnapshotChanged)\n\treturn nil\n}", "func (t Task) getBackup(labels map[string]string) (*velero.Backup, error) {\n\tclient, err := t.getSourceClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist := velero.BackupList{}\n\terr = client.List(\n\t\tcontext.TODO(),\n\t\t&list,\n\t\tk8sclient.MatchingLabels(labels))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(list.Items) > 0 {\n\t\treturn &list.Items[0], nil\n\t}\n\n\treturn nil, nil\n}", "func (s *BackupServer) applyBackup(ctx context.Context, c *beta.Client, request *betapb.ApplyFilestoreBetaBackupRequest) (*betapb.FilestoreBetaBackup, error) {\n\tp := ProtoToBackup(request.GetResource())\n\tres, err := c.ApplyBackup(ctx, p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr := BackupToProto(res)\n\treturn r, nil\n}", "func Backup(ctx context.Context, res http.ResponseWriter) error {\n\tts := time.Now().Unix()\n\tfilename := fmt.Sprintf(\"search-%d.bak.tar.gz\", ts)\n\ttmp := os.TempDir()\n\tbk := filepath.Join(tmp, filename)\n\n\t// create search-{stamp}.bak.tar.gz\n\tf, err := os.Create(bk)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = backup.ArchiveFS(ctx, cfg.SearchDir(), f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = f.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// write data to response\n\tdata, err := os.Open(bk)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer data.Close()\n\tdefer os.Remove(bk)\n\n\tdisposition := `attachment; filename=%s`\n\tinfo, err := data.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres.Header().Set(\"Content-Type\", \"application/octet-stream\")\n\tres.Header().Set(\"Content-Disposition\", fmt.Sprintf(disposition, ts))\n\tres.Header().Set(\"Content-Length\", fmt.Sprintf(\"%d\", info.Size()))\n\n\t_, err = io.Copy(res, data)\n\n\treturn err\n}", "func (s *Service) ScheduleTransfer(params *ScheduleParams, tx *gorm.DB) error {\n\tvar err error\n\tif tx == nil {\n\t\ttx = s.db.Begin()\n\t\tdefer func() {\n\t\t\tif err != nil {\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttx.Commit()\n\t\t}()\n\t}\n\n\terr = s.validate(params, tx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger := s.logger.New(\"method\", \"ScheduleTransfer\")\n\ttxRepo := s.scheduledTransactionRepository.WrapContext(tx)\n\tlogRepo := s.scheduledTransactionLogRepository.WrapContext(tx)\n\n\ttransaction, err := s.findOrCreateScheduledTransaction(params, tx)\n\tif err != nil {\n\t\tlogger.Error(\"failed to find or create scheduled transaction\", \"error\", err, \"params\", s.paramsToString(params))\n\t\treturn err\n\t}\n\n\tnewAmount := transaction.Amount.Add(params.Amount)\n\terr = txRepo.Updates(&ScheduledTransaction{\n\t\tId: transaction.Id,\n\t\tAmount: newAmount,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = logRepo.Create(&ScheduledTransactionLog{\n\t\tScheduledTransactionId: transaction.Id,\n\t\tAmount: params.Amount,\n\t\tCreatedAt: &params.Now,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (api *APIServer) integrationPost(w http.ResponseWriter, r *http.Request) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tlines := strings.Split(string(body), \"\\n\")\n\tif len(lines) < 2 {\n\t\thttp.Error(w, \"use TSVWithNames format\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcolumns := strings.Split(lines[1], \"\\t\")\n\tcommands := strings.Split(columns[0], \" \")\n\tlog.Println(commands)\n\n\tswitch commands[0] {\n\tcase \"create\", \"upload\", \"download\":\n\t\tif locked := api.lock.TryAcquire(1); !locked {\n\t\t\tlog.Println(ErrAPILocked)\n\t\t\thttp.Error(w, ErrAPILocked.Error(), http.StatusLocked)\n\t\t\treturn\n\t\t}\n\t\tdefer api.lock.Release(1)\n\t\tstart := time.Now()\n\t\tapi.metrics.LastBackupStart.Set(float64(start.Unix()))\n\t\tdefer api.metrics.LastBackupDuration.Set(float64(time.Since(start).Nanoseconds()))\n\t\tdefer api.metrics.LastBackupEnd.Set(float64(time.Now().Unix()))\n\n\t\tgo func() {\n\t\t\tapi.status.start(columns[0])\n\t\t\terr := api.c.Run(append([]string{\"clickhouse-backup\"}, commands...))\n\t\t\tdefer api.status.stop(err)\n\t\t\tif err != nil {\n\t\t\t\tapi.metrics.FailedBackups.Inc()\n\t\t\t\tapi.metrics.LastBackupSuccess.Set(0)\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}()\n\t\tapi.metrics.SuccessfulBackups.Inc()\n\t\tapi.metrics.LastBackupSuccess.Set(1)\n\t\tfmt.Fprintln(w, \"acknowledged\")\n\t\treturn\n\tcase \"delete\", \"freeze\", \"clean\":\n\t\tif locked := api.lock.TryAcquire(1); !locked {\n\t\t\tlog.Println(ErrAPILocked)\n\t\t\thttp.Error(w, ErrAPILocked.Error(), http.StatusLocked)\n\t\t\treturn\n\t\t}\n\t\tdefer api.lock.Release(1)\n\t\tstart := time.Now()\n\t\tapi.metrics.LastBackupStart.Set(float64(start.Unix()))\n\t\tdefer api.metrics.LastBackupDuration.Set(float64(time.Since(start).Nanoseconds()))\n\t\tdefer api.metrics.LastBackupEnd.Set(float64(time.Now().Unix()))\n\n\t\tapi.status.start(columns[0])\n\t\terr := api.c.Run(append([]string{\"clickhouse-backup\"}, commands...))\n\t\tdefer api.status.stop(err)\n\t\tif err != nil {\n\t\t\tapi.metrics.FailedBackups.Inc()\n\t\t\tapi.metrics.LastBackupSuccess.Set(0)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\tapi.metrics.SuccessfulBackups.Inc()\n\t\tapi.metrics.LastBackupSuccess.Set(1)\n\t\tfmt.Fprintln(w, \"OK\")\n\t\tlog.Println(\"OK\")\n\t\treturn\n\tdefault:\n\t\thttp.Error(w, fmt.Sprintf(\"bad operation '%s'\", columns[0]), http.StatusBadRequest)\n\t}\n}", "func NewBackupBackend(b *APIBackend) *BackupBackend {\n\treturn &BackupBackend{\n\t\tLogger: b.Logger.With(zap.String(\"handler\", \"backup\")),\n\n\t\tHTTPErrorHandler: b.HTTPErrorHandler,\n\t\tBackupService: b.BackupService,\n\t\tSqlBackupRestoreService: b.SqlBackupRestoreService,\n\t\tBucketManifestWriter: b.BucketManifestWriter,\n\t}\n}", "func Backup(ns string, pod string, s string) (err error) {\n\tcmdName := \"unwritten\"\n\tcmdArgs := []string{\"backup\"}\n\tcmdTimeout := time.Duration(maxApplyTimeout) * time.Second\n\terr = RunCommand(cmdName, cmdArgs, cmdTimeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (client *KeyVaultClient) backupSecretCreateRequest(ctx context.Context, vaultBaseURL string, secretName string, options *KeyVaultClientBackupSecretOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/secrets/{secret-name}/backup\"\n\tif secretName == \"\" {\n\t\treturn nil, errors.New(\"parameter secretName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{secret-name}\", url.PathEscape(secretName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (c *Client) scheduleSubmit(r *Request) {\n\tc.requests = append(c.requests, r)\n}", "func SaveBackup(rootname string) (string, error) {\n\tt0 := time.Now()\n\tfname := rootname\n\tif util.Blank(fname) {\n\t\tfname = \"Backup_\" + t0.Format(\"2006-01-02-15-04-05\")\n\t}\n\tfn := backupfolder + fname + \".dat\"\n\tdblock.Lock()\n\tdefer dblock.Unlock()\n\terr := write_file(db, fn)\n\ttelp := time.Now().Sub(t0).Seconds() * 1000.0\n\tif err != nil {\n\t\tlog.Errorf(\"Unable to write backup file. Err=%v\", err)\n\t\tlog.Errorf(\"Name of backup file: %s\", fn)\n\t\treturn fname, fmt.Errorf(\"Unalble to write backup file. Err=%v\", err)\n\t} else {\n\t\tlog.Infof(\"Backup file (%s) written to disk. (%8.2f ms)\", fn, telp)\n\t}\n\treturn fname, nil\n}", "func (client CloudEndpointsClient) PostBackupPreparer(ctx context.Context, resourceGroupName string, storageSyncServiceName string, syncGroupName string, cloudEndpointName string, parameters BackupRequest) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"cloudEndpointName\": autorest.Encode(\"path\", cloudEndpointName),\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"storageSyncServiceName\": autorest.Encode(\"path\", storageSyncServiceName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t\t\"syncGroupName\": autorest.Encode(\"path\", syncGroupName),\n\t}\n\n\tconst APIVersion = \"2020-03-01\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (database *Database) Backup(reason string) error {\n\n\terr := os.MkdirAll(backupsDir, 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tname := \"testing\"\n\tfilename := fmt.Sprintf(\"%s/%s_%s_%s.db\",\n\t\tbackupsDir, strings.Replace(name, \" \", \"_\", -1),\n\t\ttime.Now().Format(\"20060102150405\"), reason)\n\n\tsrc, err := os.Open(database.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer src.Close()\n\n\tdest, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dest.Close()\n\n\tif _, err := io.Copy(dest, src); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (r *mutationResolver) BackupDatabase(ctx context.Context, input models.BackupDatabaseInput) (*models.BackupDatabasePayload, error) {\n\tret := new(models.BackupDatabasePayload)\n\tret.ClientMutationID = input.ClientMutationID\n\terr := verifyAdminToken(input.AdminToken)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar compress bool\n\tif input.Compress != nil && *input.Compress {\n\t\tcompress = true\n\t}\n\n\tvar fullPath = path.Join(DataPath, \"backup\", time.Now().Format(\"csheet-20060102-150405.bak\"))\n\tif compress {\n\t\tfullPath += \".gz\"\n\t}\n\terr = os.MkdirAll(path.Dir(fullPath), 0700)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tf, err := os.Create(fullPath)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tdefer f.Close()\n\n\tvar w io.Writer = f\n\tif compress {\n\t\tvar zw = gzip.NewWriter(w)\n\t\tdefer zw.Close()\n\t\tw = zw\n\t}\n\t_, err = db.Backup(w, 0)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tret.Created = new(deprecated.DiskFile)\n\tret.Created.Path = fullPath\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tret.Created.ModTime = fi.ModTime()\n\tret.Created.Size = fi.Size()\n\treturn ret, err\n}", "func (self *Tree) BackupToDisk(t time.Time) (error, *BackupQuery) {\n\n\tfmt.Println(\"STARTING FILE DUMP\", t)\n\t_, _, _, _, _, qhour, _, _, _ := self.When(t)\n\tq := &BackupQuery{\n\t\ttree: self,\n\t\tencname: fmt.Sprintf(\n\t\t\t\"%d_%02d_%02d_%02d_\",\n\t\t\tt.Year(),\n\t\t\tint(t.Month()),\n\t\t\tt.Day(),\n\t\t\tt.Hour(),\n\t\t),\n\t}\n\treturn q.Do(qhour, nil), q\n}", "func StartBackup() {\n\tfor {\n\t\tRunOnce()\n\t\t// sleep to tomorrow night\n\t\tsleep()\n\t}\n}", "func CreateBackupFromRequest(backupName string, orgID string, request *api.BackupCreateRequest) (err error) {\n\t//ctx, err := backup.GetPxCentralAdminCtx()\n\tctx, err := backup.GetAdminCtxFromSecret()\n\texpect(err).NotTo(haveOccurred(),\n\t\tfmt.Sprintf(\"Failed to fetch px-central-admin ctx: [%v]\", err))\n\tbackupDriver := Inst().Backup\n\t_, err = backupDriver.CreateBackup(ctx, request)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Failed to create backup [%s] in org [%s]. Error: [%v]\",\n\t\t\tbackupName, orgID, err)\n\t}\n\treturn err\n}", "func (c *ClientSet) CreateSchedule(ns, period string, count int) (string, v1.BackupPhase, error) {\n\tvar status v1.BackupPhase\n\tsnapVolume := true\n\n\tsname, err := c.generateScheduleName()\n\tif err != nil {\n\t\treturn \"\", status, err\n\t}\n\n\tsched := &v1.Schedule{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: sname,\n\t\t\tNamespace: VeleroNamespace,\n\t\t},\n\t\tSpec: v1.ScheduleSpec{\n\t\t\tTemplate: v1.BackupSpec{\n\t\t\t\tIncludedNamespaces: []string{ns},\n\t\t\t\tSnapshotVolumes: &snapVolume,\n\t\t\t\tStorageLocation: BackupLocation,\n\t\t\t\tVolumeSnapshotLocations: []string{SnapshotLocation},\n\t\t\t},\n\t\t\tSchedule: period,\n\t\t},\n\t}\n\to, err := c.VeleroV1().\n\t\tSchedules(VeleroNamespace).\n\t\tCreate(context.TODO(), sched, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn \"\", status, err\n\t}\n\n\tif count < 0 {\n\t\treturn o.Name, status, nil\n\t}\n\tif status, err = c.waitForScheduleCompletion(o.Name, count); err == nil {\n\t\treturn o.Name, status, nil\n\t}\n\treturn o.Name, status, err\n}", "func CreateBackupGetErr(backupName string, clusterName string, bLocation string, bLocationUID string,\n\tnamespaces []string, labelSelectors map[string]string, orgID string) (err error) {\n\n\tStep(fmt.Sprintf(\"Create backup [%s] in org [%s] from cluster [%s]\",\n\t\tbackupName, orgID, clusterName), func() {\n\n\t\tbackupDriver := Inst().Backup\n\t\tbkpCreateRequest := &api.BackupCreateRequest{\n\t\t\tCreateMetadata: &api.CreateMetadata{\n\t\t\t\tName: backupName,\n\t\t\t\tOrgId: orgID,\n\t\t\t},\n\t\t\tBackupLocationRef: &api.ObjectRef{\n\t\t\t\tName: bLocation,\n\t\t\t\tUid: bLocationUID,\n\t\t\t},\n\t\t\tCluster: sourceClusterName,\n\t\t\tNamespaces: namespaces,\n\t\t\tLabelSelectors: labelSelectors,\n\t\t}\n\t\t//ctx, err := backup.GetPxCentralAdminCtx()\n\t\tctx, err := backup.GetAdminCtxFromSecret()\n\t\texpect(err).NotTo(haveOccurred(),\n\t\t\tfmt.Sprintf(\"Failed to fetch px-central-admin ctx: [%v]\",\n\t\t\t\terr))\n\t\t_, err = backupDriver.CreateBackup(ctx, bkpCreateRequest)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Failed to create backup [%s] in org [%s]. Error: [%v]\",\n\t\t\t\tbackupName, orgID, err)\n\t\t}\n\t})\n\n\treturn err\n}", "func (t BackupJob) Run() {\n\n\tparms, err := GetBackupJobParms(t.Logger)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tparms.CCP_IMAGE_TAG = t.CCP_IMAGE_TAG\n\n\tvar s = getBackupJobTemplate(t.Logger)\n\tvar pv = getBackupJobPVTemplate(t.Logger)\n\tvar pvc = getBackupJobPVCTemplate(t.Logger)\n\n\ttmpl, err := template.New(\"jobtemplate\").Parse(s)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttmplpv, err := template.New(\"pvtemplate\").Parse(pv)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttmplpvc, err := template.New(\"pvctemplate\").Parse(pvc)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar tmpfile, tmpfilePV, tmpfilePVC *os.File\n\ttmpfile, err = ioutil.TempFile(\"/tmp\", \"backupjob\")\n\tif err != nil {\n\t\tt.Logger.Println(err.Error())\n\t\tpanic(err)\n\t}\n\ttmpfilePV, err = ioutil.TempFile(\"/tmp\", \"backupjobpv\")\n\tif err != nil {\n\t\tt.Logger.Println(err.Error())\n\t\tpanic(err)\n\t}\n\ttmpfilePVC, err = ioutil.TempFile(\"/tmp\", \"backupjobpvc\")\n\tif err != nil {\n\t\tt.Logger.Println(err.Error())\n\t\tpanic(err)\n\t}\n\n\terr = tmpl.Execute(tmpfile, parms)\n\n\tif err := tmpfile.Close(); err != nil {\n\t\tt.Logger.Println(err.Error())\n\t\tpanic(err)\n\t}\n\tt.Logger.Println(\"tmpfile is \" + tmpfile.Name())\n\n\terr = tmplpv.Execute(tmpfilePV, parms)\n\tif err := tmpfilePV.Close(); err != nil {\n\t\tt.Logger.Println(err.Error())\n\t\tpanic(err)\n\t}\n\tt.Logger.Println(\"tmpfilePV is \" + tmpfilePV.Name())\n\n\terr = tmplpvc.Execute(tmpfilePVC, parms)\n\tif err := tmpfilePVC.Close(); err != nil {\n\t\tt.Logger.Println(err.Error())\n\t\tpanic(err)\n\t}\n\tt.Logger.Println(\"tmpfilePVC is \" + tmpfilePVC.Name())\n\n\tvar stdout, stderr string\n\tstdout, stderr, err = createBackupJob(parms, tmpfile.Name(), tmpfilePV.Name(), tmpfilePVC.Name(), t.Cmd)\n\tif err != nil {\n\t\tt.Logger.Println(err.Error())\n\t}\n\tt.Logger.Println(stdout)\n\tt.Logger.Println(stderr)\n\n\t//defer os.Remove(tmpfile.Name()) //clean up\n\t//defer os.Remove(tmpfilePV.Name()) //clean up\n\t//defer os.Remove(tmpfilePVC.Name()) //clean up\n}", "func (r *Reconciler) reconcileScheduledBackups(\n\tctx context.Context, cluster *v1beta1.PostgresCluster, sa *corev1.ServiceAccount,\n\tcronjobs []*batchv1.CronJob,\n) bool {\n\tlog := logging.FromContext(ctx).WithValues(\"reconcileResource\", \"repoCronJob\")\n\t// requeue if there is an error during creation\n\tvar requeue bool\n\n\tfor _, repo := range cluster.Spec.Backups.PGBackRest.Repos {\n\t\t// if the repo level backup schedules block has not been created,\n\t\t// there are no schedules defined\n\t\tif repo.BackupSchedules != nil {\n\t\t\t// next if the repo level schedule is not nil, create the CronJob.\n\t\t\tif repo.BackupSchedules.Full != nil {\n\t\t\t\tif err := r.reconcilePGBackRestCronJob(ctx, cluster, repo,\n\t\t\t\t\tfull, repo.BackupSchedules.Full, sa, cronjobs); err != nil {\n\t\t\t\t\tlog.Error(err, \"unable to reconcile Full backup for \"+repo.Name)\n\t\t\t\t\trequeue = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif repo.BackupSchedules.Differential != nil {\n\t\t\t\tif err := r.reconcilePGBackRestCronJob(ctx, cluster, repo,\n\t\t\t\t\tdifferential, repo.BackupSchedules.Differential, sa, cronjobs); err != nil {\n\t\t\t\t\tlog.Error(err, \"unable to reconcile Differential backup for \"+repo.Name)\n\t\t\t\t\trequeue = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif repo.BackupSchedules.Incremental != nil {\n\t\t\t\tif err := r.reconcilePGBackRestCronJob(ctx, cluster, repo,\n\t\t\t\t\tincremental, repo.BackupSchedules.Incremental, sa, cronjobs); err != nil {\n\t\t\t\t\tlog.Error(err, \"unable to reconcile Incremental backup for \"+repo.Name)\n\t\t\t\t\trequeue = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn requeue\n}", "func (s *CreateFileSystemInput) SetBackup(v bool) *CreateFileSystemInput {\n\ts.Backup = &v\n\treturn s\n}", "func RestoreBackup(serviceID string, backupID string, settings *models.Settings) *models.Task {\n\tbackup := map[string]string{\n\t\t\"archiveType\": \"cf\",\n\t\t\"encryptionType\": \"aes\",\n\t}\n\tb, err := json.Marshal(backup)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\tresp := httpclient.Post(b, fmt.Sprintf(\"%s/v1/environments/%s/services/%s/restore/%s\", settings.PaasHost, settings.EnvironmentID, serviceID, backupID), true, settings)\n\tvar m map[string]string\n\tjson.Unmarshal(resp, &m)\n\treturn &models.Task{\n\t\tID: m[\"taskId\"],\n\t}\n}", "func (scheduleAPI *scheduleAPIServer) saveScheduleWorker() {\n\tfor {\n\t\tselect {\n\t\tcase <-scheduleAPI.ctx.Done():\n\t\t\treturn\n\t\tcase <-time.After(time.Duration(5 * time.Minute)):\n\t\t\tfunc() {\n\t\t\t\tf, err := os.OpenFile(\"snapshot\", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 066)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Log.Warn(\"error while saving file\", zap.Error(err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Lock the mutex\n\t\t\t\tscheduleAPI.muSchedule.Lock()\n\n\t\t\t\tbs, err := proto.Marshal(&scheduleAPI.weeklySchedule)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Log.Error(\"error while marshaling file\", zap.Error(err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Unlock the mutex\n\t\t\t\tscheduleAPI.muSchedule.Unlock()\n\n\t\t\t\t_, err = f.Write(bs)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogger.Log.Error(\"error while writing to file\", zap.Error(err))\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}()\n\t\t}\n\t}\n}", "func (client *WebAppsClient) backupSlotCreateRequest(ctx context.Context, resourceGroupName string, name string, slot string, request BackupRequest, options *WebAppsBackupSlotOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup\"\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 slot == \"\" {\n\t\treturn nil, errors.New(\"parameter slot cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{slot}\", url.PathEscape(slot))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, runtime.MarshalAsJSON(req, request)\n}", "func Start() {\n\tfor {\n\t\tlog.Println(\"Starting backup.\")\n\n\t\t// read the config file\n\t\tconfig, err := readConfigFile()\n\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\ttime.Sleep(retryPeriod)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar databases []*database.Database\n\n\t\t// add all databases to the databases slice\n\t\tfor _, name := range config.Databases {\n\t\t\tdatabases = append(databases, database.New(name))\n\t\t}\n\n\t\t// create a new temporary zip file\n\t\tfile, err := zipper.New()\n\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\ttime.Sleep(retryPeriod)\n\t\t\tcontinue\n\t\t}\n\n\t\t// go through the databases slice and dump the databases\n\t\tfor _, db := range databases {\n\t\t\terr = db.Dump()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// add the databases to the zip file\n\t\tif errs := file.Zip(databases); errs != nil {\n\t\t\tlog.Printf(\"Failed to zip the files. Error:%s\", err.Error())\n\t\t\ttime.Sleep(retryPeriod)\n\t\t\tcontinue\n\t\t}\n\n\t\t// close (save) the zip file\n\t\tif err = file.ZipFile.Close(); err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\ttime.Sleep(retryPeriod)\n\t\t\tcontinue\n\t\t}\n\n\t\t// upload the zip file\n\t\tif err = file.Upload(); err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\ttime.Sleep(retryPeriod)\n\t\t\tcontinue\n\t\t}\n\n\t\tstats := Stats{\n\t\t\tBackupTime: time.Now().UTC().Format(timeFormat),\n\t\t\tNextBackupTime: time.Now().UTC().Add(sleepPeriod).Format(timeFormat),\n\t\t\tSuccess: true,\n\t\t}\n\n\t\tif err = stats.store(); err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t}\n\n\t\tlog.Println(\"Backed up!\")\n\n\t\t// sleep for 24 hours\n\t\ttime.Sleep(sleepPeriod)\n\t}\n}", "func sqlBackup() {\n\tgodrv.Register(\"SET NAMES utf8\")\n\tdb, err := sql.Open(\"mysql\", fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s\", username, password, hostname, port, dbname))\n\tif err != nil {\n\t\tfmt.Println(\"Error opening database: \", err)\n\t\treturn\n\t}\n\n\tdefer db.Close()\n\n\trows, err := db.Query(\"Show databases;\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar name string\n\t\terr := rows.Scan(&name)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tif !contains(ingoreSqlTableList, name) {\n\t\t\tlog.Println(\"*******************\")\n\t\t\tlog.Println(name + \" is backuping\")\n\t\t\tdumpFilenameFormat := fmt.Sprintf(\"%s-20060102150405\", name)\n\t\t\tdumper, err := mysqldump.Register(db, backupSqlDir, dumpFilenameFormat)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error registering databse:\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tresultFilename, err := dumper.Dump()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error dumping:\", err)\n\t\t\t}\n\t\t\tlog.Println(name + \" is backuped\")\n\t\t\tlog.Printf(\"File is saved to %s \\n\", resultFilename)\n\t\t\tlog.Println(\"*******************\")\n\n\t\t\tdumper.Close()\n\t\t}\n\n\t}\n}", "func (b *BackuPOT) backup(localPath localPath, remotePath remotePath) error {\n if err := log.ValidateKey(log.Key(remotePath)); err != nil {\n return backupotDebug.Error(err)\n }\n // get file info\n dir, name := splitPath(localPath)\n //localPath = dir + \"/\" + name\n // compress and read the file\n buf, fileInfo, err := b.prepareFile(dir, name)\n if err != nil {\n return backupotDebug.Error(err)\n }\n if need, err := b.needBackup(remotePath, fileInfo); err != nil {\n return backupotDebug.Error(err)\n } else if !need {\n return backupotDebug.Error(errors.New(\"No need to backup. No change since last backup.\"))\n }\n // Put the file to teapot\n if err := b.putRemoteFile(remotePath, buf); err != nil {\n return backupotDebug.Error(err)\n }\n // Put fileInfo\n if err := b.putRemoteFileInfo(remotePath, fileInfo); err != nil {\n return backupotDebug.Error(err)\n }\n return nil\n}", "func (backupWrapper *v1BackupWrapper) setBackup(\n\tbackup *cstorapis.CStorBackup) *v1BackupWrapper {\n\tbackupWrapper.backup = backup\n\treturn backupWrapper\n}", "func (b BackupSchedule) Validate() error {\n\treturn validateBackupSchedule(&b).ToAggregate()\n}", "func NewAutoBackup(ctx *pulumi.Context,\n\tname string, args *AutoBackupArgs, opts ...pulumi.ResourceOption) (*AutoBackup, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.DiskId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DiskId'\")\n\t}\n\tif args.Weekdays == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Weekdays'\")\n\t}\n\tvar resource AutoBackup\n\terr := ctx.RegisterResource(\"sakuracloud:index/autoBackup:AutoBackup\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (client *KeyVaultClient) fullBackupCreateRequest(ctx context.Context, vaultBaseURL string, options *KeyVaultClientBeginFullBackupOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/backup\"\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\tif options != nil && options.AzureStorageBlobContainerURI != nil {\n\t\treturn req, runtime.MarshalAsJSON(req, *options.AzureStorageBlobContainerURI)\n\t}\n\treturn req, nil\n}", "func (game *Game) Backup(turnNumber int, force bool) error {\n\tcurrent2hPath := game.TwohFile.Fullpath\n\n\ttarget2hPath, err := game.TwohFile.BackupFilepath(turnNumber)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcurrentTrnPath := game.TrnFile.Fullpath\n\n\ttargetTrnPath, err := game.TrnFile.BackupFilepath(turnNumber)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !force && (utility.FileExists(target2hPath) || utility.FileExists(targetTrnPath)) {\n\t\treturn errors.New(fmt.Sprintf(\"Backup for turn %v already exists in %v, not forcing\", turnNumber, game.Directory))\n\t}\n\n\terr = utility.Cp(current2hPath, target2hPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = utility.Cp(currentTrnPath, targetTrnPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func GetBackupCreateRequest(backupName string, clusterName string, bLocation string, bLocationUID string,\n\tnamespaces []string, labelSelectors map[string]string, orgID string) *api.BackupCreateRequest {\n\treturn &api.BackupCreateRequest{\n\t\tCreateMetadata: &api.CreateMetadata{\n\t\t\tName: backupName,\n\t\t\tOrgId: orgID,\n\t\t},\n\t\tBackupLocationRef: &api.ObjectRef{\n\t\t\tName: bLocation,\n\t\t\tUid: bLocationUID,\n\t\t},\n\t\tCluster: clusterName,\n\t\tNamespaces: namespaces,\n\t\tLabelSelectors: labelSelectors,\n\t}\n}", "func handleABS(kubecli kubernetes.Interface, s *api.ABSBackupSource, sch api.BackupSchedule, endpoints []string, clientTLSSecret, namespace string) (*api.BackupStatus, error) {\n\tcli, err := absfactory.NewClientFromSecret(kubecli, namespace, s.ABSSecret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar tlsConfig *tls.Config\n\tif len(clientTLSSecret) != 0 {\n\t\td, err := k8sutil.GetTLSDataFromSecret(kubecli, namespace, clientTLSSecret)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get TLS data from secret (%v): %v\", clientTLSSecret, err)\n\t\t}\n\t\ttlsConfig, err = etcdutil.NewTLSConfig(d.CertData, d.KeyData, d.CAData)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to constructs tls config: %v\", err)\n\t\t}\n\t}\n\n\tbm := backup.NewBackupManagerFromWriter(kubecli, writer.NewABSWriter(cli.ABS), tlsConfig, endpoints, namespace)\n\tappendRev := false\n\tif sch.BackupIntervalInSecond > 0 {\n\t\tappendRev = true\n\t}\n\trev, etcdVersion, err := bm.SaveSnap(s.Path, appendRev)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to save snapshot (%v)\", err)\n\t}\n\n\terr = bm.PurgeBackup(s.Path, sch.MaxBackups)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to purge backups (%v)\", err)\n\t}\n\treturn &api.BackupStatus{EtcdVersion: etcdVersion, EtcdRevision: rev}, nil\n}", "func UpdateScheduledBackup(schedulePolicyName, schedulePolicyUID string, ScheduledBackupInterval time.Duration) (err error) {\n\tvar ctx context1.Context\n\n\tStep(fmt.Sprintf(\"Update schedule policy %s\", schedulePolicyName), func() {\n\t\tbackupDriver := Inst().Backup\n\n\t\t// Create a backup schedule\n\t\tschedulePolicyUpdateRequest := &api.SchedulePolicyUpdateRequest{\n\t\t\tCreateMetadata: &api.CreateMetadata{\n\t\t\t\tName: schedulePolicyName,\n\t\t\t\tUid: schedulePolicyUID,\n\t\t\t\tOrgId: OrgID,\n\t\t\t},\n\n\t\t\tSchedulePolicy: &api.SchedulePolicyInfo{\n\t\t\t\tInterval: &api.SchedulePolicyInfo_IntervalPolicy{\n\t\t\t\t\t// Retain 5 backups at a time for ease of inspection\n\t\t\t\t\tRetain: 5,\n\t\t\t\t\tMinutes: int64(ScheduledBackupInterval / time.Minute),\n\t\t\t\t\tIncrementalCount: &api.SchedulePolicyInfo_IncrementalCount{\n\t\t\t\t\t\tCount: 0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\t//ctx, err = backup.GetPxCentralAdminCtx()\n\t\tctx, err = backup.GetAdminCtxFromSecret()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t_, err = backupDriver.UpdateSchedulePolicy(ctx, schedulePolicyUpdateRequest)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t})\n\treturn err\n}", "func NewBackupScheduleReconciler(mgr manager.Manager) *BackupScheduleReconciler {\n\treturn &BackupScheduleReconciler{\n\t\tClient: mgr.GetClient(),\n\t\tLog: ctrl.Log.WithName(\"controllers\").WithName(\"BackupSchedule\"),\n\t\tscheme: mgr.GetScheme(),\n\t\tbackupScheduleCtrl: &realBackupScheduleControl{client: mgr.GetClient()},\n\t\tcronAnythingCtrl: &realCronAnythingControl{client: mgr.GetClient()},\n\t\tbackupCtrl: &realBackupControl{client: mgr.GetClient()},\n\t}\n}", "func (fbbsd FrequencyBasedBackupScheduleDescription) AsBackupScheduleDescription() (*BackupScheduleDescription, bool) {\n\treturn nil, false\n}", "func backupScheduleFound(repo v1beta1.PGBackRestRepo, backupType string) bool {\n\tif repo.BackupSchedules != nil {\n\t\tswitch backupType {\n\t\tcase full:\n\t\t\treturn repo.BackupSchedules.Full != nil\n\t\tcase differential:\n\t\t\treturn repo.BackupSchedules.Differential != nil\n\t\tcase incremental:\n\t\t\treturn repo.BackupSchedules.Incremental != nil\n\t\tdefault:\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "func (client *CassandraClustersClient) getBackupCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, backupID string, options *CassandraClustersClientGetBackupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif backupID == \"\" {\n\t\treturn nil, errors.New(\"parameter backupID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{backupId}\", url.PathEscape(backupID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-15-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (w *Worker) doBackups(r *http.Request) *http.Response {\n\thosts := w.getAliveHosts(w.backup)\n\tif len(hosts) == 0 {\n\t\treturn nil\n\t}\n\n\tfor id, host := range hosts {\n\t\tvar req *http.Request\n\n\t\tif req = w.requestSetHost(host, r); req != nil {\n\t\t\tres, err := w.makeRequest(req)\n\n\t\t\tif err != nil && err != http_err {\n\t\t\t\tw.markHostBroken(TYPE_BACKUP, id)\n\t\t\t}\n\n\t\t\treturn res\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *Client) Backup(fullName string) (string, error) {\n\tnewName := c.newFullName(fullName)\n\tif err := c.copyImage(fullName, newName); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn newName, nil\n}", "func (r *ReconcileVolumeBackup) requestCreate(snapshot *v1alpha1.VolumeSnapshot, instance *backupsv1alpha1.VolumeBackup) error {\n\tif err := controllerutil.SetControllerReference(instance, snapshot, r.scheme); err != nil {\n\t\tlog.Error(err, \"Unable to set owner reference of %v\", snapshot.Name)\n\t\treturn err\n\t}\n\n\t_, err := r.snapClientset.SnapshotV1alpha1().VolumeSnapshots(instance.Namespace).Create(snapshot)\n\tif err != nil {\n\t\tlog.Error(err, \"Error creating VolumeSnapshot\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func (tbbsd TimeBasedBackupScheduleDescription) AsBasicBackupScheduleDescription() (BasicBackupScheduleDescription, bool) {\n\treturn &tbbsd, true\n}", "func (client *BackupAndExportClient) validateBackupCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *BackupAndExportClientValidateBackupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/validateBackup\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serverName == \"\" {\n\t\treturn nil, errors.New(\"parameter serverName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serverName}\", url.PathEscape(serverName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-30-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewCreateBackupPlanRequestWithoutParam() *CreateBackupPlanRequest {\n\n return &CreateBackupPlanRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/backupPlans\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "func (a *Client) CreateVolumeBackup(params *CreateVolumeBackupParams) (*CreateVolumeBackupOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateVolumeBackupParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"CreateVolumeBackup\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/volumeBackups\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &CreateVolumeBackupReader{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.(*CreateVolumeBackupOK), nil\n\n}", "func RestoreBackup(dto *action_dtos.RestoreBackupDto, service *pgCommon.PostgresServiceInformations) error {\n\t_, err := service.PgoApi.RestoreBackup(&msgs.RestoreRequest{\n\t\tBackrestStorageType: \"s3\",\n\t\tNamespace: service.ClusterInstance.Namespace,\n\t\tFromCluster: dto.OldClusterName,\n\t})\n\n\tif err != nil {\n\t\tlogger.RError(err, \"Unable to progress restore backup action for \"+service.ClusterInstance.Name)\n\t}\n\n\treturn err\n}" ]
[ "0.68177533", "0.6513657", "0.6345432", "0.61539024", "0.6150429", "0.59448236", "0.59301215", "0.57305014", "0.567647", "0.56463933", "0.56347996", "0.55442417", "0.5516464", "0.5512978", "0.54288435", "0.54252183", "0.5423092", "0.53933567", "0.53620535", "0.5304515", "0.53024966", "0.5287012", "0.5274553", "0.5240257", "0.52125907", "0.5201263", "0.5197901", "0.5193865", "0.5190788", "0.51752067", "0.51659596", "0.5156838", "0.51544", "0.51497257", "0.5144454", "0.5130758", "0.5118629", "0.51069325", "0.51032394", "0.509765", "0.5095664", "0.5089121", "0.5045759", "0.5038492", "0.5031684", "0.50157404", "0.49964774", "0.49929613", "0.49886978", "0.4984478", "0.49727508", "0.49612388", "0.49432582", "0.49203804", "0.49145597", "0.48910302", "0.48842147", "0.48794314", "0.4859297", "0.4853696", "0.48391458", "0.48350975", "0.48336023", "0.48207933", "0.47995034", "0.47800428", "0.47796935", "0.47609758", "0.47550917", "0.4750218", "0.47475082", "0.474426", "0.47394803", "0.47359347", "0.47356698", "0.47129026", "0.47111207", "0.47100815", "0.46899512", "0.46878478", "0.46866283", "0.46765006", "0.4673488", "0.46702135", "0.46696153", "0.4666109", "0.46660882", "0.46615413", "0.46611732", "0.4658255", "0.4650289", "0.46458763", "0.46453506", "0.46369666", "0.4622272", "0.46214142", "0.46200666", "0.46130967", "0.4613006", "0.46083748" ]
0.78230155
0
GetUserList get user list from paas
GetUserList получает список пользователей из paas
func (m *publicUser) GetUserList(c *gin.Context) (int, interface{}) { user := plugins.CurrentPlugin(c, m.config.LoginVersion) userList, err := user.GetUserList(c, m.config.ConfigMap) rspBody := metadata.LonginSystemUserListResult{} if nil != err { rspBody.Code = common.CCErrCommHTTPDoRequestFailed rspBody.ErrMsg = err.Error() rspBody.Result = false } rspBody.Result = true rspBody.Data = userList return 200, rspBody }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetListUser(c *gin.Context) {\r\n\tvar usr []model.UserTemporary\r\n\tres := model.GetLUser(usr)\r\n\r\n\tutils.WrapAPIData(c, map[string]interface{}{\r\n\t\t\"Data\": res,\r\n\t}, http.StatusOK, \"success\")\r\n}", "func getUserList() string {\n\tvar userlist string\n\tfmt.Println(len(Users))\n\tfor key, value := range Users {\n\t\tfmt.Println(\"key\", key, \"value\", value)\n\t\tuserlist = userlist + key + \"|\"\n\n\t}\n\treturn strings.TrimRight(userlist, \"|\")\n}", "func (up *userProvider) List(ctx context.Context) ([]models.User, error) {\n\tusers, err := up.userStore.List(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn users, nil\n}", "func (s *initServer) GetUserList(ctx context.Context, in *pb.UserListRequest) (*pb.UserListResponse, error) {\t\n\treturn userListTempl(ctx, in, \"userList:user\", false)\n}", "func (s *Service) List(c context.Context, req *user.ListReq) (*user.ListResp, error) {\n\tif err := req.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := s.auth.GetUser(c)\n\n\tlimit, offset := query.Paginate(req.Limit, req.Page)\n\n\tusers, err := s.udb.List(\n\t\ts.dbcl.WithContext(c),\n\t\tquery.ForTenant(u, req.TenantId),\n\t\tlimit,\n\t\toffset,\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar pu []*user.Resp\n\tfor _, v := range users {\n\t\tpu = append(pu, v.Proto())\n\t}\n\n\treturn &user.ListResp{Users: pu}, nil\n}", "func (retUser) List(ctx context.Context, db *sqlx.DB) ([]User, error) {\n\tctx, span := global.Tracer(\"service\").Start(ctx, \"internal.data.retrieve.user.list\")\n\tdefer span.End()\n\n\tusers := []User{}\n\tconst q = `SELECT * FROM users`\n\n\tif err := db.SelectContext(ctx, &users, q); err != nil {\n\t\treturn nil, errors.Wrap(err, \"selecting users\")\n\t}\n\n\treturn users, nil\n}", "func (m *userManager) UserList() []string {\n\tuserList := make([]string, 0)\n\tm.db.View(func(tx *bolt.Tx) error {\n\t\tusers := tx.Bucket(m.usersBucket)\n\t\treturn users.ForEach(func(username, v []byte) error {\n\t\t\tuserList = append(userList, string(username))\n\t\t\treturn nil\n\t\t})\n\t})\n\treturn userList\n}", "func userList(w http.ResponseWriter, r *http.Request) {}", "func GetUserList(w http.ResponseWriter, r *http.Request) {\n\n\tusers, err := user.GetUserList(r)\n\n\tif err != nil {\n\t\thttpext.AbortAPI(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\thttpext.SuccessDataAPI(w, \"Ok\", users)\n}", "func (UserService) List(ctx context.Context, gdto dto.GeneralListDto) ([]model.User, int64) {\n\tcols := \"*\"\n\tgdto.Q, cols = dataPermService.DataPermFilter(ctx, \"users\", gdto)\n\treturn userDao.List(gdto, cols)\n}", "func (u *User) List() ([]*UserListRes, error) {\n\tvar users []db.Users\n\tif err := u.Sess.Asc(\"id\").Find(&users); err != nil {\n\t\treturn nil, err\n\t}\n\tres := make([]*UserListRes, len(users))\n\tfor i := 0; i < len(users); i++ {\n\t\tuser := users[i]\n\t\tres[i] = &UserListRes{ID: user.Id, Name: user.Name}\n\t}\n\treturn res, nil\n}", "func (m *Mgr) list(ctx context.Context) (users []*User, err error) {\n\trows, err := m.db.QueryContext(ctx, `SELECT username, password FROM users`)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar u User\n\t\tif err = rows.Scan(&u.Username, &u.Password); err != nil {\n\t\t\treturn\n\t\t}\n\t\tusers = append(users, &u)\n\t}\n\treturn users, rows.Err()\n}", "func (us *UserService) List(p *Pagination) ([]User, error) {\n\treturn us.Datasource.List(p)\n}", "func (us UserService) List(dto dto.GeneralListDto) ([]model.User, int64) {\n\treturn userDao.List(dto)\n}", "func (m *Mgr) List(ctx context.Context) ([]*User, error) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\tusers, err := m.list(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// hide passwords\n\tfor _, u := range users {\n\t\tu.Password = \"\"\n\t}\n\treturn users, nil\n}", "func (r *UserRead) list(q *msg.Request, mr *msg.Result) {\n\tvar (\n\t\tuserID, userName string\n\t\trows *sql.Rows\n\t\terr error\n\t)\n\n\tif rows, err = r.stmtList.Query(); err != nil {\n\t\tmr.ServerError(err, q.Section)\n\t\treturn\n\t}\n\n\tfor rows.Next() {\n\t\tif err = rows.Scan(\n\t\t\t&userID,\n\t\t\t&userName,\n\t\t); err != nil {\n\t\t\trows.Close()\n\t\t\tmr.ServerError(err, q.Section)\n\t\t\treturn\n\t\t}\n\t\tmr.User = append(mr.User, proto.User{\n\t\t\tID: userID,\n\t\t\tUserName: userName,\n\t\t})\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tmr.ServerError(err, q.Section)\n\t\treturn\n\t}\n\tmr.OK()\n}", "func (u *UserServiceHandler) List(ctx context.Context) ([]User, error) {\n\n\turi := \"/v1/user/list\"\n\n\treq, err := u.client.NewRequest(ctx, http.MethodGet, uri, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar users []User\n\terr = u.client.DoWithContext(ctx, req, &users)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn users, nil\n}", "func (h *User) List(w http.ResponseWriter, r *http.Request) {\n\tlimit, offset := utils.GetPaginationParams(r.URL.Query())\n\tresp, err := h.Storage.GetUserList(limit, offset)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tR.JSON500(w)\n\t\treturn\n\t}\n\n\tif len(resp) < 1 {\n\t\tR.JSON404(w)\n\t\treturn\n\t}\n\n\tR.JSON200(w, resp)\n}", "func (h *ServiceUsersHandler) List(ctx context.Context, project, serviceName string) ([]*ServiceUser, error) {\n\t// Aiven API does not provide list operation for service users, need to get them via service info instead\n\tservice, err := h.client.Services.Get(ctx, project, serviceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn service.Users, nil\n}", "func (c *UsersClient) List(ctx context.Context, filter string) (*[]models.User, int, error) {\n\tparams := url.Values{}\n\tif filter != \"\" {\n\t\tparams.Add(\"$filter\", filter)\n\t}\n\tresp, status, _, err := c.BaseClient.Get(ctx, base.GetHttpRequestInput{\n\t\tValidStatusCodes: []int{http.StatusOK},\n\t\tUri: base.Uri{\n\t\t\tEntity: \"/users\",\n\t\t\tParams: params,\n\t\t\tHasTenantId: true,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, status, err\n\t}\n\tdefer resp.Body.Close()\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\tvar data struct {\n\t\tUsers []models.User `json:\"value\"`\n\t}\n\tif err := json.Unmarshal(respBody, &data); err != nil {\n\t\treturn nil, status, err\n\t}\n\treturn &data.Users, status, nil\n}", "func (u *UserService) List(ctx context.Context) ([]*User, *http.Response, error) {\n\treq, err := u.client.newRequest(\"GET\", \"user.list\", nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar users []*User\n\tresp, err := u.client.do(ctx, req, &users)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn users, resp, nil\n}", "func (remoteAccessVpnUserApi *RemoteAccessVpnUserApi) List() ([]RemoteAccessVpnUser, error) {\n\tdata, err := remoteAccessVpnUserApi.entityService.List(map[string]string{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn parseRemoteAccessVpnUserList(data), nil\n}", "func (service Service) GetList(pagination entity.Pagination) (ug []entity.UserGroup, count int, err error) {\n\tusers, count, err := service.repository.GetList(pagination)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tug, err = service.mapUsersToUserGroups(users)\n\treturn\n}", "func List(ctx echo.Context) error {\n\tvar res []*userResponse\n\terr := db.Model(&User{}).Where(\"type = ?\", ctx.QueryParams().Get(\"type\")).Scan(&res).Error\n\tif err != nil {\n\t\treturn ctx.JSON(http.StatusBadRequest, &response{Code: 1})\n\t}\n\treturn ctx.JSON(http.StatusOK, &response{\n\t\tCode: 0,\n\t\tData: res,\n\t})\n}", "func (s *UserServer) List(ctx context.Context, in *pb.UserQuery) (*pb.UsersInfo, error) {\n\tvar err error\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tutils.GetLog().Error(\"rpc.user.List error: %+v\", err)\n\t\t}\n\t}()\n\n\tconfig := &users.Config{\n\t\tPageNum: int(in.Num),\n\t\tPageSize: int(in.Size),\n\t\tSearch: in.Search,\n\t\tIDs: in.IDs,\n\t}\n\n\tusers := users.NewUsers(config)\n\tif err = users.Do(); err != nil {\n\t\treturn nil, errors.New(users.ErrorCode().String())\n\t}\n\n\tsrvUsers := users.Users()\n\tcount := users.Count()\n\n\tvar pbUsers []*pb.UserInfo\n\tfor _, srvUser := range srvUsers {\n\t\tpbUser := srvUserToPbUser(srvUser)\n\t\tpbUsers = append(pbUsers, pbUser)\n\t}\n\n\treturn &pb.UsersInfo{Users: pbUsers, TotalNum: count}, nil\n}", "func (m *manager) List(ctx context.Context, query *q.Query) (models.Users, error) {\n\tquery = q.MustClone(query)\n\tif query.Sorting == \"\" {\n\t\tquery.Sorting = \"username\"\n\t}\n\n\texcludeAdmin := true\n\tfor key := range query.Keywords {\n\t\tstr := strings.ToLower(key)\n\t\tif str == \"user_id__in\" {\n\t\t\texcludeAdmin = false\n\t\t\tbreak\n\t\t} else if str == \"user_id\" {\n\t\t\texcludeAdmin = false\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif excludeAdmin {\n\t\t// Exclude admin account when not filter by UserIDs, see https://github.com/goharbor/harbor/issues/2527\n\t\tquery.Keywords[\"user_id__gt\"] = 1\n\t}\n\n\treturn m.dao.List(ctx, query)\n}", "func (us *UserService) List(ctx context.Context) ([]*resources.User, error) {\n\tdoc, err := us.list(ctx, \"one.userpool.info\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\telements := doc.FindElements(\"USER_POOL/USER\")\n\n\tusers := make([]*resources.User, len(elements))\n\tfor i, e := range elements {\n\t\tusers[i] = resources.CreateUserFromXML(e)\n\t}\n\n\treturn users, nil\n}", "func listUser(ctx sdk.Context, k Keeper) ([]byte, error) {\n\tvar userList []types.User\n\tstore := ctx.KVStore(k.storeKey)\n\titerator := sdk.KVStorePrefixIterator(store, []byte(types.UserPrefix))\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\tvar user types.User\n\t\tk.cdc.MustUnmarshalBinaryLengthPrefixed(store.Get(iterator.Key()), &user)\n\t\tuserList = append(userList, user)\n\t}\n\tres := codec.MustMarshalJSONIndent(k.cdc, userList)\n\treturn res, nil\n}", "func GetUsers(req *http.Request, render render.Render, account services.Account) {\n qs := req.URL.Query()\n userIDs := qs[\"userId\"]\n var users []models.User\n for _, userID := range userIDs {\n if user, err := account.GetUser(userID); err != nil {\n render.JSON(err.HttpCode, err)\n return\n } else {\n users = append(users, *user)\n }\n }\n render.JSON(http.StatusOK, users)\n}", "func ListUser(email, password string) []User {\n\tvar u []User\n\tDb.Find(&u)\n\treturn u\n}", "func (db *MySQLDB) ListUser(ctx context.Context, request *helper.PageRequest) ([]*User, *helper.Page, error) {\n\tfLog := mysqlLog.WithField(\"func\", \"ListUser\").WithField(\"RequestID\", ctx.Value(constants.RequestID))\n\tcount, err := db.Count(ctx)\n\tif err != nil {\n\t\tfLog.Errorf(\"db.Count got %s\", err.Error())\n\t\treturn nil, nil, err\n\t}\n\tpage := helper.NewPage(request, uint(count))\n\tuserList := make([]*User, 0)\n\n\tvar OrderBy string\n\tswitch strings.ToUpper(request.OrderBy) {\n\tcase \"EMAIL\":\n\t\tOrderBy = \"EMAIL\"\n\tcase \"ENABLED\":\n\t\tOrderBy = \"ENABLED\"\n\tcase \"SUSPENDED\":\n\t\tOrderBy = \"SUSPENDED\"\n\tcase \"LAST_SEEN\":\n\t\tOrderBy = \"LAST_SEEN\"\n\tcase \"LAST_LOGIN\":\n\t\tOrderBy = \"LAST_LOGIN\"\n\tdefault:\n\t\tOrderBy = \"EMAIL\"\n\t}\n\n\tq := fmt.Sprintf(\"SELECT REC_ID, EMAIL,HASHED_PASSPHRASE,ENABLED, SUSPENDED,LAST_SEEN,LAST_LOGIN,FAIL_COUNT,ACTIVATION_CODE,ACTIVATION_DATE,TOTP_KEY,ENABLE_2FE,TOKEN_2FE,RECOVERY_CODE FROM HANSIP_USER ORDER BY %s %s LIMIT %d, %d\", OrderBy, request.Sort, page.OffsetStart, page.OffsetEnd-page.OffsetStart)\n\trows, err := db.instance.QueryContext(ctx, q)\n\tif err != nil {\n\t\tfLog.Errorf(\"db.instance.QueryContext got %s. SQL = %s\", err.Error(), q)\n\t\treturn nil, nil, &ErrDBQueryError{\n\t\t\tWrapped: err,\n\t\t\tMessage: \"Error ListUser\",\n\t\t\tSQL: q,\n\t\t}\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tuser := &User{}\n\t\tvar enabled, suspended, enable2fa int\n\t\terr := rows.Scan(&user.RecID, &user.Email, &user.HashedPassphrase, &enabled, &suspended, &user.LastSeen, &user.LastLogin, &user.FailCount, &user.ActivationCode,\n\t\t\t&user.ActivationDate, &user.UserTotpSecretKey, &enable2fa, &user.Token2FA, &user.RecoveryCode)\n\t\tif err != nil {\n\t\t\tfLog.Warnf(\"rows.Scan got %s\", err.Error())\n\t\t\treturn nil, nil, &ErrDBScanError{\n\t\t\t\tWrapped: err,\n\t\t\t\tMessage: \"Error ListUser\",\n\t\t\t\tSQL: q,\n\t\t\t}\n\t\t} else {\n\t\t\tif enabled == 1 {\n\t\t\t\tuser.Enabled = true\n\t\t\t}\n\t\t\tif suspended == 1 {\n\t\t\t\tuser.Suspended = true\n\t\t\t}\n\t\t\tif enable2fa == 1 {\n\t\t\t\tuser.Enable2FactorAuth = true\n\t\t\t}\n\t\t\tuserList = append(userList, user)\n\t\t}\n\t}\n\treturn userList, page, nil\n}", "func (r repository) List(ctx context.Context, list *ListUsersRequest) ([]model.User, error) {\n\tusers := make([]model.User, 0)\n\toffset := (list.Page - 1) * list.Limit\n\terr := r.db.Select(&users, ListUsersSQL, offset, list.Limit)\n\tif err != nil {\n\t\tr.logger.Errorf(\"Failed to select users %s\", err)\n\t\treturn nil, err\n\t}\n\treturn users, nil\n}", "func UserListAll(w http.ResponseWriter, r *http.Request) {\n\n\tvar err error\n\tvar pageSize int\n\tvar paginatedUsers auth.PaginatedUsers\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\trefRoles := gorillaContext.Get(r, \"auth_roles\").([]string)\n\n\t// Grab url path variables\n\turlValues := r.URL.Query()\n\tpageToken := urlValues.Get(\"pageToken\")\n\tstrPageSize := urlValues.Get(\"pageSize\")\n\tprojectName := urlValues.Get(\"project\")\n\tprojectUUID := \"\"\n\n\tif projectName != \"\" {\n\t\tprojectUUID = projects.GetUUIDByName(projectName, refStr)\n\t\tif projectUUID == \"\" {\n\t\t\terr := APIErrorNotFound(\"ProjectUUID\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif strPageSize != \"\" {\n\t\tif pageSize, err = strconv.Atoi(strPageSize); err != nil {\n\t\t\tlog.Errorf(\"Pagesize %v produced an error while being converted to int: %v\", strPageSize, err.Error())\n\t\t\terr := APIErrorInvalidData(\"Invalid page size\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// check that user is indeed a service admin in order to be priviledged to see full user info\n\tpriviledged := auth.IsServiceAdmin(refRoles)\n\n\t// Get Results Object - call is always priviledged because this handler is only accessible by service admins\n\tif paginatedUsers, err = auth.PaginatedFindUsers(pageToken, int32(pageSize), projectUUID, priviledged, refStr); err != nil {\n\t\terr := APIErrorInvalidData(\"Invalid page token\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := paginatedUsers.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func ListUser(url, token string) {\n\tres, err := handleReadRequest(url, http.MethodGet, token)\n\tif err != nil {\n\t\tfmt.Println(\"Error\\n\")\n\t}\n\n\tvar apiResponse ListUsers\n\terr = json.Unmarshal(res, &apiResponse)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tfmt.Print(\"List of users:\\n\")\n\tfor i:=0; i < len(apiResponse.Users); i++ {\n\t\tfmt.Print(apiResponse.Users[i],\"\\n\")\n\t}\n}", "func (s *initServer) GetUserListFilter(ctx context.Context, in *pb.UserListRequest) (*pb.UserListResponse, error) {\t\n\treturn userListTempl(ctx, in, \"userListFilter:user\", true)\n}", "func (s *UserServiceImpl) ListUser(c *gin.Context) ([]*models.User, error) {\n\tdb := c.MustGet(\"db\").(*gorm.DB)\n\tusers := []*models.User{}\n\terr := db.Find(&users).Error\n\treturn users, err\n}", "func (u *User) List(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {\n\tctx, span := trace.StartSpan(ctx, \"handlers.User.List\")\n\tdefer span.End()\n\n\tusers, err := user.List(ctx, u.db)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn web.Respond(ctx, w, users, http.StatusOK)\n}", "func (r mysqlRepo) GetUserList(ctx context.Context, page, perpage int) (data []User, total int, err error) {\n\tusers := make([]User, 0)\n\toffset := (page - 1) * perpage\n\tquery := \"SELECT id, username, email, created_at, updated_at FROM users limit ?,?\"\n\n\terr = r.db.Select(&users, query, offset, perpage)\n\tif err != nil {\n\t\tr.logger.Errorf(\"failed to get list of users %s\", err)\n\t\treturn\n\t}\n\n\treturn users, len(users), nil\n}", "func getUser(c *fiber.Ctx) error {\n\tUserscollection := mg.Db.Collection(\"users\")\n\tListscollection := mg.Db.Collection(\"lists\")\n\tusername := c.Params(\"name\")\n\tuserQuery := bson.D{{Key: \"username\", Value: username}}\n\n\tuserRecord := Userscollection.FindOne(c.Context(), &userQuery)\n\tuser := &User{}\n\tuserRecord.Decode(&user)\n\tif len(user.ID) < 1 {\n\t\treturn c.Status(404).SendString(\"cant find user\")\n\t}\n\tlistQuery := bson.D{{Key: \"userid\", Value: user.Username}}\n\tcursor, err := Listscollection.Find(c.Context(), &listQuery)\n\tif err != nil {\n\t\treturn c.Status(500).SendString(err.Error())\n\t}\n\tvar lists []List = make([]List, 0)\n\tif err := cursor.All(c.Context(), &lists); err != nil {\n\t\treturn c.Status(500).SendString(\"internal err\")\n\t}\n\tuser.Password = \"\"\n\tuser.TaskCode = \"\"\n\treturn c.Status(200).JSON(&fiber.Map{\n\t\t\"user\": user,\n\t\t\"lists\": lists,\n\t})\n}", "func userListTempl(ctx context.Context, in *pb.UserListRequest, id string, f bool) (*pb.UserListResponse, error) {\n\tresp := getUserListResp(ctx)\n\n\tc := newConn(id)\n\tu := pbUser.NewUserServiceClient(c)\n\tdefer c.Close()\n\n\tcode, err := handleAuthCheck(ctx, u); \n\tif err != nil {\n\t\treturn resp(nil, err.Error(), code)\n\t}\n\n\tres, err := u.UserList(ctx, &pbUser.UserListRequest{\n\t\tList: in.GetList(),\n\t\tOffset: in.GetOffset(),\n\t\tFilter: f,\n\t\tValue: in.GetValue(),\n\t})\n\n\tif err != nil {\n\t\treturn resp(nil, err.Error(), \"400\")\n\t}\n\n\tvar users []*pb.Users\n\tvar wg sync.WaitGroup\n\n\tfor _, el := range res.GetUsers() {\n\t\twg.Add(1)\n\t\tgo func(item *pbUser.Users) {\n\t\t\tusers = append(users, &pb.Users{\n\t\t\t\tName: item.GetName(),\n\t\t\t\tEmail: item.GetEmail(),\n\t\t\t\tUuid: item.GetUuid(),\n\t\t\t\tId: item.GetId(),\n\t\t\t})\n\t\t\twg.Done()\n\t\t}(el)\n\t}\n\twg.Wait()\n\t\n\treturn resp(users, res.Message, res.Code)\n}", "func (c client) UserList() ([]*User, error) {\n\tdata := url.Values{}\n\tdata.Set(\"token\", c.conf.Token)\n\tres, err := http.PostForm(\"https://slack.com/api/users.list\", data)\n\tif err != nil {\n\t\treturn []*User{}, err\n\t}\n\tdefer res.Body.Close()\n\n\tvar list userlist\n\tif err = json.NewDecoder(res.Body).Decode(&list); err != nil {\n\t\treturn []*User{}, err\n\t}\n\treturn list.Members, nil\n}", "func listUsersPartial(client *Client) ([]interface{}, error) {\n\treturn client.GetItemListInterfaceArray(\"/access/users\")\n}", "func (pool *Pool) GetUserList() []string {\n\tpool.mu.Lock()\n\tusernames := make([]string, 0)\n\n\tfor client := range pool.Clients {\n\t\tusernames = append(usernames, client.Account.Username)\n\t}\n\n\tpool.mu.Unlock()\n\treturn usernames\n}", "func (rep *UserRepo) List(ctx context.Context) ([]*User, error) {\n\tu := []*User{}\n\terr := rep.db.Query(\n\t\tctx,\n\t\trep.db.Select(\"*\").From(rep.table()),\n\t).Decode(&u)\n\treturn u, err\n}", "func (s repoUserService) List(path string) ([]*api.User, error) {\n\trepoPath, err := api.NewRepoPath(path)\n\tif err != nil {\n\t\treturn nil, errio.Error(err)\n\t}\n\n\tusers, err := s.client.httpClient.ListRepoUsers(repoPath.GetNamespaceAndRepoName())\n\tif err != nil {\n\t\treturn nil, errio.Error(err)\n\t}\n\n\treturn users, nil\n}", "func (c *DefaultIdentityProvider) ListUsers(ctx context.Context, options *metainternal.ListOptions) (*auth.UserList, error) {\n\tkeyword := \"\"\n\tlimit := 50\n\tif options.FieldSelector != nil {\n\t\tkeyword, _ = options.FieldSelector.RequiresExactMatch(auth.KeywordQueryTag)\n\t\tlimitStr, _ := options.FieldSelector.RequiresExactMatch(auth.QueryLimitTag)\n\t\tif li, err := strconv.Atoi(limitStr); err == nil && li > 0 {\n\t\t\tlimit = li\n\t\t}\n\t}\n\n\t_, tenantID := authentication.GetUsernameAndTenantID(ctx)\n\tif tenantID != \"\" && tenantID != c.tenantID {\n\t\treturn nil, apierrors.NewBadRequest(\"must in the same tenant\")\n\t}\n\n\tallList, err := c.localIdentityLister.List(labels.Everything())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar localIdentityList []*authv1.LocalIdentity\n\tfor i, item := range allList {\n\t\tif item.Spec.TenantID == c.tenantID {\n\t\t\tlocalIdentityList = append(localIdentityList, allList[i])\n\t\t}\n\t}\n\n\tif keyword != \"\" {\n\t\tvar newList []*authv1.LocalIdentity\n\t\tfor i, val := range localIdentityList {\n\t\t\tif strings.Contains(val.Name, keyword) || strings.Contains(val.Spec.Username, keyword) || strings.Contains(val.Spec.DisplayName, keyword) {\n\t\t\t\tnewList = append(newList, localIdentityList[i])\n\t\t\t}\n\t\t}\n\t\tlocalIdentityList = newList\n\t}\n\n\titems := localIdentityList[0:min(len(localIdentityList), limit)]\n\n\tuserList := auth.UserList{}\n\tfor _, item := range items {\n\t\tuser := convertToUser(item)\n\t\tuserList.Items = append(userList.Items, user)\n\t}\n\n\treturn &userList, nil\n}", "func (cs *UserService) List() ([]UsersResponse, error) {\n\n\treq, err := cs.client.NewRequest(\"GET\", \"/users\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := cs.client.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif err := validateResponse(resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbodyBytes, _ := ioutil.ReadAll(resp.Body)\n\tbodyString := string(bodyBytes)\n\n\tu := &listUsersJSONResponse{}\n\terr = json.Unmarshal([]byte(bodyString), &u)\n\n\treturn u.Users, err\n}", "func (h UserHTTP) List(w http.ResponseWriter, r *http.Request) {\n\tlistRequest := listRequestDecoder(r)\n\tusers, err := h.svc.ListUsers(r.Context(), listRequest)\n\tif err != nil {\n\t\th.logger.With(r.Context()).Errorf(\"list users error : %s\", err)\n\t\trender.Render(w, r, e.BadRequest(err, \"bad request\"))\n\t\treturn\n\t}\n\trender.Respond(w, r, users)\n}", "func (cli *OpsGenieUserV2Client) List(req userv2.ListUsersRequest) (*userv2.ListUsersResponse, error) {\n\tvar response userv2.ListUsersResponse\n\terr := cli.sendGetRequest(&req, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &response, nil\n}", "func (s *Database) ListUser() ([]*UserPartner, error) {\n\tvar users []*UserPartner\n\terr := s.Engine.Desc(\"id\").Find(&users)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(users) == 0 {\n\t\treturn nil, errors.New(\"Database rong\")\n\t}\n\treturn users, nil\n}", "func listUsers(client *chef.Client, filters ...string) map[string]string {\n\tvar filter string\n\tif len(filters) > 0 {\n\t\tfilter = filters[0]\n\t}\n\tuserList, err := client.Users.List(filter)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue listing users:\", err)\n\t}\n\treturn userList\n}", "func List(w http.ResponseWriter, r *http.Request) {\n\tauthUser, err := auth.GetUserFromJWT(w, r)\n\tif err != nil {\n\t\tresponse.FormatStandardResponse(false, \"error-auth\", \"\", err.Error(), w)\n\t\treturn\n\t}\n\n\tlistHandler(w, authUser, false)\n}", "func List(ctx context.Context, dbConn *db.DB) ([]User, error) {\n\tu := []User{}\n\n\tf := func(collection *mgo.Collection) error {\n\t\treturn collection.Find(nil).All(&u)\n\t}\n\tif err := dbConn.MGOExecute(ctx, usersCollection, f); err != nil {\n\t\treturn nil, errors.Wrap(err, \"db.users.find()\")\n\t}\n\n\treturn u, nil\n}", "func ListUser(ctx context.Context, tx *sql.Tx, request *models.ListUserRequest) (response *models.ListUserResponse, err error) {\n\tvar rows *sql.Rows\n\tqb := &common.ListQueryBuilder{}\n\tqb.Auth = common.GetAuthCTX(ctx)\n\tspec := request.Spec\n\tqb.Spec = spec\n\tqb.Table = \"user\"\n\tqb.Fields = UserFields\n\tqb.RefFields = UserRefFields\n\tqb.BackRefFields = UserBackRefFields\n\tresult := []*models.User{}\n\n\tif spec.ParentFQName != nil {\n\t\tparentMetaData, err := common.GetMetaData(tx, \"\", spec.ParentFQName)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"can't find parents\")\n\t\t}\n\t\tspec.Filters = common.AppendFilter(spec.Filters, \"parent_uuid\", parentMetaData.UUID)\n\t}\n\n\tquery := qb.BuildQuery()\n\tcolumns := qb.Columns\n\tvalues := qb.Values\n\tlog.WithFields(log.Fields{\n\t\t\"listSpec\": spec,\n\t\t\"query\": query,\n\t}).Debug(\"select query\")\n\trows, err = tx.QueryContext(ctx, query, values...)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"select query failed\")\n\t}\n\tdefer rows.Close()\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"row error\")\n\t}\n\n\tfor rows.Next() {\n\t\tvaluesMap := map[string]interface{}{}\n\t\tvalues := make([]interface{}, len(columns))\n\t\tvaluesPointers := make([]interface{}, len(columns))\n\t\tfor _, index := range columns {\n\t\t\tvaluesPointers[index] = &values[index]\n\t\t}\n\t\tif err := rows.Scan(valuesPointers...); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"scan failed\")\n\t\t}\n\t\tfor column, index := range columns {\n\t\t\tval := valuesPointers[index].(*interface{})\n\t\t\tvaluesMap[column] = *val\n\t\t}\n\t\tm, err := scanUser(valuesMap)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"scan row failed\")\n\t\t}\n\t\tresult = append(result, m)\n\t}\n\tresponse = &models.ListUserResponse{\n\t\tUsers: result,\n\t}\n\treturn response, nil\n}", "func (s *UsersService) List(opt *UsersOptions) ([]User, *http.Response, error) {\n\turi, err := addOptions(\"users\", opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tusers := new(Users)\n\tres, err := s.client.Get(uri, users)\n\tif err != nil {\n\t\treturn nil, res, err\n\t}\n\n\treturn users.Users, res, err\n}", "func (a *API) listUsers(w http.ResponseWriter, req *http.Request) {\n\tvar (\n\t\tpath string\n\t\tusers cmap.ConcurrentMap\n\t\twg sync.WaitGroup\n\t)\n\t// Force reload policy to get the newest\n\t_ = a.policyEngine.LoadPolicy()\n\tif username := req.FormValue(\"name\"); username != \"\" {\n\t\tpath = common.Path(model.DefaultUsersPrefix, common.Hash(username, crypto.MD5))\n\t} else {\n\t\tpath = common.Path(model.DefaultUsersPrefix)\n\t}\n\tresp, err := a.etcdcli.DoGet(path, etcdv3.WithPrefix(),\n\t\tetcdv3.WithSort(etcdv3.SortByKey, etcdv3.SortAscend))\n\tif err != nil {\n\t\ta.respondError(w, apiError{\n\t\t\tcode: http.StatusInternalServerError,\n\t\t\terr: err,\n\t\t})\n\t\treturn\n\t}\n\tusers = cmap.New()\n\tfor _, ev := range resp.Kvs {\n\t\twg.Add(1)\n\t\tgo func(evv []byte) {\n\t\t\tdefer wg.Done()\n\t\t\tvar (\n\t\t\t\tu model.User\n\t\t\t\tp [][]string\n\t\t\t)\n\t\t\t_ = json.Unmarshal(evv, &u)\n\t\t\tp = a.policyEngine.GetFilteredPolicy(0, u.Username)\n\t\t\tfor i, v := range p {\n\t\t\t\t// The first element is username, so just remove it.\n\t\t\t\tp[i] = v[1:]\n\t\t\t}\n\t\t\tusers.Set(u.Username, p)\n\t\t}(ev.Value)\n\t}\n\twg.Wait()\n\ta.respondSuccess(w, http.StatusOK, users)\n}", "func ListAllUsers(w http.ResponseWriter, r *http.Request) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusBadRequest, \"Mohomaaf ...dsb\", nil, nil)\n\t\t}\n\t}()\n\n\tfLog := userMgmtLogger.WithField(\"func\", \"ListAllUsers\").WithField(\"RequestID\", r.Context().Value(constants.RequestID)).WithField(\"path\", r.URL.Path).WithField(\"method\", r.Method)\n\n\tiauthctx := r.Context().Value(constants.HansipAuthentication)\n\tif iauthctx == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusUnauthorized, \"You are not authorized to access this resource\", nil, nil)\n\t\treturn\n\t}\n\n\tfLog.Trace(\"Listing Users\")\n\tpageRequest, err := helper.NewPageRequestFromRequest(r)\n\tif err != nil {\n\t\tfLog.Errorf(\"helper.NewPageRequestFromRequest got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusBadRequest, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tusers, page, err := UserRepo.ListUser(r.Context(), pageRequest)\n\tif err != nil {\n\t\tfLog.Errorf(\"UserRepo.ListUser got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusInternalServerError, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tsusers := make([]*SimpleUser, len(users))\n\tfor i, v := range users {\n\t\tsusers[i] = &SimpleUser{\n\t\t\tRecID: v.RecID,\n\t\t\tEmail: v.Email,\n\t\t\tEnabled: v.Enabled,\n\t\t\tSuspended: v.Suspended,\n\t\t}\n\t}\n\tret := make(map[string]interface{})\n\tret[\"users\"] = susers\n\tret[\"page\"] = page\n\thelper.WriteHTTPResponse(r.Context(), w, http.StatusOK, \"List of all user paginated\", nil, ret)\n}", "func GetPropiedadesByUser(c *gin.Context) {\n\tvar prop []Models.Propiedad\n\tparams, ok := c.Request.URL.Query()[\"userId\"]\n\n\tif(!ok){\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\" : gin.H { \n\t\t\t\"status\": http.StatusBadRequest,\n\t\t\t\"message\": \"Invalid param\",\n\t\t}})\n\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t}\n\terr := Models.GetAllPropiedadesByUser(&prop, string(params[0]))\n\tif (err != nil || !ok ) {\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"error\" : gin.H { \n\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\"message\": err.Error(),\n\t\t}})\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tfmt.Println(c.Request.URL.Query())\n\t\t page, _ := strconv.Atoi(c.DefaultQuery(\"page\", \"1\"))\n\t\t limit, _ := strconv.Atoi(c.DefaultQuery(\"limit\", \"15\"))\n\t\n\t\t paginator := pagination.Paging(&pagination.Param{\n\t\t\tDB: Config.DB.Model(&prop).Preload(\"SharedAreas\").Select(\"*\").Joins(\"inner join PropiedadUsuario on PropiedadUsuario.propiedad_id = Propiedades.id\").Where(\"PropiedadUsuario.user_id = ?\", params).Find(&prop),\n\t\t\tPage: page,\n\t\t\tLimit: limit,\n\t\t\tOrderBy: []string{\"id\"},\n\t\t\tShowSQL: true,\n\t\t}, &prop)\n\t\tc.JSON(http.StatusOK, paginator)\n\t}\n}", "func (c *Client) ListUser(ctx context.Context, path string) (*http.Response, error) {\n\tvar body io.Reader\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"https\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"GET\", u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\theader.Set(\"Content-Type\", \"application/json\")\n\tc.SignerJWT.Sign(ctx, req)\n\treturn c.Client.Do(ctx, req)\n}", "func (srv *UsersService) ListHandler(ctx *gin.Context) {\n\tlogger := srv.logger.New(\"action\", \"ListHandler\")\n\n\tcurrentUser := GetCurrentUser(ctx)\n\n\tlimitQuery := ctx.DefaultQuery(\"limit\", \"10\")\n\tpageQuery := ctx.DefaultQuery(\"page\", \"1\")\n\tparams := ctx.Request.URL.Query()\n\n\tvar adminsRoleIncluded = false\n\n\troles := params[\"filter[role_name]\"]\n\tif len(roles) > 0 {\n\t\tfor key, role := range roles {\n\t\t\t// remove root from role names if user is not root\n\t\t\t// only root can see root users\n\t\t\tif role == models.RoleRoot && currentUser.RoleName != models.RoleRoot {\n\t\t\t\tcopy(roles[key:], roles[key+1:])\n\t\t\t\troles[len(roles)-1] = \"\"\n\t\t\t\troles = roles[:len(roles)-1]\n\t\t\t}\n\t\t\tif role == models.RoleRoot || role == models.RoleAdmin {\n\t\t\t\tadminsRoleIncluded = true\n\t\t\t}\n\t\t}\n\t} else {\n\t\tadminsRoleIncluded = true\n\t}\n\n\tvar hasPerm bool\n\tif adminsRoleIncluded {\n\t\thasPerm = srv.PermissionsService.CanViewAdminProfile(currentUser.UID)\n\t} else {\n\t\thasPerm = srv.PermissionsService.CanViewUserProfile(currentUser.UID)\n\t}\n\n\tif !hasPerm {\n\t\tsrv.ResponseService.Forbidden(ctx)\n\t\treturn\n\t}\n\n\tquery := srv.Repository.GetUsersRepository().Filter(params)\n\n\tpagination, err := srv.Repository.GetUsersRepository().Paginate(query, pageQuery, limitQuery, serializers.NewUsers())\n\tif err != nil {\n\t\tlogger.Error(\"сan't load list of user\", \"error\", err)\n\t\t// Returns a \"400 StatusBadRequest\" response\n\t\tsrv.ResponseService.Error(ctx, responses.CannotRetrieveCollection, \"Can't load list of users\")\n\t\treturn\n\t}\n\n\t// Returns a \"200 OK\" response\n\tsrv.ResponseService.OkResponse(ctx, pagination)\n}", "func (t *CassandraUpgradeTest) listUsers() ([]string, error) {\n\tr, err := http.Get(fmt.Sprintf(\"http://%s/list\", net.JoinHostPort(t.ip, \"8080\")))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer r.Body.Close()\n\tif r.StatusCode != http.StatusOK {\n\t\tb, err := io.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, fmt.Errorf(string(b))\n\t}\n\tvar names []string\n\tif err := json.NewDecoder(r.Body).Decode(&names); err != nil {\n\t\treturn nil, err\n\t}\n\treturn names, nil\n}", "func (e Endpoints) ListUsers(ctx context.Context, token string, args map[string]string) (users []registry.User, err error) {\n\trequest := ListUsersRequest{\n\t\tArgs: args,\n\t\tToken: token,\n\t}\n\tresponse, err := e.ListUsersEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(ListUsersResponse).Users, response.(ListUsersResponse).Err\n}", "func (s *Service) List() *ListOp {\n\treturn &ListOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: \"users\",\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv21,\n\t}\n}", "func (c *Client) ListUsers() ([]User, error) {\n\tusers := []User{}\n\t_, err := c.sling.Get(\"users\").ReceiveSuccess(&users)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn users, nil\n}", "func (m *TestTooDB) ListUser(ctx context.Context) []*app.User {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"user\", \"listuser\"}, time.Now())\n\n\tvar native []*TestToo\n\tvar objs []*app.User\n\terr := m.Db.Scopes().Table(m.TableName()).Find(&native).Error\n\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"error listing TestToo\", \"error\", err.Error())\n\t\treturn objs\n\t}\n\n\tfor _, t := range native {\n\t\tobjs = append(objs, t.TestTooToUser())\n\t}\n\n\treturn objs\n}", "func getUsers(types int) {\n\treq, _ := http.NewRequest(\"GET\", cfg.Main.Server+\"users\", nil)\n\treq.Header.Set(\"Content-Type\", \"application/xml\")\n\treq.Header.Set(\"Authorization\", cfg.Main.Key)\n\tclient := &http.Client{}\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tp(\"Couldn't connect to Openfire server: %s\", err.Error())\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != 200 {\n\t\tp(\"Error requesting userlist from the server.\")\n\t\treturn\n\t}\n\tbody, _ := ioutil.ReadAll(res.Body)\n\tvar users XMLUsers\n\txml.Unmarshal(body, &users)\n\tfor _, e := range users.User {\n\t\tn := e.Username + \",\"\n\t\tif e.Name != \"\" {\n\t\t\tn = e.Username + \",\" + e.Name\n\t\t}\n\t\tswitch types {\n\t\tcase 0:\n\t\t\tm := \"<missing e-mail>\"\n\t\t\tif e.Email != \"\" {\n\t\t\t\tm = e.Email\n\t\t\t}\n\t\t\tp(\"%s,%s\", n, m)\n\t\tcase 1:\n\t\t\tif e.Email != \"\" {\n\t\t\t\tp(\"%s,%s\", n, e.Email)\n\t\t\t}\n\t\tcase 2:\n\t\t\tif e.Email == \"\" {\n\t\t\t\tp(\"%s\", n)\n\t\t\t}\n\t\t}\n\t}\n}", "func (db *Database) GetUsersList() ([]*User, error) {\n\trows, err := db.db.Query(`\n\t\tSELECT id, username, owner FROM melodious.accounts WHERE banned=false;\n\t`)\n\tif err != nil {\n\t\treturn []*User{}, err\n\t}\n\tusers := []*User{}\n\tfor rows.Next() {\n\t\tuser := &User{}\n\t\terr := rows.Scan(&(user.ID), &(user.Username), &(user.Owner))\n\t\tif err != nil {\n\t\t\treturn []*User{}, err\n\t\t}\n\t\tusers = append(users, user)\n\t}\n\treturn users, nil\n}", "func (store *Storage) ListUsers() ([]string, error) {\n\treturn store.Back.ListUsers()\n}", "func (a *Server) ListUsers(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"lists all users\")\n}", "func (c *UsersController) List(ctx *app.ListUsersContext) error {\n\t// UsersController_List: start_implement\n\n\t// Put your logic here\n\tusers, err := models.UserList(c.db, ctx.Offset, ctx.Limit)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn ctx.InternalServerError(goa.ErrInternal(ErrInternalServerError))\n\t}\n\n\tres := app.UserCollection{}\n\n\tfor _, user := range users {\n\t\tuserMedia := &app.User{\n\t\t\tID: user.ID,\n\t\t\tScreenName: user.ScreenName,\n\t\t\tCreatedAt: user.CreatedAt.Unix(),\n\t\t\tUpdatedAt: user.UpdatedAt.Unix(),\n\t\t}\n\t\tres = append(res, userMedia)\n\t}\n\n\treturn ctx.OK(res)\n\t// UsersController_List: end_implement\n}", "func GetUsers(c *gin.Context) {\n\tdb := dbConn()\n\tselDB, err := db.Query(\"CALL read_users()\")\n\tif err != nil {\n\t\tpanic(err.Error)\n\t}\n\n\tuser := User{}\n\tusers := []User{}\n\tfor selDB.Next() {\n\t\tvar id, username, useremail, fname, lname, password, passwordchange, passwordexpired, lastlogon, accountlocked string\n\t\terr = selDB.Scan(&id, &username, &useremail, &fname, &lname, &password, &passwordchange, &passwordexpired, &lastlogon, &accountlocked)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tc.JSON(500, gin.H{\n\t\t\t\t\"error\": err.Error(),\n\t\t\t})\n\t\t}\n\t\tuser.ID = id\n\t\tuser.UserName = username\n\t\tuser.UserEmail = useremail\n\t\tuser.FName = fname\n\t\tuser.LName = lname\n\t\tuser.Password = password\n\t\tuser.PasswordChange = passwordchange\n\t\tuser.PasswordExpired = passwordexpired\n\t\tuser.LastLogon = lastlogon\n\t\tuser.AccountLocked = accountlocked\n\t\tiid, err := strconv.Atoi(id)\n\t\tif err != nil {\n\t\t\tpanic(err.Error)\n\t\t}\n\t\tselDB02, err := db.Query(\"CALL read_access_userid(?)\", iid)\n\t\tif err != nil {\n\t\t\tpanic(err.Error)\n\t\t}\n\t\taccess := Access{}\n\t\taccessList := []Access{}\n\t\tfor selDB02.Next() {\n\t\t\tvar accessid, userid, courtid, caseaccess, personaccess, accountingaccess, juryaccess, attorneyaccess, configaccess, securitylevel, sealedcase string\n\t\t\terr := selDB02.Scan(&accessid, &userid, &courtid, &caseaccess, &personaccess, &accountingaccess, &juryaccess, &attorneyaccess, &configaccess, &securitylevel, &sealedcase)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tc.JSON(500, gin.H{\n\t\t\t\t\t\"error\": err.Error(),\n\t\t\t\t})\n\t\t\t}\n\t\t\taccess.AccessID = accessid\n\t\t\taccess.IDUser = userid\n\t\t\taccess.IDCourt = courtid\n\t\t\taccess.CaseAccess = caseaccess\n\t\t\taccess.PersonAccess = personaccess\n\t\t\taccess.AccountingAccess = accountingaccess\n\t\t\taccess.JuryAccess = juryaccess\n\t\t\taccess.AttorneyAccess = attorneyaccess\n\t\t\taccess.ConfigAccess = configaccess\n\t\t\taccess.SecurityLevel = securitylevel\n\t\t\taccess.SealedCase = sealedcase\n\t\t\taccessList = append(accessList, access)\n\t\t}\n\t\tuser.AccessList = accessList\n\t\tusers = append(users, user)\n\t}\n\n\tc.JSON(200, gin.H{\n\t\t\"result\": users,\n\t})\n\n\tdefer db.Close()\n}", "func (u *UserModel) List(limit int, offset int, order string) ([]*models.User, error) {\n\torderOpts := map[string]string{\n\t\t\"firstName\": \"first_name\",\n\t\t\"lastName\": \"last_name\",\n\t\t\"email\": \"email\",\n\t\t\"created\": \"created\",\n\t\t\"status\": \"s.name\",\n\t}\n\n\tif val, ok := orderOpts[order]; ok {\n\t\torder = val\n\t} else {\n\t\torder = \"created\"\n\t}\n\n\tstmt := fmt.Sprintf(`SELECT u.id, u.uuid, first_name, last_name, email, phone, s.slug, u.created\n\t\t\t FROM user AS u\n\t\t LEFT JOIN ref_user_status AS s ON u.status_id = s.id\n\t\t ORDER BY %s\n\t\t\t LIMIT ?,?`, order)\n\n\tif limit < 1 {\n\t\tlimit = DEFAULT_LIMIT\n\t}\n\n\trows, err := u.DB.Query(stmt, offset, limit)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tusers := []*models.User{}\n\n\tfor rows.Next() {\n\t\tu := &models.User{}\n\t\terr = rows.Scan(&u.ID, &u.UUID, &u.FirstName, &u.LastName, &u.Email, &u.Phone, &u.Status, &u.Created)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tusers = append(users, u)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn users, nil\n}", "func GetList(tx *sql.Tx) (list []Info, err error) {\n\tmapper := rlt.NewAccountMapper(tx)\n\trows, err := mapper.FindAccountAll()\n\tfor _, row := range rows {\n\t\tinfo := Info{}\n\t\tinfo.ID = row.ID\n\t\tinfo.Domain = row.Domain.String\n\t\tinfo.UserName = row.UserName\n\t\tinfo.DisplayName = row.DisplayName\n\t\tinfo.Email = row.Email\n\t\tlist = append(list, info) //数据写入\n\t}\n\treturn list, err\n}", "func getUser(client *chef.Client, name string) chef.User {\n\tuserList, err := client.Users.Get(name)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"Issue listing user\", err)\n\t}\n\treturn userList\n}", "func (objectSet *UserObjectSet) GetObjectListFromParams(params *param.GetParams) ([]*nimbleos.User, error) {\n\tuserObjectSetResp, err := objectSet.Client.ListFromParams(userPath, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buildUserObjectSet(userObjectSetResp), err\n}", "func UserListByToken(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\turlToken := urlVars[\"token\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get Results Object\n\tresult, err := auth.GetUserByToken(urlToken, refStr)\n\n\tif err != nil {\n\t\tif err.Error() == \"not found\" {\n\t\t\terr := APIErrorNotFound(\"User\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\terr := APIErrQueryDatastore()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := result.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func (v UsersResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t}\n\n\tusers := &models.Users{}\n\n\t// Paginate results. Params \"page\" and \"per_page\" control pagination.\n\t// Default values are \"page=1\" and \"per_page=20\".\n\tq := tx.PaginateFromParams(c.Params())\n\n\t// Retrieve all Users from the DB\n\tif err := q.All(users); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\treturn c.Render(200, r.JSON(users))\n}", "func ShowCurrentUserList() {\n\tul := &define.UserList\n\tShowUserList(ul)\n}", "func (r *V1Alpha1PermissionManagerUser) List() ([]User, error) {\n\t//noinspection GoPreferNilSlice\n\tusers := []User{}\n\n\trawResponse, err := r.kubeclient.Discovery().RESTClient().Get().AbsPath(v1alpha1.ResourceURL).DoRaw(r.context)\n\n\tif err != nil {\n\t\tlog.Print(\"Failed to get users from k8s CRUD api\", err)\n\t\treturn []User{}, err\n\t}\n\n\t// generated from the api-server JSON response, most of the fields are not used but useful as documentation\n\tvar getAllUserResponse v1alpha1.PermissionManagerUserList\n\terr = json.Unmarshal(rawResponse, &getAllUserResponse)\n\n\tif err != nil {\n\t\tlog.Print(\"Failed to decode users from k8s CRUD api\", err)\n\t\treturn []User{}, err\n\t}\n\n\tfor _, v := range getAllUserResponse.Items {\n\t\tusers = append(users, User{Name: v.Spec.Name})\n\t}\n\n\treturn users, nil\n}", "func DefaultListUserInfo(ctx context.Context, db *gorm.DB) ([]*UserInfo, error) {\n\tin := UserInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm1.ApplyCollectionOperators(ctx, db, &UserInfoORM{}, &UserInfo{}, nil, nil, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []UserInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*UserInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func (v UsersResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn fmt.Errorf(\"no transaction found\")\n\t}\n\n\tusers := &models.Users{}\n\n\t// Paginate results. Params \"page\" and \"per_page\" control pagination.\n\t// Default values are \"page=1\" and \"per_page=20\".\n\tq := tx.PaginateFromParams(c.Params())\n\n\t// Retrieve all Users from the DB\n\tif err := q.All(users); err != nil {\n\t\treturn err\n\t}\n\n\t// Add the paginator to the context so it can be used in the template.\n\tc.Set(\"pagination\", q.Paginator)\n\n\treturn c.Render(http.StatusOK, r.Auto(c, users))\n}", "func (s *UsersService) ListWithFilter(opt *UserListFilterOptions) ([]User, *Response, error) {\n\tvar u string\n\tvar err error\n\n\tpagesRetreived := 0\n\n\tif opt.NextURL != nil {\n\t\tu = opt.NextURL.String()\n\t} else {\n\t\tif opt.EmailEqualTo != \"\" {\n\t\t\topt.FilterString = appendToFilterString(opt.FilterString, profileEmailFilter, FilterEqualOperator, opt.EmailEqualTo)\n\t\t}\n\t\tif opt.LoginEqualTo != \"\" {\n\t\t\topt.FilterString = appendToFilterString(opt.FilterString, profileLoginFilter, FilterEqualOperator, opt.LoginEqualTo)\n\t\t}\n\n\t\tif opt.StatusEqualTo != \"\" {\n\t\t\topt.FilterString = appendToFilterString(opt.FilterString, profileStatusFilter, FilterEqualOperator, opt.StatusEqualTo)\n\t\t}\n\n\t\tif opt.IDEqualTo != \"\" {\n\t\t\topt.FilterString = appendToFilterString(opt.FilterString, profileIDFilter, FilterEqualOperator, opt.IDEqualTo)\n\t\t}\n\n\t\tif opt.FirstNameEqualTo != \"\" {\n\t\t\topt.FilterString = appendToFilterString(opt.FilterString, profileFirstNameFilter, FilterEqualOperator, opt.FirstNameEqualTo)\n\t\t}\n\n\t\tif opt.LastNameEqualTo != \"\" {\n\t\t\topt.FilterString = appendToFilterString(opt.FilterString, profileLastNameFilter, FilterEqualOperator, opt.LastNameEqualTo)\n\t\t}\n\n\t\t// API documenation says you can search with \"starts with\" but these don't work\n\t\t// if opt.FirstNameStartsWith != \"\" {\n\t\t// \topt.FilterString = appendToFilterString(opt.FilterString, profileFirstNameFilter, filterStartsWithOperator, opt.FirstNameStartsWith)\n\t\t// }\n\n\t\t// if opt.LastNameStartsWith != \"\" {\n\t\t// \topt.FilterString = appendToFilterString(opt.FilterString, profileLastNameFilter, filterStartsWithOperator, opt.LastNameStartsWith)\n\t\t// }\n\n\t\tif !opt.LastUpdated.Value.IsZero() {\n\t\t\topt.FilterString = appendToFilterString(opt.FilterString, profileLastUpdatedFilter, opt.LastUpdated.Operator, opt.LastUpdated.Value.UTC().Format(oktaFilterTimeFormat))\n\t\t}\n\n\t\tif opt.Limit == 0 {\n\t\t\topt.Limit = defaultLimit\n\t\t}\n\n\t\tu, err = addOptions(\"users\", opt)\n\n\t}\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tusers := make([]User, 1)\n\tresp, err := s.client.Do(req, &users)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\tpagesRetreived++\n\n\tif (opt.NumberOfPages > 0 && pagesRetreived < opt.NumberOfPages) || opt.GetAllPages {\n\n\t\tfor {\n\n\t\t\tif pagesRetreived == opt.NumberOfPages {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif resp.NextURL != nil {\n\t\t\t\tvar userPage []User\n\t\t\t\tpageOption := new(UserListFilterOptions)\n\t\t\t\tpageOption.NextURL = resp.NextURL\n\t\t\t\tpageOption.NumberOfPages = 1\n\t\t\t\tpageOption.Limit = opt.Limit\n\n\t\t\t\tuserPage, resp, err = s.ListWithFilter(pageOption)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn users, resp, err\n\t\t\t\t}\n\t\t\t\tusers = append(users, userPage...)\n\t\t\t\tpagesRetreived++\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn users, resp, err\n}", "func GetUsers(c *gin.Context) {\n\tvar user []Models.User\n\tvar u Models.User\n\terr := Models.GetAllUsers(&user)\n\tif err != nil {\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"error\" : gin.H { \n\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\"message\": err.Error(),\n\t\t}})\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tlog.Println(\"====== Bind By Query String ======\")\n\t\tlog.Println(u.Nombre)\n\t\t//var rubro []Models.RubroUsuario\n\t \n\t\tfmt.Println(c.Request.URL.Query())\n\t\t page, _ := strconv.Atoi(c.DefaultQuery(\"page\", \"1\"))\n\t\t limit, _ := strconv.Atoi(c.DefaultQuery(\"limit\", \"50\"))\n\t\n\t\t paginator := pagination.Paging(&pagination.Param{\n\t\t\tDB: Config.DB.Preload(\"Rubros\").Preload(\"Unidades\"),\n\t\t\tPage: page,\n\t\t\tLimit: limit,\n\t\t\tOrderBy: []string{\"id\"},\n\t\t\tShowSQL: true,\n\t\t}, &user)\n \n\t\tc.JSON(200, paginator)\n\n\t}\n}", "func (u *UsersController) List(ctx *gin.Context) {\n\tcriteria := u.buildCriteria(ctx)\n\n\tvar listAsAdmin bool\n\tif isTatAdmin(ctx) {\n\t\tlistAsAdmin = true\n\t} else {\n\t\tuser, e := PreCheckUser(ctx)\n\t\tif e != nil {\n\t\t\tctx.AbortWithError(http.StatusInternalServerError, e)\n\t\t\treturn\n\t\t}\n\t\tlistAsAdmin = user.CanListUsersAsAdmin\n\t}\n\tcount, users, err := userDB.ListUsers(criteria, listAsAdmin)\n\tif err != nil {\n\t\tctx.AbortWithError(http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tout := &tat.UsersJSON{\n\t\tCount: count,\n\t\tUsers: users,\n\t}\n\tctx.JSON(http.StatusOK, out)\n}", "func (s *userService) List() *userListDoer {\n\treturn &userListDoer{client: s.client}\n}", "func ListAll() []ModelUser {\n\tcommon.Logger(\"info\", \"Initialize Get Database in PostgreSQL\", \"Modul User : ListAll\")\n\tdb := common.GetPostgreSQLDB()\n\n\ttx := db.Begin()\n\n\tcommon.Logger(\"info\", \"Prepare Query Select Table in Database PostgreSQL\", \"Modul User : ListAll\")\n\tvar models []ModelUser\n\n\tcommon.Logger(\"info\", \"Prepare Read Data from PostgreSQL\", \"Modul User : ListAll\")\n\ttx.Find(&models)\n\n\ttx.Commit()\n\tcommon.Logger(\"info\", \"Finnished Read Data from PostgreSQL\", \"Modul User : ListAll\")\n\n\treturn models\n}", "func ListAllUsers(w http.ResponseWriter, r *http.Request){\n\n\trows, err:= db.Query(\"SELECT * FROM users LIMIT 20\")\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tpanic(\"failed to connect database\")\n\t}\n\n\tlistUsers := Users{}\n\tfor rows.Next() {\n\t\tp := User{}\n\t\tif err := rows.Scan(&p.ID, &p.Name, &p.Score); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlistUsers = append(listUsers, p)\n\n\t}\n\tdefer rows.Close()\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tjson.NewEncoder(w).Encode(listUsers)\n}", "func GetUsersByName(name string)(users Users,err error){\n\trows,err := db.Query(\"select user_id,email,password,date from users where user_name = ?\",name)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor rows.Next() {\n\t\tu := &User{}\n\t\trows.Scan(&u.Id,&u.Email,&u.password,&u.Date)\n\t\tu.Name = name\n\t\tusers = append(users,u)\n\t}\n\t//for _,v := range users{\n\t//\tfmt.Println(v)\n\t//}\n\treturn\n}", "func (e *EndpointUsers) listUsers(writer http.ResponseWriter, request *http.Request) {\n\t_, usr := validate(e.sessions, e.users, e.permissions, writer, request, user.LIST_USERS)\n\tif usr == nil {\n\t\treturn\n\t}\n\n\tusers, err := e.users.List()\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tres := &userListDTO{}\n\tfor _, u := range users {\n\t\tres.List = append(res.List, newUserDTO(u))\n\t}\n\tWriteJSONBody(writer, res)\n}", "func (s *HookStorage) ListByUser(id string) (*model.HookList, error) {\n\n\tvar (\n\t\terr error\n\t\thooks = new(model.HookList)\n\t\tuser_filter = r.Row.Field(\"user\").Eq(id)\n\t)\n\n\tres, err := r.Table(HookTable).Filter(user_filter).Run(s.Session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Close()\n\n\tif res.IsNil() {\n\t\treturn nil, nil\n\t}\n\n\terr = res.All(hooks)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn hooks, nil\n}", "func listUsersFull(client *Client) ([]interface{}, error) {\n\treturn client.GetItemListInterfaceArray(\"/access/users?full=1\")\n}", "func (client IdentityClient) listUsers(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/users\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListUsersResponse\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 users(ds *datastore.Client) ([]User, error) {\n\tdst := make([]User, 0)\n\t_, err := ds.GetAll(context.Background(), datastore.NewQuery(userKind).Limit(limit).Project(usernameField, userIDField).Order(usernameField), &dst)\n\treturn dst, err\n}", "func (sys *IAMSys) ListUsers() (map[string]madmin.UserInfo, error) {\n\tobjectAPI := newObjectLayerFn()\n\tif objectAPI == nil {\n\t\treturn nil, errServerNotInitialized\n\t}\n\n\tvar users = make(map[string]madmin.UserInfo)\n\n\tsys.RLock()\n\tdefer sys.RUnlock()\n\n\tfor k, v := range sys.iamUsersMap {\n\t\tusers[k] = madmin.UserInfo{\n\t\t\tPolicyName: sys.iamUserPolicyMap[k].Policy,\n\t\t\tStatus: madmin.AccountStatus(v.Status),\n\t\t}\n\t}\n\n\treturn users, nil\n}", "func GetListUserRej(c *gin.Context) {\r\n\tvar usr []model.UserReject\r\n\tres := model.GetLUserRE(usr)\r\n\r\n\tutils.WrapAPIData(c, map[string]interface{}{\r\n\t\t\"Data\": res,\r\n\t}, http.StatusOK, \"success\")\r\n}", "func (s *Shell) ListUsers(_ *cli.Context) (err error) {\n\tresp, err := s.HTTP.Get(\"/v2/users/\", nil)\n\tif err != nil {\n\t\treturn s.errorOut(err)\n\t}\n\tdefer func() {\n\t\tif cerr := resp.Body.Close(); cerr != nil {\n\t\t\terr = multierr.Append(err, cerr)\n\t\t}\n\t}()\n\n\treturn s.renderAPIResponse(resp, &AdminUsersPresenters{})\n}", "func GetUserAnimelist(username string) (*UserAnimelist, error) {\n\tres := &UserAnimelist{}\n\terr := urlToStruct(fmt.Sprintf(\"/users/%s/animelist\",\n\t\turl.QueryEscape(username)), res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "func ListUsers(db *pg.DB) ([]*models.User, error) {\n\tvar users []*models.User\n\n\t_, err := db.Query(&users, `SELECT * FROM Users`)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Print names and PK\n\tfor i, n := range users {\n\t\tfmt.Println(i, n.UserName, n.Password, n.Email)\n\t}\n\treturn users, nil\n}", "func (objectSet *UserObjectSet) GetObjectList() ([]*nimbleos.User, error) {\n\tresp, err := objectSet.Client.List(userPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buildUserObjectSet(resp), err\n}", "func ListUsers(w http.ResponseWriter, r *http.Request) {\n\tusers, err := dal.GetUsers(\"\")\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tcommon.WriteResponse(w, users)\n}" ]
[ "0.7359356", "0.72904336", "0.7077272", "0.7028727", "0.7027776", "0.702073", "0.70161134", "0.6993351", "0.6991551", "0.6870929", "0.6868621", "0.68681204", "0.68483824", "0.6812991", "0.67967814", "0.6774643", "0.6770087", "0.6731464", "0.67262626", "0.6713845", "0.6699844", "0.669929", "0.6655612", "0.6642702", "0.66425526", "0.66208535", "0.66092664", "0.6592394", "0.65824366", "0.6565941", "0.6565435", "0.65618855", "0.6551717", "0.65379125", "0.652043", "0.64877695", "0.6467049", "0.64624953", "0.6460552", "0.6437262", "0.6417338", "0.6416917", "0.64069706", "0.63966924", "0.63772124", "0.635496", "0.63445115", "0.63397175", "0.63367265", "0.6330442", "0.6330112", "0.63160896", "0.6307465", "0.6302185", "0.63019973", "0.6290428", "0.62751806", "0.6273702", "0.62730396", "0.6243787", "0.62279373", "0.6223127", "0.62165004", "0.6207883", "0.62019795", "0.61897224", "0.61881655", "0.61817247", "0.6138993", "0.613614", "0.61356974", "0.61355895", "0.6134378", "0.61292255", "0.6124605", "0.6120286", "0.61117357", "0.6110998", "0.61083", "0.6101624", "0.60785526", "0.6058127", "0.60500795", "0.6046629", "0.604288", "0.6033443", "0.6027155", "0.60182554", "0.6013303", "0.6011811", "0.6010597", "0.60038596", "0.59978145", "0.5975926", "0.5972293", "0.59710544", "0.59707624", "0.59706646", "0.59648466", "0.5962433" ]
0.7338346
1
Register a new tunnel on this control connection
Зарегистрировать новый туннель на этом контролируемом соединении
func (c *Control) registerTunnel(rawTunnelReq *msg.ReqTunnel) { for _, proto := range strings.Split(rawTunnelReq.Protocol, "+") { tunnelReq := *rawTunnelReq tunnelReq.Protocol = proto c.conn.Debug("Registering new tunnel") t, err := NewTunnel(&tunnelReq, c) if err != nil { ack := &msg.NewTunnel{Error: err.Error()} if len(c.tunnels) == 0 { // you can't fail your first tunnel registration // terminate the control connection c.stop <- ack } else { // inform client of failure c.out <- ack } // we're done return } // add it to the list of tunnels c.tunnels = append(c.tunnels, t) // acknowledge success c.out <- &msg.NewTunnel{ Url: t.url, Protocol: proto, ReqId: rawTunnelReq.ReqId, } rawTunnelReq.Hostname = strings.Replace(t.url, proto+"://", "", 1) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (na *Nagent) CreateTunnel(tun *netproto.Tunnel) error {\n\terr := na.validateMeta(tun.Kind, tun.ObjectMeta)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// check if tunnel already exists\n\toldTun, err := na.FindTunnel(tun.ObjectMeta)\n\tif err == nil {\n\t\t// check if tunnel contents are same\n\t\tif !proto.Equal(&oldTun.Spec, &tun.Spec) {\n\t\t\tlog.Errorf(\"Tunnel %+v already exists\", oldTun)\n\t\t\treturn errors.New(\"tunnel already exists\")\n\t\t}\n\n\t\tlog.Infof(\"Received duplicate tunnel create for {%+v}\", tun)\n\t\treturn nil\n\t}\n\t// find the corresponding namespace\n\tns, err := na.FindNamespace(tun.ObjectMeta)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// find the corresponding vrf for the route\n\tvrf, err := na.ValidateVrf(tun.Tenant, tun.Namespace, tun.Spec.VrfName)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to find the vrf %v\", tun.Spec.VrfName)\n\t\treturn err\n\t}\n\t// Allocate ID only on first object creates and use existing ones during config replay\n\tif tun.Status.TunnelID == 0 {\n\t\t// Tunnel IDs and Interface IDs must be unique in the datapath as tunnel is modeled as an interface in HAL.\n\t\ttunnelID, err := na.Store.GetNextID(types.InterfaceID, 0)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not allocate tunnel id. {%+v}\", err)\n\t\t\treturn err\n\t\t}\n\t\ttun.Status.TunnelID = tunnelID + types.UplinkOffset + types.TunnelOffset\n\t}\n\n\t// create it in datapath\n\terr = na.Datapath.CreateTunnel(tun, vrf)\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating tunnel in datapath. Nw {%+v}. Err: %v\", tun, err)\n\t\treturn err\n\t}\n\n\t// Add the current tunnel as a dependency to the namespace.\n\terr = na.Solver.Add(ns, tun)\n\tif err != nil {\n\t\tlog.Errorf(\"Could not add dependency. Parent: %v. Child: %v\", ns, tun)\n\t\treturn err\n\t}\n\n\t// Add the current tunnel as a dependency to the vrf.\n\terr = na.Solver.Add(vrf, tun)\n\tif err != nil {\n\t\tlog.Errorf(\"Could not add dependency. Parent: %v. Child: %v\", vrf, tun)\n\t\treturn err\n\t}\n\n\t// save it in db\n\tkey := na.Solver.ObjectKey(tun.ObjectMeta, tun.TypeMeta)\n\tna.Lock()\n\tna.TunnelDB[key] = tun\n\tna.Unlock()\n\tdat, _ := tun.Marshal()\n\terr = na.Store.RawWrite(tun.GetKind(), tun.GetKey(), dat)\n\n\treturn err\n}", "func NewTunnel(m *msg.ReqTunnel, ctl *Control) (t *Tunnel, err error) {\n\tt = &Tunnel{\n\t\treq: m,\n\t\tstart: time.Now(),\n\t\tctl: ctl,\n\t\tLogger: log.NewPrefixLogger(),\n\t}\n\n\tproto := t.req.Protocol\n\tswitch proto {\n\tcase \"tcp\":\n\t\tbindTcp := func(port int) error {\n\t\t\tif t.listener, err = net.ListenTCP(\"tcp\", &net.TCPAddr{IP: net.ParseIP(\"0.0.0.0\"), Port: port}); err != nil {\n\t\t\t\terr = t.ctl.conn.Error(\"Error binding TCP listener: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// create the url\n\t\t\taddr := t.listener.Addr().(*net.TCPAddr)\n\t\t\tt.url = fmt.Sprintf(\"tcp://%s:%d\", opts.domain, addr.Port)\n\n\t\t\t// register it\n\t\t\tif err = tunnelRegistry.RegisterAndCache(t.url, t); err != nil {\n\t\t\t\t// This should never be possible because the OS will\n\t\t\t\t// only assign available ports to us.\n\t\t\t\tt.listener.Close()\n\t\t\t\terr = fmt.Errorf(\"TCP listener bound, but failed to register %s\", t.url)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tgo t.listenTcp(t.listener)\n\t\t\treturn nil\n\t\t}\n\n\t\t// use the custom remote port you asked for\n\t\tif t.req.RemotePort != 0 {\n\t\t\tbindTcp(int(t.req.RemotePort))\n\t\t\treturn\n\t\t}\n\n\t\t// try to return to you the same port you had before\n\t\tcachedUrl := tunnelRegistry.GetCachedRegistration(t)\n\t\tif cachedUrl != \"\" {\n\t\t\tvar port int\n\t\t\tparts := strings.Split(cachedUrl, \":\")\n\t\t\tportPart := parts[len(parts)-1]\n\t\t\tport, err = strconv.Atoi(portPart)\n\t\t\tif err != nil {\n\t\t\t\tt.ctl.conn.Error(\"Failed to parse cached url port as integer: %s\", portPart)\n\t\t\t} else {\n\t\t\t\t// we have a valid, cached port, let's try to bind with it\n\t\t\t\tif bindTcp(port) != nil {\n\t\t\t\t\tt.ctl.conn.Warn(\"Failed to get custom port %d: %v, trying a random one\", port, err)\n\t\t\t\t} else {\n\t\t\t\t\t// success, we're done\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Bind for TCP connections\n\t\tbindTcp(0)\n\t\treturn\n\n\tcase \"http\", \"https\":\n\t\tl, ok := listeners[proto]\n\t\tif !ok {\n\t\t\terr = fmt.Errorf(\"Not listening for %s connections\", proto)\n\t\t\treturn\n\t\t}\n\n\t\tif err = registerVhost(t, proto, l.Addr.(*net.TCPAddr).Port); err != nil {\n\t\t\treturn\n\t\t}\n\n\tdefault:\n\t\terr = fmt.Errorf(\"Protocol %s is not supported\", proto)\n\t\treturn\n\t}\n\n\t// pre-encode the http basic auth for fast comparisons later\n\tif m.HttpAuth != \"\" {\n\t\tm.HttpAuth = \"Basic \" + base64.StdEncoding.EncodeToString([]byte(m.HttpAuth))\n\t}\n\n\tt.AddLogPrefix(t.Id())\n\tt.Info(\"Registered new tunnel on: %s\", t.ctl.conn.Id())\n\n\tmetrics.OpenTunnel(t)\n\treturn\n}", "func (db *DB) NewTunnel(tunnel *Tunnel) error {\n\tq := `\nINSERT INTO tunnel (port, forward_port, forward_address) VALUES(?, ?, ?);\n `\n\t_, err := db.Exec(q, tunnel.Port, tunnel.ForwardPort, tunnel.ForwardAddress)\n\treturn err\n}", "func newTunnel(nc *nats.Conn, subject string, readTimeout time.Duration, respHandler func(response *Response)) *Tunnel {\n\treturn &Tunnel{\n\t\tsubject: subject,\n\t\tnc: nc,\n\t\tdone: make(chan bool),\n\t\trespHandler: respHandler,\n\t\trandSuffix: &RandomSuffix{\n\t\t\trandomGenerator: rand.New(rand.NewSource(time.Now().UnixNano())), //nolint gosec\n\t\t},\n\t\tmon: tunnelMon{\n\t\t\treadTimeout: readTimeout,\n\t\t},\n\t}\n}", "func registerVhost(t *Tunnel, protocol string, servingPort int) (err error) {\n\tvhost := os.Getenv(\"VHOST\")\n\tif vhost == \"\" {\n\t\tvhost = fmt.Sprintf(\"%s:%d\", opts.domain, servingPort)\n\t}\n\n\t// Canonicalize virtual host by removing default port (e.g. :80 on HTTP)\n\tdefaultPort, ok := defaultPortMap[protocol]\n\tif !ok {\n\t\treturn fmt.Errorf(\"Couldn't find default port for protocol %s\", protocol)\n\t}\n\n\tif servingPort == defaultPort {\n\t\tvhost = opts.domain\n\t}\n\n\t// Register for specific hostname\n\thostname := strings.ToLower(strings.TrimSpace(t.req.Hostname))\n\tif hostname != \"\" {\n\t\tt.url = fmt.Sprintf(\"%s://%s\", protocol, hostname)\n\t\treturn tunnelRegistry.Register(t.url, t)\n\t}\n\n\t// Register for specific subdomain\n\tsubdomain := strings.ToLower(strings.TrimSpace(t.req.Subdomain))\n\tif subdomain != \"\" {\n\t\tt.url = fmt.Sprintf(\"%s://%s.%s\", protocol, subdomain, vhost)\n\t\treturn tunnelRegistry.Register(t.url, t)\n\t}\n\n\t// Register for random URL\n\tt.url, err = tunnelRegistry.RegisterRepeat(func() string {\n\t\treturn fmt.Sprintf(\"%s://%x.%s\", protocol, rand.Int31(), vhost)\n\t}, t)\n\n\treturn\n}", "func (c *service) OpenTunnel(localAddress, remoteAddress string) error {\n\tlocal, err := net.Listen(\"tcp\", localAddress)\n\tif err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"failed to listen on local: %v\", localAddress))\n\t}\n\tvar forwarding = NewForwarding(c.client, remoteAddress, local)\n\tif len(c.forwarding) == 0 {\n\t\tc.forwarding = make([]*Tunnel, 0)\n\t}\n\tc.forwarding = append(c.forwarding, forwarding)\n\tgo forwarding.Handle()\n\treturn nil\n}", "func NewTunnel(dst, src string) *Tunnel {\n\ttunnel := &Tunnel{Src: src, Dst: dst}\n\treturn tunnel\n}", "func (sc stakingClient) RegisterProxy(fromInfo keys.Info, passWd, memo string, accNum, seqNum uint64) (\n\tresp sdk.TxResponse, err error) {\n\tif err = params.CheckKeyParams(fromInfo, passWd); err != nil {\n\t\treturn\n\t}\n\n\tmsg := types.NewMsgRegProxy(fromInfo.GetAddress(), true)\n\n\treturn sc.BuildAndBroadcast(fromInfo.GetName(), passWd, memo, []sdk.Msg{msg}, accNum, seqNum)\n\n}", "func (ghost *Ghost) Register() error {\n\tfor _, addr := range ghost.addrs {\n\t\tvar (\n\t\t\tconn net.Conn\n\t\t\terr error\n\t\t)\n\n\t\tlog.Printf(\"Trying %s ...\\n\", addr)\n\t\tghost.Reset()\n\n\t\t// Check if server has TLS enabled.\n\t\t// Only control channel needs to determine if TLS is enabled. Other mode\n\t\t// should use the tlsSettings passed in when it was spawned.\n\t\tif ghost.mode == ModeControl {\n\t\t\tvar enabled bool\n\n\t\t\tswitch ghost.tlsMode {\n\t\t\tcase TLSDetect:\n\t\t\t\tenabled, err = ghost.tlsEnabled(addr)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tcase TLSForceEnable:\n\t\t\t\tenabled = true\n\t\t\tcase TLSForceDisable:\n\t\t\t\tenabled = false\n\t\t\t}\n\n\t\t\tghost.tls.SetEnabled(enabled)\n\t\t}\n\n\t\tconn, err = net.DialTimeout(\"tcp\", addr, connectTimeout)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Println(\"Connection established, registering...\")\n\t\tif ghost.tls.Enabled {\n\t\t\tcolonPos := strings.LastIndex(addr, \":\")\n\t\t\tconfig := ghost.tls.Config\n\t\t\tconfig.ServerName = addr[:colonPos]\n\t\t\tconn = tls.Client(conn, config)\n\t\t}\n\n\t\tghost.Conn = conn\n\t\treq := NewRequest(\"register\", map[string]interface{}{\n\t\t\t\"mid\": ghost.mid,\n\t\t\t\"sid\": ghost.sid,\n\t\t\t\"mode\": ghost.mode,\n\t\t\t\"properties\": ghost.properties,\n\t\t})\n\n\t\tregistered := func(res *Response) error {\n\t\t\tif res == nil {\n\t\t\t\tghost.reset = true\n\t\t\t\treturn errors.New(\"Register request timeout\")\n\t\t\t} else if res.Response != Success {\n\t\t\t\tlog.Println(\"Register:\", res.Response)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Registered with Overlord at %s\", addr)\n\t\t\t\tghost.connectedAddr = addr\n\t\t\t\tif err := ghost.Upgrade(); err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t}\n\t\t\t\tghost.pauseLanDisc = true\n\t\t\t}\n\t\t\tghost.RegisterStatus = res.Response\n\t\t\treturn nil\n\t\t}\n\n\t\tvar handler ResponseHandler\n\t\tswitch ghost.mode {\n\t\tcase ModeControl:\n\t\t\thandler = registered\n\t\tcase ModeTerminal:\n\t\t\thandler = ghost.SpawnTTYServer\n\t\tcase ModeShell:\n\t\t\thandler = ghost.SpawnShellServer\n\t\tcase ModeFile:\n\t\t\thandler = ghost.InitiatefileOperation\n\t\tcase ModeForward:\n\t\t\thandler = ghost.SpawnPortModeForwardServer\n\t\t}\n\t\terr = ghost.SendRequest(req, handler)\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"Cannot connect to any server\")\n}", "func (n networkRoute) Register(m *mux.Router, handler http.Handler) {\n}", "func (s *replayService) OpenTunnel(localAddress, remoteAddress string) error {\n\treturn nil\n}", "func (p *Pool) Tunnel(host string, local, remote string) (*Tunnel, error) {\n\n\tlistener, err := net.Listen(\"tcp\", local)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttunnel := &Tunnel{\n\t\tlistener: listener,\n\t\thost: host,\n\t\tremote: remote,\n\t\tpool: p,\n\t}\n\n\tgo tunnel.accept()\n\n\treturn tunnel, nil\n}", "func (o *Overlay) RegisterProtocolInstance(pi ProtocolInstance) error {\n\to.instancesLock.Lock()\n\tdefer o.instancesLock.Unlock()\n\tvar tni *TreeNodeInstance\n\tvar tok = pi.Token()\n\tvar ok bool\n\t// if the TreeNodeInstance doesn't exist\n\tif tni, ok = o.instances[tok.ID()]; !ok {\n\t\treturn ErrWrongTreeNodeInstance\n\t}\n\n\tif tni.isBound() {\n\t\treturn ErrProtocolRegistered\n\t}\n\n\ttni.bind(pi)\n\to.protocolInstances[tok.ID()] = pi\n\tlog.Lvlf4(\"%s registered ProtocolInstance %x\", o.server.Address(), tok.ID())\n\treturn nil\n}", "func (hub *WSHub) Register(conn *websocket.Conn) {\n\thub.mu.Lock()\n\thub.connections[conn] = true\n\thub.mu.Unlock()\n}", "func NewTunnel(fakedns string, dohdns doh.Transport, tunWriter io.WriteCloser, dialer *net.Dialer, config *net.ListenConfig, listener Listener) (Tunnel, error) {\n\tif tunWriter == nil {\n\t\treturn nil, errors.New(\"Must provide a valid TUN writer\")\n\t}\n\tcore.RegisterOutputFn(tunWriter.Write)\n\tt := &intratunnel{\n\t\tTunnel: tunnel.NewTunnel(tunWriter, core.NewLWIPStack()),\n\t}\n\tif err := t.registerConnectionHandlers(fakedns, dialer, config, listener); err != nil {\n\t\treturn nil, err\n\t}\n\tt.SetDNS(dohdns)\n\treturn t, nil\n}", "func New(clientset *kubernetes.Clientset, config *restclient.Config, namespace, deploymentName string, remotePort, localPort int) (*k8s.Tunnel, error) {\n\tpodName, err := getServerPodName(clientset, namespace, deploymentName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Debugf(\"found pod: %s\", podName)\n\n\tt := k8s.NewTunnel(clientset.CoreV1().RESTClient(), config, namespace, podName, remotePort)\n\treturn t, t.ForwardPort(localPort)\n}", "func (opt *GuacamoleHTTPTunnelMap) Put(uuid string, tunnel gnet.GuacamoleTunnel) {\n\tone := NewGuacamoleHTTPTunnel(tunnel)\n\topt.tunnelMapLock.Lock()\n\topt.tunnelMap[uuid] = &one\n\topt.tunnelMapLock.Unlock()\n}", "func RegisterProtocol(name string, v interface{}) {\n\troot.Protocols[name] = v\n}", "func (pr *ProxyRegistry) RegisterProxy(proxy *models.Proxy) {\n\tpr.mu.Lock()\n\tdefer pr.mu.Unlock()\n\tpr.connectedProxies[proxy.GetConnectionID()] = proxy\n\tlog.Debug().Str(\"proxy\", proxy.String()).Msgf(\"Registered proxy %s from stream %d\", proxy.String(), proxy.GetConnectionID())\n}", "func sshTunnel(tunnel *config.Tunnel, address, port string) (*sshtun.SSHTun, error) {\n\tdebug := viper.GetBool(\"debug\")\n\n\tlp, err := strconv.Atoi(tunnel.LocalPort)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid local port '%s': %w\", tunnel.LocalPort, err)\n\t}\n\n\trp, err := strconv.Atoi(port)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid remote port '%s': %w\", port, err)\n\t}\n\n\t// Get the address of the intermediate host\n\tserver, _, err := configuration.HostSocket(tunnel.Host, true)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting ssh tunnel server address: %s\", err)\n\t}\n\n\tsshTun := sshtun.New(lp, server, rp)\n\tsshTun.SetKeyFile(tunnel.Key)\n\tsshTun.SetUser(tunnel.User)\n\tsshTun.SetRemoteHost(address)\n\n\t// We enable debug messages to see what happens\n\tsshTun.SetDebug(debug) //DEBUG\n\n\tif debug {\n\t\t// Print the equivalent SSH command\n\t\tfmt.Printf(\"ssh -i %s -N -L %d:%s:%d %s@%s\\n\",\n\t\t\ttunnel.Key,\n\t\t\tlp,\n\t\t\taddress,\n\t\t\trp,\n\t\t\ttunnel.User,\n\t\t\tserver,\n\t\t)\n\n\t\t// Print tunnel status changes\n\t\tsshTun.SetConnState(func(tun *sshtun.SSHTun, state sshtun.ConnState) {\n\t\t\tswitch state {\n\t\t\tcase sshtun.StateStarting:\n\t\t\t\tlog.Printf(\"SSH tunnel starting\")\n\t\t\tcase sshtun.StateStarted:\n\t\t\t\tlog.Printf(\"SSH tunnel open\")\n\t\t\tcase sshtun.StateStopped:\n\t\t\t\tlog.Printf(\"SSH tunnel Stopped\")\n\t\t\t}\n\t\t})\n\t}\n\n\t// Start the tunnel\n\tgo func() {\n\t\tif err := sshTun.Start(); err != nil {\n\t\t\tlog.Printf(\"SSH tunnel stopped: %s\", err.Error())\n\t\t}\n\t}()\n\n\treturn sshTun, nil\n}", "func RegisterProxy(initialEntry *ServiceEntry, entries chan *ServiceEntry, iface *net.Interface) (*Server, error) {\n\ts, err := newServer(initialEntry, iface)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.waitGroup.Add(1)\n\tgo s.mainloop(entries)\n\n\treturn s, nil\n}", "func StartTunnel(host string, port int) (*Tunnel, error) {\n\n\tngrok, err := startTunnel(host, port)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgo ngrok.tail()\n\tngrok.wait()\n\n\treturn ngrok, nil\n}", "func Register(b bot.Bot, hostPort, key string) {\n\tb.Commands().Add(\"tor\", bot.Command{\n\t\tHelp: \"get info on TOR node\",\n\t\tHandler: func(e *bot.Event) { torInfo(e, hostPort, key) },\n\t\tPub: true,\n\t\tPriv: false,\n\t\tHidden: false})\n}", "func NewTunnelIF(name string, counter *vswitch.Counter,\n\tparams CParams) (*TunnelIF, error) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tfor _, direction := range directions {\n\t\tif _, err := moduleNoLock(direction, params); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\ttif := &TunnelIF{\n\t\tname: name,\n\t\tcounter: (*C.struct_vsw_counter)(unsafe.Pointer(counter)),\n\t}\n\n\treturn tif, nil\n}", "func Register(kontrolURL, kiteHome, username, token string, debug bool) error {\n\tvar err error\n\n\t// Open up a prompt if the username is not passed via a flag and it's not a\n\t// token based authentication. If token is empty, it means the user can be\n\t// authenticated via password\n\tif token == \"\" && username == \"\" {\n\t\tusername, err = ask(\"Username:\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// User can just press enter to use the default on the prompt\n\t\tif username == \"\" {\n\t\t\treturn errors.New(\"Username can not be empty.\")\n\t\t}\n\t}\n\n\tk := kite.New(\"klient\", protocol.Version)\n\tk.Config.Environment = protocol.Environment\n\tk.Config.Region = protocol.Region\n\tk.Config.Username = username\n\n\tif debug {\n\t\tk.SetLogLevel(kite.DEBUG)\n\t}\n\n\t// Production Koding servers are only working over HTTP\n\tk.Config.Transport = config.XHRPolling\n\n\t// Give a warning if an existing kite.key exists\n\tkiteKeyPath := kiteHome + \"/kite.key\"\n\tif _, err := readKey(kiteKeyPath); err == nil {\n\t\tresult, err := ask(fmt.Sprintf(\"An existing %s detected. Type 'yes' to override and continue:\", kiteKeyPath))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif result != \"yes\" {\n\t\t\treturn errors.New(\"aborting registration\")\n\t\t}\n\t}\n\n\tkontrol := k.NewClient(kontrolURL)\n\tif err := kontrol.Dial(); err != nil {\n\t\treturn err\n\t}\n\tdefer kontrol.Close()\n\n\t// Register is always called with sudo, so Init should have enough\n\t// permissions.\n\tif err := tlsproxy.Init(); err != nil {\n\t\treturn err\n\t}\n\n\tauthType := \"password\"\n\tif token != \"\" {\n\t\tauthType = \"token\"\n\t}\n\n\tvar args = struct {\n\t\tUsername string\n\t\tToken string\n\t\tAuthType string\n\t}{\n\t\tUsername: username,\n\t\tToken: token,\n\t\tAuthType: authType,\n\t}\n\n\t// If authtType is password, this causes Kontrol to execute the\n\t// 'kite.getPass' method (builtin method in the Kite library) on our own\n\t// local kite (the one we declared above) method bidirectional. So once we\n\t// execute this, we immediately get a prompt asking for our password, which\n\t// is then transfered back to Kontrol. If we have a token, it will not ask\n\t// for a password and will create retunr the key immediately if the token\n\t// is valid for the given username (which is passed via the args).\n\tresult, err := kontrol.TellWithTimeout(\"registerMachine\", 5*time.Minute, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If the token is correct a valid and signed `kite.key` is returned\n\t// back. We go and create/override the ~/.kite/kite.key with this content.\n\tif err := writeKey(result.MustString(), kiteKeyPath); err != nil {\n\t\treturn err\n\t}\n\n\t// Using authenticated here instead of registered, so it is a\n\t// middleground in UX for both raw `klient -register` usage, and also\n\t// `kd install` usage. `kd install` is very user facing, and\n\t// registration is potentially confusing to the end user (since\n\t// they are already registered to koding.com.. etc)\n\tfmt.Println(\"Authenticated successfully\")\n\treturn nil\n}", "func testFlowTunnel(t *testing.T, tunnelType string) {\n\tts := NewTestStorage()\n\n\taa := helper.NewAgentAnalyzerWithConfig(t, confAgentAnalyzer, ts)\n\taa.Start()\n\tdefer aa.Stop()\n\n\tclient, err := api.NewCrudClientFromConfig(&http.AuthenticationOpts{})\n\tif err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\n\tcapture1 := api.NewCapture(\"G.V().Has('Name', 'tunnel-vm1').Out().Has('Name', 'tunnel')\", \"\")\n\tif err := client.Create(\"capture\", capture1); err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\n\tcapture2 := api.NewCapture(\"G.V().Has('Name', 'tunnel-vm2-eth0')\", \"\")\n\tif err := client.Create(\"capture\", capture2); err != nil {\n\t\tt.Fatal(err.Error())\n\t}\n\ttime.Sleep(1 * time.Second)\n\n\tsetupCmds := []helper.Cmd{\n\t\t{\"sudo ovs-vsctl add-br br-tunnel\", true},\n\n\t\t{\"sudo ip netns add tunnel-vm1\", true},\n\t\t{\"sudo ip link add tunnel-vm1-eth0 type veth peer name eth0 netns tunnel-vm1\", true},\n\t\t{\"sudo ip link set tunnel-vm1-eth0 up\", true},\n\n\t\t{\"sudo ip netns exec tunnel-vm1 ip link set eth0 up\", true},\n\t\t{\"sudo ip netns exec tunnel-vm1 ip address add 172.16.0.1/24 dev eth0\", true},\n\n\t\t{\"sudo ip netns add tunnel-vm2\", true},\n\t\t{\"sudo ip link add tunnel-vm2-eth0 type veth peer name eth0 netns tunnel-vm2\", true},\n\t\t{\"sudo ip link set tunnel-vm2-eth0 up\", true},\n\t\t{\"sudo ip netns exec tunnel-vm2 ip link set eth0 up\", true},\n\t\t{\"sudo ip netns exec tunnel-vm2 ip address add 172.16.0.2/24 dev eth0\", true},\n\n\t\t{\"sudo ovs-vsctl add-port br-tunnel tunnel-vm1-eth0\", true},\n\t\t{\"sudo ovs-vsctl add-port br-tunnel tunnel-vm2-eth0\", true}}\n\n\ttunnelAdd := \"\"\n\tif tunnelType == \"gre\" {\n\t\ttunnelAdd = \"sudo ip netns exec tunnel-vm1 ip tunnel add tunnel mode gre remote 172.16.0.2 local 172.16.0.1 ttl 255\"\n\t} else {\n\t\ttunnelAdd = \"sudo ip netns exec tunnel-vm1 ip link add tunnel type vxlan id 10 remote 172.16.0.2 local 172.16.0.1 ttl 255 dev eth0 dstport 4789\"\n\t}\n\tsetupCmds = append(setupCmds, []helper.Cmd{\n\t\t{tunnelAdd, true},\n\t\t{\"sudo ip netns exec tunnel-vm1 ip link set tunnel up\", true},\n\t\t{\"sudo ip netns exec tunnel-vm1 ip link add name dummy0 type dummy\", true},\n\t\t{\"sudo ip netns exec tunnel-vm1 ip link set dummy0 up\", true},\n\t\t{\"sudo ip netns exec tunnel-vm1 ip a add 192.168.0.1/32 dev dummy0\", true},\n\t\t{\"sudo ip netns exec tunnel-vm1 ip r add 192.168.0.0/24 dev tunnel\", true}}...)\n\n\tif tunnelType == \"gre\" {\n\t\ttunnelAdd = \"sudo ip netns exec tunnel-vm2 ip tunnel add tunnel mode gre remote 172.16.0.1 local 172.16.0.2 ttl 255\"\n\t} else {\n\t\ttunnelAdd = \"sudo ip netns exec tunnel-vm2 ip link add tunnel type vxlan id 10 remote 172.16.0.1 local 172.16.0.2 ttl 255 dev eth0 dstport 4789\"\n\t}\n\tsetupCmds = append(setupCmds, []helper.Cmd{\n\t\t{tunnelAdd, true},\n\t\t{\"sudo ip netns exec tunnel-vm2 ip link set tunnel up\", true},\n\t\t{\"sudo ip netns exec tunnel-vm2 ip link add name dummy0 type dummy\", true},\n\t\t{\"sudo ip netns exec tunnel-vm2 ip link set dummy0 up\", true},\n\t\t{\"sudo ip netns exec tunnel-vm2 ip a add 192.168.0.2/32 dev dummy0\", true},\n\t\t{\"sudo ip netns exec tunnel-vm2 ip r add 192.168.0.0/24 dev tunnel\", true},\n\t\t{\"sleep 10\", false},\n\t\t{\"sudo ip netns exec tunnel-vm1 ping -c 5 -I 192.168.0.1 192.168.0.2\", false}}...)\n\n\ttearDownCmds := []helper.Cmd{\n\t\t{\"ip netns del tunnel-vm1\", true},\n\t\t{\"ip netns del tunnel-vm2\", true},\n\t\t{\"ovs-vsctl del-br br-tunnel\", true},\n\t}\n\n\thelper.ExecCmds(t, setupCmds...)\n\tdefer helper.ExecCmds(t, tearDownCmds...)\n\n\tgh := helper.NewGremlinQueryHelper(&http.AuthenticationOpts{})\n\n\tflowsInnerTunnel := gh.GetFlowsFromGremlinReply(t, `G.V().Has('Name', 'tunnel-vm1').Out().Has('Name', 'tunnel').Flows()`)\n\tflowsBridge := gh.GetFlowsFromGremlinReply(t, `G.V().Has('Name', 'tunnel-vm2-eth0').Flows()`)\n\n\tvar TrackID string\n\tfor _, flow := range flowsInnerTunnel {\n\t\t// A vxlan innerpacket contains Ethernet while gre\n\t\t// innerpacket does not\n\t\tif strings.Contains(flow.LayersPath, \"IPv4/ICMPv4/Payload\") {\n\t\t\tif TrackID != \"\" {\n\t\t\t\tt.Errorf(\"We should only found one ICMPv4 flow in the tunnel %v\", flowsInnerTunnel)\n\t\t\t}\n\t\t\tTrackID = flow.TrackingID\n\t\t}\n\t}\n\n\tsuccess := false\n\tfor _, f := range flowsBridge {\n\t\tif TrackID == f.TrackingID && strings.Contains(f.LayersPath, \"ICMPv4/Payload\") && f.Network != nil && f.Network.Protocol == flow.FlowProtocol_IPV4 {\n\t\t\tsuccess = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !success {\n\t\tt.Errorf(\"TrackingID not found in %s tunnel: leaving the interface(%v) == seen in the tunnel(%v)\", tunnelType, flowsInnerTunnel, flowsBridge)\n\t}\n\n\tclient.Delete(\"capture\", capture1.ID())\n\tclient.Delete(\"capture\", capture2.ID())\n}", "func actHostRegister(data *interface{}, client *wserver.Client) {\n\thostLogin := (*data).(string)\n\tnew_host := NewHost(hostLogin, client)\n\tok := hostConnections.Add(new_host)\n\tif !ok {\n\t\tclient.SendJson(&Action{\"REGISTER_FAIL\", \"login exist\"})\n\t} else {\n\t\tclient.SendJson(&Action{\"REGISTER_SUCCESS\", \"\"})\n\t}\n}", "func Register(p Protocol, n NewFunc) {\n\treglock.Lock()\n\tdefer reglock.Unlock()\n\tregistry[p] = n\n}", "func NewTunnel(conn net.Conn) *Tunnel {\n\tnc := &netConn{Conn: conn}\n\n\t// The rURL value doesn't actually matter, as we are not actually dialing to anything\n\trURL, _ := url.Parse(\"http://\" + conn.RemoteAddr().String())\n\tproxy := httputil.NewSingleHostReverseProxy(rURL)\n\tproxy.Transport = &http2.Transport{\n\t\tDialTLS: func(netw, addr string, _ *tls.Config) (net.Conn, error) {\n\t\t\t// HTTP/2 protocol normally requires a TLS handshake. This works\n\t\t\t// around that by using an already established connection. This\n\t\t\t// also avoids the usual requirement of performing an h2c upgrade\n\t\t\t// when not using TLS.\n\t\t\treturn nc, nil\n\t\t},\n\t\t// Routed requests may use the http scheme if we specify this config.\n\t\tAllowHTTP: true,\n\t}\n\n\treturn &Tunnel{\n\t\tproxy: proxy,\n\t\tconn: nc,\n\t}\n}", "func (s *server) OpenTunnel(req *message.OpenTunnelRequest) (*message.OpenTunnelResponse, error) {\n\tver, err := semver.NewVersion(req.Version)\n\tif err != nil {\n\t\treturn nil, withcode(err, message.StatusCode_InvalidVersion)\n\t}\n\n\tif ver.Major < version.MajorVersion {\n\t\terr := errors.Errorf(\"client version %s doesn't match the server version %s\", req.Version, version.NewVersion().String())\n\t\treturn nil, withcode(err, message.StatusCode_VersionTooOld)\n\t}\n\n\t// TODO: check encryption\n\n\tsrc := s.Peer(req.Source)\n\tif src == nil {\n\t\treturn nil, errors.Errorf(\"source peer '%s' not found in cache\", req.Source)\n\t}\n\tdst := s.Peer(req.Destination)\n\tif dst == nil {\n\t\treturn nil, errors.Errorf(\"destination peer '%s' not found in cache\", req.Destination)\n\t}\n\ts.notifier.OpenTunnel(src, dst)\n\n\treturn &message.OpenTunnelResponse{}, nil\n}", "func (f *FakeTunnel) Start(serviceURL string) error {\n\tf.active = true\n\treturn nil\n}", "func (c *Client) CreateDirectConnectTunnel(request *CreateDirectConnectTunnelRequest) (response *CreateDirectConnectTunnelResponse, err error) {\n if request == nil {\n request = NewCreateDirectConnectTunnelRequest()\n }\n response = NewCreateDirectConnectTunnelResponse()\n err = c.Send(request, response)\n return\n}", "func PrepareTunnel(db *DB) error {\n\tq := `\nCREATE TABLE IF NOT EXISTS tunnel (port INTEGER PRIMARY KEY,\n forward_port INTEGER,\n forward_address VARCHAR)\n `\n\t_, err := db.Exec(q)\n\treturn err\n}", "func Accept(t *Tunnel, tunnelID string, relayURL string, auths ...config.Auth) error {\n\tvar cfg, err = config.Load()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdeviceKey := cfg.LoadAuth().GetDeviceKey()\n\tparams := map[string]string{\"key\": deviceKey, \"tunnel\": tunnelID}\n\n\t// get authentication\n\tauth, err := config.LoadAuth().GetDeviceAuth()\n\tif len(auths) > 0 {\n\t\tauth = auths[0]\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\t// set relayURL\n\tauth = auth.WithAPIServer(relayURL)\n\n\tt._initTunnel(DeviceSide)\n\tt.CloseListeners = append(t.CloseListeners, t._onClose)\n\tt.TimeoutListeners = append(t.TimeoutListeners, t._pingTimeout)\n\terr = OpenWebsocket(&t.Connection, \"/accept\", params, t.onMessage, auth)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// time out after 30 secs\n\tselect {\n\tcase err = <-t.connected:\n\t\tbreak\n\tcase <-time.After(time.Second * 30):\n\t\terr = fmt.Errorf(\"Timeout while accepting tunnel %s\", tunnelID)\n\t}\n\n\tclose(t.connected)\n\tt.connected = nil\n\n\t// init watchdog\n\tif err == nil {\n\t\tt.wdog = util.NewWatchdog(180*time.Second, t._onTimeout)\n\t}\n\n\treturn err\n}", "func createTunnel(cfg *SSHConfig) (*SSHTunnel, error) {\n\tf, err := CreateTempFileFromString(cfg.GatewayConfig.PrivateKey, 0400)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlocalPort := cfg.LocalPort\n\tif localPort == 0 {\n\t\tlocalPort, err = getFreePort()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\toptions := \"-q -oServerAliveInterval=60 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oPubkeyAuthentication=yes -oPasswordAuthentication=no\"\n\tcmdString := fmt.Sprintf(\"ssh -i %s -NL %d:%s:%d %s@%s %s -p %d\",\n\t\tf.Name(),\n\t\tlocalPort,\n\t\tcfg.Host,\n\t\tcfg.Port,\n\t\tcfg.GatewayConfig.User,\n\t\tcfg.GatewayConfig.Host,\n\t\toptions,\n\t\tcfg.GatewayConfig.Port,\n\t)\n\tcmd := exec.Command(\"sh\", \"-c\", cmdString)\n\terr = cmd.Start()\n\t//\terr = cmd.Wait()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor nbiter := 0; !isTunnelReady(localPort) && nbiter < 100; nbiter++ {\n\t\ttime.Sleep(10 * time.Millisecond)\n\t}\n\treturn &SSHTunnel{\n\t\tport: localPort,\n\t\tcmd: cmd,\n\t\tcmdString: cmdString,\n\t\tkeyFile: f,\n\t}, nil\n}", "func NewTunnel(\n\tgatewayAddr string,\n\tlayer knxnet.TunnelLayer,\n\tconfig TunnelConfig,\n) (tunnel *Tunnel, err error) {\n\tvar sock knxnet.Socket\n\n\t// Create socket which will be used for communication.\n\tif config.UseTCP {\n\t\tsock, err = knxnet.DialTunnelTCP(gatewayAddr)\n\t} else {\n\t\tsock, err = knxnet.DialTunnelUDP(gatewayAddr)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Initialize the Client structure.\n\tclient := &Tunnel{\n\t\tsock: sock,\n\t\tconfig: checkTunnelConfig(config),\n\t\tlayer: layer,\n\t\tack: make(chan *knxnet.TunnelRes),\n\t\tinbound: make(chan cemi.Message),\n\t\tdone: make(chan struct{}),\n\t}\n\n\t// Connect to the gateway.\n\terr = client.requestConn()\n\tif err != nil {\n\t\tsock.Close()\n\t\treturn nil, err\n\t}\n\n\tclient.wait.Add(1)\n\tgo client.serve()\n\n\treturn client, nil\n}", "func (_PlasmaFramework *PlasmaFrameworkTransactorSession) RegisterVault(_vaultId *big.Int, _vaultAddress common.Address) (*types.Transaction, error) {\n\treturn _PlasmaFramework.Contract.RegisterVault(&_PlasmaFramework.TransactOpts, _vaultId, _vaultAddress)\n}", "func newCreateClientTunnelReply(cidr *net.IPNet, tid int64) (f linkFrame) {\n f.method = CLIENT_TUN_NEW\n f.param = map[string]interface{} { K_CIDR : cidr.String() }\n f.response = tid\n return\n}", "func (t *targetrunner) register() error {\n\tjsbytes, err := json.Marshal(t.si)\n\tif err != nil {\n\t\tglog.Errorf(\"Unexpected failure to json-marshal %+v, err: %v\", t.si, err)\n\t\treturn err\n\t}\n\turl := ctx.config.Proxy.URL + \"/\" + Rversion + \"/\" + Rcluster\n\t_, err = t.call(url, http.MethodPost, jsbytes)\n\treturn err\n}", "func (_PlasmaFramework *PlasmaFrameworkSession) RegisterVault(_vaultId *big.Int, _vaultAddress common.Address) (*types.Transaction, error) {\n\treturn _PlasmaFramework.Contract.RegisterVault(&_PlasmaFramework.TransactOpts, _vaultId, _vaultAddress)\n}", "func (c *Compute) Tunnel(ip string, port int) (Dialer, error) {\n\tusr, err := user.Current()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get current user: %v\", err)\n\t}\n\tif err := key.Read(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read ssh private key: %v\", err)\n\t}\n\traddr := ip + \":22\"\n\tconn, err := ssh.Dial(\"tcp\", ip+\":22\", &ssh.ClientConfig{\n\t\tUser: usr.Username,\n\t\tAuth: []ssh.AuthMethod{\n\t\t\tssh.PublicKeys(key),\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to dial ssh conn to %q: %v\", raddr, err)\n\t}\n\treturn func(net, addr string) (net.Conn, error) {\n\t\tparts := strings.Split(addr, \":\")\n\t\tif len(parts) < 2 {\n\t\t\treturn nil, fmt.Errorf(\"no port to connect to %q: %v\", addr, parts)\n\t\t}\n\t\tport := parts[1]\n\t\tlog.Println(\"tunneling connection to port:\", port)\n\t\tladdr := fmt.Sprintf(\"127.0.0.1:%s\", parts[1])\n\t\treturn conn.Dial(\"tcp\", laddr)\n\t}, nil\n}", "func (g *Gossiper) Register(subscriber IEndPointStateChangeSubscriber) {\n\tg.subscribers = append(g.subscribers, subscriber)\n}", "func (m *Monocular) Register(echoContext echo.Context) error {\n\tlog.Debug(\"Helm Repository Register...\")\n\treturn m.portalProxy.RegisterEndpoint(echoContext, m.Info)\n}", "func (r *dbLocalProxyRequirement) addLocalProxyWithTunnel(reasons ...string) {\n\tr.addLocalProxy(reasons...)\n\tr.tunnel = true\n\tr.tunnelReasons = append(r.tunnelReasons, reasons...)\n}", "func openTunnel(a, b net.Conn, timeout time.Duration) error {\n\tfe := firstErr{}\n\tmuTimeout := atomic.Value{}\n\tmuTimeout.Store(timeout)\n\n\twg := sync.WaitGroup{}\n\twg.Add(1)\n\tgo func() {\n\t\topenOneWayTunnel(a, b, &muTimeout, &fe)\n\t\twg.Done()\n\t}()\n\topenOneWayTunnel(b, a, &muTimeout, &fe)\n\twg.Wait()\n\n\treturn fe.getErr()\n}", "func (p *Proxy) AddServerAccess(s *Server) (err error) {\n\n // We only want to connect internally to the VPN.\n // These should not be exposed.\n // serverAddress := s.PublicServerAddress()\n serverAddress := s.ServerAddress()\n\n f:= logrus.Fields{\n \"proxy\": p.Name, \"server\": s.Name, \"user\": s.User, \"serverAddress\": serverAddress,\n }\n log.Info(f, \"Adding server access to proxy.\")\n\n if s.ServerPort == 0 {\n return fmt.Errorf(\"Failed to add server: invalid server port = (%d)\", s.ServerPort)\n }\n\n rcon, err := p.GetRcon()\n if err != nil { return err }\n\n motd := fmt.Sprintf(\"%s hosted by %s in the %s neighborhood.\", s.Name, s.User, s.Name)\n command := fmt.Sprintf(\"bconf addServer(\\\"%s\\\", \\\"%s\\\", \\\"%s\\\", false)\",\n s.Name, motd, serverAddress)\n\n reply, err := rcon.Send(command)\n f[\"command\"] = command\n f[\"reply\"] = reply\n if err != nil { \n log.Error(f, \"Remore addServer failed.\", err)\n return err \n }\n // fmt.Printf(\"Received reply: %s\\n\", reply)\n log.Info(f, \"Remote addServer reply.\")\n\n return err\n}", "func RegisterGateway(tp Type, gw Gateway) {\n\tif _, ok := gateways[tp]; ok {\n\t\tpanic(fmt.Errorf(\"%s gateway already registered\", tp))\n\t}\n\tgateways[tp] = gw\n}", "func (s *MirrorConnections) Add(mirror uint32, ip string, port uint16) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tif m, ok := s.value[mirror]; ok {\n\t\tm[ip] = port\n\t\treturn\n\t}\n\n\tm := make(map[string]uint16)\n\tm[ip] = port\n\ts.value[mirror] = m\n}", "func (s *Server) Register(tm server.StateHandlerType, hmi interface{}) {\n\ts.pub.Register(tm, hmi)\n}", "func (c *connection) Register(state *utils.State) {\n\tvar connection = connect()\n\tlistener(connection, state)\n\n\tdefer connection.Close()\n}", "func (net *Network) Register(vm *intcode.VM) {\n\taddress := net.nextAddr\n\tnet.nextAddr++\n\tnet.vms[address] = vm\n\n\tmsgCh := make(chan int, 128)\n\tmsgCh <- address\n\tvm.SetInputFunc(func() int {\n\t\t// can't use SetInputChan because it will block if there is nothing available\n\t\t// in the channel.\n\t\tselect {\n\t\tcase val := <-msgCh:\n\t\t\treturn val\n\t\tdefault:\n\t\t\treturn -1\n\t\t}\n\t})\n\tnet.msgs[address] = msgCh\n}", "func (f *Forwarder) Add(id userid.ID, stream TransferAgent) {\n\tif _, loaded := f.transferAgents.LoadOrStore(id, stream); !loaded {\n\t\tf.connections += 1\n\t}\n}", "func (_DelegateProfile *DelegateProfileSession) Register() (common.Address, error) {\n\treturn _DelegateProfile.Contract.Register(&_DelegateProfile.CallOpts)\n}", "func (s *Service) AddRemote(conn net.Conn) {\r\n\ts.Mutex.Lock()\r\n\ts.Remotes = append(s.Remotes, CreateRemoteConnection(conn, s.Protocols, s, s.Engine))\r\n\ts.Mutex.Unlock()\r\n}", "func (b *Builder) RegisterProtocol(rp *rolldpos.Protocol) *Builder {\n\tb.rp = rp\n\treturn b\n}", "func Register(t *http.Transport) {\n\tcopy := t.Clone()\n\n\tcopy.Dial = nil // nolint <= deprecated function\n\tcopy.DialTLS = nil // nolint <= deprecated function\n\n\tswitch {\n\tcase copy.DialContext == nil && copy.DialTLSContext == nil:\n\t\tcopy.DialContext = dialContextAdapter(defaultDialContextFunc)\n\n\tcase copy.DialContext == nil && copy.DialTLSContext != nil:\n\t\tcopy.DialContext = dialContextAdapter(defaultDialContextFunc)\n\t\tcopy.DialTLSContext = dialContextAdapter(copy.DialTLSContext)\n\n\tcase copy.DialContext != nil && copy.DialTLSContext == nil:\n\t\tcopy.DialContext = dialContextAdapter(copy.DialContext)\n\n\tcase copy.DialContext != nil && copy.DialTLSContext != nil:\n\t\tcopy.DialContext = dialContextAdapter(copy.DialContext)\n\t\tcopy.DialTLSContext = dialContextAdapter(copy.DialTLSContext)\n\t}\n\n\ttt := roundTripAdapter(copy)\n\n\tt.RegisterProtocol(\"unix\", tt)\n}", "func NewRegister(router router.Router, proxy *Proxy) *Register {\n\treturn &Register{router: router, proxy: proxy}\n}", "func newProxyConn(client *ssh.Client, stderr io.Writer, free func()) (*proxyConn, error) {\n\t// Open new session to the agent\n\tsession, err := client.NewSession()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get a pipe to stdin so that we can send data down\n\tstdin, err := session.StdinPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get a pipe to stdout so that we can get responses back\n\tstdout, err := session.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set stderr\n\tsession.Stderr = stderr\n\n\t// Start the shell on the other side\n\tif err := session.Shell(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &proxyConn{\n\t\tclient: client,\n\t\tsession: session,\n\t\tstdin: stdin,\n\t\tstdout: stdout,\n\t\tfree: free,\n\t}, nil\n}", "func (h *IPSecVppHandler) AddTunnelInterface(tunnel *ipsec.TunnelInterfaces_Tunnel) (uint32, error) {\n\treturn h.tunnelIfAddDel(tunnel, true)\n}", "func (g *Glutton) registerHandlers() {\n\n\tfor _, rule := range g.rules {\n\n\t\tif rule.Type == \"conn_handler\" && rule.Target != \"\" {\n\n\t\t\tvar handler string\n\n\t\t\tswitch rule.Name {\n\n\t\t\tcase \"proxy_tcp\":\n\t\t\t\thandler = rule.Name\n\t\t\t\tg.protocolHandlers[rule.Target] = g.protocolHandlers[handler]\n\t\t\t\tdelete(g.protocolHandlers, handler)\n\t\t\t\thandler = rule.Target\n\t\t\t\tbreak\n\n\t\t\tcase \"proxy_ssh\":\n\t\t\t\thandler = rule.Name\n\t\t\t\terr := g.NewSSHProxy(rule.Target)\n\t\t\t\tif err != nil {\n\t\t\t\t\tg.logger.Error(fmt.Sprintf(\"[ssh.prxy] failed to initialize SSH proxy\"))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\trule.Target = handler\n\t\t\t\tbreak\n\t\t\tcase \"proxy_telnet\":\n\t\t\t\thandler = rule.Name\n\t\t\t\terr := g.NewTelnetProxy(rule.Target)\n\t\t\t\tif err != nil {\n\t\t\t\t\tg.logger.Error(fmt.Sprint(\"[telnet.prxy] failed to initialize TELNET proxy\"))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\trule.Target = handler\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\thandler = rule.Target\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif g.protocolHandlers[handler] == nil {\n\t\t\t\tg.logger.Warn(fmt.Sprintf(\"[glutton ] no handler found for %v protocol\", handler))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tg.processor.RegisterConnHandler(handler, func(conn net.Conn, md *freki.Metadata) error {\n\t\t\t\thost, port, err := net.SplitHostPort(conn.RemoteAddr().String())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif md == nil {\n\t\t\t\t\tg.logger.Debug(fmt.Sprintf(\"[glutton ] connection not tracked: %s:%s\", host, port))\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tg.logger.Debug(\n\t\t\t\t\tfmt.Sprintf(\"[glutton ] new connection: %s:%s -> %d\", host, port, md.TargetPort),\n\t\t\t\t\tzap.String(\"host\", host),\n\t\t\t\t\tzap.String(\"sport\", port),\n\t\t\t\t\tzap.String(\"dport\", strconv.Itoa(int(md.TargetPort))),\n\t\t\t\t\tzap.String(\"handler\", handler),\n\t\t\t\t)\n\n\t\t\t\tif g.producer != nil {\n\t\t\t\t\terr = g.producer.LogHTTP(conn, md, nil, \"\")\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tg.logger.Error(fmt.Sprintf(\"[glutton ] error: %v\", err))\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tdone := make(chan struct{})\n\t\t\t\tgo g.closeOnShutdown(conn, done)\n\t\t\t\tconn.SetDeadline(time.Now().Add(45 * time.Second))\n\t\t\t\tctx := g.contextWithTimeout(72)\n\t\t\t\terr = g.protocolHandlers[handler](ctx, conn)\n\t\t\t\tdone <- struct{}{}\n\t\t\t\treturn err\n\t\t\t})\n\t\t}\n\t}\n}", "func Register(r shared.Responder) {\n\tserver.Register(r)\n}", "func (na *Nagent) UpdateTunnel(tun *netproto.Tunnel) error {\n\t// find the corresponding namespace\n\t_, err := na.FindNamespace(tun.ObjectMeta)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texistingTunnel, err := na.FindTunnel(tun.ObjectMeta)\n\tif err != nil {\n\t\tlog.Errorf(\"Tunnel %v not found\", tun.ObjectMeta)\n\t\treturn err\n\t}\n\n\t// find the corresponding vrf for the route\n\tvrf, err := na.ValidateVrf(existingTunnel.Tenant, existingTunnel.Namespace, existingTunnel.Spec.VrfName)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to find the vrf %v\", existingTunnel.Spec.VrfName)\n\t\treturn err\n\t}\n\n\tif proto.Equal(tun, existingTunnel) {\n\t\tlog.Infof(\"Nothing to update.\")\n\t\treturn nil\n\t}\n\n\terr = na.Datapath.UpdateTunnel(existingTunnel, vrf)\n\tif err != nil {\n\t\tlog.Errorf(\"Error updating the tunnel {%+v} in datapath. Err: %v\", existingTunnel, err)\n\t\treturn err\n\t}\n\tkey := na.Solver.ObjectKey(tun.ObjectMeta, tun.TypeMeta)\n\tna.Lock()\n\tna.TunnelDB[key] = tun\n\tna.Unlock()\n\terr = na.Store.Write(tun)\n\treturn err\n}", "func (_KNS *KNSSession) Register(prime_owner common.Address, wallet common.Address, Jid string, tel string) (*types.Transaction, error) {\n\treturn _KNS.Contract.Register(&_KNS.TransactOpts, prime_owner, wallet, Jid, tel)\n}", "func Register() error {\n\tif os.Getenv(\"PREMKIT_ROUTER\") == \"\" {\n\t\tlog.Infof(\"PREMKIT_ROUTER not defined. Not going to register with an upstream.\")\n\t\treturn nil\n\t}\n\n\t// TODO once the code is in github, use a reference to the schema instead of hard coding this json object\n\tbody := fmt.Sprintf(`\n{\n\t\"service\": {\n\t\t\"name\": \"healthcheck\",\n\t\t\"path\": \"healthcheck\",\n\t\t\"upstreams\": [\n\t\t\t{\n\t\t\t\t\"url\": %q,\n\t\t\t\t\"include_service_path\": false,\n\t\t\t\t\"insecure_skip_verify\": false\n\t\t\t}\n\t\t]\n\t}\n}`, os.Getenv(\"ADVERTISE_ADDRESS\"))\n\n\turi := fmt.Sprintf(\"%s/premkit/v1/service\", os.Getenv(\"PREMKIT_ROUTER\"))\n\trequest := gorequest.New()\n\tresp, _, errs := request.Post(uri).\n\t\tSend(body).\n\t\tEnd()\n\n\tif len(errs) > 0 {\n\t\terr := fmt.Errorf(\"Error(s) registering with router: %#v\", errs)\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\n\tif resp.StatusCode != http.StatusCreated {\n\t\terr := fmt.Errorf(\"Unexpected response from router: %d\", resp.StatusCode)\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *RdmaDevPlugin) register() error {\n\tkubeletEndpoint := filepath.Join(deprecatedSockDir, kubeEndPoint)\n\tconn, err := dial(kubeletEndpoint, 5*time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: m.socketName,\n\t\tResourceName: m.resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Register(t types.ImageTransport) {\n\tkt.Add(t)\n}", "func newTunnelDialer(ssh ssh.ClientConfig, keepAlivePeriod, dialTimeout time.Duration, opts ...DialProxyOption) ContextDialer {\n\tdialer := newDirectDialer(keepAlivePeriod, dialTimeout)\n\treturn ContextDialerFunc(func(ctx context.Context, network, addr string) (conn net.Conn, err error) {\n\t\tif proxyURL := utils.GetProxyURL(addr); proxyURL != nil {\n\t\t\tconn, err = DialProxyWithDialer(ctx, proxyURL, addr, dialer, opts...)\n\t\t} else {\n\t\t\tconn, err = dialer.DialContext(ctx, network, addr)\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\n\t\tsconn, err := sshConnect(ctx, conn, ssh, dialTimeout, addr)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\treturn sconn, nil\n\t})\n}", "func Run(p ProtocolHandler, tunnelID string, brokerURL string) {\n\tdata := p.self()\n\n\terr := tunnel.Accept(data.tunnel, tunnelID, brokerURL)\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"accepting tunnel failed: \")\n\t} else {\n\t\tp.receive()\n\t}\n}", "func (h *Hub) Add(conn *websocket.Conn) {\n\th.mux.Lock()\n\tdefer h.mux.Unlock()\n\n\th.conns[conn] = struct{}{}\n}", "func (server *Server) Register(action INetworkAction) {\n\n}", "func (follower *Follower) Register(leaderHost string) (err error) {\n\tlog.Printf(\"Registring with Leader...\\n\")\n\tconn, err := net.Dial(\"tcp\", leaderHost)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmessage := &Message{\n\t\tAction: Message_REGISTER.Enum(),\n\n\t\tId: follower.id[:],\n\t\tHost: proto.String(follower.host),\n\t}\n\n\tdata, err := proto.Marshal(message)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := conn.Write(data); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (h *BasicHost) RegisterProtocol(\n\tpid common.Pid,\n\thandler ProtocolHandler,\n\tadapters ...ProtocolAdapter,\n) {\n\th.host.SetStreamHandler(pid.ProtocolID(), func(stream net.Stream) {\n\t\tdefer stream.Reset()\n\t\tmsg, err := common.ReadMessage(stream)\n\t\tif err != nil {\n\t\t\tlog.Println(\"failed to read message from stream :\", err)\n\t\t\treturn\n\t\t}\n\t\tgo handler.Handle(adapters...)(msg)\n\t})\n}", "func Register(c *context.Context) {\n\tctx = c\n\tensureConnection()\n\tsetTargetChannel = startReleaseChannelUpdater(ctx)\n}", "func (c *Cluster) Set(host, forward string) {\n\tproxy := &httputil.ReverseProxy{\n\t\tDirector: func(r *http.Request) {\n\t\t\tr.URL.Scheme = \"http\"\n\t\t\tr.URL.Host = forward\n\t\t},\n\t\tErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) {\n\t\t\tw.WriteHeader(http.StatusBadGateway)\n\t\t\t_, _ = w.Write([]byte(errors.Cause(err).Error()))\n\t\t},\n\t}\n\n\tc.proxiesLock.Lock()\n\tdefer c.proxiesLock.Unlock()\n\n\tc.proxies[host] = proxy\n}", "func (t *ZMQTransport) RegisterHook(h TransportHook) {\n\tt.hooks = append(t.hooks, h)\n}", "func RegisterStartForward(pubKey, upstream string) {\n\tpubKey = strings.TrimPrefix(pubKey, \"authorized_keys_\")\n\tconnectionsStarted.WithLabelValues(pubKey, upstream).Inc()\n\tconnectionsEnded.WithLabelValues(pubKey, upstream).Add(0)\n}", "func (_PlasmaFramework *PlasmaFrameworkTransactor) RegisterVault(opts *bind.TransactOpts, _vaultId *big.Int, _vaultAddress common.Address) (*types.Transaction, error) {\n\treturn _PlasmaFramework.contract.Transact(opts, \"registerVault\", _vaultId, _vaultAddress)\n}", "func (i *Interface) NewTunnel(index uint32, tunnel *Tunnel) (*VIF, error) {\n\tif tunnel == nil {\n\t\treturn nil, errors.New(\"Tunnel details is not given\")\n\t}\n\n\tvif, err := newVIF(i, fmt.Sprintf(\"%s-%d\", i.name, index))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvif.setTunnel(tunnel)\n\tif err := i.initVIF(vif); err != nil {\n\t\tvif.Free()\n\t\treturn nil, err\n\t}\n\n\treturn vif, nil\n}", "func (k *Keeper) RegisterRoute(moduleName, route string, invar sdk.Invariant) {\n\tinvarRoute := NewInvarRoute(moduleName, route, invar)\n\tk.routes = append(k.routes, invarRoute)\n}", "func (t *Tunnel) Connect(client *ssh.Client) {\n\t// Connect to the remote website we will forward. If we cannot connect, we\n\t// stop the forwarding.\n\ttarget, err := net.DialTimeout(\"tcp\", t.Src, 10*time.Second)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t\treturn\n\t}\n\n\t// Try to allocate the port in the remote client to listen to the content of\n\t// target. If it is not possible, we skip.\n\tlistener, err := client.Listen(\"tcp\", t.Dst)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\n\t// If everything goes well, we establish the connection and copy the content\n\t// of the target into the listener in the remote host.\n\tres, err := listener.Accept()\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\n\tgo util.Transfer(res, target)\n\tgo util.Transfer(target, res)\n}", "func (svr *Service) RegisterWorkConn(workConn net.Conn, newMsg *msg.NewWorkConn) error {\n\txl := utilnet.NewLogFromConn(workConn)\n\tctl, exist := svr.ctlManager.GetByID(newMsg.RunID)\n\tif !exist {\n\t\txl.Warn(\"No client control found for run id [%s]\", newMsg.RunID)\n\t\treturn fmt.Errorf(\"no client control found for run id [%s]\", newMsg.RunID)\n\t}\n\t// server plugin hook\n\tcontent := &plugin.NewWorkConnContent{\n\t\tUser: plugin.UserInfo{\n\t\t\tUser: ctl.loginMsg.User,\n\t\t\tMetas: ctl.loginMsg.Metas,\n\t\t\tRunID: ctl.loginMsg.RunID,\n\t\t},\n\t\tNewWorkConn: *newMsg,\n\t}\n\tretContent, err := svr.pluginManager.NewWorkConn(content)\n\tif err == nil {\n\t\tnewMsg = &retContent.NewWorkConn\n\t\t// Check auth.\n\t\terr = svr.authVerifier.VerifyNewWorkConn(newMsg)\n\t}\n\tif err != nil {\n\t\txl.Warn(\"invalid NewWorkConn with run id [%s]\", newMsg.RunID)\n\t\t_ = msg.WriteMsg(workConn, &msg.StartWorkConn{\n\t\t\tError: util.GenerateResponseErrorString(\"invalid NewWorkConn\", err, ctl.serverCfg.DetailedErrorsToClient),\n\t\t})\n\t\treturn fmt.Errorf(\"invalid NewWorkConn with run id [%s]\", newMsg.RunID)\n\t}\n\treturn ctl.RegisterWorkConn(workConn)\n}", "func cliRegister(name string, servport, myport int){\n\t//este serv va a enviarle un mensaje a un servidor\n\t//save a quien se va a conectar y le envia el nombre, su credencial\n\tresp := send(servport + 1, name, fmt.Sprintf(\"%d\", myport))\n\t//con la rspta necesitamos crear un mapa temporal de tipo entero\n\ttemp := make(map[int]string)\n\t_ = json.Unmarshal([]byte(resp),&temp)\n\tfor port, na := range temp {\n\t\tlib[port] = na\n\t}\n\tfmt.Println(lib)\n}", "func (tunnel *Tunnel) Start() error {\n\treturn <-tunnel.startAsync()\n}", "func (g *GrpcClient) Register(request *protofiles.RegisterRequest) (*protofiles.RegisterResponse, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), g.connectionTimeoutSecs)\n\tdefer cancel()\n\n\treturn g.client.Register(ctx, request)\n}", "func (m *WidgetDevicePlugin) Register(kubeletEndpoint, resourceName string) error {\n\tconn, err := dial(kubeletEndpoint, 5*time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(m.socket),\n\t\tResourceName: resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (client *GatewayClient) putConn(c *tls.Conn) {\n\tclient.idleConn <- c\n}", "func (c *ConsulClient) Register(ctx context.Context, name string, ttl time.Duration) (string, error) {\n\tregistryOperationCount.WithLabelValues(env, \"Register\").Inc()\n\n\tstartTime := time.Now()\n\tdefer func() {\n\t\tregistryOperationTimeTaken.WithLabelValues(env, \"Register\").Observe(time.Now().Sub(startTime).Seconds())\n\t}()\n\n\tsessionID, _, err := c.client.Session().Create(&api.SessionEntry{\n\t\tName: name,\n\t\tTTL: ttl.String(),\n\t\tLockDelay: 2,\n\t\tBehavior: api.SessionBehaviorDelete,\n\t}, nil)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn sessionID, nil\n}", "func (s *Switch) RegisterDirectProtocol(protocol string) chan service.DirectMessage { // TODO: not used - remove\n\tif s.started == 1 {\n\t\tlog.Panic(\"attempt to register direct protocol after p2p has started\")\n\t}\n\tmchan := make(chan service.DirectMessage, s.config.BufferSize)\n\ts.directProtocolHandlers[protocol] = mchan\n\treturn mchan\n}", "func (n *Node) RegisterStrategy(topic string, strategy RoutingStrategy) {\n\tn.strategyMap[topic] = strategy\n}", "func (p *Protocol) Register(r *protocol.Registry) error {\n\treturn r.Register(protocolID, p)\n}", "func (p *Protocol) Register(r *protocol.Registry) error {\n\treturn r.Register(protocolID, p)\n}", "func (p *Protocol) Register(r *protocol.Registry) error {\n\treturn r.Register(protocolID, p)\n}", "func (c *Connector) Tunnel(host kubeoneapi.HostConfig) (Tunneler, error) {\n\tconn, err := c.Connect(host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttunn, ok := conn.(Tunneler)\n\tif !ok {\n\t\terr = errors.New(\"unable to assert Tunneler\")\n\t}\n\n\treturn tunn, err\n}", "func (w Ws) Register(r *gin.RouterGroup) {\n\tst := r.Group(\"\")\n\tst.GET(\"/ws/:id\", w.Server)\n\tst.DELETE(\"/ws/:id\", w.Offline)\n\tst.PUT(\"/ws/:id\", w.Dispatch)\n}", "func (router *Router) ListenAndAcceptTunnels(addr string) {\n\tladdr, err := net.ResolveTCPAddr(\"tcp\", addr)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tln, err := net.ListenTCP(\"tcp\", laddr)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tgo func() {\n\t\tdefer ln.Close()\n\t\tfor {\n\t\t\tconn, err := ln.AcceptTCP()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error accepting tunnel conn:\", err)\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trouter.mu.Lock()\n\t\t\trouter.pool = append(router.pool, NewTunnel(conn))\n\t\t\trouter.mu.Unlock()\n\n\t\t\tlog.Println(\"Tunnel added:\", conn.RemoteAddr().String())\n\t\t}\n\t}()\n}", "func Register(name string, h Holder) {\n\tmux.Lock()\n\tdefer mux.Unlock()\n\tif h == nil {\n\t\tpanic(\"Register Holder is nil\")\n\t}\n\tif _, dup := pool[name]; dup {\n\t\tpanic(\"Register called twice for Holder \" + name)\n\t}\n\tpool[name] = h\n}", "func (m *CambriconDevicePlugin) Register(kubeletEndpoint, resourceName string) error {\n\tconn, err := dial(kubeletEndpoint, 5*time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(m.socket),\n\t\tResourceName: resourceName,\n\t\tOptions: &pluginapi.DevicePluginOptions{\n\t\t\tGetPreferredAllocationAvailable: m.options.Mode == topologyAware,\n\t\t},\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Tunnel() net.Conn {\n\tconn, err := net.Dial(tcpPort, address)\n\tif err != nil {\n\t\tlog.Println(\"[TUNNEL-ERROR] : Unable to connect to port.\")\n\t}\n\treturn conn\n}", "func (s *Server) Register(name string, h Handler) error {\n if _, ok := s.registry[name]; ok {\n return fmt.Errorf(\"cannot register name %q twice\", name)\n }\n s.registry[name] = &register{handler: h}\n return nil\n}", "func NextTunnel(inlet int) (int, error) {\n\tif inlet <= TunnelNotConnected || inlet > TunnelLeftTop {\n\t\treturn TunnelNotConnected, fmt.Errorf(\"inlet out of bounds %v\", inlet)\n\t}\n\t/*\n\t 6 5\n\t 1 2\n\t 3 8 3 8\n\t 4 7 4 7\n\t 6 5\n\t 1 2\n\t*/\n\tio := map[int]int{\n\t\t1: 6,\n\t\t2: 5,\n\t\t3: 8,\n\t\t4: 7,\n\t\t5: 2,\n\t\t6: 1,\n\t\t7: 4,\n\t\t8: 3,\n\t}\n\treturn io[inlet], nil\n}" ]
[ "0.6146846", "0.61225635", "0.5909397", "0.56072223", "0.5565189", "0.5540766", "0.5476352", "0.54763263", "0.54655796", "0.5418362", "0.53958005", "0.5362109", "0.5323186", "0.5291799", "0.52836424", "0.526554", "0.5163012", "0.5159695", "0.51567835", "0.51567405", "0.5155557", "0.5148601", "0.5127688", "0.5121817", "0.5112529", "0.51095676", "0.5072767", "0.506788", "0.50528103", "0.50481075", "0.50387627", "0.5023833", "0.50199693", "0.5004026", "0.49882382", "0.49841318", "0.498195", "0.4975741", "0.4974349", "0.4953912", "0.49515274", "0.49416265", "0.49184445", "0.4917442", "0.4897506", "0.48853973", "0.488468", "0.48774812", "0.4876174", "0.4867218", "0.48502234", "0.48491552", "0.48398325", "0.4834381", "0.48256502", "0.4806526", "0.47991687", "0.47952753", "0.47879094", "0.47842863", "0.47778383", "0.47715294", "0.4756461", "0.47534055", "0.4744438", "0.47377965", "0.47344035", "0.4733924", "0.47330102", "0.47327498", "0.47091317", "0.46959", "0.469049", "0.46896935", "0.46862856", "0.4684824", "0.4681123", "0.4671364", "0.4667592", "0.4657169", "0.46543753", "0.46539307", "0.46495807", "0.4639256", "0.46362063", "0.46359277", "0.4633345", "0.46304682", "0.4630449", "0.4622438", "0.4622438", "0.4622438", "0.46200383", "0.46128556", "0.46109164", "0.45999858", "0.4598325", "0.45936212", "0.45796767", "0.45785987" ]
0.73147064
0
GenerateModels parses the magmagenmeta key of the given swagger YAML file, copies the files that the target file depends on into the current working directory, shells out to `swagger generate models`, then cleans up the dependency files.
GenerateModels парсит ключ magmagenmeta заданного файла swagger YAML, копирует файлы, на которые зависит целевой файл, в текущую рабочую директорию, выполняет команду `swagger generate models`, а затем удаляет файлы зависимостей.
func GenerateModels(targetFilepath string, configFilepath string, rootDir string, specs map[string]MagmaSwaggerSpec) error { absTargetFilepath, err := filepath.Abs(targetFilepath) if err != nil { return fmt.Errorf("target filepath %s is invalid: %w", targetFilepath, err) } tmpGenDir, err := ioutil.TempDir(".", "tmpgen") if err != nil { return fmt.Errorf("could not create temporary gen directory: %w", err) } defer os.RemoveAll(tmpGenDir) // For each dependency, strip the magma-gen-meta and write the result to // the filename specified by `dependent-filename` err = StripAndWriteSwaggerSpecs(specs, tmpGenDir) if err != nil { return err } // Shell out to go-swagger targetSpec := specs[absTargetFilepath] outputDir := filepath.Join(rootDir, targetSpec.MagmaGenMeta.OutputDir) absConfigFilepath, err := filepath.Abs(configFilepath) if err != nil { return err } cmd := exec.Command( "swagger", "generate", "model", "--spec", filepath.Join(tmpGenDir, targetSpec.MagmaGenMeta.TempGenFilename), "--target", outputDir, "--config-file", absConfigFilepath, ) stdoutBuf := &strings.Builder{} stderrBuf := &strings.Builder{} cmd.Stdout = stdoutBuf cmd.Stderr = stderrBuf err = cmd.Run() if err != nil { return fmt.Errorf("failed to generate models; stdout:\n%s\nstderr:\n%s: %w", stdoutBuf.String(), stderrBuf.String(), err) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (g *Generator) Generate(context *common.Context, schema *schema.Schema) ([]common.Output, error) {\n\tmoduleName := strings.ToLower(schema.Title)\n\tvar outputs []common.Output\n\n\tfor _, def := range schema.Definitions {\n\t\t// create models only for objects\n\t\tif def.Type != nil {\n\t\t\tif t, ok := def.Type.(string); ok {\n\t\t\t\tif t != \"object\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tf, err := generateMainFile(context, schema)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpath := fmt.Sprintf(\n\t\t\t\"%s%s/main.go\",\n\t\t\tcontext.Config.Target,\n\t\t\tmoduleName,\n\t\t)\n\n\t\toutputs = append(outputs, common.Output{\n\t\t\tContent: f,\n\t\t\tPath: path,\n\t\t})\n\n\t}\n\n\treturn outputs, nil\n\n}", "func GenerateModels(w *Writer, packagename string, spec *swagme.Spec) error {\n\tw.WriteSinglelineComment(\"Code generated by swagme\")\n\tw.WriteBlankLine()\n\n\tif info := spec.Info; info != nil {\n\t\tw.WriteSinglelineComment(fmt.Sprintf(\"package %s defines models for %s %s\", packagename, info.Title, info.Version))\n\t}\n\n\tw.WritePackage(packagename)\n\n\t// generate enums\n\tfor _, enum := range buildEnums(spec.Definitions) {\n\t\tw.WriteBlankLine()\n\t\tif err := generateEnum(w, &enum); err != nil {\n\t\t\tw.WriteMultilineCommentf(`ERROR with enum %q:\\n%v`, enum.Name, err)\n\t\t}\n\t}\n\n\t// generate structs\n\tfor name, definition := range spec.Definitions {\n\t\tw.WriteBlankLine()\n\t\tif err := generateDefinition(w, name, definition); err != nil {\n\t\t\tw.WriteMultilineCommentf(`ERROR with definition %q:\\n%v`, name, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func Generate(swaggerFile string, options Options) (err error) {\n\tpkgName := \"api\"\n\tif options.PackageName != \"\" {\n\t\tpkgName = options.PackageName\n\t}\n\n\t// Generate to stdout\n\tif options.TargetFile == \"\" {\n\t\treturn pkg.GenerateFromFile(swaggerFile, pkgName, os.Stdout)\n\t}\n\n\t// Generate to tmp file. If no errors presents then will move tmp file to `options.TargetFile`\n\tgenFile, err := ioutil.TempFile(\"\", \"*-gorest.go\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while tmp file creating: %v\", err)\n\t}\n\n\terr = pkg.GenerateFromFile(swaggerFile, pkgName, genFile)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"api generating error: %v\", err)\n\n\t\tif removeErr := removeFile(genFile); removeErr != nil {\n\t\t\treturn fmt.Errorf(\"%s, error while tmp file removing: %v\", err, removeErr)\n\t\t}\n\t\treturn err\n\t}\n\treturn os.Rename(genFile.Name(), options.TargetFile)\n}", "func (s *schg) Generate(schemaInBase, schemaOutBase string) (err error) {\n\ts.definitions = nil\n\ts.services = make(map[string]string, 0)\n\ts.pkg = filepath.Base(schemaOutBase)\n\tif schemaInBase, err = filepath.Abs(filepath.Clean(schemaInBase)); err != nil {\n\t\treturn\n\t}\n\tif schemaOutBase, err = filepath.Abs(filepath.Clean(schemaOutBase)); err != nil {\n\t\treturn\n\t}\n\ts.defFile = filepath.Join(schemaInBase, definitionsFile)\n\n\tif err = s.loadDefinitions(schemaInBase); err != nil {\n\t\tlog.Println(fmt.Sprintf(cannotReadFileErr, definitionsFile, err))\n\t}\n\tif err = filepath.Walk(schemaInBase, s.walkFunc()); err != nil {\n\t\treturn\n\t}\n\t// remove created temporary files/dirs at the end.\n\tdefer func() {\n\t\tif e := s.dropTmpDirs(); e != nil {\n\t\t\tlog.Println(fmt.Sprintf(cannotRemoveTempDirsErr, e))\n\t\t}\n\t}()\n\tif err = s.createPaths(schemaOutBase); err != nil {\n\t\treturn\n\t}\n\tif err = s.saveAsGoBinData(schemaOutBase); err != nil {\n\t\treturn\n\t}\n\tif err = s.createBindSchemaFiles(schemaOutBase); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func Generate(swagger *openapi3.Swagger, packageName string, opts Options) (string, error) {\n\timportMapping = constructImportMapping(opts.ImportMapping)\n\n\tfilterOperationsByTag(swagger, opts)\n\tif !opts.SkipPrune {\n\t\tpruneUnusedComponents(swagger)\n\t}\n\n\t// This creates the golang templates text package\n\tTemplateFunctions[\"opts\"] = func() Options { return opts }\n\tt := template.New(\"oapi-codegen\").Funcs(TemplateFunctions)\n\t// This parses all of our own template files into the template object\n\t// above\n\tt, err := templates.Parse(t)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error parsing oapi-codegen templates\")\n\t}\n\n\t// Override built-in templates with user-provided versions\n\tfor _, tpl := range t.Templates() {\n\t\tif _, ok := opts.UserTemplates[tpl.Name()]; ok {\n\t\t\tutpl := t.New(tpl.Name())\n\t\t\tif _, err := utpl.Parse(opts.UserTemplates[tpl.Name()]); err != nil {\n\t\t\t\treturn \"\", errors.Wrapf(err, \"error parsing user-provided template %q\", tpl.Name())\n\t\t\t}\n\t\t}\n\t}\n\n\tops, err := OperationDefinitions(swagger)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error creating operation definitions\")\n\t}\n\n\tvar typeDefinitions, constantDefinitions string\n\tif opts.GenerateTypes {\n\t\ttypeDefinitions, err = GenerateTypeDefinitions(t, swagger, ops, opts.ExcludeSchemas)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error generating type definitions\")\n\t\t}\n\n\t\tconstantDefinitions, err = GenerateConstants(t, ops)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error generating constants\")\n\t\t}\n\n\t}\n\n\tvar echoServerOut string\n\tif opts.GenerateEchoServer {\n\t\techoServerOut, err = GenerateEchoServer(t, ops)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error generating Go handlers for Paths\")\n\t\t}\n\t}\n\n\tvar chiServerOut string\n\tif opts.GenerateChiServer {\n\t\tchiServerOut, err = GenerateChiServer(t, ops)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error generating Go handlers for Paths\")\n\t\t}\n\t}\n\n\tvar clientOut string\n\tif opts.GenerateClient {\n\t\tclientOut, err = GenerateClient(t, ops)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error generating client\")\n\t\t}\n\t}\n\n\tvar clientWithResponsesOut string\n\tif opts.GenerateClient {\n\t\tclientWithResponsesOut, err = GenerateClientWithResponses(t, ops)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error generating client with responses\")\n\t\t}\n\t}\n\n\tvar inlinedSpec string\n\tif opts.EmbedSpec {\n\t\tinlinedSpec, err = GenerateInlinedSpec(t, swagger)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error generating Go handlers for Paths\")\n\t\t}\n\t}\n\n\tvar buf bytes.Buffer\n\tw := bufio.NewWriter(&buf)\n\n\texternalImports := importMapping.GoImports()\n\timportsOut, err := GenerateImports(t, externalImports, packageName)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error generating imports\")\n\t}\n\n\t_, err = w.WriteString(importsOut)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error writing imports\")\n\t}\n\n\t_, err = w.WriteString(constantDefinitions)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error writing constants\")\n\t}\n\n\t_, err = w.WriteString(typeDefinitions)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error writing type definitions\")\n\n\t}\n\n\tif opts.GenerateClient {\n\t\t_, err = w.WriteString(clientOut)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error writing client\")\n\t\t}\n\t\t_, err = w.WriteString(clientWithResponsesOut)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error writing client\")\n\t\t}\n\t}\n\n\tif opts.GenerateEchoServer {\n\t\t_, err = w.WriteString(echoServerOut)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error writing server path handlers\")\n\t\t}\n\t}\n\n\tif opts.GenerateChiServer {\n\t\t_, err = w.WriteString(chiServerOut)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error writing server path handlers\")\n\t\t}\n\t}\n\n\tif opts.EmbedSpec {\n\t\t_, err = w.WriteString(inlinedSpec)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"error writing inlined spec\")\n\t\t}\n\t}\n\n\terr = w.Flush()\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error flushing output buffer\")\n\t}\n\n\t// remove any byte-order-marks which break Go-Code\n\tgoCode := SanitizeCode(buf.String())\n\n\t// The generation code produces unindented horrors. Use the Go Imports\n\t// to make it all pretty.\n\tif opts.SkipFmt {\n\t\treturn goCode, nil\n\t}\n\n\toutBytes, err := imports.Process(packageName+\".go\", []byte(goCode), nil)\n\tif err != nil {\n\t\tfmt.Println(goCode)\n\t\treturn \"\", errors.Wrap(err, \"error formatting Go code\")\n\t}\n\treturn string(outBytes), nil\n}", "func (m *MigrationParams) GenerateFiles() (err error) {\n\tvar forwardFile, reverseFile *os.File\n\n\tif forwardFile, err = newMigrationFile(m.Forward, m.Dirpath); err != nil {\n\t\treturn\n\t}\n\tfmt.Fprintln(os.Stderr, \"created forward file:\", forwardFile.Name())\n\tdefer func() { _ = forwardFile.Close() }()\n\n\tif !m.Reversible {\n\t\tfmt.Fprintln(os.Stderr, \"migration marked irreversible, did not create reverse file\")\n\t\treturn\n\t}\n\n\tif reverseFile, err = newMigrationFile(m.Reverse, m.Dirpath); err != nil {\n\t\treturn\n\t}\n\tfmt.Fprintln(os.Stderr, \"created reverse file:\", reverseFile.Name())\n\tdefer func() { _ = reverseFile.Close() }()\n\treturn\n}", "func (g *generator) Generate() error {\n\terr := g.Prepare()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// temporary template variable\n\tvar templ string\n\tswitch g.repositoryType {\n\tcase Mongo:\n\t\ttempl = repositorytmpl.MongoRepositoryTemplate\n\t}\n\n\t// compile mongo repository\n\trepoTmpl, err := template.New(\"repository\").Parse(templ)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, resource := range *g.Resources {\n\t\tif entity, ok := resource.(*model.Model); ok {\n\t\t\tgenlog.Info(\"Generating repository for model %s\", entity.Name)\n\t\t\tcontent := bytes.Buffer{}\n\t\t\terr = repoTmpl.Execute(&content,\n\t\t\t\tstruct {\n\t\t\t\t\tModel *model.Model\n\t\t\t\t\tPackageName string\n\t\t\t\t}{\n\t\t\t\t\tModel: entity,\n\t\t\t\t\tPackageName: g.PackageName(),\n\t\t\t\t},\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tg.SaveFile(entity.Name+\"Repository\", content)\n\t\t}\n\t}\n\n\treturn nil\n}", "func actionGenerate(ctx *cli.Context) (err error) {\n\tif err = autoUpdate(ctx); err != nil {\n\t\treturn\n\t}\n\terr = installDependencies()\n\tif err != nil {\n\t\treturn\n\t}\n\tf := ctx.Args().Get(0)\n\n\tgoPath := initGopath()\n\tif !fileExist(goPath) {\n\t\treturn cli.NewExitError(fmt.Sprintf(\"GOPATH not exist: \"+goPath), 1)\n\t}\n\n\tfilesToGenerate := []string{f}\n\tiPath := ctx.String(\"i\")\n\tif iPath != \"\" {\n\t\tiPath = goPath + \"/src/go-common/app/interface/\" + iPath\n\t\tif !fileExist(iPath) {\n\t\t\treturn cli.NewExitError(fmt.Sprintf(\"interface project not found: \"+iPath), 1)\n\t\t}\n\t\tpbs := filesWithSuffix(iPath+\"/api\", \".pb\", \".proto\")\n\t\tif len(pbs) == 0 {\n\t\t\treturn cli.NewExitError(fmt.Sprintf(\"no pbs found in path: \"+iPath+\"/api\"), 1)\n\t\t}\n\t\tfilesToGenerate = pbs\n\t\tfmt.Printf(\".pb files found %v\\n\", pbs)\n\t} else {\n\t\tif f == \"\" {\n\t\t\t// if is is empty, look up project that contains current dir\n\t\t\tabs, _ := filepath.Abs(\".\")\n\t\t\tproj := lookupProjPath(abs)\n\t\t\tif proj == \"\" {\n\t\t\t\treturn cli.NewExitError(\"current dir is not in any project : \"+abs, 1)\n\t\t\t}\n\t\t\tif proj != \"\" {\n\t\t\t\tpbs := filesWithSuffix(proj+\"/api\", \".pb\", \".proto\")\n\t\t\t\tif len(pbs) == 0 {\n\t\t\t\t\treturn cli.NewExitError(fmt.Sprintf(\"no pbs found in path: \"+proj+\"/api\"), 1)\n\t\t\t\t}\n\t\t\t\tfilesToGenerate = pbs\n\t\t\t\tfmt.Printf(\".pb files found %v\\n\", pbs)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, p := range filesToGenerate {\n\t\tif !fileExist(p) {\n\t\t\treturn cli.NewExitError(fmt.Sprintf(\"file not exist: \"+p), 1)\n\t\t}\n\t\tgenerateForFile(p, goPath)\n\t}\n\tif syncLiveDoc {\n\t\terr = actionSyncLiveDoc(ctx)\n\t}\n\treturn\n}", "func Generate() error {\n\tlogCategories, err := getDefinitions()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttemp, err := getTemplates()\n\tif err != nil {\n\t\treturn err\n\t}\n\toutputPath := os.Getenv(\"GENERATOR_OUTPUT_PATH\")\n\tavailable := make([]string, 0)\n\tif len(outputPath) == 0 {\n\t\toutputPath = \"./templates\"\n\t}\n\tfor k, content := range logCategories {\n\t\tavailable = append(available, content.ResourceType)\n\t\tos.MkdirAll(fmt.Sprintf(\"%s/%s/\", outputPath, k), os.ModePerm)\n\t\tfr, err := os.Create(fmt.Sprintf(\"%s/%s/rule.json\", outputPath, k))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_ = temp.ExecuteTemplate(fr, ruleTemplate, content)\n\t\tfp, err := os.Create(fmt.Sprintf(\"%s/%s/parameters.json\", outputPath, k))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_ = temp.ExecuteTemplate(fp, paramTemplate, nil)\n\t}\n\tos.MkdirAll(outputPath, os.ModePerm)\n\tfa, err := os.Create(fmt.Sprintf(\"%s/available_resources.json\", outputPath))\n\tif err != nil {\n\t\treturn err\n\t}\n\t_ = temp.ExecuteTemplate(fa, generatedTemplate, available)\n\treturn nil\n}", "func (s *Schema) Generate(root string) error {\n\treturn inSubDirectory(root, s.Package, func(dir string) error {\n\t\tk, p, err := s.getFirstEndpoint()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(s.Endpoints) == 1 && isDefaultEndpoint(k) {\n\t\t\tif err = s.genSingleHandler(dir, p); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn fixImports(dir, handlerDst)\n\t\t}\n\n\t\tif err = s.genEndpointsInterface(dir); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err = s.genHandler(dir); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err = s.genDispatcher(dir); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err = s.genHandlers(dir); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn fixImports(dir, endpointsDst)\n\t})\n}", "func Generate(c *goproject.Config, p *Project) error {\n\tcwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to get current working directory: %v\", err)\n\t}\n\n\tfullPath := filepath.Join(cwd, p.Name)\n\n\terr = os.Mkdir(fullPath, 0750)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create project directory: %v\", err)\n\t}\n\n\terr = copyFiles(p.Tpl.path, fullPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to copy template files: %v\", err)\n\t}\n\n\terr = applyProjectToTemplates(p, fullPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to execute templates: %v\", err)\n\t}\n\n\terr = fixCmdProjectFolderName(p, fullPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to rename cmd project folder: %v\", err)\n\t}\n\n\terr = gitCleanup(fullPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize git: %v\", err)\n\t}\n\n\treturn nil\n}", "func Generate(ctx *cli.Context) error { // nolint: gocyclo\n\tvar filterRe *regexp.Regexp\n\tvar excludeLabels []string\n\tvar err error\n\n\t// verify the given endpoint, it should be one of supported connectors\n\tif ctx.String(\"endpoint\") == \"\" {\n\t\treturn fmt.Errorf(\"endpoint type is missing\")\n\t}\n\tconnector := ctx.String(\"endpoint\")\n\tif !connectors.ConnectorRegistered(connector) {\n\t\treturn fmt.Errorf(\"given endpoint isn't supported: %v\", connector)\n\t}\n\n\tif !ctx.Bool(\"no-filter-tags\") { // if the flag is not there, lets apply the filter\n\t\tfilterReStr := ctx.String(\"filter-tags\")\n\t\tif filterReStr == \"\" {\n\t\t\treturn fmt.Errorf(\"regular expression for tag filtering should be defined\")\n\t\t}\n\t\tif filterRe, err = regexp.Compile(filterReStr); err != nil {\n\t\t\treturn fmt.Errorf(\"can't compile the regular expression: %v\", err)\n\t\t}\n\t}\n\n\tls := ctx.String(\"exclude-labels\")\n\tif ls != \"\" {\n\t\texcludeLabels = strings.Split(ls, \",\")\n\t\t//trim spaces from label names\n\t\tfor i := range excludeLabels {\n\t\t\texcludeLabels[i] = strings.Trim(excludeLabels[i], \" \")\n\t\t}\n\t}\n\n\tconn, err := connectors.NewConnector(connector, ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texists, err := conn.RepositoryExists()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !exists {\n\t\t// TODO: this should provide detailed information about repository: owner, repo name\n\t\treturn fmt.Errorf(\"project not found\")\n\t}\n\n\ttags, issues, mrs, err := getConnectorData(\n\t\tconn,\n\t\tfilterRe,\n\t\texcludeLabels,\n\t\tctx.String(\"new-release\"),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgen := generator.New(data.NewReleases(tags, issues, mrs))\n\n\t// use stdout if - is given, otherwise create a new file\n\tfilename := ctx.String(\"file\")\n\tvar wr io.Writer\n\tif filename != \"-\" {\n\t\tvar file *os.File\n\t\tif file, err = os.Create(filename); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func() {\n\t\t\tif cerr := file.Close(); err == nil && cerr != nil {\n\t\t\t\terr = cerr\n\t\t\t}\n\t\t}()\n\n\t\twr = file\n\t} else {\n\t\twr = Stdout\n\t}\n\n\terr = gen.Render(wr)\n\n\treturn err\n}", "func (g Generator) Generate() error {\n\tdefaultSchema := \"public\"\n\tif g.DefaultSchema != \"\" {\n\t\tdefaultSchema = g.DefaultSchema\n\t}\n\n\ttableFiles, err := listYamlFiles(\"tables\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tviewFiles, err := listYamlFiles(\"views\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttableSpecs, err := createTableSpecs(tableFiles, defaultSchema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tviewSpecs, err := createViewSpecs(viewFiles, defaultSchema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trootDir := \".\"\n\tif g.RootDir != \"\" {\n\t\trootDir = g.RootDir\n\t}\n\n\ti, err := interpolation.NewInterpolator(g.BaseImportPath, rootDir, defaultSchema, tableSpecs, viewSpecs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = i.Interpolate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ti.DisplayTargets()\n\n\terr = g.generateCommons(i)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.generateTables(i.TablesData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.generateViews(i.ViewsData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Generate(env environ.Values, cfg *Config) error {\n\tinfo, err := cfg.Driver.Parse(env.Log, cfg.ConnStr, cfg.Schemas, makeFilter(cfg.IncludeTables, cfg.ExcludeTables))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdb, err := makeData(env.Log, info, cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(cfg.SchemaPaths) == 0 {\n\t\tenv.Log.Println(\"No SchemaPaths specified, skipping schemas.\")\n\t} else {\n\t\tif err := generateSchemas(env, cfg, db); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif len(cfg.EnumPaths) == 0 {\n\t\tenv.Log.Println(\"No EnumPath specified, skipping enums.\")\n\t} else {\n\t\tif err := generateEnums(env, cfg, db); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif len(cfg.TablePaths) == 0 {\n\t\tenv.Log.Println(\"No table path specified, skipping tables.\")\n\t} else {\n\t\tif err := generateTables(env, cfg, db); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn copyStaticFiles(env, cfg.StaticDir, cfg.OutputDir)\n}", "func generate(ctx *Context) (err error) {\n\tgt, err := parseDirRecursive(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Create dummies if no C & C++ files will be generated.\n\tif len(gt.Packages) == 0 {\n\t\treturn generateDummyFiles(ctx)\n\t}\n\n\terr = generateCMainHeader(gt, ctx.CGenIncludeDir)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, gp := range gt.Packages {\n\t\terr = generateGoFile(gp)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\terr = generateCHeaderFile(gp, ctx.CGenDir)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\terr = generateCPPHeaderFile(gp, ctx.CPPGenDir)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\terr = generateCPPSourceFile(gp, ctx.CPPGenDir)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func generate(copyrights string, collector *collector, templateBuilder templateBuilder) {\n\tfor _, pkg := range collector.Packages {\n\t\tfileTemplate := fileTpl{\n\t\t\tCopyright: copyrights,\n\n\t\t\tStandardImports: []string{\n\t\t\t\t\"fmt\",\n\t\t\t\t\"unicode\",\n\t\t\t\t\"unicode/utf8\",\n\t\t\t},\n\n\t\t\tCustomImports: []string{\n\t\t\t\t\"github.com/google/uuid\",\n\t\t\t},\n\t\t}\n\t\tfor _, f := range pkg.Files {\n\t\t\tfor _, d := range f.Decls {\n\t\t\t\tg, ok := d.(*ast.GenDecl)\n\t\t\t\tif !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tstructs := structSearch(g)\n\t\t\t\tif len(structs) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfor _, s := range structs {\n\t\t\t\t\tatLeastOneField := false\n\n\t\t\t\t\tfor _, field := range s.Type.Fields.List {\n\n\t\t\t\t\t\tpos := collector.FileSet.Position(field.Type.Pos())\n\t\t\t\t\t\ttyp := collector.Info.TypeOf(field.Type)\n\n\t\t\t\t\t\tcomposedType := \"\"\n\t\t\t\t\t\tbaseName := getType(typ, &composedType)\n\t\t\t\t\t\tfmt.Println(\"Add validation: \", pos, \": \", baseName, \"/\", composedType)\n\n\t\t\t\t\t\tif err := templateBuilder.generateCheck(field, s.Name, baseName, composedType); err != nil {\n\t\t\t\t\t\t\tfmt.Printf(\"struct %s: %s\\n\", s.Name, err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tatLeastOneField = true\n\t\t\t\t\t}\n\n\t\t\t\t\tif !atLeastOneField {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\terr := templateBuilder.generateMethod(s.Name)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Printf(\"struct gen %s: %s\\n\", s.Name, err)\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}\n\n\t\tfileTemplate.Package = pkg.Name\n\t\terr := templateBuilder.generateFile(pkg.Path, fileTemplate)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Generation error\", err)\n\t\t}\n\t}\n}", "func TestGenerator_Generate(t *testing.T) {\n\timportmap := map[string]string{\n\t\t\"policy/v1beta1/value_type.proto\": \"istio.io/api/policy/v1beta1\",\n\t\t\"mixer/adapter/model/v1beta1/extensions.proto\": \"istio.io/api/mixer/adapter/model/v1beta1\",\n\t\t\"gogoproto/gogo.proto\": \"github.com/gogo/protobuf/gogoproto\",\n\t\t\"google/protobuf/duration.proto\": \"github.com/gogo/protobuf/types\",\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\tfdsFiles map[string]string // FDS and their package import paths\n\t\twant string\n\t}{\n\t\t{\"AllTemplates\", map[string]string{\n\t\t\t\"testdata/check/template.descriptor\": \"istio.io/istio/mixer/template/list\",\n\t\t\t\"testdata/report2/template.descriptor\": \"istio.io/istio/mixer/template/metric\",\n\t\t\t\"testdata/quota/template.descriptor\": \"istio.io/istio/mixer/template/quota\",\n\t\t\t\"testdata/apa/template.descriptor\": \"istio.io/istio/mixer/template/apa\",\n\t\t\t\"testdata/report1/template.descriptor\": \"istio.io/istio/mixer/template/log\"},\n\t\t\t\"testdata/template.gen.go.golden\"},\n\t}\n\tfor _, v := range tests {\n\t\tt.Run(v.name, func(t *testing.T) {\n\t\t\ttestTmpDir := path.Join(os.TempDir(), \"bootstrapTemplateTest\")\n\t\t\t_ = os.MkdirAll(testTmpDir, os.ModeDir|os.ModePerm)\n\t\t\toutFile, err := os.Create(path.Join(testTmpDir, path.Base(v.want)))\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tdefer func() {\n\t\t\t\tif !t.Failed() {\n\t\t\t\t\tif removeErr := os.RemoveAll(testTmpDir); removeErr != nil {\n\t\t\t\t\t\tt.Logf(\"Could not remove temporary folder %s: %v\", testTmpDir, removeErr)\n\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tt.Logf(\"Generated data is located at '%s'\", testTmpDir)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tg := Generator{OutFilePath: outFile.Name(), ImportMapping: importmap}\n\t\t\tif err := g.Generate(v.fdsFiles); err != nil {\n\t\t\t\tt.Fatalf(\"Generate(%s) produced an error: %v\", v.fdsFiles, err)\n\t\t\t}\n\n\t\t\tif same := fileCompare(outFile.Name(), v.want, t.Errorf); !same {\n\t\t\t\tt.Errorf(\"Files %v and %v were not the same.\", outFile.Name(), v.want)\n\t\t\t}\n\t\t})\n\t}\n}", "func (l *library) generate() error {\n\t// write empty __init__.py in each dir\n\twalkFn := 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() {\n\t\t\treturn nil\n\t\t}\n\t\treturn generateEmptyInitPy(path)\n\t}\n\n\tif err := filepath.Walk(l.baseDir, walkFn); err != nil {\n\t\treturn err\n\t}\n\n\t// json schema\n\tif err := generateJSONSchema(&raml.APIDefinition{\n\t\tTypes: l.Types,\n\t}, l.dir); err != nil {\n\t\tlog.Errorf(\"failed to generate jsonschema:%v\", err)\n\t\treturn err\n\t}\n\n\t// security schemes\n\tif err := generateServerSecurity(l.SecuritySchemes, templates(serverKindFlask), l.dir); err != nil {\n\t\treturn err\n\t}\n\n\t// included libraries\n\tfor _, ramlLib := range l.Libraries {\n\t\tchildLib := newLibrary(ramlLib, l.baseDir)\n\t\tif err := childLib.generate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func main() {\n\tif len(os.Args) < 4 {\n\t\tfmt.Fprintln(os.Stderr, \"not enough program arguments: [cmd] [package] [model] [mattermost-server dir]\")\n\t\tos.Exit(1)\n\t}\n\tpackageName := os.Args[1]\n\tmodelName := os.Args[2]\n\tvar goFiles []string\n\twalker := func(fullPath 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.HasPrefix(info.Name(), \".\")) || strings.Contains(fullPath, \"mattermost-server/vendor\") {\n\t\t\treturn nil\n\t\t}\n\t\tif path.Ext(info.Name()) == \".go\" && !strings.HasSuffix(info.Name(), \"_test\") {\n\t\t\tgoFiles = append(goFiles, fullPath)\n\t\t}\n\t\treturn nil\n\t}\n\tif err := filepath.Walk(os.Args[3], walker); err != nil {\n\t\tlog.Fatalf(\"could not scan folder: %v\", err)\n\t}\n\tfset := token.NewFileSet()\n\n\tfor _, fileName := range goFiles {\n\t\tfileNode, err := parser.ParseFile(fset, fileName, nil, parser.AllErrors|parser.ParseComments)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"could not parse %s: %v\", fileName, err)\n\t\t\tcontinue\n\t\t}\n\t\tw := &finder.Walker{\n\t\t\tName: modelName,\n\t\t\tPackage: packageName,\n\t\t}\n\t\tresult := w.Process(fileNode)\n\t\tbuf := new(bytes.Buffer)\n\t\tif err = format.Node(buf, fset, result); err != nil {\n\t\t\tlog.Printf(\"error: %v\\n\", err)\n\t\t} else if err := ioutil.WriteFile(fileName, buf.Bytes(), 0664); err != nil {\n\t\t\tlog.Printf(\"error: %v\\n\", err)\n\t\t}\n\t}\n}", "func (Docs) Generate() error {\n\treturn sh.RunWith(ENV, \"go\", \"run\", \"-tags=mage_docs\", \"./magefiles\")\n}", "func generateSchemaFile(o, wdPath string) error {\n\tsData, err := GenerateSchema()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// check if the provided output path is relative\n\tif !path.IsAbs(o) {\n\t\to = path.Join(wdPath, o)\n\t}\n\n\terr = os.WriteFile(path.Join(o, schemaFileName), sData, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tLog.Info(\"generated JSON schema for BlueprintMetadata\", \"path\", path.Join(o, schemaFileName))\n\treturn nil\n}", "func generatePbFiles() error {\n\tfullPath := filepath.Join(appPath)\n\n\t_, err := os.Stat(fullPath)\n\tif err != nil {\n\t\tos.MkdirAll(fullPath, os.ModePerm)\n\t}\n\n\t_, err = exec.LookPath(\"protoc\")\n\tif err != nil {\n\t\tlog.Fatal(\"protoc is not available\")\n\t\treturn err\n\t}\n\n\terr = Exec(\"protoc\", \"-I\", protoPath, protoPath+string(filepath.Separator)+protoFileName, \"--go_out=plugins=grpc:\"+fullPath)\n\tif err != nil {\n\t\t_, statErr := os.Stat(fullPath)\n\t\tif statErr == nil {\n\t\t\tos.RemoveAll(fullPath)\n\t\t}\n\t\tlog.Fatal(\"error occured\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func Generate(ctx context.Context, p StructProvider, filename string, pkg string, embedStructs bool) error {\n\tstructs, err := p.ProvideStructs(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !embedStructs {\n\t\tvar results []*structbuilder.Struct\n\t\tfor _, s := range structs {\n\t\t\tresults = append(results, s.UnembedStructs()...)\n\t\t}\n\n\t\tstructs = results\n\t}\n\n\timportPaths := uniqueImportPaths(structs)\n\n\tdata := struct {\n\t\tStructs []*structbuilder.Struct\n\t\tPackage string\n\t\tImportPaths []string\n\t}{\n\t\tstructs,\n\t\tpkg,\n\t\timportPaths,\n\t}\n\n\tvar buf bytes.Buffer\n\tif err := tmpl.Execute(&buf, &data); err != nil {\n\t\treturn err\n\t}\n\n\t//formatted := buf.Bytes()\n\tformatted, err := format.Source(buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif filename != \"\" {\n\t\treturn ioutil.WriteFile(filename, formatted, 0666)\n\t}\n\n\tfmt.Println(string(formatted))\n\treturn nil\n}", "func main() {\n\tgodotenv.Load(os.Getenv(\"PWD\") + \"/.env\")\n\tuser := os.Getenv(\"DB_USERNAME\")\n\tpass := os.Getenv(\"DB_PASSWORD\")\n\thost := os.Getenv(\"DB_HOSTNAME\")\n\tport := os.Getenv(\"DB_PORT\")\n\tdatabase := os.Getenv(\"DB_DATABASE\")\n\n\tmode := flag.String(\"mode\", \"code\", \"Generate Mode\")\n\ttemplatePath := flag.String(\"template\", os.Getenv(\"PWD\")+\"/template\", \"Template Path\")\n\toutputPath := flag.String(\"project\", os.Getenv(\"PWD\")+\"/src\", \"Project Path\")\n\trelationMode := flag.Bool(\"relation\", false, \"Relation Mode\")\n\tflag.Parse()\n\n\tfmt.Println(\"Generate Mode: \" + *mode)\n\tfmt.Println(\"Template Path: \" + *templatePath)\n\tfmt.Println(\"Project Path: \" + *outputPath)\n\n\tif *mode == \"json\" || *mode == \"all\" {\n\t\tfmt.Println(\"Generate:\", \"goapigen.json\")\n\t\tfmt.Println(\"hostdb:\", host)\n\t\tfmt.Println(\"Connecting to mysql server \" + host + \":\" + port)\n\t\tgenjson.GenJson(user, pass, host, port, database, *relationMode)\n\t}\n\n\tif *mode == \"code\" || *mode == \"all\" {\n\t\tgenstruct.GenStruct(*templatePath, *outputPath)\n\t}\n\n\treturn\n}", "func generateGoSchemaFile(schema map[string]interface{}, config Config) {\r\n var obj map[string]interface{}\r\n var schemas = make(map[string]interface{})\r\n var outString = \"package main\\n\\nvar schemas = `\\n\"\r\n\r\n var filename = config.Schemas.GoSchemaFilename\r\n var apiFunctions = config.Schemas.API\r\n var elementNames = config.Schemas.GoSchemaElements\r\n \r\n var functionKey = \"API\"\r\n var objectModelKey = \"objectModelSchemas\"\r\n \r\n schemas[functionKey] = interface{}(make(map[string]interface{}))\r\n schemas[objectModelKey] = interface{}(make(map[string]interface{}))\r\n\r\n fmt.Printf(\"Generate Go SCHEMA file %s for: \\n %s and: \\n %s\\n\", filename, apiFunctions, elementNames)\r\n\r\n // grab the event API functions for input\r\n for i := range apiFunctions {\r\n functionSchemaName := \"#/definitions/API/\" + apiFunctions[i]\r\n functionName := apiFunctions[i]\r\n obj = getObject(schema, functionSchemaName)\r\n if obj == nil {\r\n fmt.Printf(\"** WARN ** %s returned nil from getObject\\n\", functionSchemaName)\r\n return\r\n }\r\n schemas[functionKey].(map[string]interface{})[functionName] = obj \r\n } \r\n\r\n // grab the elements requested (these are useful separately even though\r\n // they obviously appear already as part of the event API functions)\r\n for i := range elementNames {\r\n elementName := elementNames[i]\r\n obj = getObject(schema, elementName)\r\n if obj == nil {\r\n fmt.Printf(\"** ERR ** %s returned nil from getObject\\n\", elementName)\r\n return\r\n }\r\n schemas[objectModelKey].(map[string]interface{})[elementName] = obj \r\n }\r\n \r\n // marshal for output to file \r\n schemaOut, err := json.MarshalIndent(&schemas, \"\", \" \")\r\n if err != nil {\r\n fmt.Printf(\"** ERR ** cannot marshal schema file output for writing\\n\")\r\n return\r\n }\r\n outString += string(schemaOut) + \"`\"\r\n ioutil.WriteFile(filename, []byte(outString), 0644)\r\n}", "func Generate() error {\n\tmg.Deps(Download)\n\tmg.Deps(appConf)\n\tmg.Deps(manifest)\n\tmg.Deps(versionInfo)\n\n\tfmt.Println(\"⚙️ Go generate...\")\n\tif err := sh.RunV(mg.GoCmd(), \"generate\", \"-v\"); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (g *Generator) Generate() error {\n\tsteps := []func() error{\n\t\tg.prepareData,\n\t\tg.genModels,\n\t\tg.genSchema,\n\t}\n\n\tfor _, s := range steps {\n\t\tif err := s(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (input Input) GenerateModel() error {\n\tfolderName := \"model\"\n\t// Create model folder if not exists\n\tif _, err := os.Stat(folderName); os.IsNotExist(err) {\n\t\terr = os.MkdirAll(folderName, 0755)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcontent, err := input.generateHeaderContent()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif input.Settings.List {\n\t\tcontent += \"\\n\\n\" + input.getnerateGetFunction()\n\t}\n\tif input.Settings.Add {\n\t\tcontent += \"\\n\\n\" + input.generateCreateFunction()\n\t}\n\tif input.Settings.Details {\n\t\tcontent += \"\\n\\n\" + input.generateGetDetailsFunction()\n\t}\n\tif input.Settings.Update {\n\t\tcontent += \"\\n\\n\" + input.generateUpdateFunction()\n\t}\n\tif input.Settings.Delete {\n\t\tcontent += \"\\n\\n\" + input.generateDeleteFunction()\n\t}\n\tcontent += \"\\n\\n\" + input.generateExports()\n\n\tfilename := strings.ToLower(input.Name) + \".js\"\n\n\terr = ioutil.WriteFile(folderName+\"/\"+filename, []byte(content), 0644)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func RunGenerate(output, input, title, description string) error {\n\tvar err error\n\tvar t *template.Template\n\tvar fd *os.File\n\n\tpages := filepath.Join(output, \"post\")\n\tif err = createStructure(input, output); err != nil {\n\t\treturn errors.Wrap(err, \"create directory structure\")\n\t}\n\tif err = models.ParseDir(input); err != nil {\n\t\treturn errors.Wrap(err, \"parse input directory\")\n\t}\n\tif t, err = template.ParseGlob(\"templates/*.tmpl\"); err != nil {\n\t\treturn errors.Wrap(err, \"parse template glob\")\n\t}\n\tfor _, v := range models.MPages {\n\t\tv.Slug = v.Slug + \".html\"\n\t\tif fd, err = os.Create(filepath.Join(pages, v.Slug)); err != nil {\n\t\t\treturn errors.Wrap(err, \"create post file\")\n\t\t}\n\t\tif err = t.ExecuteTemplate(\n\t\t\tfd, \"post.tmpl\",\n\t\t\tgin.H{\"post\": v, \"gitalk\": gin.H{}, \"local\": true},\n\t\t); err != nil {\n\t\t\treturn errors.Wrap(err, \"execute template post\")\n\t\t}\n\t}\n\n\tif fd, err = os.Create(filepath.Join(output, \"index.html\")); err != nil {\n\t\treturn errors.Wrap(err, \"create index file\")\n\t}\n\tdata := gin.H{\n\t\t\"posts\": models.SPages,\n\t\t\"title\": title,\n\t\t\"description\": description,\n\t\t\"local\": true,\n\t\t\"author\": models.GetGlobalAuthor(),\n\t}\n\tif err = t.ExecuteTemplate(fd, \"index.tmpl\", data); err != nil {\n\t\treturn errors.Wrap(err, \"execute template index\")\n\t}\n\treturn nil\n}", "func Generate() ([]string, error) {\n\tvar (\n\t\tver string\n\t\toutDir string\n\t)\n\tset := flag.NewFlagSet(\"app\", flag.PanicOnError)\n\tset.String(\"design\", \"\", \"\") // Consume design argument so Parse doesn't complain\n\tset.StringVar(&ver, \"version\", \"\", \"\")\n\tset.StringVar(&outDir, \"out\", \"\", \"\")\n\tset.Parse(os.Args[2:])\n\t// First check compatibility\n\tif err := codegen.CheckVersion(ver); err != nil {\n\t\treturn nil, err\n\t}\n\treturn writeFunctions(design.Design, outDir)\n}", "func CollectModels(outModelDir string) (Models, error) {\n\tfiles, err := ioutil.ReadDir(outModelDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar models Models\n\tvar wg sync.WaitGroup\n\tvar mu sync.Mutex\n\terrCh := make(chan error, 1)\n\tdone := make(chan bool, 1)\n\n\tfor _, file := range files {\n\t\twg.Add(1)\n\t\tgo func(f os.FileInfo) {\n\t\t\tdefer wg.Done()\n\t\t\tif f.IsDir() {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif !strings.HasSuffix(f.Name(), \".go\") {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tmodelPath := filepath.Join(outModelDir, f.Name())\n\t\t\tms, err := ParseModel(modelPath)\n\t\t\tif err != nil {\n\t\t\t\terrCh <- err\n\t\t\t}\n\n\t\t\tmu.Lock()\n\n\t\t\tfor _, m := range ms {\n\t\t\t\tmodels = append(models, m)\n\t\t\t}\n\n\t\t\tmu.Unlock()\n\t\t}(file)\n\t}\n\n\twg.Wait()\n\tclose(done)\n\n\tselect {\n\tcase <-done:\n\tcase err := <-errCh:\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn models, nil\n}", "func (a Generator) Run(root string, data makr.Data) error {\n\tg := makr.New()\n\n\tif a.AsAPI {\n\t\tdefer os.RemoveAll(filepath.Join(a.Root, \"templates\"))\n\t\tdefer os.RemoveAll(filepath.Join(a.Root, \"locales\"))\n\t\tdefer os.RemoveAll(filepath.Join(a.Root, \"public\"))\n\t}\n\tif a.Force {\n\t\tos.RemoveAll(a.Root)\n\t}\n\n\tg.Add(makr.NewCommand(makr.GoGet(\"golang.org/x/tools/cmd/goimports\", \"-u\")))\n\tif a.WithDep {\n\t\tg.Add(makr.NewCommand(makr.GoGet(\"github.com/golang/dep/cmd/dep\", \"-u\")))\n\t}\n\n\tfiles, err := generators.FindByBox(packr.NewBox(\"../newapp/templates\"))\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tfor _, f := range files {\n\t\tif !a.AsAPI {\n\t\t\tg.Add(makr.NewFile(f.WritePath, f.Body))\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.Contains(f.WritePath, \"locales\") || strings.Contains(f.WritePath, \"templates\") || strings.Contains(f.WritePath, \"public\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tg.Add(makr.NewFile(f.WritePath, f.Body))\n\t}\n\n\tdata[\"name\"] = a.Name\n\tif err := refresh.Run(root, data); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\ta.setupCI(g, data)\n\n\tif err := a.setupWebpack(root, data); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif err := a.setupPop(root, data); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif err := a.setupDocker(root, data); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tg.Add(makr.NewCommand(a.goGet()))\n\n\tg.Add(makr.Func{\n\t\tRunner: func(root string, data makr.Data) error {\n\t\t\tg.Fmt(root)\n\t\t\treturn nil\n\t\t},\n\t})\n\n\ta.setupVCS(g)\n\n\tdata[\"opts\"] = a\n\treturn g.Run(root, data)\n}", "func GenerateTestSupport(name string, modelNames, operationIDs []string, includeUI bool,includeTCK bool, opts GenOpts) error {\n\t\t// Load the spec\n\t_, specDoc, err := loadSpec(opts.Spec)\n\t\n\tif err != nil {\n\t\treturn err\n\t}\n\t\n\t\n\tmodels, mnc := make(map[string]spec.Schema), len(modelNames)\n\tfor k, v := range specDoc.Spec().Definitions {\n\t\tfor _, nm := range modelNames {\n\t\t\tif mnc == 0 || k == nm {\n\t\t\t\tmodels[k] = v\n\t\t\t}\n\t\t}\n\t}\n\n\toperations := make(map[string]spec.Operation)\n\tif len(modelNames) == 0 {\n\t\tfor _, k := range specDoc.OperationIDs() {\n\t\t\tif op, ok := specDoc.OperationForName(k); ok {\n\t\t\t\toperations[k] = *op\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor _, k := range specDoc.OperationIDs() {\n\t\t\tfor _, nm := range operationIDs {\n\t\t\t\tif k == nm {\n\t\t\t\t\tif op, ok := specDoc.OperationForName(k); ok {\n\t\t\t\t\t\toperations[k] = *op\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif name == \"\" {\n\t\tif specDoc.Spec().Info != nil && specDoc.Spec().Info.Title != \"\" {\n\t\t\tname = swag.ToGoName(specDoc.Spec().Info.Title)\n\t\t} else {\n\t\t\tname = \"swagger\"\n\t\t}\n\t}\n\n\tgenerator := testGenerator{\n\t\tName: name,\n\t\tSpecDoc: specDoc,\n\t\tModels: models,\n\t\tOperations: operations,\n\t\tTarget: opts.Target,\n\t\tDumpData: opts.DumpData,\n\t\tPackage: opts.APIPackage,\n\t\tAPIPackage: opts.APIPackage,\n\t\tModelsPackage: opts.ModelPackage,\n\t\tServerPackage: opts.ServerPackage,\n\t\tClientPackage: opts.ClientPackage,\n\t\tPrincipal: opts.Principal,\n\t\tIncludeUI: includeUI,\n\t\tIncludeTCK: includeTCK,\n\t}\n\n\treturn generator.GenerateTest()\n}", "func (c *Converter) GenerateJSONSchemas() ([]types.GeneratedJSONSchema, error) {\n\n\tc.logger.Debug(\"Converting API\")\n\n\t// Store the output in here:\n\tgeneratedJSONSchemas, err := c.mapOpenAPIDefinitionsToJSONSchema()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not map openapi definitions to jsonschema\")\n\t}\n\n\treturn generatedJSONSchemas, nil\n}", "func (g *RPCGenerator) Generate(src, target string, protoImportPath []string, goOptions ...string) error {\n\tabs, err := filepath.Abs(target)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = util.MkdirIfNotExist(abs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.g.Prepare()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprojectCtx, err := ctx.Prepare(abs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp := parser.NewDefaultProtoParser()\n\tproto, err := p.Parse(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdirCtx, err := mkdir(projectCtx, proto)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.g.GenEtc(dirCtx, proto, g.cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.g.GenPb(dirCtx, protoImportPath, proto, g.cfg, goOptions...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.g.GenConfig(dirCtx, proto, g.cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.g.GenSvc(dirCtx, proto, g.cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.g.GenLogic(dirCtx, proto, g.cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.g.GenServer(dirCtx, proto, g.cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.g.GenMain(dirCtx, proto, g.cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.g.GenCall(dirCtx, proto, g.cfg)\n\n\tconsole.NewColorConsole().MarkDone()\n\n\treturn err\n}", "func (a *App) Generator(data makr.Data) (*makr.Generator, error) {\n\tg := makr.New()\n\tg.Add(makr.NewCommand(makr.GoGet(\"golang.org/x/tools/cmd/goimports\", \"-u\")))\n\tg.Add(makr.NewCommand(makr.GoGet(\"github.com/golang/dep/cmd/dep\", \"-u\")))\n\tg.Add(makr.NewCommand(makr.GoGet(\"github.com/motemen/gore\", \"-u\")))\n\n\tfiles, err := generators.Find(filepath.Join(generators.TemplatesPath, \"newapp\"))\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tfor _, f := range files {\n\t\tg.Add(makr.NewFile(f.WritePath, f.Body))\n\t}\n\trr, err := refresh.New()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tg.Add(rr)\n\n\tif data[\"ciProvider\"] == \"travis\" {\n\t\tg.Add(makr.NewFile(\".travis.yml\", nTravis))\n\t} else if data[\"ciProvider\"] == \"gitlab-ci\" {\n\t\tif _, ok := data[\"withPop\"]; ok {\n\t\t\tif data[\"dbType\"] == \"postgres\" {\n\t\t\t\tdata[\"testDbUrl\"] = \"postgres://postgres:postgres@postgres:5432/\" + data[\"name\"].(string) + \"_test?sslmode=disable\"\n\t\t\t} else if data[\"dbType\"] == \"mysql\" {\n\t\t\t\tdata[\"testDbUrl\"] = \"mysql://root:root@mysql:3306/\" + data[\"name\"].(string) + \"_test\"\n\t\t\t} else {\n\t\t\t\tdata[\"testDbUrl\"] = \"\"\n\t\t\t}\n\t\t\tg.Add(makr.NewFile(\".gitlab-ci.yml\", nGitlabCi))\n\t\t} else {\n\t\t\tg.Add(makr.NewFile(\".gitlab-ci.yml\", nGitlabCiNoPop))\n\t\t}\n\t}\n\n\tif !a.API {\n\t\tif a.SkipWebpack {\n\t\t\twg, err := standard.New(data)\n\t\t\tif err != nil {\n\t\t\t\treturn g, errors.WithStack(err)\n\t\t\t}\n\t\t\tg.Add(wg)\n\t\t} else if a.WithReact {\n\t\t\twg, err := react.New(data)\n\t\t\tif err != nil {\n\t\t\t\treturn g, err\n\t\t\t}\n\t\t\tg.Add(wg)\n\t\t} else {\n\t\t\twg, err := webpack.New(data)\n\t\t\tif err != nil {\n\t\t\t\treturn g, errors.WithStack(err)\n\t\t\t}\n\t\t\tg.Add(wg)\n\t\t}\n\t}\n\tif !a.SkipPop {\n\t\tg.Add(newSodaGenerator())\n\t}\n\tif a.API {\n\t\tg.Add(makr.Func{\n\t\t\tRunner: func(path string, data makr.Data) error {\n\t\t\t\treturn os.RemoveAll(filepath.Join(path, \"templates\"))\n\t\t\t},\n\t\t})\n\t\tg.Add(makr.Func{\n\t\t\tRunner: func(path string, data makr.Data) error {\n\t\t\t\treturn os.RemoveAll(filepath.Join(path, \"locales\"))\n\t\t\t},\n\t\t})\n\t}\n\tif a.Docker != \"none\" {\n\t\tdg, err := docker.New()\n\t\tif err != nil {\n\t\t\treturn g, errors.WithStack(err)\n\t\t}\n\t\tg.Add(dg)\n\t}\n\tg.Add(makr.NewCommand(a.goGet()))\n\n\tif _, err := exec.LookPath(\"git\"); err == nil {\n\t\tg.Add(makr.NewCommand(exec.Command(\"git\", \"init\")))\n\t\tg.Add(makr.NewCommand(exec.Command(\"git\", \"add\", \".\")))\n\t\tg.Add(makr.NewCommand(exec.Command(\"git\", \"commit\", \"-m\", \"Initial Commit\")))\n\t}\n\n\treturn g, nil\n}", "func Generate() error {\n\tmg.Deps(Download)\n\tmg.Deps(appConf)\n\tmg.Deps(versionInfo)\n\n\tfmt.Println(\"⚙️ Go generate...\")\n\tif err := sh.RunV(mg.GoCmd(), \"generate\", \"-v\"); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Generate(fileSet *token.FileSet, pkgs map[string]*ast.Package, pkgPath string, typeName string) *ast.File {\n\tpkg, spec, zeroValue, values, valueStrings, _ := findDefinitions(fileSet, pkgs, typeName)\n\treturn generateFile(pkg, spec, zeroValue, values, valueStrings)\n}", "func (g *Generator) GenerateMessages() error {\n\tfor _, message := range g.depfile.ProtoFile.CollectMessages() {\n\t\terr := g.generateMessage(message.(*fproto.MessageElement))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (s *Server) Generate() error {\n\tif err := s.generateSchemas(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.generateMain(); err != nil {\n\t\treturn err\n\t}\n\n\treturn s.generateResources()\n}", "func main() {\n\tgenerateSwaggerJSON()\n}", "func (s *Service) GenerateManifest(ctx context.Context, q *apiclient.ManifestRequest) (*apiclient.ManifestResponse, error) {\n\tconfig := s.initConstants.PluginConfig\n\n\tenv := append(os.Environ(), environ(q.Env)...)\n\tif len(config.Spec.Init.Command) > 0 {\n\t\t_, err := runCommand(config.Spec.Init, q.AppPath, env)\n\t\tif err != nil {\n\t\t\treturn &apiclient.ManifestResponse{}, err\n\t\t}\n\t}\n\n\tout, err := runCommand(config.Spec.Generate, q.AppPath, env)\n\tif err != nil {\n\t\treturn &apiclient.ManifestResponse{}, err\n\t}\n\n\tmanifests, err := kube.SplitYAMLToString([]byte(out))\n\tif err != nil {\n\t\treturn &apiclient.ManifestResponse{}, err\n\t}\n\n\treturn &apiclient.ManifestResponse{\n\t\tManifests: manifests,\n\t}, err\n}", "func (g *Generator) Generate(opts ...Option) error {\n\tfor _, opt := range opts {\n\t\tif err := opt(g); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif g.getWriter == nil {\n\t\treturn errNoGetWriter\n\t}\n\n\tpkg, err := g.generate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tw, err := g.getWriter()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn genutil.WriteYAML(w, pkg)\n}", "func (baseModel *BaseModel) Generate(specificModel AppliedAlgorithm) {\n specificModel.Clear()\n for {\n finished := baseModel.SingleIteration(specificModel)\n if finished {\n return\n }\n }\n}", "func (mfs *MemFS) GoGenerate(pkgName, out, contentEncoding string) (err error) {\n\tif len(pkgName) == 0 {\n\t\tpkgName = \"main\"\n\t}\n\tif len(out) == 0 {\n\t\tout = \"memfs_generate.go\"\n\t}\n\n\ttmpl, err := generateTemplate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, err := os.Create(out)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"memfs: GoGenerate: %w\", err)\n\t}\n\n\tif len(contentEncoding) > 0 {\n\t\terr = mfs.ContentEncode(contentEncoding)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"GoGenerate: %w\", err)\n\t\t}\n\t}\n\n\tnames := mfs.ListNames()\n\n\terr = tmpl.ExecuteTemplate(f, templateNameHeader, pkgName)\n\tif err != nil {\n\t\tgoto fail\n\t}\n\n\tfor x := 0; x < len(names); x++ {\n\t\t// Ignore and delete the file from map if its the output\n\t\t// itself.\n\t\tif strings.HasSuffix(names[x], out) {\n\t\t\tdelete(mfs.pn.v, names[x])\n\t\t\tcontinue\n\t\t}\n\n\t\tnode := mfs.pn.v[names[x]]\n\t\terr = tmpl.ExecuteTemplate(f, templateNameGenerateNode, node)\n\t\tif err != nil {\n\t\t\tgoto fail\n\t\t}\n\t}\n\n\terr = tmpl.ExecuteTemplate(f, templateNamePathFuncs, mfs.pn.v)\n\tif err != nil {\n\t\tgoto fail\n\t}\n\n\terr = f.Sync()\n\tif err != nil {\n\t\tgoto fail\n\t}\n\n\terr = f.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"memfs: GoGenerate: %w\", err)\n\t}\n\n\treturn nil\nfail:\n\t_ = f.Close()\n\treturn fmt.Errorf(\"memfs: GoGenerate: %w\", err)\n}", "func (g Generator) Generate(ctx *genall.GenerationContext) error {\n\tobjs := generateFeatures(ctx)\n\n\tif len(objs) == 0 {\n\t\treturn nil\n\t}\n\tfor _, obj := range objs {\n\t\tif err := ctx.WriteYAML(obj.(corev1alpha2.Feature).Name+\".yaml\", obj); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (g *GenprotoGenerator) Regen(ctx context.Context) error {\n\tlog.Println(\"regenerating genproto\")\n\t// Create space to put generated .pb.go's.\n\tc := execv.Command(\"mkdir\", \"-p\", \"generated\")\n\tc.Dir = g.genprotoDir\n\tif err := c.Run(); err != nil {\n\t\treturn err\n\t}\n\n\t// Get the last processed googleapis hash.\n\tlastHash, err := os.ReadFile(filepath.Join(g.genprotoDir, \"regen.txt\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(noahdietz): In local mode, since it clones a shallow copy with 1 commit,\n\t// if the last regenerated hash is earlier than the top commit, the git diff-tree\n\t// command fails. This is is a bit of a rough edge. Using my local clone of\n\t// googleapis rectified the issue.\n\tpkgFiles, err := g.getUpdatedPackages(string(lastHash))\n\tif err != nil {\n\t\treturn err\n\t}\n\tpkgFiles, err = filterPackages(pkgFiles)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Println(\"generating from protos\")\n\tgrp, _ := errgroup.WithContext(ctx)\n\tfor pkg, fileNames := range pkgFiles {\n\t\tpk := pkg\n\t\tfn := fileNames\n\n\t\tgrp.Go(func() error {\n\t\t\tlog.Println(\"running protoc on\", pk)\n\t\t\treturn g.protoc(fn)\n\t\t})\n\t}\n\tif err := grp.Wait(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.moveAndCleanupGeneratedSrc(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := gocmd.Vet(g.genprotoDir); err != nil {\n\t\treturn err\n\t}\n\n\tif err := gocmd.Build(g.genprotoDir); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (g *Generator) Generate() error {\n\t// first we read the code from which we should find the types\n\tif err := g.readPackageCode(g.options.Source); err != nil {\n\t\treturn err\n\t}\n\n\t// then we generate code for the types given\n\tfor _, rootType := range g.options.Types {\n\t\tif err := g.generateStructCode(rootType); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t//\n\tg.Imports = strings.Join(toolbox.MapKeysToStringSlice(g.imports), \"\\n\")\n\treturn g.writeCode()\n}", "func generate(\n\tkustomization *types.Kustomization, overlay string, quayConfigFiles map[string][]byte,\n) ([]client.Object, error) {\n\tfSys := filesys.MakeEmptyDirInMemory()\n\tif err := filepath.Walk(\n\t\tkustomizeDir(),\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\n\t\t\tif info.IsDir() {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tf, err := os.ReadFile(path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn fSys.WriteFile(path, f)\n\t\t},\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Write `kustomization.yaml` to filesystem\n\tkustomizationFile, err := yaml.Marshal(kustomization)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := fSys.WriteFile(\n\t\tfilepath.Join(appDir(), \"kustomization.yaml\"), kustomizationFile,\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Add all Quay config files to directory to be included in the generated `Secret`\n\tfor fileName, file := range quayConfigFiles {\n\t\tif err := fSys.WriteFile(\n\t\t\tfilepath.Join(appDir(), \"bundle\", fileName), file,\n\t\t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\topts := &krusty.Options{\n\t\tPluginConfig: &types.PluginConfig{},\n\t}\n\tk := krusty.MakeKustomizer(opts)\n\tresMap, err := k.Run(fSys, overlay)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toutput := []client.Object{}\n\tfor _, resource := range resMap.Resources() {\n\t\tresourceJSON, err := resource.MarshalJSON()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tgvk := schema.GroupVersionKind{\n\t\t\tGroup: resource.GetGvk().Group,\n\t\t\tVersion: resource.GetGvk().Version,\n\t\t\tKind: resource.GetGvk().Kind,\n\t\t}\n\n\t\tobj := ModelFor(gvk)\n\t\tif obj == nil {\n\t\t\treturn nil, fmt.Errorf(\"kind not supported: %s\", gvk.Kind)\n\t\t}\n\n\t\tif err := json.Unmarshal(resourceJSON, obj); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\toutput = append(output, obj)\n\t}\n\n\treturn output, nil\n}", "func generate(g *Graph) error {\n\tvar (\n\t\tassets assets\n\t\texternal []GraphTemplate\n\t)\n\ttemplates, external = g.templates()\n\tfor _, n := range g.Nodes {\n\t\tassets.addDir(filepath.Join(g.Config.Target, n.PackageDir()))\n\t\tfor _, tmpl := range Templates {\n\t\t\tb := bytes.NewBuffer(nil)\n\t\t\tif err := templates.ExecuteTemplate(b, tmpl.Name, n); err != nil {\n\t\t\t\treturn fmt.Errorf(\"execute template %q: %w\", tmpl.Name, err)\n\t\t\t}\n\t\t\tassets.add(filepath.Join(g.Config.Target, tmpl.Format(n)), b.Bytes())\n\t\t}\n\t}\n\tfor _, tmpl := range append(GraphTemplates, external...) {\n\t\tif tmpl.Skip != nil && tmpl.Skip(g) {\n\t\t\tcontinue\n\t\t}\n\t\tif dir := filepath.Dir(tmpl.Format); dir != \".\" {\n\t\t\tassets.addDir(filepath.Join(g.Config.Target, dir))\n\t\t}\n\t\tb := bytes.NewBuffer(nil)\n\t\tif err := templates.ExecuteTemplate(b, tmpl.Name, g); err != nil {\n\t\t\treturn fmt.Errorf(\"execute template %q: %w\", tmpl.Name, err)\n\t\t}\n\t\tassets.add(filepath.Join(g.Config.Target, tmpl.Format), b.Bytes())\n\t}\n\tfor _, f := range AllFeatures {\n\t\tif f.cleanup == nil || g.featureEnabled(f) {\n\t\t\tcontinue\n\t\t}\n\t\tif err := f.cleanup(g.Config); err != nil {\n\t\t\treturn fmt.Errorf(\"cleanup %q feature assets: %w\", f.Name, err)\n\t\t}\n\t}\n\t// Write and format assets only if template execution\n\t// finished successfully.\n\tif err := assets.write(); err != nil {\n\t\treturn err\n\t}\n\t// cleanup assets that are not needed anymore.\n\tcleanOldNodes(assets, g.Config.Target)\n\t// We can't run \"imports\" on files when the state is not completed.\n\t// Because, \"goimports\" will drop undefined package. Therefore, it\n\t// is suspended to the end of the writing.\n\treturn assets.format()\n}", "func Generate(dirList ...string) {\n\tvar root = NewEmptyFileTree()\n\tfor _, dir := range dirList {\n\t\ttree := LoadFileTree(dir)\n\t\troot.Children = append(root.Children, tree)\n\t}\n\n\tvar RawFuncList []RawFunc\n\tWalkFileTree(root, &RawFuncList)\n\n\tvar handlers []HandlerFunc\n\tvar middlewares = make(map[string]*MiddlewareFunc)\n\tvar imports = make(map[string]bool)\n\tTraverseRawFuncList(&RawFuncList, &handlers, middlewares, imports)\n\n\tvar ctx GenContext\n\tctx.InitGroupTree(middlewares, &handlers)\n\n\ttplFile := GenTemplate()\n\tfor k, _ := range imports {\n\t\tAddImport(tplFile, k)\n\t}\n\n\tlist := ctx.Root.GenAST()\n\tfileExprListAppend(tplFile, &list)\n\n\texport(tplFile)\n}", "func Generate(destDir string, dbConn DBConnection) (err error) {\n\tdefer utils.ErrorCatch(&err)\n\n\tdb := openConnection(dbConn)\n\tdefer utils.DBClose(db)\n\n\tfmt.Println(\"Retrieving database information...\")\n\t// No schemas in MySQL\n\tdbInfo := metadata.GetSchemaMetaData(db, dbConn.DBName, &mySqlQuerySet{})\n\n\tgenPath := path.Join(destDir, dbConn.DBName)\n\n\ttemplate.GenerateFiles(genPath, dbInfo, mysql.Dialect)\n\n\treturn nil\n}", "func GenerateSupportFiles(packageName, path string) error {\n\n\tpath, _ = filepath.Abs(path)\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\tlog.Fatal(\"file path provided is invalid\")\n\t\treturn err\n\t}\n\n\tprotoPath = path[:strings.LastIndex(path, string(filepath.Separator))]\n\tprotoFileName = path[strings.LastIndex(path, string(filepath.Separator))+1:]\n\n\tlog.Println(\"protoPath:[\", protoPath, \"] protoFileName:[\", protoFileName, \"]\")\n\n\tprotoImpPath = strings.Split(protoFileName, \".\")[0]\n\n\tlog.Println(\"generating pb files\")\n\terr = generatePbFiles()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Println(\"getting proto data\")\n\tpdArr, err := getProtoData(packageName, path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// refactoring streaming methods and unary methods\n\tpdArr = arrangeProtoData(pdArr)\n\n\tlog.Println(\"creating trigger support files\")\n\terr = generateServiceImplFile(pdArr, \"server\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Println(\"creating service support files\")\n\terr = generateServiceImplFile(pdArr, \"client\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Println(\"support files created\")\n\treturn nil\n}", "func Generate(analysis *types.Analysis) {\n\tcreateFolders(analysis.Settings)\n\n\tcorrConditions := correlateConditions(analysis)\n\tcluster(corrConditions, analysis.Settings)\n\tcorrReadouts := correlateReadouts(analysis)\n\tcluster(corrReadouts, analysis.Settings)\n\n\tcreateCorrelationImages(corrConditions, corrReadouts, analysis.Settings)\n\tcreateCytoscapeFiles(corrConditions, corrReadouts, analysis.Settings)\n\twriteTrees(corrConditions, corrReadouts, analysis.Settings)\n\tcreateBaitPreyImages(analysis, corrConditions, corrReadouts)\n\n\tfs.Instance.RemoveAll(filepath.Join(\".\", \"minimap\"))\n}", "func (g *Generator) generate(file *FileDescriptor) {\n\tg.file = g.FileOf(file.FileDescriptorProto)\n\tg.usedPackages = make(map[string]bool)\n\n\tif g.file.index == 0 {\n\t\t// For one file in the package, assert version compatibility.\n\t\tg.P(\"// This is a compile-time assertion to ensure that this generated file\")\n\t\tg.P(\"// is compatible with the proto package it is being compiled against.\")\n\t\tg.P(\"// A compilation error at this line likely means your copy of the\")\n\t\tg.P(\"// proto package needs to be updated.\")\n\t\tg.P(\"const _ = \", g.Pkg[\"proto\"], \".ProtoPackageIsVersion\", generatedCodeVersion, \" // please upgrade the proto package\")\n\t\tg.P()\n\t}\n\n\tfor _, td := range g.file.imp {\n\t\tg.generateImported(td)\n\t}\n\tfor _, desc := range g.file.desc {\n\t\t// Don't generate virtual messages for maps.\n\t\tif desc.GetOptions().GetMapEntry() {\n\t\t\tcontinue\n\t\t}\n\t}\n\tg.generateInitFunction()\n\n\t// Run the plugins before the imports so we know which imports are necessary.\n\tg.runPlugins(file)\n\n\t// Generate header and imports last, though they appear first in the output.\n\trem := g.Buffer\n\tg.Buffer = new(bytes.Buffer)\n\tg.generateHeader()\n\tg.generateImports()\n\tif !g.writeOutput {\n\t\treturn\n\t}\n\tg.Write(rem.Bytes())\n\n\t// Reformat generated code.\n\tfset := token.NewFileSet()\n\traw := g.Bytes()\n\tast, err := parser.ParseFile(fset, \"\", g, parser.ParseComments)\n\tif err != nil {\n\t\t// Print out the bad code with line numbers.\n\t\t// This should never happen in practice, but it can while changing generated code,\n\t\t// so consider this a debugging aid.\n\t\tvar src bytes.Buffer\n\t\ts := bufio.NewScanner(bytes.NewReader(raw))\n\t\tfor line := 1; s.Scan(); line++ {\n\t\t\tfmt.Fprintf(&src, \"%5d\\t%s\\n\", line, s.Bytes())\n\t\t}\n\t\tg.Fail(\"bad Go source code was generated:\", err.Error(), \"\\n\"+src.String())\n\t}\n\tg.Reset()\n\terr = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(g, fset, ast)\n\tif err != nil {\n\t\tg.Fail(\"generated Go source code could not be reformatted:\", err.Error())\n\t}\n}", "func (gc Client) Generate() error {\n\t// helper package\n\tgh := goramlHelper{\n\t\tpackageName: \"goraml\",\n\t\tpackageDir: \"goraml\",\n\t}\n\tif err := gh.generate(gc.TargetDir); err != nil {\n\t\treturn err\n\t}\n\n\t// generate struct\n\tif err := generateAllStructs(gc.apiDef, gc.TargetDir, gc.PackageName); err != nil {\n\t\treturn err\n\t}\n\n\t// libraries\n\tif err := generateLibraries(gc.libraries, gc.TargetDir, gc.libsRootURLs); err != nil {\n\t\treturn err\n\t}\n\n\tif err := gc.generateHelperFile(gc.TargetDir); err != nil {\n\t\treturn err\n\t}\n\n\tif err := gc.generateSecurity(gc.TargetDir); err != nil {\n\t\treturn err\n\t}\n\n\tif err := gc.generateServices(gc.TargetDir); err != nil {\n\t\treturn err\n\t}\n\treturn gc.generateClientFile(gc.TargetDir)\n}", "func generate(c *cli.Context) error {\n\t// load variables from the config file\n\terr := action.Load(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create the docs configuration\n\t//\n\t// https://pkg.go.dev/github.com/go-vela/cli/action/docs?tab=doc#Config\n\td := &docs.Config{\n\t\tAction: internal.ActionGenerate,\n\t\tMarkdown: c.Bool(\"markdown\"),\n\t\tMan: c.Bool(\"man\"),\n\t}\n\n\t// validate docs configuration\n\t//\n\t// https://pkg.go.dev/github.com/go-vela/cli/action/docs?tab=doc#Config.Validate\n\terr = d.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// execute the generate call for the docs configuration\n\t//\n\t// https://pkg.go.dev/github.com/go-vela/cli/action/docs?tab=doc#Config.Generate\n\treturn d.Generate(c.App)\n}", "func (g *GenData) GenFiles(fd *[]FileDefn) error {\n\tvar err error\n\tvar pathIn *util.Path\n\tvar work *util.WorkQueue\n\n\t// Setup the worker queue.\n\twork = util.NewWorkQueue(\n\t\tfunc(a interface{}, cmn interface{}) {\n\t\t\tvar data *TaskData\n\t\t\tvar ok bool\n\n\t\t\tdata, ok = a.(*TaskData)\n\t\t\tif ok {\n\t\t\t\tdata.genFile()\n\t\t\t} else {\n\t\t\t\tpanic(fmt.Sprintf(\"FATAL: Invalid TaskData Type of %T!\", a))\n\t\t\t}\n\t\t},\n\t\tnil,\n\t\t0)\n\n\t// Generate all the files for this phase.\n\tfor _, def := range *fd {\n\n\t\tif !sharedData.Quiet() {\n\t\t\tlog.Println(\"Setting up file:\", def.ModelName, \"generating:\", def.FileName, \"...\")\n\t\t}\n\n\t\t// Create the input model file path.\n\t\tif pathIn, err = g.CreateModelPath(def.ModelName); err != nil {\n\t\t\treturn fmt.Errorf(\"Error: %s: %s\\n\", pathIn.String(), err.Error())\n\t\t}\n\t\tif sharedData.Debug() {\n\t\t\tlog.Println(\"\\t\\tmodelPath=\", pathIn)\n\t\t}\n\n\t\t// Now setup to generate the file pushing the setup info\n\t\t// onto the work queue.\n\t\tif g.SetupFile != nil {\n\t\t\tg.SetupFile(g, def, work)\n\t\t} else {\n\t\t\tpanic(\"FATAL: Missing GenData::SetupFile!\\n\")\n\t\t}\n\t}\n\twork.CloseAndWaitForCompletion()\n\n\treturn err\n}", "func (d *Dir) Generate(cfg *Config) (Document, error) {\n\n\tif err := cfg.check(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"config is improperly formatted\")\n\t}\n\n\tff, err := d.Files(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfiles := Docs{}\n\tfor _, f := range ff {\n\t\tif d, err := f.Generate(cfg); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfiles = append(files, d)\n\t\t}\n\t}\n\treturn files, nil\n}", "func Generate(meltAst comp.Module, ctx *comp.Context) (*token.FileSet, *ast.File, error) {\n\t// b()\n\tf := token.NewFileSet()\n\ta, err := GenerateModule(meltAst, ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn f, a, nil\n}", "func GenORMSetup(db *gorm.DB) {\n\n\t// relative to the models package, swith to ../controlers package\n\tfilename := filepath.Join(OrmPkgGenPath, \"setup.go\")\n\n\t// we should use go generate\n\tlog.Println(\"generating orm setup file : \" + filename)\n\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\t// create the list of structs\n\tvar structs []models.Struct\n\tdb.Find(&structs)\n\n\tLISTOFSTRUCT := \"\\n\"\n\n\tdeleteCalls := \"\"\n\n\tfor idx, _struct := range structs {\n\t\tif idx != 0 {\n\t\t\tLISTOFSTRUCT += \",\\n\"\n\t\t}\n\t\tLISTOFSTRUCT += fmt.Sprintf(\"\\t\\t&%sDB{}\", _struct.Name)\n\n\t\tdeleteCalls += fmt.Sprintf(\"\\tdb.Delete(&%sDB{})\\n\", _struct.Name)\n\n\t\tfmt.Printf(\"\t\torm.LoadDB%s(%ss, db)\\n\", _struct.Name, _struct.Name)\n\t}\n\tres := strings.ReplaceAll(template, \"{{LISTOFSTRUCT}}\", LISTOFSTRUCT)\n\n\tres = strings.ReplaceAll(res, \"{{Deletes}}\", deleteCalls)\n\n\tfmt.Fprintf(f, \"%s\", res)\n\n\tdefer f.Close()\n}", "func GenerateMicroService(plugin *protogen.Plugin, file *protogen.File, svc *protogen.Service, opts *annotations.ServiceOptions) error {\n\tc := NewMicroService(plugin, file, svc, opts)\n\treturn c.render()\n}", "func genPackage(types map[string]pschema.ComplexTypeSpec, resourceTokens []string, includeObjectMetaType bool) (*pschema.Package, error) {\n\tif includeObjectMetaType {\n\t\ttypes[objectMetaToken] = pschema.ComplexTypeSpec{\n\t\t\tObjectTypeSpec: pschema.ObjectTypeSpec{\n\t\t\t\tType: \"object\",\n\t\t\t},\n\t\t}\n\t}\n\n\tresources := map[string]pschema.ResourceSpec{}\n\tfor _, baseRef := range resourceTokens {\n\t\tcomplexTypeSpec := types[baseRef]\n\t\tresources[baseRef] = pschema.ResourceSpec{\n\t\t\tObjectTypeSpec: complexTypeSpec.ObjectTypeSpec,\n\t\t\tInputProperties: complexTypeSpec.Properties,\n\t\t}\n\t}\n\n\tpkgSpec := pschema.PackageSpec{\n\t\tName: DefaultName,\n\t\tVersion: Version,\n\t\tTypes: types,\n\t\tResources: resources,\n\t}\n\n\tpkg, err := pschema.ImportSpec(pkgSpec, nil)\n\tif err != nil {\n\t\treturn &pschema.Package{}, errors.Wrapf(err, \"could not import spec\")\n\t}\n\n\tif includeObjectMetaType {\n\t\tdelete(types, objectMetaToken)\n\t}\n\n\treturn pkg, nil\n}", "func Generate(pkginfo *pkginfo.PkgInfo) {\n\tcmake := cmakefile.Open(pkginfo.Name)\n\tdefer cmake.Close()\n\tfor key, values := range pkginfo.Amalgamate {\n\t\tcmake.Amalgamate(key, values)\n\t}\n\tfor _, funcheck := range pkginfo.FunctionChecks {\n\t\tcmake.CheckFunctionExists(funcheck.Name, funcheck.Define)\n\t}\n\tfor _, symcheck := range pkginfo.SymbolChecks {\n\t\tcmake.CheckSymbolExists(symcheck.Name, symcheck.Header, symcheck.Define)\n\t}\n\tfor _, depname := range pkginfo.Dependencies {\n\t\thandler, ok := deps.All[depname]\n\t\tif !ok {\n\t\t\tlog.Fatalf(\"unknown dependency: %s\", depname)\n\t\t}\n\t\thandler(cmake)\n\t}\n\tcmake.FinalizeCompilerFlags()\n\tfor _, name := range sortedLibraryBuildInfo(pkginfo.Targets.Libraries) {\n\t\tbuildinfo := pkginfo.Targets.Libraries[name]\n\t\tcmake.AddLibrary(\n\t\t\tname, buildinfo.Compile, buildinfo.Link, buildinfo.Install,\n\t\t\tbuildinfo.Headers,\n\t\t)\n\t}\n\tfor _, name := range sortedBuildInfo(pkginfo.Targets.Executables) {\n\t\tbuildinfo := pkginfo.Targets.Executables[name]\n\t\tcmake.AddExecutable(\n\t\t\tname, buildinfo.Compile, buildinfo.Link, buildinfo.Install,\n\t\t)\n\t}\n\tfor _, name := range sortedScriptBuildInfo(pkginfo.Targets.Scripts) {\n\t\tbuildinfo := pkginfo.Targets.Scripts[name]\n\t\tcmake.AddScript(name, buildinfo.Install)\n\t}\n\tfor _, name := range sortedTestInfo(pkginfo.Tests) {\n\t\ttestinfo := pkginfo.Tests[name]\n\t\tcmake.AddTest(name, testinfo.Command)\n\t}\n}", "func main() {\n\tvar svcPath, svcImportPath string\n\tflag.StringVar(&svcPath, \"path\", \"service\",\n\t\t\"The `path` to generate service clients in to.\",\n\t)\n\tflag.StringVar(&svcImportPath, \"svc-import-path\",\n\t\tapi.SDKImportRoot+\"/service\",\n\t\t\"The Go `import path` to generate client to be under.\",\n\t)\n\tvar ignoreUnsupportedAPIs bool\n\tflag.BoolVar(&ignoreUnsupportedAPIs, \"ignore-unsupported-apis\",\n\t\ttrue,\n\t\t\"Ignores API models that use unsupported features\",\n\t)\n\n\tvar strictServiceId bool\n\tflag.BoolVar(&strictServiceId, \"use-service-id\", false, \"enforce strict usage of the serviceId from the model\")\n\n\tflag.Usage = usage\n\tflag.Parse()\n\n\tif len(os.Getenv(\"AWS_SDK_CODEGEN_DEBUG\")) != 0 {\n\t\tapi.LogDebug(os.Stdout)\n\t}\n\n\t// Make sure all paths are based on platform's pathing not Unix\n\tglobs := flag.Args()\n\tfor i, g := range globs {\n\t\tglobs[i] = filepath.FromSlash(g)\n\t}\n\tsvcPath = filepath.FromSlash(svcPath)\n\n\tmodelPaths, err := api.ExpandModelGlobPath(globs...)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"failed to glob file pattern\", err)\n\t\tos.Exit(1)\n\t}\n\tmodelPaths, _ = api.TrimModelServiceVersions(modelPaths)\n\n\tloader := api.Loader{\n\t\tBaseImport: svcImportPath,\n\t\tIgnoreUnsupportedAPIs: ignoreUnsupportedAPIs,\n\t\tStrictServiceId: strictServiceId,\n\t}\n\n\tapis, err := loader.Load(modelPaths)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"failed to load API models\", err)\n\t\tos.Exit(1)\n\t}\n\tif len(apis) == 0 {\n\t\tfmt.Fprintf(os.Stderr, \"expected to load models, but found none\")\n\t\tos.Exit(1)\n\t}\n\n\tif v := os.Getenv(\"SERVICES\"); len(v) != 0 {\n\t\tsvcs := strings.Split(v, \",\")\n\t\tfor pkgName, a := range apis {\n\t\t\tvar found bool\n\t\t\tfor _, include := range svcs {\n\t\t\t\tif a.PackageName() == include {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tdelete(apis, pkgName)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar wg sync.WaitGroup\n\tservicePaths := map[string]struct{}{}\n\tfor _, a := range apis {\n\t\tif _, ok := excludeServices[a.PackageName()]; ok {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Create the output path for the model.\n\t\tpkgDir := filepath.Join(svcPath, a.PackageName())\n\t\tos.MkdirAll(filepath.Join(pkgDir, a.InterfacePackageName()), 0775)\n\n\t\tif _, ok := servicePaths[pkgDir]; ok {\n\t\t\tfmt.Fprintf(os.Stderr,\n\t\t\t\t\"attempted to generate a client into %s twice. Second model package, %v\\n\",\n\t\t\t\tpkgDir, a.PackageName())\n\t\t\tos.Exit(1)\n\t\t}\n\t\tservicePaths[pkgDir] = struct{}{}\n\n\t\tg := &generateInfo{\n\t\t\tAPI: a,\n\t\t\tPackageDir: pkgDir,\n\t\t}\n\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\twriteServiceFiles(g, pkgDir)\n\t\t}()\n\t}\n\n\twg.Wait()\n}", "func Generate(inst cue.InstanceOrValue, c *Config) (*ast.File, error) {\n\tall, err := schemas(c, inst)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttop, err := c.compose(inst, all)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ast.File{Decls: top.Elts}, nil\n}", "func Generate(packageName, srcDir string) error {\n\n\terrFmt := \"generate: %v\\n\"\n\n\tabsPath, err := filepath.Abs(srcDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(errFmt, err)\n\t}\n\n\tfs := vfs.New()\n\n\terr = buildTree(absPath, fs.Children)\n\tif err != nil {\n\t\treturn fmt.Errorf(errFmt, err)\n\t}\n\n\terr = os.MkdirAll(packageName, os.FileMode(0755))\n\tif err != nil {\n\t\treturn fmt.Errorf(errFmt, err)\n\t}\n\n\tspec := vfsSpec{packageName, absPath, fs}\n\n\terr = writeFile(prodTmplStr, \"\", &spec)\n\tif err != nil {\n\t\treturn fmt.Errorf(errFmt, err)\n\t}\n\n\terr = writeFile(devTmplStr, \"dev\", &spec)\n\tif err != nil {\n\t\treturn fmt.Errorf(errFmt, err)\n\t}\n\n\treturn nil\n\n}", "func (meta *BundleMetaData) GenerateMetadata() error {\n\t// Create output directory\n\tif err := os.MkdirAll(meta.BundleDir, projutil.DirMode); err != nil {\n\t\treturn err\n\t}\n\n\t// Create annotation values for both bundle.Dockerfile and annotations.yaml, which should\n\t// hold the same set of values always.\n\tvalues := annotationsValues{\n\t\tBundleDir: meta.BundleDir,\n\t\tPackageName: meta.PackageName,\n\t\tChannels: meta.Channels,\n\t\tDefaultChannel: meta.DefaultChannel,\n\t\tIsScorecardConfigPresent: meta.IsScoreConfigPresent,\n\t}\n\n\tfor k, v := range meta.OtherLabels {\n\t\tvalues.OtherLabels = append(values.OtherLabels, fmt.Sprintf(\"%s=%s\", k, v))\n\t}\n\tsort.Strings(values.OtherLabels)\n\n\t// Write each file\n\tmetadataDir := filepath.Join(meta.BundleDir, defaultMetadataDir)\n\tif err := os.MkdirAll(metadataDir, projutil.DirMode); err != nil {\n\t\treturn err\n\t}\n\n\tdockerfilePath := defaultBundleDockerfilePath\n\t// If migrating from packagemanifests to bundle, bundle.Dockerfile is present\n\t// inside bundleDir, else it's in the project directory. Hence, dockerfile\n\t// should have the path specified with respect to output directory of resulting bundles.\n\t// Remove this, when pkgman-to-bundle migrate command is removed.\n\tif len(meta.PkgmanifestPath) != 0 {\n\t\tdockerfilePath = filepath.Join(filepath.Dir(meta.BundleDir), \"bundle.Dockerfile\")\n\t\tvalues.BundleDir = filepath.Base(meta.BundleDir)\n\t}\n\n\ttemplateMap := map[string]*template.Template{\n\t\tdockerfilePath: dockerfileTemplate,\n\t\tfilepath.Join(metadataDir, \"annotations.yaml\"): annotationsTemplate,\n\t}\n\n\tfor path, tmpl := range templateMap {\n\t\tlog.Info(fmt.Sprintf(\"Creating %s\", path))\n\t\tf, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func() {\n\t\t\tif err := f.Close(); err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t}\n\t\t}()\n\t\tif err = tmpl.Execute(f, values); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tlog.Infof(\"Bundle metadata generated successfully\")\n\treturn nil\n}", "func (g *CodeGenerator) Generate() error {\n\tif len(g.opts.FilePath) == 0 {\n\t\treturn errors.New(\"invalid file path\")\n\t}\n\n\tif len(g.opts.PackageName) == 0 {\n\t\treturn errors.New(\"invalid package name\")\n\t}\n\n\t// generate package\n\tg.P(\"package \", g.opts.PackageName)\n\tg.P()\n\n\t// generate import path\n\tg.P(\"import (\")\n\tfor _, path := range g.opts.ImportPath {\n\t\tg.P(\"\\t\\\"\", path, \"\\\"\")\n\t}\n\tg.P(\")\")\n\tg.P()\n\n\t// generate variables\n\tfor _, v := range g.opts.Variables {\n\t\tvariableLine := fmt.Sprintf(\"var\\t%-15s\\t%-15s\\t//%-15s\", v.name, v.tp, v.comment)\n\t\tg.P(variableLine)\n\t\tg.P()\n\t}\n\n\t// generate structs\n\tfor _, s := range g.opts.Structs {\n\t\t// struct comment\n\t\tif len(s.comment) > 0 {\n\t\t\tg.P(\"// \", s.comment)\n\t\t}\n\n\t\t// struct begin\n\t\tg.P(\"type \", s.name, \" struct {\")\n\n\t\t// struct fields\n\t\tfieldLines := make([]string, s.fieldRaw.Size())\n\t\tit := s.fieldRaw.Iterator()\n\t\tfor it.Next() {\n\t\t\tfieldRaw := it.Value().(*ExcelFieldRaw)\n\n\t\t\t// don't need import\n\t\t\tif !fieldRaw.imp {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfieldLine := fmt.Sprintf(\"\\t%-15s\\t%-20s\\t%-20s\\t//%-10s\", it.Key(), fieldRaw.tp, fieldRaw.tag, fieldRaw.desc)\n\t\t\tfieldLines[fieldRaw.idx] = fieldLine\n\t\t}\n\n\t\t// print struct field in sort\n\t\tfor _, v := range fieldLines {\n\t\t\tif len(v) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tg.P(v)\n\t\t}\n\n\t\t// struct end\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\t// generate functions\n\tfor _, f := range g.opts.Functions {\n\t\t// function comment\n\t\tif len(f.comment) > 0 {\n\t\t\tg.P(\"// \", f.comment)\n\t\t}\n\n\t\t// function receiver\n\t\tvar receiver string\n\t\tif len(f.receiver) > 0 {\n\t\t\treceiver = fmt.Sprintf(\"(e *%s)\", f.receiver)\n\t\t}\n\n\t\t// function parameters\n\t\tparameters := strings.Join(f.parameters, \", \")\n\n\t\t// function begin\n\t\tg.P(\"func \", receiver, \" \", f.name, \"(\", parameters, \") \", f.retType, \" {\")\n\n\t\t// function body\n\t\tg.P(\"\\t\", f.body)\n\n\t\t// function end\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\treturn ioutil.WriteFile(g.opts.FilePath, g.buf.Bytes(), 0666)\n}", "func GenerateSubCommands() []*cobra.Command {\n\n\tvar generateService = &cobra.Command{\n\t\tUse: \"project\",\n\t\tRunE: actionGenerateProject,\n\t}\n\treturn []*cobra.Command{generateService}\n}", "func main() {\n\tvar err error\n\tvar buffer bytes.Buffer\n\n\t// Generate the User struct\n\tuserStruct, userImport, err := Generate(User{})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\t// Generate the UserStatus struct\n\tuserStatus, statusImport, err := Generate(UserStatus{})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\t// Write the package declaration\n\tbuffer.Write([]byte(\"package model\\n\"))\n\n\t// Write the imports\n\tbuffer.Write([]byte(\"import (\\n\"))\n\tfor _, i := range userImport {\n\t\tbuffer.Write([]byte(fmt.Sprintf(`\"%s\"`, i) + \"\\n\"))\n\t}\n\tfor _, i := range statusImport {\n\t\tbuffer.Write([]byte(fmt.Sprintf(`\"%s\"`, i) + \"\\n\"))\n\t}\n\tbuffer.Write([]byte(\")\\n\"))\n\n\t// Wrote the structs\n\tbuffer.Write(userStruct)\n\tbuffer.Write([]byte(\"\\n\\n\"))\n\tbuffer.Write(userStatus)\n\tbuffer.Write([]byte(\"\\n\\n\"))\n\n\t// Format the buffer using go fmt\n\tout, err := format.Source(buffer.Bytes())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\t// Write the file\n\terr = ioutil.WriteFile(\"model.go\", out, 0644)\n\tif err != nil {\n\t\tlog.Println(\"File save error\")\n\t\treturn\n\t}\n}", "func Generate(g *grammar.Grammar, w Writer, opts Options) error {\n\tlang, ok := languages[g.TargetLang]\n\tif !ok {\n\t\treturn fmt.Errorf(\"unsupported language: %s\", g.TargetLang)\n\t}\n\n\ttemplates := lang.templates(g)\n\tfor _, f := range templates {\n\t\ttmpl := template.New(\"main\").Funcs(funcMap).Funcs(extraFuncs(f.name, g))\n\n\t\t// Load shared templates.\n\t\tvar err error\n\t\tif !opts.NoBuiltins {\n\t\t\ttmpl, err = tmpl.Parse(lang.SharedDefs)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error in built-in shared_defs: %v\", err)\n\t\t\t}\n\t\t}\n\t\ttmpl, err = loadOverlay(g.TargetLang+\"_shared\", tmpl, opts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Load templates for the current file.\n\t\tif !opts.NoBuiltins {\n\t\t\ttmpl, err = tmpl.Parse(f.template)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error in built-in %v: %v\", f.name, err)\n\t\t\t}\n\t\t}\n\t\ttmpl, err = loadOverlay(g.TargetLang+\"_\"+f.name, tmpl, opts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// TODO come up with a way to parse this once\n\t\t_, err = tmpl.Parse(g.CustomTemplates)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error in inline template: %v\", err)\n\t\t}\n\n\t\tvar buf strings.Builder\n\t\terr = tmpl.Execute(&buf, g)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error generating %v: %w\", f.name, err)\n\t\t}\n\t\toutName := g.Options.FilenamePrefix + f.name\n\t\tsrc := Format(outName, ExtractImports(buf.String()), opts.Compat)\n\t\tif err := w.Write(outName, src); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func Generate(opts GenerateOptions, queryFiles []codegen.QueryFile) error {\n\tpkgName := opts.GoPkg\n\tif pkgName == \"\" {\n\t\tpkgName = filepath.Base(opts.OutputDir)\n\t}\n\tcaser := casing.NewCaser()\n\tcaser.AddAcronyms(opts.Acronyms)\n\ttemplater := NewTemplater(TemplaterOpts{\n\t\tCaser: caser,\n\t\tResolver: NewTypeResolver(caser, opts.TypeOverrides),\n\t\tPkg: pkgName,\n\t})\n\ttemplatedFiles, err := templater.TemplateAll(queryFiles)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"template all: %w\", err)\n\t}\n\n\t// Order for reproducible results.\n\tsort.Slice(templatedFiles, func(i, j int) bool {\n\t\treturn templatedFiles[i].SourcePath < templatedFiles[j].SourcePath\n\t})\n\n\t// Link each child to the package. Necessary so the leader can define all\n\t// Querier methods.\n\tpkg := TemplatedPackage{Files: templatedFiles}\n\tfor i := range templatedFiles {\n\t\ttemplatedFiles[i].Pkg = pkg\n\t}\n\n\ttmpl, err := parseQueryTemplate()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse generated Go code template: %w\", err)\n\t}\n\temitter := NewEmitter(opts.OutputDir, tmpl)\n\tif err := emitter.EmitAllQueryFiles(templatedFiles); err != nil {\n\t\treturn fmt.Errorf(\"emit generated Go code: %w\", err)\n\t}\n\treturn nil\n}", "func (g *TmplGen) GenerateAllFiles() {\n\t// Initialize the plugins\n\tfor _, p := range plugins {\n\t\tp.Init(&g.Generator)\n\t}\n\t// Generate the output. The generator runs for every file, even the files\n\t// that we don't generate output for, so that we can collate the full list\n\t// of exported symbols to support public imports.\n\tgenFileMap := make(map[*FileDescriptor]bool, len(g.genFiles))\n\tfor _, file := range g.genFiles {\n\t\tgenFileMap[file] = true\n\t}\n\tfor _, file := range g.allFiles {\n\t\tg.Reset()\n\t\tg.annotations = nil\n\t\tg.writeOutput = genFileMap[file]\n\t\tg.generate(file)\n\t\tif !g.writeOutput {\n\t\t\tcontinue\n\t\t}\n\t\tfname := file.goPFileName(g.pathType, g.PName)\n\t\tlog.Println(fname)\n\t\tg.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{\n\t\t\tName: proto.String(fname),\n\t\t\tContent: proto.String(g.String()),\n\t\t})\n\t\tif g.annotateCode {\n\t\t\t// Store the generated code annotations in text, as the protoc plugin protocol requires that\n\t\t\t// strings contain valid UTF-8.\n\t\t\tg.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{\n\t\t\t\tName: proto.String(file.goFileName(g.pathType) + \".meta\"),\n\t\t\t\tContent: proto.String(proto.CompactTextString(&descriptor.GeneratedCodeInfo{Annotation: g.annotations})),\n\t\t\t})\n\t\t}\n\t}\n}", "func (plugs Plugins) Generate(ctx context.Context, args []string) error {\n\topts := struct {\n\t\thelp bool\n\t}{}\n\n\tflags := flag.NewFlagSet(\"bluffalo generate\", flag.ContinueOnError)\n\tflags.BoolVar(&opts.help, \"h\", false, \"print this help\")\n\n\tif err := flags.Parse(args); err != nil {\n\t\treturn err\n\t}\n\n\targs = flags.Args()\n\tif opts.help || len(args) == 0 {\n\t\tsort.Slice(plugs, func(i, j int) bool {\n\t\t\treturn plugs[i].Name() < plugs[j].Name()\n\t\t})\n\n\t\tstderr := cmdx.Stderr(ctx)\n\t\tfor _, p := range plugs {\n\t\t\tif _, ok := p.(Generator); ok {\n\t\t\t\tfmt.Fprintf(stderr, \"%s %s - [%s]\\n\", flags.Name(), p.Name(), p)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\targ := args[0]\n\tif len(args) > 0 {\n\t\targs = args[1:]\n\t}\n\n\tfor _, p := range plugs {\n\t\tf, ok := p.(Generator)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tif p.Name() != arg {\n\t\t\tcontinue\n\t\t}\n\n\t\treturn f.Generate(ctx, args)\n\t}\n\treturn fmt.Errorf(\"unknown generator %s\", arg)\n}", "func (d *docGenerator) generateDocs(api API) error {\n\tdir := api.Configuration().DocsDirectory\n\tif !strings.HasSuffix(dir, \"/\") {\n\t\tdir = dir + \"/\"\n\t}\n\n\tif err := d.mkdir(dir, os.FileMode(0777)); err != nil {\n\t\tapi.Configuration().Logger.Println(err)\n\t\treturn err\n\t}\n\n\thandlers := api.ResourceHandlers()\n\tdocs := map[string][]handlerDoc{}\n\tversions := versions(handlers)\n\n\tfor _, version := range versions {\n\t\tversionDocs := make([]handlerDoc, 0, len(handlers))\n\t\tfor _, handler := range handlers {\n\t\t\tdoc, err := d.generateHandlerDoc(handler, version, dir)\n\t\t\tif err != nil {\n\t\t\t\tapi.Configuration().Logger.Println(err)\n\t\t\t\treturn err\n\t\t\t} else if doc != nil {\n\t\t\t\tversionDocs = append(versionDocs, doc)\n\t\t\t}\n\t\t}\n\n\t\tdocs[version] = versionDocs\n\t}\n\n\tif err := d.generateIndexDocs(docs, versions, dir); err != nil {\n\t\tapi.Configuration().Logger.Println(err)\n\t\treturn err\n\t}\n\n\tapi.Configuration().Debugf(\"Documentation generated in %s\", dir)\n\treturn nil\n}", "func Generate(file File) ([]byte, error) {\n\tcode := jen.NewFilePathName(file.Package.Path, file.Package.Name)\n\n\tcode.HeaderComment(\"//go:build !ignore_autogenerated\\n// +build !ignore_autogenerated\\n\")\n\n\tif file.HeaderText != \"\" {\n\t\tcode.HeaderComment(file.HeaderText)\n\t}\n\n\tcode.HeaderComment(\"Code generated by mga tool. DO NOT EDIT.\")\n\n\tcode.ImportName(\"github.com/go-kit/kit/endpoint\", \"endpoint\")\n\tcode.ImportAlias(\"github.com/sagikazarmark/kitx/endpoint\", \"kitxendpoint\")\n\n\tcode.Comment(\"endpointError identifies an error that should be returned as an endpoint error.\")\n\tcode.Type().Id(\"endpointError\").Interface(\n\t\tjen.Id(\"EndpointError\").Params().Bool(),\n\t)\n\n\tcode.Comment(\"serviceError identifies an error that should be returned as a service error.\")\n\tcode.Type().Id(\"serviceError\").Interface(\n\t\tjen.Id(\"ServiceError\").Params().Bool(),\n\t)\n\n\tfor _, set := range file.EndpointSets {\n\t\tgenerateEndpointSet(code, set)\n\t}\n\n\tvar buf bytes.Buffer\n\n\terr := code.Render(&buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn format.Source(buf.Bytes())\n}", "func generate(proto string, localArgs []string) error {\n\targs := []string{\n\t\t\"--proto_path=.\",\n\t\t\"--proto_path=\" + filepath.Join(base.KratosMod(), \"api\"),\n\t\t\"--proto_path=\" + filepath.Join(base.KratosMod(), \"third_party\"),\n\t\t\"--proto_path=\" + filepath.Join(os.Getenv(\"GOPATH\"), \"src\"),\n\t\t\"--go_out=paths=source_relative:.\",\n\t\t\"--go-grpc_out=paths=source_relative:.\",\n\t\t\"--go-http_out=paths=source_relative:.\",\n\t\t\"--go-errors_out=paths=source_relative:.\",\n\t}\n\t// ts umi为可选项 只在安装 protoc-gen-ts-umi情况下生成\n\tfmt.Println(localArgs)\n\tfor _, v := range localArgs[1:] {\n\t\tif v == \"vendor\" {\n\t\t\targs = append(args, \"--proto_path=./vendor\")\n\t\t} else {\n\t\t\tif err := look(fmt.Sprintf(\"protoc-gen-%s\", v)); err == nil {\n\t\t\t\targs = append(args, fmt.Sprintf(\"--%s_out=paths=source_relative:.\", v))\n\t\t\t} else {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t}\n\t}\n\targs = append(args, proto)\n\tfd := exec.Command(\"protoc\", args...)\n\tfd.Stdout = os.Stdout\n\tfd.Stderr = os.Stderr\n\t//fd.Dir = path\n\tif err := fd.Run(); err != nil {\n\t\tfmt.Printf(\"comand: protoc %s \\n\", strings.Join(args, \" \"))\n\t\treturn err\n\t}\n\tfmt.Printf(\"proto: %s\\n\", proto)\n\tfmt.Printf(\"comand: protoc %s \\n\", strings.Join(args, \" \"))\n\treturn nil\n}", "func main() {\n\tflag.Parse()\n\tconfig := createConfig()\n\twebServices := rest.AggregatedAPIs()\n\tswagger, err := builder.BuildOpenAPISpec(webServices, config)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\tjsonBytes, err := json.MarshalIndent(swagger, \"\", \" \")\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\tif err := ioutil.WriteFile(*outputFile, jsonBytes, 0644); err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n}", "func generateMan(info os.FileInfo, name string) {\n\tcontents, err := ioutil.ReadFile(info.Name())\n\tif err != nil {\n\t\tfmt.Printf(\"Could not read file: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tout := md2man.Render(contents)\n\tif len(out) == 0 {\n\t\tfmt.Println(\"Failed to render\")\n\t\tos.Exit(1)\n\t}\n\tcomplete := filepath.Join(m1Dir, name)\n\tif err := ioutil.WriteFile(complete, out, info.Mode()); err != nil {\n\t\tfmt.Printf(\"Could not write file: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\t// Check duplicates (e.g. lu and list-updates)\n\tname = duplicateName(name)\n\tif name != \"\" {\n\t\tcomplete = filepath.Join(m1Dir, name)\n\t\tif err := ioutil.WriteFile(complete, out, info.Mode()); err != nil {\n\t\t\tfmt.Printf(\"Could not write file: %v\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "func Generate() {\n\treader := strings.NewReader(API)\n\tvar conf = config.Source(reader)\n\tyml, err := config.NewYAML(conf)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tfmt.Println(yml.Name())\n}", "func (self *GoCodeGenerator) Generate(in io.Reader, out io.Writer) error {\n\tfuncMap := template.FuncMap{\n\t\t\"title\": strings.Title,\n\t\t\"fieldType\": self.fieldType,\n\t\t\"val\": self.val,\n\t}\n\tbuff, err := ioutil.ReadAll(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt := template.Must(template.New(\"gen\").Funcs(funcMap).Parse(string(buff)))\n\treturn t.Execute(out, struct {\n\t\tAll []*objectRef\n\t}{\n\t\tAll: self.all,\n\t})\n}", "func (p *servicePlugin) Generate(file *generator.FileDescriptor) {\n\tif !p.getGenericServicesOptions(file) {\n\t\treturn\n\t}\n\tfor _, svc := range file.Service {\n\t\tp.genServiceInterface(file, svc)\n\t\tp.genServiceServer(file, svc)\n\t\tp.genServiceClient(file, svc)\n\t}\n}", "func GenerateCustomBuilders(opts Opts) error {\n\tconf := loader.Config{}\n\tif opts.IsTestFile {\n\t\tconf.ImportWithTests(opts.PkgPath)\n\t} else {\n\t\tconf.Import(opts.PkgPath)\n\t}\n\tprg, err := conf.Load()\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tvar tables types.Object\n\tvar tablesPkg *types.Package\n\n\tpkg := prg.Package(opts.PkgPath)\n\tif opts.IsTestFile {\n\t\ttestPkg := prg.Package(opts.PkgPath + \"_test\")\n\t\ttables, tablesPkg = findTablesDef(opts.TablesStructName, testPkg, pkg)\n\t} else {\n\t\ttables, tablesPkg = findTablesDef(opts.TablesStructName, pkg)\n\t}\n\n\tif tables == nil {\n\t\treturn fmt.Errorf(\"Table definition struct '%s' not found\", opts.TablesStructName)\n\t}\n\n\ttablesT, ok := tables.Type().Underlying().(*types.Struct)\n\tif !ok {\n\t\treturn errors.Wrapf(err, \"%s is not struct\", opts.TablesStructName)\n\t}\n\n\thelpers := make([]*helper, 0, tablesT.NumFields())\n\n\tfor i := 0; i < tablesT.NumFields(); i++ {\n\t\tfld := tablesT.Field(i)\n\n\t\ttableName := fld.Name()\n\n\t\tvar fldT *types.Struct\n\t\tfldVar, ok := fld.Type().(*types.Named)\n\t\tif ok {\n\t\t\tfldT, ok = fldVar.Underlying().(*types.Struct)\n\t\t}\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"%s contains non struct field %s\",\n\t\t\t\topts.TablesStructName,\n\t\t\t\ttableName,\n\t\t\t)\n\t\t}\n\n\t\tmodelPkgName := \"\"\n\t\tmodelPkg := fldVar.Obj().Pkg()\n\t\tif modelPkg.Name() != tablesPkg.Name() {\n\t\t\tmodelPkgName = modelPkg.Name()\n\t\t}\n\n\t\ttableTag, err := parseTableTag(getTag(tablesT.Tag(i), \"goq\"))\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to parse tag of Tables.%s\", tableName)\n\t\t}\n\n\t\thelperName := tableTag.HelperName\n\t\tif helperName == \"\" {\n\t\t\thelperName = util.ColToFld(tableName)\n\t\t}\n\n\t\tmodelName := fldVar.Obj().Name()\n\t\tfields, err := listColumnFields(modelName, fldT)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thelpers = append(helpers, &helper{\n\t\t\tName: helperName,\n\t\t\tTableName: tableName,\n\t\t\tModelPkgName: modelPkgName,\n\t\t\tModelName: modelName,\n\t\t\tFields: fields,\n\t\t})\n\n\t}\n\n\tsrc, err := execTemplate(tablesPkg.Name(), helpers, nil)\n\tif src != nil {\n\t\tfile, err := createOutFile(opts.OutFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer file.Close()\n\t\tfile.Write(src)\n\t}\n\n\treturn err\n}", "func (g *Generator) GenerateServices() error {\n\tif g.ServiceGen == nil || len(g.depfile.ProtoFile.Services) == 0 {\n\t\treturn nil\n\t}\n\n\tfor _, svc := range g.depfile.ProtoFile.CollectServices() {\n\t\terr := g.ServiceGen.GenerateService(g, svc.(*fproto.ServiceElement))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func Generate(conf config.Config, tableName string) (err error) {\n\n\terr = yaml.ReadTables(conf)\n\tif util.ErrorCheck(err) {\n\t\treturn fmt.Errorf(\"Generate failed. Unable to read YAML Tables\")\n\t}\n\n\t// Filter by tableName in the YAML Schema\n\tif tableName != \"*\" {\n\t\ttgtTbl := []table.Table{}\n\n\t\tfor _, tbl := range yaml.Schema {\n\t\t\tif tbl.Name == tableName {\n\t\t\t\ttgtTbl = append(tgtTbl, tbl)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Reduce the YAML schema to the single target table\n\t\tyaml.Schema = tgtTbl\n\t}\n\n\tif len(yaml.Schema) == 0 {\n\t\treturn fmt.Errorf(\"Generate: YAML Table not found: %s\", tableName)\n\t}\n\n\treturn writeTables(conf, yaml.Schema)\n}", "func NewGenerateCommand() *cobra.Command {\n\tconst StdIn = \"-\"\n\n\tvar command = &cobra.Command{\n\t\tUse: \"generate --path=<path> --include-paths=<additional path>:<additional path>\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tvar manifests []unstructured.Unstructured\n\t\t\tvar err error\n\t\t\tvar errs []error\n\n\t\t\tconf := getConfig(cmd)\n\n\t\t\tif conf.path == StdIn {\n\t\t\t\tmanifests, err = readManifestData(cmd.InOrStdin())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfiles, err := listYamlFiles(conf.path)\n\t\t\t\tif len(files) < 1 {\n\t\t\t\t\treturn fmt.Errorf(\"no YAML files were found in %s\", conf.path)\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tmanifests, errs = readFilesAsManifests(files)\n\t\t\t\tif len(errs) != 0 {\n\t\t\t\t\t// TODO: handle multiple errors nicely\n\t\t\t\t\treturn fmt.Errorf(\"could not read YAML files: %s\", errs)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif len(conf.includePaths) > 0 {\n\t\t\t\tvar addManifests []unstructured.Unstructured\n\n\t\t\t\tfor _, path := range conf.includePaths {\n\t\t\t\t\tfiles, err := listYamlFiles(path)\n\t\t\t\t\tif len(files) < 1 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\taddManifests, errs = readFilesAsManifests(files)\n\t\t\t\t\tif len(errs) != 0 {\n\t\t\t\t\t\treturn fmt.Errorf(\"could not read YAML files: %s\", errs)\n\t\t\t\t\t}\n\t\t\t\t\tmanifests = append(manifests, addManifests...)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, manifest := range manifests {\n\n\t\t\t\tif len(manifest.Object) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\toutput, err := yaml.Marshal(manifest.Object)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Errorf(\"could not export %s into YAML: %s\", err)\n\t\t\t\t}\n\n\t\t\t\tfmt.Fprintf(cmd.OutOrStdout(), \"%s---\\n\", string(output))\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn command\n}", "func GenerateSubCommands() []*cobra.Command {\n\n\tvar generaterule = &cobra.Command{\n\t\tUse: \"filestore-rules\",\n\t\tRunE: actionGenerateFilestoreRule,\n\t}\n\n\tvar generateconfig = &cobra.Command{\n\t\tUse: \"filestore-config\",\n\t\tRunE: actionGenerateFilestoreConfig,\n\t}\n\n\treturn []*cobra.Command{generaterule, generateconfig}\n}", "func (b *Bundler) Generate(p *ir.PatientInfo) (*r4pb.Bundle, error) {\n\tif p == nil {\n\t\treturn nil, errors.New(\"cannot generate resources from nil PatientInfo\")\n\t}\n\treturn b.createBundle(p), nil\n}", "func GeneratePlantUMLFiles(master *assembly.MasterTypeCollection, outputFolder string, verbose bool) {\r\n\tif verbose {\r\n\t\tfmt.Println(\"------------------------------------------------------------------------------------------------------------------------------------\")\r\n\t\tfmt.Println(\"------------------------------------------------------------------------------------------------------------------------------------\")\r\n\t}\r\n\r\n\tif verbose {\r\n\t\tfor _, k := range master.GetDataTypeKeys() {\r\n\t\t\tv, _ := master.GetDataType(k)\r\n\t\t\tfmt.Printf(\"%s\\n\", *v)\r\n\t\t}\r\n\r\n\t\tfor _, k := range master.GetScopeKeys() {\r\n\t\t\tv, _ := master.GetScope(k)\r\n\t\t\tfmt.Printf(\"%s\\n\", v)\r\n\t\t}\r\n\t}\r\n\r\n\tscopeUMLBuilderMap := make(map[string]*strings.Builder)\r\n\tscopeNotesBuilderMap := make(map[string]*strings.Builder)\r\n\r\n\t//\r\n\t// generate the scope classes\r\n\t//\r\n\tfor _, scopeName := range master.GetScopeKeys() {\r\n\t\tscope, _ := master.GetScope(scopeName)\r\n\r\n\t\tumlSb := &strings.Builder{}\r\n\t\tscopeUMLBuilderMap[scopeName] = umlSb\r\n\t\tnotesSb := &strings.Builder{}\r\n\t\tscopeNotesBuilderMap[scopeName] = notesSb\r\n\r\n\t\tumlSb.WriteString(\"@startuml\\n\")\r\n\t\tumlSb.WriteString(\"skinparam classAttributeIconSize 0\\n\")\r\n\r\n\t\tumlSb.WriteString(fmt.Sprintf(\"class %s {\\n\", scope.Name))\r\n\r\n\t\tfor _, scopeMethod := range scope.Methods {\r\n\t\t\twriteMethodToStringBuilder(umlSb, scopeMethod, scopeName, \"static\")\r\n\t\t}\r\n\r\n\t\tumlSb.WriteString(\"}\\n\")\r\n\t}\r\n\r\n\t//\r\n\t// generate the data types for each scope\r\n\t//\r\n\r\n\tfor _, k := range master.GetDataTypeKeys() {\r\n\t\tv, _ := master.GetDataType(k)\r\n\r\n\t\tswitch vActual := (*v).(type) {\r\n\t\tcase *types.InterfaceDescriptor:\r\n\t\t\tscopeName := vActual.Package\r\n\t\t\tumlSb, existing := scopeUMLBuilderMap[scopeName]\r\n\t\t\tif !existing {\r\n\t\t\t\tfmt.Printf(\"Skipping UML generation for interface, no scope tracked for '%s\\n\", vActual.GetCannonicalName())\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\r\n\t\t\tumlSb.WriteString(fmt.Sprintf(\"interface \\\"%s\\\" {\\n\", vActual.Name))\r\n\t\t\tfor _, method := range vActual.Methods {\r\n\t\t\t\twriteMethodToStringBuilder(umlSb, method, scopeName, \"abstract\")\r\n\t\t\t}\r\n\r\n\t\t\tumlSb.WriteString(\"}\\n\")\r\n\r\n\t\t\tfor _, promoted := range vActual.PromotedTypes {\r\n\t\t\t\tpromotedName := (*promoted).GetCannonicalName()\r\n\r\n\t\t\t\tif strings.HasPrefix(promotedName, scopeName) {\r\n\t\t\t\t\tpromotedName = (*promoted).GetSimpleName()\r\n\t\t\t\t}\r\n\r\n\t\t\t\tumlSb.WriteString(fmt.Sprintf(\"\\\"%s\\\" <|-- %s\\n\", promotedName, vActual.Name))\r\n\t\t\t}\r\n\t\tcase *types.StructDescriptor:\r\n\t\t\tscopeName := vActual.Package\r\n\r\n\t\t\tif vActual.IsBuiltin() {\r\n\t\t\t\tif verbose {\r\n\t\t\t\t\tfmt.Printf(\"Skipping UML generation for builtin type '%s'\\n\", vActual.Name)\r\n\t\t\t\t}\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\r\n\t\t\tumlSb, existing := scopeUMLBuilderMap[scopeName]\r\n\t\t\tif !existing {\r\n\t\t\t\tif verbose {\r\n\t\t\t\t\tfmt.Printf(\"Skipping UML generation for struct, no scope tracked for '%s'\\n\", vActual.GetCannonicalName())\r\n\t\t\t\t}\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\r\n\t\t\tumlSb.WriteString(fmt.Sprintf(\"class \\\"%s\\\" {\\n\", vActual.Name))\r\n\r\n\t\t\tfor _, attribute := range vActual.Attributes {\r\n\t\t\t\twriteAttributeToStringBuilder(umlSb, attribute, scopeName)\r\n\t\t\t}\r\n\r\n\t\t\tfor _, method := range vActual.Methods {\r\n\t\t\t\twriteMethodToStringBuilder(umlSb, method, scopeName, \"\")\r\n\t\t\t}\r\n\r\n\t\t\tumlSb.WriteString(\"}\\n\")\r\n\t\t\tfor _, promoted := range vActual.PromotedTypes {\r\n\t\t\t\tpromotedName := (*promoted).GetCannonicalName()\r\n\r\n\t\t\t\tif _, _, isLocal := types.IsNameLocalToScope(promotedName, scopeName); isLocal {\r\n\t\t\t\t\tpromotedName = (*promoted).GetSimpleName()\r\n\t\t\t\t}\r\n\r\n\t\t\t\tumlSb.WriteString(fmt.Sprintf(\"\\\"%s\\\" <|-- %s\\n\", promotedName, vActual.Name))\r\n\t\t\t}\r\n\r\n\t\t\tfor _, attribute := range vActual.Attributes {\r\n\t\t\t\tattributeTypeName := attribute.CannonicalTypeName\r\n\r\n\t\t\t\tif resolvedName, extractedPrefix, isLocal := types.IsNameLocalToScope(attributeTypeName, scopeName); isLocal {\r\n\t\t\t\t\tattributeTypeName = resolvedName\r\n\t\t\t\t\tif extractedPrefix == types.ArrayDescriptorMarker {\r\n\t\t\t\t\t\tumlSb.WriteString(fmt.Sprintf(\"\\\"%s\\\" --* %s\\n\", attributeTypeName, vActual.Name))\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tumlSb.WriteString(fmt.Sprintf(\"\\\"%s\\\" -- %s\\n\", attributeTypeName, vActual.Name))\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tcase *types.PointerDescriptor:\r\n\t\t\tif verbose {\r\n\t\t\t\tfmt.Printf(\"Skipping UML generation for '%s'\\n\", vActual.GetCannonicalName())\r\n\t\t\t}\r\n\t\tcase *types.ArrayDescriptor:\r\n\t\t\tif verbose {\r\n\t\t\t\tfmt.Printf(\"Skipping UML generation for '%s'\\n\", vActual.GetCannonicalName())\r\n\t\t\t}\r\n\t\tcase *types.MapDescriptor:\r\n\t\t\tif verbose {\r\n\t\t\t\tfmt.Printf(\"Skipping UML generation for '%s'\\n\", vActual.GetCannonicalName())\r\n\t\t\t}\r\n\t\tcase *types.ChannelDescriptor:\r\n\t\t\tif verbose {\r\n\t\t\t\tfmt.Printf(\"Skipping UML generation for '%s'\\n\", vActual.GetCannonicalName())\r\n\t\t\t}\r\n\t\tcase *types.FunctionDescriptor:\r\n\t\t\tif verbose {\r\n\t\t\t\tfmt.Printf(\"Skipping UML generation for '%s'\\n\", vActual.GetCannonicalName())\r\n\t\t\t}\r\n\t\tcase *types.EllipsisDescriptor:\r\n\t\t\tif verbose {\r\n\t\t\t\tfmt.Printf(\"Skipping UML generation for '%s'\\n\", vActual.GetCannonicalName())\r\n\t\t\t}\r\n\t\tcase *types.AliasedTypeDescriptor:\r\n\t\t\tscopeName := vActual.Package\r\n\t\t\tnotesSb, existing := scopeNotesBuilderMap[scopeName]\r\n\t\t\tif !existing {\r\n\t\t\t\tif verbose {\r\n\t\t\t\t\tfmt.Printf(\"Skipping UML generation for alias, no scope tracked for '%s'\\n\", vActual.GetCannonicalName())\r\n\t\t\t\t}\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\r\n\t\t\tnotesSb.WriteString(vActual.String())\r\n\t\t\tnotesSb.WriteString(\"\\n\")\r\n\r\n\t\tdefault:\r\n\t\t\tif verbose {\r\n\t\t\t\tfmt.Printf(\"skipping UML generation for '%s'\\n\", *v)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//\r\n\t// end the scopes and write the files\r\n\t//\r\n\tfor _, k := range master.GetScopeKeys() {\r\n\t\tumlSb := scopeUMLBuilderMap[k]\r\n\t\tnoteSb := scopeNotesBuilderMap[k]\r\n\r\n\t\tif noteSb.Len() > 0 {\r\n\t\t\tumlSb.WriteString(fmt.Sprintf(\"note as Note%s\\n\", k))\r\n\t\t\tumlSb.WriteString(noteSb.String())\r\n\t\t\tumlSb.WriteString(\"end note\\n\")\r\n\t\t\tumlSb.WriteString(fmt.Sprintf(\"%s .. Note%s\\n\", k, k))\r\n\t\t}\r\n\r\n\t\tumlSb.WriteString(\"@enduml\\n\")\r\n\r\n\t\tfileName := outputFolder + k + \".uml.txt\"\r\n\t\tuml := umlSb.String()\r\n\t\tumlBytes := []byte(uml)\r\n\t\terr := ioutil.WriteFile(fileName, umlBytes, 0644)\r\n\t\tif err != nil {\r\n\t\t\tfmt.Printf(\"ERROR: err while writing to %s\\n\", fileName)\r\n\t\t\tfmt.Println(err)\r\n\t\t} else {\r\n\t\t\tfmt.Printf(\"wrote out %s\\n\", fileName)\r\n\t\t}\r\n\t}\r\n\r\n}", "func Generate(req *plugin.CodeGeneratorRequest, p Plugin, filenameSuffix string) *plugin.CodeGeneratorResponse {\n\tg := New()\n\tg.Request = req\n\tif len(g.Request.FileToGenerate) == 0 {\n\t\tg.Fail(\"no files to generate\")\n\t}\n\n\tg.CommandLineParameters(g.Request.GetParameter())\n\n\tg.WrapTypes()\n\tg.SetPackageNames()\n\tg.BuildTypeNameMap()\n\tg.GeneratePlugin(p)\n\n\tfor i := 0; i < len(g.Response.File); i++ {\n\t\tg.Response.File[i].Name = proto.String(\n\t\t\tstrings.Replace(*g.Response.File[i].Name, \".pb.go\", filenameSuffix, -1),\n\t\t)\n\t}\n\tif err := FormatSource(g.Response); err != nil {\n\t\tg.Error(err)\n\t}\n\treturn g.Response\n}", "func Generate(conf config.Curve, baseDir string, bgen *bavard.BatchGenerator) error {\n\tif conf.Equal(config.BW6_761) || conf.Equal(config.BW6_633) || conf.Equal(config.BLS24_315) {\n\t\treturn nil\n\t}\n\n\tentries := []bavard.Entry{\n\t\t{File: filepath.Join(baseDir, \"e2.go\"), Templates: []string{\"fq2.go.tmpl\"}},\n\t\t{File: filepath.Join(baseDir, \"e6.go\"), Templates: []string{\"fq6.go.tmpl\"}},\n\t\t{File: filepath.Join(baseDir, \"e12.go\"), Templates: []string{\"fq12.go.tmpl\"}},\n\t\t{File: filepath.Join(baseDir, \"e2_amd64.go\"), Templates: []string{\"amd64.fq2.go.tmpl\"}},\n\t\t{File: filepath.Join(baseDir, \"e2_fallback.go\"), Templates: []string{\"fallback.fq2.go.tmpl\"}, BuildTag: \"!amd64\"},\n\t\t{File: filepath.Join(baseDir, \"e2_test.go\"), Templates: []string{\"tests/fq2.go.tmpl\"}},\n\t\t{File: filepath.Join(baseDir, \"e6_test.go\"), Templates: []string{\"tests/fq6.go.tmpl\"}},\n\t\t{File: filepath.Join(baseDir, \"e12_test.go\"), Templates: []string{\"tests/fq12.go.tmpl\"}},\n\t\t{File: filepath.Join(baseDir, \"asm.go\"), Templates: []string{\"asm.go.tmpl\"}, BuildTag: \"!noadx\"},\n\t\t{File: filepath.Join(baseDir, \"asm_noadx.go\"), Templates: []string{\"asm_noadx.go.tmpl\"}, BuildTag: \"noadx\"},\n\t}\n\n\tif err := bgen.Generate(conf, \"fptower\", \"./tower/template/fq12over6over2\", entries...); err != nil {\n\t\treturn err\n\t}\n\n\t{\n\t\t// fq2 assembly\n\t\tfName := filepath.Join(baseDir, \"e2_amd64.s\")\n\t\tf, err := os.Create(fName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif conf.Equal(config.BN254) || conf.Equal(config.BLS12_381) {\n\t\t\t_, _ = io.WriteString(f, \"// +build !amd64_adx\\n\")\n\t\t}\n\t\tFq2Amd64 := amd64.NewFq2Amd64(f, conf.Fp, conf)\n\t\tif err := Fq2Amd64.Generate(true); err != nil {\n\t\t\t_ = f.Close()\n\t\t\treturn err\n\t\t}\n\t\t_ = f.Close()\n\n\t}\n\n\tif conf.Equal(config.BN254) || conf.Equal(config.BLS12_381) {\n\t\t{\n\t\t\t// fq2 assembly\n\t\t\tfName := filepath.Join(baseDir, \"e2_adx_amd64.s\")\n\t\t\tf, err := os.Create(fName)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, _ = io.WriteString(f, \"// +build amd64_adx\\n\")\n\t\t\tFq2Amd64 := amd64.NewFq2Amd64(f, conf.Fp, conf)\n\t\t\tif err := Fq2Amd64.Generate(false); err != nil {\n\t\t\t\t_ = f.Close()\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_ = f.Close()\n\n\t\t}\n\t}\n\n\treturn nil\n\n}", "func (tg *Generate) CreateAll() (err error) {\n\tif tg == nil {\n\t\treturn ErrInvalidTemlateGenerator\n\t}\n\tif tg.Project == \"\" {\n\t\treturn ErrInvalidRoot\n\t}\n\t// Todo write more conditions here\n\n\tfor _, opsData := range tg.Mapping.OpsData {\n\t\t//fmt.Println(opsData)\n\t\tswitch opsData.OpType {\n\t\tcase \"directories\":\n\t\t\tpath := filepath.Join(tg.Project, opsData.Src)\n\t\t\ttg.Output <- \"generating the following directory :\" + path\n\t\t\terr = os.MkdirAll(path, os.ModePerm)\n\t\t\tif err != nil {\n\t\t\t\terrRm := tg.RmDir()\n\t\t\t\tif errRm != nil {\n\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttg.Output <- \"the following directory has been generated :\" + path\n\t\tcase \"static-files\":\n\t\t\tdst := filepath.Join(tg.Project, opsData.Dst)\n\t\t\ttg.Output <- \"generating the following static file :\" + dst\n\t\t\tcontent, err := tg.Mapping.Reader.Read(opsData.Src)\n\t\t\tif err != nil {\n\t\t\t\terrRm := tg.RmDir()\n\t\t\t\tif errRm != nil {\n\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif content != \"\" {\n\t\t\t\tvar li int\n\n\t\t\t\tcos := runtime.GOOS\n\t\t\t\tswitch cos {\n\t\t\t\tcase \"windows\":\n\t\t\t\t\tli = strings.LastIndex(dst, \"\\\\\")\n\t\t\t\tdefault:\n\t\t\t\t\tli = strings.LastIndex(dst, \"/\")\n\t\t\t\t}\n\n\t\t\t\tdirs := dst[0:li]\n\t\t\t\terr = os.MkdirAll(dirs, 0755)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\terr = ioutil.WriteFile(dst, []byte(content), 0644)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttg.Output <- \"The following static file has been generated :\" + dst\n\t\t\t}\n\t\tcase \"multiple-file-templates\":\n\t\t\tmhandler := make(map[string]interface{})\n\t\t\tmhandler[\"Project\"] = tg.Project\n\t\t\tmhandler[\"config\"] = tg\n\t\t\tif opsData.GenForType == \"both\" {\n\t\t\t\tfor _, v := range tg.Models {\n\t\t\t\t\tmhandler[\"Model\"] = v\n\t\t\t\t\tdst := filepath.Join(tg.Project, opsData.Dst)\n\t\t\t\t\ttg.Output <- \"generating template based file :\" + dst\n\t\t\t\t\terr = os.MkdirAll(dst, 0755)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\t// If there is any extension in the opsData that means file to be created with the given extension. Otherwise create a default one with .go\n\t\t\t\t\tif opsData.Ext == \"\" {\n\t\t\t\t\t\tdst = path.Join(tg.Project, opsData.Dst, strings.ToLower(v.Name)+\".go\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If any extension starts with . add the extension as it is.Otherwise add . as a prefix to the opsData.Ext\n\t\t\t\t\t\tif string(strings.Trim(opsData.Ext, \" \")[0]) == \".\" {\n\t\t\t\t\t\t\tdst = path.Join(tg.Project, opsData.Dst, strings.ToLower(v.Name)+opsData.Ext)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdst = path.Join(tg.Project, opsData.Dst, strings.ToLower(v.Name)+\".\"+opsData.Ext)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcontent, err := tg.Mapping.Reader.Read(opsData.Src)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif content != \"\" {\n\t\t\t\t\t\terr := tg.WriteTmplToFile(dst, content, mhandler)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttg.Output <- \"the following templated based file has been generated :\" + dst\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if opsData.GenForType == \"main\" {\n\t\t\t\tfor _, v := range tg.Models {\n\t\t\t\t\tif v.Type == \"main\" {\n\t\t\t\t\t\tmhandler[\"Model\"] = v\n\t\t\t\t\t\tdst := filepath.Join(tg.Project, opsData.Dst)\n\t\t\t\t\t\ttg.Output <- \"generating template based file :\" + dst\n\t\t\t\t\t\terr = os.MkdirAll(dst, 0755)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is any extension in the opsData that means file to be created with the given extension. Otherwise create a default one with .go\n\t\t\t\t\t\tif opsData.Ext == \"\" {\n\t\t\t\t\t\t\tdst = path.Join(tg.Project, opsData.Dst, strings.ToLower(v.Name)+\".go\")\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If any extension starts with . add the extension as it is.Otherwise add . as a prefix to the opsData.Ext\n\t\t\t\t\t\t\tif string(strings.Trim(opsData.Ext, \" \")[0]) == \".\" {\n\t\t\t\t\t\t\t\tdst = path.Join(tg.Project, opsData.Dst, strings.ToLower(v.Name)+opsData.Ext)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdst = path.Join(tg.Project, opsData.Dst, strings.ToLower(v.Name)+\".\"+opsData.Ext)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontent, err := tg.Mapping.Reader.Read(opsData.Src)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif content != \"\" {\n\t\t\t\t\t\t\terr := tg.WriteTmplToFile(dst, content, mhandler)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttg.Output <- \"the following templated based file has been generated :\" + dst\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if opsData.GenForType == \"sub\" {\n\t\t\t\tfor _, v := range tg.Models {\n\t\t\t\t\tif v.Type == \"sub\" {\n\t\t\t\t\t\tmhandler[\"Model\"] = v\n\t\t\t\t\t\tdst := filepath.Join(tg.Project, opsData.Dst)\n\t\t\t\t\t\ttg.Output <- \"generating template based file :\" + dst\n\t\t\t\t\t\terr = os.MkdirAll(dst, 0755)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is any extension in the opsData that means file to be created with the given extension. Otherwise create a default one with .go\n\t\t\t\t\t\tif opsData.Ext == \"\" {\n\t\t\t\t\t\t\tdst = path.Join(tg.Project, opsData.Dst, strings.ToLower(v.Name)+\".go\")\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If any extension starts with . add the extension as it is.Otherwise add . as a prefix to the opsData.Ext\n\t\t\t\t\t\t\tif string(strings.Trim(opsData.Ext, \" \")[0]) == \".\" {\n\t\t\t\t\t\t\t\tdst = path.Join(tg.Project, opsData.Dst, strings.ToLower(v.Name)+opsData.Ext)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdst = path.Join(tg.Project, opsData.Dst, strings.ToLower(v.Name)+\".\"+opsData.Ext)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontent, err := tg.Mapping.Reader.Read(opsData.Src)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif content != \"\" {\n\t\t\t\t\t\t\terr := tg.WriteTmplToFile(dst, content, mhandler)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttg.Output <- \"the following templated based file has been generated :\" + dst\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\tcase \"single-file-templates\":\n\t\t\t// Todo for opsData.Ext if there is an extension\n\t\t\tmhandler := make(map[string]interface{})\n\t\t\tmhandler[\"config\"] = tg\n\t\t\tdst := path.Join(tg.Project, opsData.Dst)\n\t\t\ttg.Output <- \"generating template based contents to the file :\" + dst\n\t\t\tli := strings.LastIndex(dst, \"/\")\n\t\t\tdirs := dst[0:li]\n\t\t\terr = os.MkdirAll(dirs, 0755)\n\t\t\tif err != nil {\n\t\t\t\terrRm := tg.RmDir()\n\t\t\t\tif errRm != nil {\n\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontent, err := tg.Mapping.Reader.Read(opsData.Src)\n\t\t\tif err != nil {\n\t\t\t\terrRm := tg.RmDir()\n\t\t\t\tif errRm != nil {\n\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif content != \"\" {\n\t\t\t\terr := tg.WriteTmplToFile(dst, content, mhandler)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttg.Output <- \"The following templated based file has been generated :\" + dst\n\t\t\t}\n\t\tcase \"exec\":\n\t\t\t// Todo for opsData.Ext if there is an extension\n\t\t\tmhandler := make(map[string]interface{})\n\t\t\tmhandler[\"config\"] = tg\n\t\t\tdst := path.Join(tg.Project, opsData.Dst)\n\t\t\ttg.Output <- \"generating shall based executable files :\" + dst\n\t\t\tli := strings.LastIndex(dst, \"/\")\n\t\t\tdirs := dst[0:li]\n\t\t\terr = os.MkdirAll(dirs, 0755)\n\t\t\tif err != nil {\n\t\t\t\terrRm := tg.RmDir()\n\t\t\t\tif errRm != nil {\n\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontent, err := tg.Mapping.Reader.Read(opsData.Src)\n\t\t\tif err != nil {\n\t\t\t\terrRm := tg.RmDir()\n\t\t\t\tif errRm != nil {\n\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif content != \"\" {\n\t\t\t\terr := tg.WriteTmplToFile(dst, content, mhandler)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrRm := tg.RmDir()\n\t\t\t\t\tif errRm != nil {\n\t\t\t\t\t\treturn errors.New(\"1.\" + err.Error() + \".2.\" + errRm.Error())\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttg.Output <- \"The following shell file has been generated :\" + dst\n\n\t\t\t\terr = os.Chmod(dst, 0700)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ttg.Output <- \"giving read|writeexecute permissions to the file :\" + dst\n\n\t\t\t}\n\t\tdefault:\n\t\t\treturn errors.New(opsData.OpType + \":this type has no implementation\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func main() {\n\tflag.Var(&filenames, \"filename\", \"specified filename those you want to generate, if no filename be set, will parse all files under ($dir)\")\n\tflag.Parse()\n\n\texportDir, _ := filepath.Abs(*generateDir)\n\t*dir, _ = filepath.Abs(*dir)\n\tif *debug {\n\t\tlog.Println(\"fromDir:\", *dir)\n\t\tlog.Println(\"generateFilename:\", *generateFilename)\n\t\tlog.Println(\"exportDir:\", exportDir)\n\t}\n\n\t// set custom funcs\n\t// tools.SetCustomGenTagFunc(CustomGenerateTagFunc)\n\t// tools.SetCustomParseTagFunc(CustomParseTagFunc)\n\n\tif len(filenames) == 0 {\n\t\tfiles, _ := ioutil.ReadDir(*dir)\n\t\tfor _, file := range files {\n\t\t\tif file.IsDir() || !strings.HasSuffix(file.Name(), \".go\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfilenames = append(filenames, file.Name())\n\t\t}\n\t}\n\n\tcfg := &tools.UsageCfg{\n\t\tExportDir: exportDir,\n\t\tExportFilename: *generateFilename,\n\t\tExportPkgName: *generatePkgName,\n\t\tExportStructSuffix: *generateStructSuffix,\n\t\tModelImportPath: *modelImportPath,\n\t\tStructSuffix: *modelStructSuffix,\n\t\tDebug: *debug,\n\t\tFilenames: filenames,\n\t\tDir: *dir,\n\t}\n\n\tif *debug {\n\t\tlog.Println(\"following filenames will be parsed\", filenames)\n\t}\n\n\tif err := tools.ParseAndGenerate(cfg); err != nil {\n\t\tpanic(err)\n\t}\n\n\tprintln(\"done!\")\n}", "func (g *Generator) Fgenerate(w io.Writer) {\n\ttpkg := templateBuilder(\"package\", `package {{ .Package }}{{\"\\n\\n\"}}`)\n\n\ttimp := templateBuilder(\"imports\", `import {{ if eq (len .Imports) 1 }}\"{{ index .Imports 0 }}\"{{else}}(\n{{ range .Imports }}{{\"\\t\"}}\"{{ . }}\"\n{{ end }}){{ end }}{{\"\\n\\n\"}}`)\n\n\tttyp := templateBuilder(\"type\", `type {{ .Opts.Type }} struct{{\"{\"}}\n{{- if gt (len .Deps) 0 -}}{{ \"\\n\" }}\n {{- range .Deps -}}\n {{- \"\\t\" }}{{ .Name }} {{ .Type -}}{{ \"\\n\" }}\n {{- end -}}\n{{- end -}}\n}{{\"\\n\\n\"}}`)\n\n\ttdep := templateBuilder(\"deps\", `{{- $cname := .Opts.Name -}}\n{{- $ctype := .Opts.Type -}}\n{{- range .Deps -}}\nfunc ({{ $cname }} *{{ $ctype }}) New{{ .Name | ucfirst }}() {{ .Type }} {{ .Func }}{{ \"\\n\\n\" }}\nfunc ({{ $cname }} *{{ $ctype }}) {{ .Name | ucfirst }}() {{ .Type }} {\n{{ \"\\t\" }}if {{ $cname }}.{{ .Name | lcfirst }} == nil {\n{{ \"\\t\\t\" }}{{ $cname }}.{{ .Name | lcfirst }} = {{ $cname }}.New{{ .Name | ucfirst }}()\n{{ \"\\t\" }}}\n{{ \"\\t\" }}return {{ $cname }}.{{ .Name | lcfirst }}\n}{{ \"\\n\\n\" }}\n{{- end -}}`)\n\n\terr := tpkg.Execute(w, g.opts)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif len(g.opts.Imports) > 0 {\n\t\terr = timp.Execute(w, g.opts)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tgWithPublicFields := struct {\n\t\tOpts opts\n\t\tDeps []dep\n\t}{\n\t\tg.opts,\n\t\tg.deps,\n\t}\n\n\terr = ttyp.Execute(w, gWithPublicFields)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif len(g.deps) > 0 {\n\t\terr = tdep.Execute(w, gWithPublicFields)\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func (s *Service) Generate(dir, filename string) error {\n\terr := makeDirIfNotExists(dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf, err := os.Create(path.Join(dir, filename))\n\tdefer f.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.generator.Execute(f, s.tmpl)\n}", "func GenerateSubCommands() []*cobra.Command {\n\n\tvar generateUserManagement = &cobra.Command{\n\t\tUse: \"auth-provider [path to config file]\",\n\t\tRunE: actionGenerateUserManagement,\n\t\tAliases: []string{\"auth-providers\"},\n\t\tExample: \"space-cli generate auth-provider config.yaml --project myproject --log-level info\",\n\t}\n\n\treturn []*cobra.Command{generateUserManagement}\n}", "func (*okapiLang) GenerateRules(args language.GenerateArgs) language.GenerateResult {\n\tconfig, valid := args.Config.Exts[okapiName].(Config)\n\tif !valid {\n\t\tlog.Fatalf(\"invalid config: %#v\", args.Config.Exts[okapiName])\n\t}\n\tvar results []RuleResult\n\tif args.File != nil && args.File.Rules != nil && containsLibrary(args.File.Rules) {\n\t\t// results = AmendRules(args, args.File.Rules, Dependencies(args.Dir, args.RegularFiles), *config.library)\n\t} else {\n\t\tresults = generateIfOcaml(args, *config.library)\n\t}\n\t// Poorman's unzip\n\tvar rules []*rule.Rule\n\tvar imports []interface{}\n\tfor _, result := range results {\n\t\trules = append(rules, result.rule)\n\t\timports = append(imports, result.deps)\n\t}\n\treturn language.GenerateResult{\n\t\tGen: rules,\n\t\tEmpty: nil,\n\t\tImports: imports,\n\t}\n}", "func generateBodyStructs(apiDef *raml.APIDefinition, dir, packageName string) error {\n\t// generate\n\tfor _, v := range apiDef.Resources {\n\t\tif err := generateStructsFromResourceBody(\"\", dir, packageName, &v); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func Generate(dir string, varConfName string) {\n\tt, dirPath := gatherVars(dir, varConfName)\n\toutput(t, dirPath)\n}" ]
[ "0.66913444", "0.64157486", "0.61856574", "0.61356175", "0.5997691", "0.589548", "0.57147914", "0.56822777", "0.56303346", "0.5599357", "0.5589933", "0.55740947", "0.5566793", "0.5553001", "0.55090463", "0.5508715", "0.5495265", "0.54901445", "0.5487085", "0.5477915", "0.54352814", "0.54107386", "0.53808415", "0.53748345", "0.533596", "0.53288394", "0.5309424", "0.53075117", "0.52891326", "0.52842444", "0.5276375", "0.52436453", "0.5241689", "0.5231385", "0.5228604", "0.52280027", "0.52167946", "0.5197135", "0.5195845", "0.515559", "0.5129238", "0.50912166", "0.5082226", "0.507459", "0.5067638", "0.50665027", "0.5058799", "0.5052758", "0.504078", "0.5035947", "0.5035558", "0.50193906", "0.5010657", "0.500742", "0.50033695", "0.49998856", "0.49992004", "0.4992752", "0.49893606", "0.49813357", "0.4980251", "0.49726284", "0.4970004", "0.496529", "0.49641046", "0.49622092", "0.49536887", "0.49487722", "0.4947907", "0.49445075", "0.4943662", "0.49388188", "0.49275476", "0.49256897", "0.4911477", "0.49097633", "0.4902586", "0.48996234", "0.48940456", "0.4893853", "0.48938176", "0.48935306", "0.48780435", "0.48721305", "0.4868479", "0.48673907", "0.48672086", "0.4863784", "0.48624963", "0.4860453", "0.4852028", "0.48428935", "0.4827657", "0.48274705", "0.48171806", "0.48122436", "0.48087403", "0.4782019", "0.47706237", "0.47699928" ]
0.8132264
0
ParseSwaggerDependencyTree parses the entire dependency tree of a magma swagger spec file specified by the rootFilepath parameter. The returned value maps between the absolute specified dependency filepath and the parsed struct for the dependency file.
ParseSwaggerDependencyTree парсит всю зависимость дерева магма swagger-спецификации файла, указанного параметром rootFilepath. Возвращаемое значение отображает между абсолютным указанным путем зависимого файла и структурой, разобранной для файла зависимости.
func ParseSwaggerDependencyTree(rootFilepath string, rootDir string) (map[string]MagmaSwaggerSpec, error) { absRootFilepath, err := filepath.Abs(rootFilepath) if err != nil { return nil, fmt.Errorf("root filepath %s is invalid: %w", rootFilepath, err) } targetSpec, err := readSwaggerSpec(absRootFilepath) if err != nil { return nil, err } type mscAndPath struct { MagmaSwaggerSpec path string } // Do a BFS to parse the entire dependency tree of swagger spec files // into structs openedFiles := map[string]bool{absRootFilepath: true} allSpecs := map[string]MagmaSwaggerSpec{} specsToVisit := []mscAndPath{{MagmaSwaggerSpec: targetSpec, path: absRootFilepath}} for len(specsToVisit) > 0 { nextSpec := specsToVisit[0] specsToVisit = specsToVisit[1:] allSpecs[nextSpec.path] = nextSpec.MagmaSwaggerSpec for _, dependencyPath := range nextSpec.MagmaGenMeta.Dependencies { absDependencyPath, err := filepath.Abs(filepath.Join(rootDir, dependencyPath)) if err != nil { return nil, fmt.Errorf("dependency filepath %s is invalid: %w", dependencyPath, err) } if _, alreadyOpened := openedFiles[absDependencyPath]; alreadyOpened { continue } openedFiles[absDependencyPath] = true dependencySpec, err := readSwaggerSpec(absDependencyPath) if err != nil { return nil, fmt.Errorf("failed to read dependency tree of swagger specs: %w", err) } specsToVisit = append( specsToVisit, mscAndPath{ MagmaSwaggerSpec: dependencySpec, path: absDependencyPath, }, ) } } return allSpecs, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Matcher) GeneratorDependencyTree(manifestFilePath string) string {\n\tlog.Debug().Msgf(\"Executing: Generate dependencies.txt\")\n\tmaven, err := exec.LookPath(\"mvn\")\n\tif err != nil {\n\t\tlog.Fatal().Err(err).Msgf(\"Please make sure Maven is installed. Hint: Check same by executing: mvn --version \\n\")\n\t}\n\ttreePath, _ := filepath.Abs(filepath.Join(os.TempDir(), m.DepsTreeFileName()))\n\toutcmd := fmt.Sprintf(\"-DoutputFile=%s\", treePath)\n\tcleanRepo := exec.Command(maven, \"--quiet\", \"clean\", \"-f\", manifestFilePath)\n\tdependencyTree := exec.Command(maven, \"--quiet\", \"org.apache.maven.plugins:maven-dependency-plugin:3.0.2:tree\", \"-f\", manifestFilePath, outcmd, \"-DoutputType=dot\", \"-DappendOutput=true\")\n\tlog.Debug().Msgf(\"Clean Repo Command: %s\", cleanRepo)\n\tlog.Debug().Msgf(\"dependencyTree Command: %s\", dependencyTree)\n\tif err := cleanRepo.Run(); err != nil {\n\t\tlog.Fatal().Err(err).Msgf(err.Error())\n\t}\n\tif err := dependencyTree.Run(); err != nil {\n\t\tlog.Fatal().Err(err).Msgf(err.Error())\n\t}\n\tlog.Debug().Msgf(\"Success: buildDepsTree\")\n\treturn treePath\n}", "func ParseDepFile(content []byte) ([]string, []string) {\n\tcontent = bytes.Replace(content, []byte(\"\\\\\\n\"), nil, -1)\n\tcomponents := bytes.Split(content, []byte(\":\"))\n\tif len(components) != 2 {\n\t\treturn nil, nil\n\t}\n\n\ttargetStrs := bytes.Split(components[0], []byte(\" \"))\n\tdepStrs := bytes.Split(components[1], []byte(\" \"))\n\n\tvar targets, deps []string\n\tfor _, t := range targetStrs {\n\t\tif len(t) > 0 {\n\t\t\ttargets = append(targets, string(t))\n\t\t}\n\t}\n\tfor _, d := range depStrs {\n\t\tif len(d) > 0 {\n\t\t\tdeps = append(deps, string(d))\n\t\t}\n\t}\n\n\treturn targets, deps\n}", "func flattenDepsToRoot(manager gps.SourceManager, deps []Dependency) (map[string]string, error) {\n\tdepMap := make(map[string]string)\n\tfor _, d := range deps {\n\t\troot, err := manager.DeduceProjectRoot(d.ImportPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdepMap[string(root)] = d.Rev\n\t}\n\treturn depMap, nil\n}", "func loadTree(root string) (*importTree, error) {\n\tvar f fileLoaderFunc\n\tswitch ext(root) {\n\tcase \".tf\", \".tf.json\":\n\t\tf = loadFileHcl\n\tdefault:\n\t}\n\n\tif f == nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"%s: unknown configuration format. Use '.tf' or '.tf.json' extension\",\n\t\t\troot)\n\t}\n\n\tc, imps, err := f(root)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tchildren := make([]*importTree, len(imps))\n\tfor i, imp := range imps {\n\t\tt, err := loadTree(imp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tchildren[i] = t\n\t}\n\n\treturn &importTree{\n\t\tPath: root,\n\t\tRaw: c,\n\t\tChildren: children,\n\t}, nil\n}", "func dependencyCache(chartdir string) (map[string]*chart.Chartfile, error) {\n\tcache := map[string]*chart.Chartfile{}\n\tdir, err := os.Open(chartdir)\n\tif err != nil {\n\t\treturn cache, err\n\t}\n\tdefer dir.Close()\n\n\tfis, err := dir.Readdir(0)\n\tif err != nil {\n\t\treturn cache, err\n\t}\n\n\tfor _, fi := range fis {\n\t\tif !fi.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tcf, err := chart.LoadChartfile(filepath.Join(chartdir, fi.Name(), \"Chart.yaml\"))\n\t\tif err != nil {\n\t\t\t// If the chartfile does not load, we ignore it.\n\t\t\tcontinue\n\t\t}\n\n\t\tcache[fi.Name()] = cf\n\t}\n\treturn cache, nil\n}", "func (w *RootWalker) DeserializeFromRef(ref skyobject.Reference, p interface{}) error {\n\tif w.r == nil {\n\t\treturn ErrRootNotFound\n\t}\n\tdata, got := w.r.Get(ref)\n\tif !got {\n\t\treturn ErrObjNotFound\n\t}\n\treturn encoder.DeserializeRaw(data, p)\n}", "func Parse(dir string) ([]*cfg.Dependency, error) {\n\tpath := filepath.Join(dir, \"Godeps/Godeps.json\")\n\tif _, err := os.Stat(path); err != nil {\n\t\treturn []*cfg.Dependency{}, nil\n\t}\n\tmsg.Info(\"Found Godeps.json file in %s\", gpath.StripBasepath(dir))\n\tmsg.Info(\"--> Parsing Godeps metadata...\")\n\n\tbuf := []*cfg.Dependency{}\n\n\tgodeps := &Godeps{}\n\n\t// Get a handle to the file.\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn buf, err\n\t}\n\tdefer file.Close()\n\n\tdec := json.NewDecoder(file)\n\tif err := dec.Decode(godeps); err != nil {\n\t\treturn buf, err\n\t}\n\n\tseen := map[string]bool{}\n\tfor _, d := range godeps.Deps {\n\t\tpkg, _ := util.NormalizeName(d.ImportPath)\n\t\tif !seen[pkg] {\n\t\t\tseen[pkg] = true\n\t\t\tdep := &cfg.Dependency{Name: pkg, Version: d.Rev}\n\t\t\tbuf = append(buf, dep)\n\t\t}\n\t}\n\n\treturn buf, nil\n}", "func parseGoListOutput(output, rootVersion string) (map[string]Module, error) {\n\tdependencies := map[string]Module{}\n\tdecoder := json.NewDecoder(strings.NewReader(output))\n\n\tfor {\n\t\tvar module jsonModule\n\t\tif err := decoder.Decode(&module); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Stash original name before applying replacement\n\t\timportPath := module.Name\n\n\t\t// If there's a replace directive, use that module instead\n\t\tif module.Replace != nil {\n\t\t\tmodule = *module.Replace\n\t\t}\n\n\t\t// Local file paths and root modules\n\t\tif module.Version == \"\" {\n\t\t\tmodule.Version = rootVersion\n\t\t}\n\n\t\tdependencies[importPath] = Module{\n\t\t\tName: module.Name,\n\t\t\tVersion: cleanVersion(module.Version),\n\t\t}\n\t}\n\n\treturn dependencies, nil\n}", "func ParsePackageJSON(rawFile []byte) map[string]string {\n\tv, _ := jason.NewObjectFromBytes(rawFile)\n\n\tdevDependecies, _ := v.GetObject(\"devDependencies\")\n\tdeps, _ := v.GetObject(\"dependencies\")\n\n\tversions := map[string]string{}\n\tassignVersionsFromDeps(devDependecies, versions)\n\tassignVersionsFromDeps(deps, versions)\n\n\treturn versions\n}", "func Parse(r io.ReadSeeker, pkgpath string) (*Package, error)", "func Decompose(root string) ([]byte, error) {\n\tm := make(map[string]interface{})\n\n\t// TODO: actually support arbitrary depths :)\n\t// TODO: yaml support would be nice as well\n\n\terr := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbase, err := filepath.Rel(root, path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !info.Mode().IsRegular() {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !strings.HasSuffix(path, \".json\") {\n\t\t\treturn nil\n\t\t}\n\n\t\tf, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar v map[string]interface{}\n\t\tif err := json.NewDecoder(f).Decode(&v); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tname := strings.Replace(base, \".json\", \"\", -1)\n\n\t\tif \"index\" == name {\n\t\t\tfor k, v := range v {\n\t\t\t\tm[k] = v\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tm[name] = v\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn json.MarshalIndent(m, \"\", \" \")\n}", "func (p *Parser) Parse(r dio.ReadSeekerAt) ([]types.Library, []types.Dependency, error) {\n\tinfo, err := buildinfo.Read(r)\n\tif err != nil {\n\t\treturn nil, nil, convertError(err)\n\t}\n\n\tlibs := make([]types.Library, 0, len(info.Deps))\n\n\tfor _, dep := range info.Deps {\n\t\t// binaries with old go version may incorrectly add module in Deps\n\t\t// In this case Path == \"\", Version == \"Devel\"\n\t\t// we need to skip this\n\t\tif dep.Path == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tmod := dep\n\t\tif dep.Replace != nil {\n\t\t\tmod = dep.Replace\n\t\t}\n\n\t\tlibs = append(libs, types.Library{\n\t\t\tName: mod.Path,\n\t\t\tVersion: mod.Version,\n\t\t})\n\t}\n\n\treturn libs, nil, nil\n}", "func getDependenciesForModule(module *TerraformModule, moduleMap map[string]*TerraformModule, terragruntConfigPaths []string) ([]*TerraformModule, error) {\n\tdependencies := []*TerraformModule{}\n\n\tif module.Config.Dependencies == nil || len(module.Config.Dependencies.Paths) == 0 {\n\t\treturn dependencies, nil\n\t}\n\n\tfor _, dependencyPath := range module.Config.Dependencies.Paths {\n\t\tdependencyModulePath, err := util.CanonicalPath(dependencyPath, module.Path)\n\t\tif err != nil {\n\t\t\treturn dependencies, nil\n\t\t}\n\n\t\tdependencyModule, foundModule := moduleMap[dependencyModulePath]\n\t\tif !foundModule {\n\t\t\terr := UnrecognizedDependency{\n\t\t\t\tModulePath: module.Path,\n\t\t\t\tDependencyPath: dependencyPath,\n\t\t\t\tTerragruntConfigPaths: terragruntConfigPaths,\n\t\t\t}\n\t\t\treturn dependencies, errors.WithStackTrace(err)\n\t\t}\n\t\tdependencies = append(dependencies, dependencyModule)\n\t}\n\n\treturn dependencies, nil\n}", "func ParseFile(path string) ([]*StructData, error) {\n\tfset := token.NewFileSet()\n\tfileNode, err := parser.ParseFile(fset, path, nil, parser.ParseComments)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error parsing file %v: %v\", path, err)\n\t}\n\n\tvar res []*StructData\n\n\tfor _, decl := range fileNode.Decls {\n\t\tgd, ok := decl.(*ast.GenDecl)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, spec := range gd.Specs {\n\t\t\tts, ok := spec.(*ast.TypeSpec)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// magic comment may be attached to \"type Foo struct\" (TypeSpec)\n\t\t\t// or to \"type (\" (GenDecl)\n\t\t\tdoc := ts.Doc\n\t\t\tif doc == nil && len(gd.Specs) == 1 {\n\t\t\t\tdoc = gd.Doc\n\t\t\t}\n\t\t\tif doc == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\targs, ok := magicYagoCommentArgs(doc.Text())\n\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttablename := ToDBName(ts.Name.Name)\n\n\t\t\tif args.TableName != \"\" {\n\t\t\t\ttablename = args.TableName\n\t\t\t}\n\n\t\t\tstr, ok := ts.Type.(*ast.StructType)\n\t\t\tif !ok || str.Incomplete {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tsd, err := parseStructTypeSpecs(ts, str, args.AutoAttrs)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tsd.NoTable = args.NoTable\n\t\t\tif !sd.NoTable {\n\t\t\t\tsd.TableName = tablename\n\t\t\t}\n\t\t\tres = append(res, sd)\n\t\t}\n\t}\n\n\treturn res, nil\n}", "func TestFindMapPaths(t *testing.T) {\n\tms := compileModules(t, map[string]string{\n\t\t\"a-module\": `\n\t\t\tmodule a-module {\n\t\t\t\tprefix \"m\";\n\t\t\t\tnamespace \"urn:m\";\n\n\t\t\t\tcontainer a-container {\n\t\t\t\t\tleaf field-a {\n\t\t\t\t\t\ttype string;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcontainer b-container {\n\t\t\t\t\tcontainer config {\n\t\t\t\t\t\tleaf field-b {\n\t\t\t\t\t\t\ttype string;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcontainer state {\n\t\t\t\t\t\tleaf field-b {\n\t\t\t\t\t\t\ttype string;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcontainer c-container {\n\t\t\t\t\t\tleaf field-d {\n\t\t\t\t\t\t\ttype string;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t`,\n\t\t\"d-module\": `\n\t\t\tmodule d-module {\n\t\t\t\tprefix \"n\";\n\t\t\t\tnamespace \"urn:n\";\n\n\t\t\t\timport a-module { prefix \"a\"; }\n\n\t\t\t\taugment \"/a:b-container/config\" {\n\t\t\t\t\tleaf field-c { type string; }\n\t\t\t\t}\n\n\t\t\t\taugment \"/a:b-container/state\" {\n\t\t\t\t\tleaf field-c { type string; }\n\t\t\t\t}\n\n\t\t\t\tcontainer d-container {\n\t\t\t\t\tlist d-list {\n\t\t\t\t\t\tkey d-key;\n\n\t\t\t\t\t\tleaf d-key {\n\t\t\t\t\t\t\ttype leafref {\n\t\t\t\t\t\t\t\tpath \"../config/d-key\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontainer config {\n\t\t\t\t\t\t\tleaf d-key {\n\t\t\t\t\t\t\t\ttype string;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontainer state {\n\t\t\t\t\t\t\tleaf d-key {\n\t\t\t\t\t\t\t\ttype string;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t`,\n\t})\n\n\ttests := []struct {\n\t\tname string\n\t\tinStruct *Directory\n\t\tinField string\n\t\tinCompressPaths bool\n\t\tinShadowSchemaPaths bool\n\t\tinAbsolutePaths bool\n\t\twantPaths [][]string\n\t\twantModules [][]string\n\t\twantErr bool\n\t}{{\n\t\tname: \"first-level container with path compression off\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"AContainer\",\n\t\t\tPath: []string{\"\", \"a-module\", \"a-container\"},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"field-a\": findEntry(t, ms, \"a-module\", \"a-container/field-a\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"field-a\",\n\t\twantPaths: [][]string{{\"field-a\"}},\n\t\twantModules: [][]string{{\"a-module\"}},\n\t}, {\n\t\tname: \"invalid parent path - shorter than directory path\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"AContainer\",\n\t\t\tPath: []string{\"\", \"a-module\", \"a-container\"},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"field-a\": findEntry(t, ms, \"a-module\", \"a-container\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"field-a\",\n\t\twantErr: true,\n\t}, {\n\t\tname: \"first-level container with path compression on\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"BContainer\",\n\t\t\tPath: []string{\"\", \"a-module\", \"b-container\"},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"field-b\": findEntry(t, ms, \"a-module\", \"b-container/config/field-b\"),\n\t\t\t},\n\t\t\tShadowedFields: map[string]*yang.Entry{\n\t\t\t\t\"field-b\": findEntry(t, ms, \"a-module\", \"b-container/state/field-b\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"field-b\",\n\t\tinCompressPaths: true,\n\t\twantPaths: [][]string{{\"config\", \"field-b\"}},\n\t\twantModules: [][]string{{\"a-module\", \"a-module\"}},\n\t}, {\n\t\tname: \"first-level container with path compression on and ignoreShadowSchemaPaths on\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"BContainer\",\n\t\t\tPath: []string{\"\", \"a-module\", \"b-container\"},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"field-b\": findEntry(t, ms, \"a-module\", \"b-container/config/field-b\"),\n\t\t\t},\n\t\t\tShadowedFields: map[string]*yang.Entry{\n\t\t\t\t\"field-b\": findEntry(t, ms, \"a-module\", \"b-container/state/field-b\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"field-b\",\n\t\tinCompressPaths: true,\n\t\tinShadowSchemaPaths: true,\n\t\twantPaths: [][]string{{\"state\", \"field-b\"}},\n\t\twantModules: [][]string{{\"a-module\", \"a-module\"}},\n\t}, {\n\t\tname: \"augmented first-level container with path compression on\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"BContainer\",\n\t\t\tPath: []string{\"\", \"a-module\", \"b-container\"},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"field-c\": findEntry(t, ms, \"a-module\", \"b-container/config/field-c\"),\n\t\t\t},\n\t\t\tShadowedFields: map[string]*yang.Entry{\n\t\t\t\t\"field-c\": findEntry(t, ms, \"a-module\", \"b-container/state/field-c\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"field-c\",\n\t\tinCompressPaths: true,\n\t\twantPaths: [][]string{{\"config\", \"field-c\"}},\n\t\twantModules: [][]string{{\"a-module\", \"d-module\"}},\n\t}, {\n\t\tname: \"augmented first-level container with inShadowSchemaPaths=true\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"BContainer\",\n\t\t\tPath: []string{\"\", \"a-module\", \"b-container\"},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"field-c\": findEntry(t, ms, \"a-module\", \"b-container/config/field-c\"),\n\t\t\t},\n\t\t\tShadowedFields: map[string]*yang.Entry{\n\t\t\t\t\"field-c\": findEntry(t, ms, \"a-module\", \"b-container/state/field-c\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"field-c\",\n\t\tinCompressPaths: true,\n\t\tinShadowSchemaPaths: true,\n\t\twantPaths: [][]string{{\"state\", \"field-c\"}},\n\t\twantModules: [][]string{{\"a-module\", \"d-module\"}},\n\t}, {\n\t\tname: \"container with absolute paths on\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"BContainer\",\n\t\t\tPath: []string{\"\", \"a-module\", \"b-container\", \"c-container\"},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"field-d\": findEntry(t, ms, \"a-module\", \"b-container/c-container/field-d\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"field-d\",\n\t\tinAbsolutePaths: true,\n\t\twantPaths: [][]string{{\"\", \"b-container\", \"c-container\", \"field-d\"}},\n\t\twantModules: [][]string{{\"\", \"a-module\", \"a-module\", \"a-module\"}},\n\t}, {\n\t\tname: \"top-level module\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"CContainer\",\n\t\t\tPath: []string{\"\"},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"top\": findEntry(t, ms, \"a-module\", \"\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"top\",\n\t\twantPaths: [][]string{{\"a-module\"}},\n\t\twantModules: [][]string{{\"a-module\"}},\n\t}, {\n\t\tname: \"list with leafref key\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"DList\",\n\t\t\tPath: []string{\"\", \"d-module\", \"d-container\", \"d-list\"},\n\t\t\tListAttr: &YangListAttr{\n\t\t\t\tKeyElems: []*yang.Entry{\n\t\t\t\t\tfindEntry(t, ms, \"d-module\", \"d-container/d-list/config/d-key\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"d-key\": findEntry(t, ms, \"d-module\", \"d-container/d-list/config/d-key\"),\n\t\t\t},\n\t\t\tShadowedFields: map[string]*yang.Entry{\n\t\t\t\t\"d-key\": findEntry(t, ms, \"d-module\", \"d-container/d-list/state/d-key\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"d-key\",\n\t\tinCompressPaths: true,\n\t\twantPaths: [][]string{\n\t\t\t{\"config\", \"d-key\"},\n\t\t\t{\"d-key\"},\n\t\t},\n\t\twantModules: [][]string{\n\t\t\t{\"d-module\", \"d-module\"},\n\t\t\t{\"d-module\"},\n\t\t},\n\t}, {\n\t\tname: \"list with leafref key with shadowSchemaPaths=true\",\n\t\tinStruct: &Directory{\n\t\t\tName: \"DList\",\n\t\t\tPath: []string{\"\", \"d-module\", \"d-container\", \"d-list\"},\n\t\t\tListAttr: &YangListAttr{\n\t\t\t\tKeyElems: []*yang.Entry{\n\t\t\t\t\tfindEntry(t, ms, \"d-module\", \"d-container/d-list/config/d-key\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"d-key\": findEntry(t, ms, \"d-module\", \"d-container/d-list/config/d-key\"),\n\t\t\t},\n\t\t\tShadowedFields: map[string]*yang.Entry{\n\t\t\t\t\"d-key\": findEntry(t, ms, \"d-module\", \"d-container/d-list/state/d-key\"),\n\t\t\t},\n\t\t},\n\t\tinField: \"d-key\",\n\t\tinCompressPaths: true,\n\t\tinShadowSchemaPaths: true,\n\t\twantPaths: [][]string{\n\t\t\t{\"state\", \"d-key\"},\n\t\t\t{\"d-key\"},\n\t\t},\n\t\twantModules: [][]string{\n\t\t\t{\"d-module\", \"d-module\"},\n\t\t\t{\"d-module\"},\n\t\t},\n\t}}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tgotPaths, gotModules, err := findMapPaths(tt.inStruct, tt.inField, tt.inCompressPaths, tt.inShadowSchemaPaths, tt.inAbsolutePaths)\n\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"%s: YANGCodeGenerator.findMapPaths(%v, %v): compress: %v, shadowSchemaPaths: %v, wantErr: %v, gotPaths error: %v\",\n\t\t\t\t\ttt.name, tt.inStruct, tt.inField, tt.inCompressPaths, tt.inShadowSchemaPaths, tt.wantErr, err)\n\t\t\t}\n\t\t\tif tt.wantErr {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif diff := cmp.Diff(tt.wantPaths, gotPaths); diff != \"\" {\n\t\t\t\tt.Errorf(\"%s: YANGCodeGenerator.findMapPaths(%v, %v): compress: %v, shadowSchemaPaths: %v, (-want, +gotPaths):\\n%s\", tt.name, tt.inStruct, tt.inField, tt.inCompressPaths, tt.inShadowSchemaPaths, diff)\n\t\t\t}\n\n\t\t\tif diff := cmp.Diff(tt.wantModules, gotModules); diff != \"\" {\n\t\t\t\tt.Errorf(\"%s: YANGCodeGenerator.findMapPaths(%v, %v): compress: %v, shadowSchemaPaths: %v, (-want, +gotModules):\\n%s\", tt.name, tt.inStruct, tt.inField, tt.inCompressPaths, tt.inShadowSchemaPaths, diff)\n\t\t\t}\n\t\t})\n\t}\n}", "func guessDeps(base string, skipImport bool) *cfg.Config {\n\tbuildContext, err := util.GetBuildContext()\n\tif err != nil {\n\t\tmsg.Die(\"Failed to build an import context: %s\", err)\n\t}\n\tname := buildContext.PackageName(base)\n\n\n\tmsg.Info(\"Generating a YAML configuration file and guessing the dependencies\")\n\n\tconfig := new(cfg.Config)\n\n\t// Get the name of the top level package\n\tconfig.Name = name\n\n\t// Import by looking at other package managers and looking over the\n\t// entire directory structure.\n\n\t// Attempt to import from other package managers.\n\tif !skipImport {\n\t\tguessImportDeps(base, config)\n\t}\n\n\timportLen := len(config.Imports)\n\tif importLen == 0 {\n\t\tmsg.Info(\"Scanning code to look for dependencies\")\n\t} else {\n\t\tmsg.Info(\"Scanning code to look for dependencies not found in import\")\n\t}\n\n\t// 返回依赖解析器\n\tr, err := dependency.NewResolver(base)\n\n\n\tif err != nil {\n\t\tmsg.Die(\"Error creating a dependency resolver: %s\", err)\n\t}\n\n\t// 初始化以测试模式\n\tr.ResolveTest = true\n\n\th := &dependency.DefaultMissingPackageHandler{Missing: []string{}, Gopath: []string{}}\n\tr.Handler = h\n\n\tsortable, testSortable, err := r.ResolveLocal(false)\n\tif err != nil {\n\t\tmsg.Die(\"分析本地依赖失败: %s\", err)\n\t}\n\n\tsort.Strings(sortable)\n\tsort.Strings(testSortable)\n\n\tvpath := r.VendorDir\n\tif !strings.HasSuffix(vpath, \"/\") {\n\t\tvpath = vpath + string(os.PathSeparator)\n\t}\n\n\tfor _, pa := range sortable {\n\t\tn := strings.TrimPrefix(pa, vpath)\n\t\troot, subpkg := util.NormalizeName(n)\n\n\t\tif !config.Imports.Has(root) && root != config.Name {\n\t\t\tmsg.Info(\"--> Found reference to %s\\n\", n)\n\t\t\td := &cfg.Dependency{\n\t\t\t\tName: root,\n\t\t\t}\n\t\t\tif len(subpkg) > 0 {\n\t\t\t\td.Subpackages = []string{subpkg}\n\t\t\t}\n\t\t\tconfig.Imports = append(config.Imports, d)\n\t\t} else if config.Imports.Has(root) {\n\t\t\tif len(subpkg) > 0 {\n\t\t\t\tsubpkg = strings.TrimPrefix(subpkg, \"/\")\n\t\t\t\td := config.Imports.Get(root)\n\t\t\t\tif !d.HasSubpackage(subpkg) {\n\t\t\t\t\tmsg.Info(\"--> Adding sub-package %s to %s\\n\", subpkg, root)\n\t\t\t\t\td.Subpackages = append(d.Subpackages, subpkg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, pa := range testSortable {\n\t\tn := strings.TrimPrefix(pa, vpath)\n\t\troot, subpkg := util.NormalizeName(n)\n\n\t\tif config.Imports.Has(root) && root != config.Name {\n\t\t\tmsg.Debug(\"--> Found test reference to %s already listed as an import\", n)\n\t\t} else if !config.DevImports.Has(root) && root != config.Name {\n\t\t\tmsg.Info(\"--> Found test reference to %s\", n)\n\t\t\td := &cfg.Dependency{\n\t\t\t\tName: root,\n\t\t\t}\n\t\t\tif len(subpkg) > 0 {\n\t\t\t\td.Subpackages = []string{subpkg}\n\t\t\t}\n\t\t\tconfig.DevImports = append(config.DevImports, d)\n\t\t} else if config.DevImports.Has(root) {\n\t\t\tif len(subpkg) > 0 {\n\t\t\t\tsubpkg = strings.TrimPrefix(subpkg, \"/\")\n\t\t\t\td := config.DevImports.Get(root)\n\t\t\t\tif !d.HasSubpackage(subpkg) {\n\t\t\t\t\tmsg.Info(\"--> Adding test sub-package %s to %s\\n\", subpkg, root)\n\t\t\t\t\td.Subpackages = append(d.Subpackages, subpkg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(config.Imports) == importLen && importLen != 0 {\n\t\tmsg.Info(\"--> Code scanning found no additional imports\")\n\t}\n\n\treturn config\n}", "func GuessDeps(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) {\n\tbuildContext, err := util.GetBuildContext()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := p.Get(\"dirname\", \".\").(string)\n\tskipImport := p.Get(\"skipImport\", false).(bool)\n\tname := guessPackageName(buildContext, base)\n\n\tInfo(\"Generating a YAML configuration file and guessing the dependencies\")\n\n\tconfig := new(cfg.Config)\n\n\t// Get the name of the top level package\n\tconfig.Name = name\n\n\t// Import by looking at other package managers and looking over the\n\t// entire directory structure.\n\n\t// Attempt to import from other package managers.\n\tif !skipImport {\n\t\tInfo(\"Attempting to import from other package managers (use --skip-import to skip)\")\n\t\tdeps := []*cfg.Dependency{}\n\t\tabsBase, err := filepath.Abs(base)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif d, ok := guessImportGodep(absBase); ok {\n\t\t\tInfo(\"Importing Godep configuration\")\n\t\t\tWarn(\"Godep uses commit id versions. Consider using Semantic Versions with Glide\")\n\t\t\tdeps = d\n\t\t} else if d, ok := guessImportGPM(absBase); ok {\n\t\t\tInfo(\"Importing GPM configuration\")\n\t\t\tdeps = d\n\t\t} else if d, ok := guessImportGB(absBase); ok {\n\t\t\tInfo(\"Importing GB configuration\")\n\t\t\tdeps = d\n\t\t}\n\n\t\tfor _, i := range deps {\n\t\t\tInfo(\"Found imported reference to %s\\n\", i.Name)\n\t\t\tconfig.Imports = append(config.Imports, i)\n\t\t}\n\t}\n\n\t// Resolve dependencies by looking at the tree.\n\tr, err := dependency.NewResolver(base)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\th := &dependency.DefaultMissingPackageHandler{Missing: []string{}, Gopath: []string{}}\n\tr.Handler = h\n\n\tsortable, err := r.ResolveLocal(false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsort.Strings(sortable)\n\n\tvpath := r.VendorDir\n\tif !strings.HasSuffix(vpath, \"/\") {\n\t\tvpath = vpath + string(os.PathSeparator)\n\t}\n\n\tfor _, pa := range sortable {\n\t\tn := strings.TrimPrefix(pa, vpath)\n\t\troot := util.GetRootFromPackage(n)\n\n\t\tif !config.HasDependency(root) {\n\t\t\tInfo(\"Found reference to %s\\n\", n)\n\t\t\td := &cfg.Dependency{\n\t\t\t\tName: root,\n\t\t\t}\n\t\t\tsubpkg := strings.TrimPrefix(n, root)\n\t\t\tif len(subpkg) > 0 && subpkg != \"/\" {\n\t\t\t\td.Subpackages = []string{subpkg}\n\t\t\t}\n\t\t\tconfig.Imports = append(config.Imports, d)\n\t\t} else {\n\t\t\tsubpkg := strings.TrimPrefix(n, root)\n\t\t\tif len(subpkg) > 0 && subpkg != \"/\" {\n\t\t\t\tsubpkg = strings.TrimPrefix(subpkg, \"/\")\n\t\t\t\td := config.Imports.Get(root)\n\t\t\t\tf := false\n\t\t\t\tfor _, v := range d.Subpackages {\n\t\t\t\t\tif v == subpkg {\n\t\t\t\t\t\tf = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !f {\n\t\t\t\t\tInfo(\"Adding sub-package %s to %s\\n\", subpkg, root)\n\t\t\t\t\td.Subpackages = append(d.Subpackages, subpkg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn config, nil\n}", "func TreeToFiles(r *git.Repository, t *git.Tree,\n\trepoURL string, repoCache *RepoCache) (map[FileKey]BlobLocation, map[string]git.Oid, error) {\n\tref := newRepoWalker(r, repoURL, repoCache)\n\n\tif err := ref.parseModuleMap(t); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tt.Walk(ref.cbInt)\n\tif ref.err != nil {\n\t\treturn nil, nil, ref.err\n\t}\n\treturn ref.tree, ref.subRepoVersions, nil\n}", "func LoadSwaggerV2AsV3(specPath string) *openapi3.Swagger {\n\tswaggerSpec := openapi2.Swagger{}\n\tc, err := ioutil.ReadFile(specPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = yaml.Unmarshal(c, &swaggerSpec)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\toa3, err := openapi2conv.ToV3Swagger(&swaggerSpec)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn oa3\n}", "func getDependencies(srcDir, importPath string, dependencies map[string]map[string]bool, maxDepth int) error {\n\tif callerFunctionName(maxDepth) == callerFunctionName(0) {\n\t\treturn nil\n\t}\n\tif dependencies[importPath] != nil {\n\t\treturn nil\n\t}\n\tdependencies[importPath] = make(map[string]bool)\n\n\t// Stop if the directory doesn't exist.\n\t// It could be because it's an built-in package or the package hasn't been downloaded.\n\tdirectory := filepath.Join(srcDir, importPath)\n\tif _, err := os.Stat(directory); os.IsNotExist(err) {\n\t\treturn nil\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\tfiles, err := ioutil.ReadDir(directory)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnext := make(map[string]bool)\n\tfor _, file := range files {\n\t\tif file.IsDir() || strings.HasPrefix(file.Name(), \".\") {\n\t\t\tcontinue\n\t\t}\n\t\tfilename := file.Name()\n\t\tif filepath.Ext(filename) == \".go\" {\n\t\t\tast, err := parser.ParseFile(token.NewFileSet(), filepath.Join(directory, filename), nil, parser.ImportsOnly)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, im := range ast.Imports {\n\t\t\t\tnextImportPath := im.Path.Value\n\t\t\t\tdependencies[importPath][nextImportPath] = true\n\n\t\t\t\tnextImportPathUnquoted, err := strconv.Unquote(nextImportPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Println(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnext[nextImportPathUnquoted] = true\n\t\t\t}\n\t\t}\n\t}\n\n\tfor n := range next {\n\t\tif err := getDependencies(srcDir, n, dependencies, maxDepth); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (m *Manager) ResolveTree(hash string) (*backend.ResolutionTree, error) {\n\t// resolve the tree\n\tlayers, err := m.processLayers(hash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// convert the list of hashes into a list of directories and get the manifests\n\tpaths := make(map[string]string, len(layers))\n\tmanifests := make(map[string]*schema.ImageManifest, len(layers))\n\tm.imagesLock.RLock()\n\tdefer m.imagesLock.RUnlock()\n\tfor _, layer := range layers {\n\t\tpaths[layer] = filepath.Join(m.Options.Directory, layer, \"rootfs\")\n\t\tmanifests[layer] = m.images[layer]\n\t}\n\n\treturn &backend.ResolutionTree{Order: layers, Paths: paths, Manifests: manifests}, nil\n}", "func resolveRoot(ctx context.Context, src ReadOnlyTarget, srcRef string, proxy *cas.Proxy) (ocispec.Descriptor, error) {\n\trefFetcher, ok := src.(registry.ReferenceFetcher)\n\tif !ok {\n\t\treturn src.Resolve(ctx, srcRef)\n\t}\n\n\t// optimize performance for ReferenceFetcher targets\n\trefProxy := &registryutil.Proxy{\n\t\tReferenceFetcher: refFetcher,\n\t\tProxy: proxy,\n\t}\n\troot, rc, err := refProxy.FetchReference(ctx, srcRef)\n\tif err != nil {\n\t\treturn ocispec.Descriptor{}, err\n\t}\n\tdefer rc.Close()\n\t// cache root if it is a non-leaf node\n\tfetcher := content.FetcherFunc(func(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error) {\n\t\tif content.Equal(target, root) {\n\t\t\treturn rc, nil\n\t\t}\n\t\treturn nil, errors.New(\"fetching only root node expected\")\n\t})\n\tif _, err = content.Successors(ctx, fetcher, root); err != nil {\n\t\treturn ocispec.Descriptor{}, err\n\t}\n\n\t// TODO: optimize special case where root is a leaf node (i.e. a blob)\n\t// and dst is a ReferencePusher.\n\treturn root, nil\n}", "func DirTree(root string) ([]*pkgs.Package, error) {\n\tparseCfg := &packages.Config{\n\t\tLogf: nil, // log.Printf (for debug), nil (for release)\n\t\tDir: root,\n\t\tTests: true,\n\t\tMode: packages.NeedName | packages.NeedImports | packages.NeedSyntax,\n\t}\n\n\tpacks, err := packages.Load(parseCfg, root+\"/...\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif packages.PrintErrors(packs) > 0 {\n\t\treturn nil, errors.New(\"unable to parse packages at root: \" + root)\n\t}\n\treturn packs, nil\n}", "func getSchemaAndDirs() (*yang.Entry, map[string]*ygen.Directory, map[string]map[string]*ygen.MappedType) {\n\tschema := &yang.Entry{\n\t\tName: \"root-module\",\n\t\tKind: yang.DirectoryEntry,\n\t\tDir: map[string]*yang.Entry{\n\t\t\t\"leaf\": {\n\t\t\t\tName: \"leaf\",\n\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t// Name is given here to test setting the YANGTypeName field.\n\t\t\t\tType: &yang.YangType{Name: \"ieeefloat32\", Kind: yang.Ybinary},\n\t\t\t},\n\t\t\t\"container\": {\n\t\t\t\tName: \"container\",\n\t\t\t\tKind: yang.DirectoryEntry,\n\t\t\t\tDir: map[string]*yang.Entry{\n\t\t\t\t\t\"leaf\": {\n\t\t\t\t\t\tName: \"leaf\",\n\t\t\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t\t\tType: &yang.YangType{Name: \"int32\", Kind: yang.Yint32},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"container-with-config\": {\n\t\t\t\tName: \"container-with-config\",\n\t\t\t\tKind: yang.DirectoryEntry,\n\t\t\t\tDir: map[string]*yang.Entry{\n\t\t\t\t\t\"config\": {\n\t\t\t\t\t\tName: \"config\",\n\t\t\t\t\t\tKind: yang.DirectoryEntry,\n\t\t\t\t\t\tDir: map[string]*yang.Entry{\n\t\t\t\t\t\t\t\"leaf\": {\n\t\t\t\t\t\t\t\tName: \"leaf\",\n\t\t\t\t\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t\t\t\t\tType: &yang.YangType{Kind: yang.Ybinary},\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\t\"state\": {\n\t\t\t\t\t\tName: \"state\",\n\t\t\t\t\t\tKind: yang.DirectoryEntry,\n\t\t\t\t\t\tConfig: yang.TSFalse,\n\t\t\t\t\t\tDir: map[string]*yang.Entry{\n\t\t\t\t\t\t\t\"leaf\": {\n\t\t\t\t\t\t\t\tName: \"leaf\",\n\t\t\t\t\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t\t\t\t\tType: &yang.YangType{Kind: yang.Ybinary},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"leaflist\": {\n\t\t\t\t\t\t\t\tName: \"leaflist\",\n\t\t\t\t\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t\t\t\t\tListAttr: &yang.ListAttr{},\n\t\t\t\t\t\t\t\tType: &yang.YangType{Kind: yang.Yuint32},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"leaflist2\": {\n\t\t\t\t\t\t\t\tName: \"leaflist2\",\n\t\t\t\t\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t\t\t\t\tListAttr: &yang.ListAttr{},\n\t\t\t\t\t\t\t\tType: &yang.YangType{Kind: yang.Ybinary},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"list-container\": {\n\t\t\t\tName: \"list-container\",\n\t\t\t\tKind: yang.DirectoryEntry,\n\t\t\t\tDir: map[string]*yang.Entry{\n\t\t\t\t\t\"list\": {\n\t\t\t\t\t\tName: \"list\",\n\t\t\t\t\t\tKind: yang.DirectoryEntry,\n\t\t\t\t\t\tListAttr: &yang.ListAttr{},\n\t\t\t\t\t\tDir: map[string]*yang.Entry{\n\t\t\t\t\t\t\t\"key1\": {\n\t\t\t\t\t\t\t\tName: \"key1\",\n\t\t\t\t\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t\t\t\t\tType: &yang.YangType{Kind: yang.Ystring},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"key2\": {\n\t\t\t\t\t\t\t\tName: \"key2\",\n\t\t\t\t\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t\t\t\t\tType: &yang.YangType{Kind: yang.Ybinary},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"union-key\": {\n\t\t\t\t\t\t\t\tName: \"union-key\",\n\t\t\t\t\t\t\t\tType: &yang.YangType{\n\t\t\t\t\t\t\t\t\tKind: yang.Yunion,\n\t\t\t\t\t\t\t\t\tType: []*yang.YangType{{\n\t\t\t\t\t\t\t\t\t\tName: \"enumeration\",\n\t\t\t\t\t\t\t\t\t\tKind: yang.Yenum,\n\t\t\t\t\t\t\t\t\t\tEnum: &yang.EnumType{},\n\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\tKind: yang.Yuint32,\n\t\t\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"list-container-with-state\": {\n\t\t\t\tName: \"list-container-with-state\",\n\t\t\t\tKind: yang.DirectoryEntry,\n\t\t\t\tDir: map[string]*yang.Entry{\n\t\t\t\t\t\"list-with-state\": {\n\t\t\t\t\t\tName: \"list-with-state\",\n\t\t\t\t\t\tKind: yang.DirectoryEntry,\n\t\t\t\t\t\tListAttr: &yang.ListAttr{},\n\t\t\t\t\t\tDir: map[string]*yang.Entry{\n\t\t\t\t\t\t\t\"key\": {\n\t\t\t\t\t\t\t\tName: \"key\",\n\t\t\t\t\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t\t\t\t\tType: &yang.YangType{\n\t\t\t\t\t\t\t\t\tKind: yang.Yleafref,\n\t\t\t\t\t\t\t\t\tPath: \"../state/key\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"state\": {\n\t\t\t\t\t\t\t\tName: \"state\",\n\t\t\t\t\t\t\t\tKind: yang.DirectoryEntry,\n\t\t\t\t\t\t\t\tDir: map[string]*yang.Entry{\n\t\t\t\t\t\t\t\t\t\"key\": {\n\t\t\t\t\t\t\t\t\t\tName: \"key\",\n\t\t\t\t\t\t\t\t\t\tKind: yang.LeafEntry,\n\t\t\t\t\t\t\t\t\t\tType: &yang.YangType{Kind: yang.Ydecimal64},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tAnnotation: map[string]interface{}{\"isCompressedSchema\": true},\n\t}\n\taddParents(schema)\n\n\t// Build fake root.\n\tfakeRoot := ygen.MakeFakeRoot(\"root\")\n\tfor k, v := range schema.Dir {\n\t\tfakeRoot.Dir[k] = v\n\t}\n\n\tdirectories := map[string]*ygen.Directory{\n\t\t\"/root\": {\n\t\t\tName: \"Root\",\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"leaf\": schema.Dir[\"leaf\"],\n\t\t\t\t\"container\": schema.Dir[\"container\"],\n\t\t\t\t\"container-with-config\": schema.Dir[\"container-with-config\"],\n\t\t\t\t\"list\": schema.Dir[\"list-container\"].Dir[\"list\"],\n\t\t\t\t\"list-with-state\": schema.Dir[\"list-container-with-state\"].Dir[\"list-with-state\"],\n\t\t\t},\n\t\t\tPath: []string{\"\", \"root\"},\n\t\t\tEntry: fakeRoot,\n\t\t},\n\t\t\"/root-module/container\": {\n\t\t\tName: \"Container\",\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"leaf\": schema.Dir[\"container\"].Dir[\"leaf\"],\n\t\t\t},\n\t\t\tPath: []string{\"\", \"root-module\", \"container\"},\n\t\t\tEntry: schema.Dir[\"container\"],\n\t\t},\n\t\t\"/root-module/container-with-config\": {\n\t\t\tName: \"ContainerWithConfig\",\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"leaf\": schema.Dir[\"container-with-config\"].Dir[\"state\"].Dir[\"leaf\"],\n\t\t\t\t\"leaflist\": schema.Dir[\"container-with-config\"].Dir[\"state\"].Dir[\"leaflist\"],\n\t\t\t\t\"leaflist2\": schema.Dir[\"container-with-config\"].Dir[\"state\"].Dir[\"leaflist2\"],\n\t\t\t},\n\t\t\tPath: []string{\"\", \"root-module\", \"container-with-config\"},\n\t\t\tEntry: schema.Dir[\"container-with-config\"],\n\t\t},\n\t\t\"/root-module/list-container/list\": {\n\t\t\tName: \"List\",\n\t\t\tListAttr: &ygen.YangListAttr{\n\t\t\t\tKeys: map[string]*ygen.MappedType{\n\t\t\t\t\t\"key1\": {NativeType: \"string\"},\n\t\t\t\t\t\"key2\": {NativeType: \"Binary\"},\n\t\t\t\t\t\"union-key\": {NativeType: \"RootModule_List_UnionKey_Union\", UnionTypes: map[string]int{\"string\": 0, \"Binary\": 1}},\n\t\t\t\t},\n\t\t\t\tKeyElems: []*yang.Entry{{Name: \"key1\"}, {Name: \"key2\"}, {Name: \"union-key\"}},\n\t\t\t},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"key1\": schema.Dir[\"list-container\"].Dir[\"list\"].Dir[\"key1\"],\n\t\t\t\t\"key2\": schema.Dir[\"list-container\"].Dir[\"list\"].Dir[\"key2\"],\n\t\t\t\t\"union-key\": schema.Dir[\"list-container\"].Dir[\"list\"].Dir[\"union-key\"],\n\t\t\t},\n\t\t\tPath: []string{\"\", \"root-module\", \"list-container\", \"list\"},\n\t\t\tEntry: schema.Dir[\"list-container\"],\n\t\t},\n\t\t\"/root-module/list-container-with-state/list-with-state\": {\n\t\t\tName: \"ListWithState\",\n\t\t\tListAttr: &ygen.YangListAttr{\n\t\t\t\tKeys: map[string]*ygen.MappedType{\n\t\t\t\t\t\"key\": {NativeType: \"float64\"},\n\t\t\t\t},\n\t\t\t\tKeyElems: []*yang.Entry{{Name: \"key\"}},\n\t\t\t},\n\t\t\tFields: map[string]*yang.Entry{\n\t\t\t\t\"key\": schema.Dir[\"list-container-with-state\"].Dir[\"list-with-state\"].Dir[\"key\"],\n\t\t\t},\n\t\t\tPath: []string{\"\", \"root-module\", \"list-container-with-state\", \"list-with-state\"},\n\t\t\tEntry: schema.Dir[\"list-container-with-state\"],\n\t\t},\n\t}\n\n\tleafTypeMap := map[string]map[string]*ygen.MappedType{\n\t\t\"/root\": {\n\t\t\t\"leaf\": {NativeType: \"Binary\"},\n\t\t\t\"container\": nil,\n\t\t\t\"container-with-config\": nil,\n\t\t\t\"list\": nil,\n\t\t\t\"list-with-state\": nil,\n\t\t},\n\t\t\"/root-module/container\": {\n\t\t\t\"leaf\": {NativeType: \"int32\"},\n\t\t},\n\t\t\"/root-module/container-with-config\": {\n\t\t\t\"leaf\": {NativeType: \"Binary\"},\n\t\t\t\"leaflist\": {NativeType: \"uint32\"},\n\t\t\t\"leaflist2\": {NativeType: \"Binary\"},\n\t\t},\n\t\t\"/root-module/list-container/list\": {\n\t\t\t\"key1\": {NativeType: \"string\"},\n\t\t\t\"key2\": {NativeType: \"Binary\"},\n\t\t\t\"union-key\": {NativeType: \"RootModule_List_UnionKey_Union\", UnionTypes: map[string]int{\"string\": 0, \"Binary\": 1}},\n\t\t},\n\t\t\"/root-module/list-container-with-state/list-with-state\": {\n\t\t\t\"key\": {NativeType: \"float64\"},\n\t\t},\n\t}\n\n\treturn schema, directories, leafTypeMap\n}", "func (resolver *NpmResolver) ParsePkgFile(pkgFile string) (*Package, error) {\n\tcontent, err := ioutil.ReadFile(pkgFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar packageInfo Package\n\tif err := json.Unmarshal(content, &packageInfo); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &packageInfo, nil\n}", "func (c APIClient) Walk(repoName string, commitID string, path string, walkFn WalkFn) error {\n\tfileInfo, err := c.InspectFile(repoName, commitID, path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := walkFn(fileInfo); err != nil {\n\t\treturn err\n\t}\n\tfor _, childPath := range fileInfo.Children {\n\t\tif err := c.Walk(repoName, commitID, filepath.Join(path, childPath), walkFn); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func DecodeRootMetadata(codec kbfscodec.Codec, tlfID tlf.ID,\n\tver, max MetadataVer, buf []byte) (MutableRootMetadata, error) {\n\trmd, err := makeMutableRootMetadataForDecode(codec, tlfID, ver, max, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := codec.Decode(buf, rmd); err != nil {\n\t\treturn nil, err\n\t}\n\tif ver < ImplicitTeamsVer && tlfID.Type() != tlf.SingleTeam &&\n\t\trmd.TypeForKeying() == tlf.TeamKeying {\n\t\treturn nil, errors.Errorf(\n\t\t\t\"Can't make an implicit teams TLF with version %s\", ver)\n\t}\n\treturn rmd, nil\n}", "func GetRoot(authToken string) (*http.Response, *Root, error) {\n\n apiDef := &api{method: \"GET\", endpoint: \"/root\", authToken: authToken}\n resp, body, err := proxyRequest(apiDef)\n if err != nil {\n return nil, nil, err\n }\n\n r := new(Root)\n err = json.Unmarshal(body, &r)\n if err != nil {\n return nil, nil, err\n }\n\n return resp, r, nil\n}", "func Read(filename string) (deps DependencyMap, err error) {\n\tdeps.Map = make(map[string]*Dependency)\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(data, &deps.Map)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// traverse map and look for empty version fields - provide a default if such found\n\tfor key := range deps.Map {\n\t\tval := deps.Map[key]\n\t\tif val.Version == \"\" {\n\t\t\tswitch val.Type {\n\t\t\tcase TypeGit, TypeGitClone:\n\t\t\t\tval.Version = \"master\"\n\t\t\tcase TypeHg:\n\t\t\t\tval.Version = \"tip\"\n\t\t\tcase TypeBzr:\n\t\t\t\tval.Version = \"trunk\"\n\t\t\tdefault:\n\t\t\t\tval.Version = \"\"\n\t\t\t}\n\t\t\tdeps.Map[key] = val\n\t\t}\n\t}\n\n\tfor name, d := range deps.Map {\n\t\terr := d.SetupVCS(name)\n\t\tif err != nil {\n\t\t\tdelete(deps.Map, name)\n\t\t}\n\n\t}\n\n\tdeps.Path = filename\n\n\treturn\n}", "func ParseGomodFile(b []byte) ([]string, error) {\n\tvar requiredModules []string\n\n\tgoModFile, err := modfile.Parse(\"\", b, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, req := range goModFile.Require {\n\t\tif !strings.Contains(req.Syntax.Token[0], \"golang.org\") { //filtering golang x std packages\n\t\t\trequiredModules = append(requiredModules, req.Syntax.Token[0])\n\t\t}\n\t}\n\t// fmt.Println(goModFile.Require)\n\n\treturn requiredModules, nil\n}", "func (u *PathRoot) UnmarshalJSON(body []byte) error {\n\ttype wrap struct {\n\t\tdropbox.Tagged\n\t\t// Root : Paths are relative to the authenticating user's root namespace\n\t\t// (This results in `PathRootError.invalid_root` if the user's root\n\t\t// namespace has changed.).\n\t\tRoot string `json:\"root,omitempty\"`\n\t\t// NamespaceId : Paths are relative to given namespace id (This results\n\t\t// in `PathRootError.no_permission` if you don't have access to this\n\t\t// namespace.).\n\t\tNamespaceId string `json:\"namespace_id,omitempty\"`\n\t}\n\tvar w wrap\n\tvar err error\n\tif err = json.Unmarshal(body, &w); err != nil {\n\t\treturn err\n\t}\n\tu.Tag = w.Tag\n\tswitch u.Tag {\n\tcase \"root\":\n\t\tu.Root = w.Root\n\n\tcase \"namespace_id\":\n\t\tu.NamespaceId = w.NamespaceId\n\n\t}\n\treturn nil\n}", "func DepthFirstSearch(root string, currentBuildNode NodeState, nodeMap map[string]NodeState) ([]string, error) {\n\n\tcurrentNodeData := currentBuildNode.NodeData\n\t// set Processing equal to true until all it's dependencies are not executed\n\tcurrentBuildNode.Processing = true\n\tnodeMap[currentNodeData.Location + currentNodeData.RuleName] = currentBuildNode\n\n\tvar dependentFiles []string\n\tfor file := range currentNodeData.Files {\n\t\tdependentFiles = append(dependentFiles, currentNodeData.Location + file)\n\t}\n\n\tfor dependencyName := range currentNodeData.Dependency {\n\n\t\tdependencyNode, FoundDependency := nodeMap[currentNodeData.Location + dependencyName]\n\t\tif FoundDependency == true {\n\n\t\t\t// If dependency is already in a processing state then it's a circular dependency\n\t\t\tif dependencyNode.Processing == true {\n\t\t\t\terr := \"Error: Circular dependency detected between \" + currentNodeData.RuleName + \" and \" + dependencyName\n\t\t\t\treturn dependentFiles, errors.New(err)\n\t\t\t} else if dependencyNode.Executed == false {\n\t\t\t\tdelete(nodeMap, dependencyName)\n\t\t\t\tfiles, err := DepthFirstSearch(root, dependencyNode, nodeMap)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn dependentFiles, err\n\t\t\t\t}\n\n\t\t\t\tfor _, file := range files {\n\t\t\t\t\tdependentFiles = append(dependentFiles, file)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tcmd := exec.Command(\"bash\", \"-c\", currentBuildNode.NodeData.Command)\n\t// Executing command from this directory\n\tcmd.Dir = root + currentBuildNode.NodeData.Location\n\t_, err := cmd.Output()\n\tif err != nil {\n\t\treturn dependentFiles, err\n\t}\n\n\tdelete(nodeMap, currentNodeData.Location + currentNodeData.RuleName)\n\tcurrentBuildNode.Processing = false\n\tcurrentBuildNode.Executed = true\n\tnodeMap[currentNodeData.Location + currentNodeData.RuleName] = currentBuildNode\n\treturn dependentFiles, nil\n}", "func GenerateModels(targetFilepath string, configFilepath string, rootDir string, specs map[string]MagmaSwaggerSpec) error {\n\tabsTargetFilepath, err := filepath.Abs(targetFilepath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"target filepath %s is invalid: %w\", targetFilepath, err)\n\t}\n\n\ttmpGenDir, err := ioutil.TempDir(\".\", \"tmpgen\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not create temporary gen directory: %w\", err)\n\t}\n\tdefer os.RemoveAll(tmpGenDir)\n\n\t// For each dependency, strip the magma-gen-meta and write the result to\n\t// the filename specified by `dependent-filename`\n\terr = StripAndWriteSwaggerSpecs(specs, tmpGenDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Shell out to go-swagger\n\ttargetSpec := specs[absTargetFilepath]\n\toutputDir := filepath.Join(rootDir, targetSpec.MagmaGenMeta.OutputDir)\n\tabsConfigFilepath, err := filepath.Abs(configFilepath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcmd := exec.Command(\n\t\t\"swagger\", \"generate\", \"model\",\n\t\t\"--spec\", filepath.Join(tmpGenDir, targetSpec.MagmaGenMeta.TempGenFilename),\n\t\t\"--target\", outputDir,\n\t\t\"--config-file\", absConfigFilepath,\n\t)\n\tstdoutBuf := &strings.Builder{}\n\tstderrBuf := &strings.Builder{}\n\tcmd.Stdout = stdoutBuf\n\tcmd.Stderr = stderrBuf\n\n\terr = cmd.Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to generate models; stdout:\\n%s\\nstderr:\\n%s: %w\", stdoutBuf.String(), stderrBuf.String(), err)\n\t}\n\n\treturn nil\n}", "func BuildTree(values []change.ConfigValue, pretty bool) ([]byte, error) {\n\tvar buf bytes.Buffer\n\n\troot := Node{Name: \"(root)\", Children: make([]*Node, 0), Leaves: make([]*Leaf, 0)}\n\n\tfor _, cv := range values {\n\t\taddPathToTree(cv.Path, cv.Value, &root)\n\t}\n\n\tjsonifyNodes(&root, &buf, pretty, 1)\n\treturn buf.Bytes(), nil\n}", "func (self *SassDependencyResolver) Resolve(path string) ([]string, error) {\n\tabs, err := filepath.Abs(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdeps, ok := self.deepDeps[abs]\n\n\tif ok {\n\t\treturn deps, nil\n\t}\n\n\tscanned := make(map[string]bool, 100)\n\tunscanned := make(map[string]bool, 100)\n\tunscanned[abs] = true\n\n\tfor len(unscanned) > 0 {\n\t\tfor subpath := range unscanned {\n\t\t\t// Move the file to scanned\n\t\t\tdelete(unscanned, subpath)\n\t\t\tscanned[subpath] = true\n\n\t\t\t// Get the dependencies or read them if needed\n\t\t\tdeps, err := self.shallowResolve(subpath)\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// Add the dependency to unscanned if it hasn't been scanned\n\t\t\t// already\n\t\t\tfor _, dep := range deps {\n\t\t\t\t_, ok = scanned[dep]\n\n\t\t\t\tif !ok {\n\t\t\t\t\tunscanned[dep] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdeps = make([]string, 0, len(scanned))\n\n\tfor dep := range scanned {\n\t\tif dep != abs {\n\t\t\tdeps = append(deps, dep)\n\t\t}\n\t}\n\n\tself.deepDeps[abs] = deps\n\treturn deps, nil\n}", "func protoGoRuntimeLibraryToGoRuntimeDependency(config *registryv1alpha1.GoConfig_RuntimeLibrary) *bufpluginconfig.GoRegistryDependencyConfig {\n\treturn &bufpluginconfig.GoRegistryDependencyConfig{\n\t\tModule: config.Module,\n\t\tVersion: config.Version,\n\t}\n}", "func (d *Graph) buildTree() {\n\tconfig := build.Default\n\n\t// For each package, look for the dependencies and build out a tree\n\tfor p := range d.Pkgs {\n\t\tpkg, _ := config.Import(d.Pkgs[p], d.SrcDir, build.AllowBinary)\n\t\timports := pkg.Imports\n\n\t\t// Iterate through the imports and build our tree\n\t\tfor i := range imports {\n\t\t\t// The full path of our current import\n\t\t\tpath := imports[i]\n\n\t\t\t// When dealing with multiple packages, we can't assume that imports\n\t\t\t// are unique. Thus the nodes may already exist and we shouldn't do any work\n\t\t\tif d.Nodes[path] != nil {\n\t\t\t\td.Nodes[path].IsDuplicate = true\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Ignore the GO standard library imports\n\t\t\tif _, ok := stdlib[strings.Split(path, \"/\")[0]]; ok && !d.StdLib {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Keep track when traversing the path\n\t\t\tvar currentNode = &Node{\n\t\t\t\tPath: path,\n\t\t\t\tIsDep: true,\n\t\t\t\tIsCoreDep: strings.HasPrefix(path, strings.Split(d.Pkgs[p], \"/\")[0]),\n\t\t\t}\n\n\t\t\t// Keep track of the number of dependencies\n\t\t\td.TotalDeps++\n\n\t\t\t// Link our dependency node to its ancestors\n\t\t\tfor path != \"\" {\n\t\t\t\t// Constant time lookup to all of our nodes\n\t\t\t\t// based on their full path string\n\t\t\t\td.Nodes[path] = currentNode\n\n\t\t\t\t// Keep popping off the tip of the path\n\t\t\t\tpath, _ = filepath.Split(path)\n\n\t\t\t\tif len(path) > 0 {\n\t\t\t\t\t// Trailing slash in file path causes issues, remove it\n\t\t\t\t\tif strings.HasSuffix(path, \"/\") {\n\t\t\t\t\t\tpath = path[:len(path)-1]\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create nodes for all directory paths if they don't exist\n\t\t\t\t\tif d.Nodes[path] == nil {\n\t\t\t\t\t\tcurrentNode.addParent(&Node{\n\t\t\t\t\t\t\tPath: path,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\t// Change the current node to the newly created item\n\t\t\t\t\t\tcurrentNode = currentNode.Parent\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Otherwise, assume the common ancestor already has it's tree built\n\t\t\t\t\t\tcurrentNode.addParent(d.Nodes[path])\n\t\t\t\t\t\tcurrentNode = nil\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// currentNode will be nil if there was already a common ancestor --\n\t\t\t// which means the root node already exists for that import path\n\t\t\tif currentNode != nil {\n\t\t\t\td.RootNode.addChild(currentNode)\n\t\t\t}\n\t\t}\n\t}\n}", "func YAMLRemoteRefParser(path string, b []byte) (*RemoteRef, error) {\n\tvar maybeRef struct {\n\t\tRemote *string `yaml:\"remote\"`\n\t\tPath string `yaml:\"path\"`\n\t\tRef string `yaml:\"ref\"`\n\t}\n\n\tif err := yaml.UnmarshalStrict(b, &maybeRef); err != nil {\n\t\t// assume errors mean this isn't a remote config\n\t\treturn nil, nil\n\t}\n\tif maybeRef.Remote == nil {\n\t\treturn nil, nil\n\t}\n\n\tref := RemoteRef{\n\t\tRemote: *maybeRef.Remote,\n\t\tPath: maybeRef.Path,\n\t\tRef: maybeRef.Ref,\n\t}\n\tif ref.Remote == \"\" {\n\t\treturn nil, errors.New(\"invalid remote reference: empty \\\"remote\\\" field\")\n\t}\n\treturn &ref, nil\n}", "func dependencyBlocksToModuleDependencies(decodedDependencyBlocks []Dependency) *ModuleDependencies {\n\tif len(decodedDependencyBlocks) == 0 {\n\t\treturn nil\n\t}\n\n\tpaths := []string{}\n\tfor _, decodedDependencyBlock := range decodedDependencyBlocks {\n\t\tconfigPath := decodedDependencyBlock.ConfigPath\n\t\tif util.IsFile(configPath) && filepath.Base(configPath) == DefaultTerragruntConfigPath {\n\t\t\t// dependencies system expects the directory containing the terragrunt.hcl file\n\t\t\tconfigPath = filepath.Dir(configPath)\n\t\t}\n\t\tpaths = append(paths, configPath)\n\t}\n\treturn &ModuleDependencies{Paths: paths}\n}", "func ParseDockerRef(dockerRef string) (string, string) {\n\trepoName, tag := parsers.ParseRepositoryTag(dockerRef)\n\n\tif len(tag) == 0 {\n\t\ttag = \"latest\"\n\t}\n\n\treturn repoName, tag\n}", "func GetStructsInFile(filePath string) (*loader.PackageInfo, ParsedStructs, error) {\n\tabsFilePath, err := filepath.Abs(filePath)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"can't get abs path for %s\", filePath)\n\t}\n\n\tneededStructs, err := getStructNamesInFile(absFilePath)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"can't get struct names: %s\", err)\n\t}\n\n\tpackageFullName := fileNameToPkgName(filePath, absFilePath)\n\tlprog, err := loadProgramFromPackage(packageFullName)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tpkgInfo := lprog.Package(packageFullName)\n\tif pkgInfo == nil {\n\t\treturn nil, nil, fmt.Errorf(\"can't load types for file %s in package %q\",\n\t\t\tfilePath, packageFullName)\n\t}\n\n\tret := ParsedStructs{}\n\n\tscope := pkgInfo.Pkg.Scope()\n\tfor _, name := range scope.Names() {\n\t\tobj := scope.Lookup(name)\n\n\t\tif neededStructs[name] == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tt := obj.Type().(*types.Named)\n\t\ts := t.Underlying().(*types.Struct)\n\n\t\tparsedStruct := parseStruct(s, neededStructs[name])\n\t\tif parsedStruct != nil {\n\t\t\tret[name] = *parsedStruct\n\t\t}\n\t}\n\n\treturn pkgInfo, ret, nil\n}", "func SchemaDescriptor() (interface{}, error) {\n\tzr, err := gzip.NewReader(bytes.NewReader(fileDescriptor))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf bytes.Buffer\n\t_, err = buf.ReadFrom(zr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar v interface{}\n\tif err := json.NewDecoder(bytes.NewReader(buf.Bytes())).Decode(&v); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn v, nil\n}", "func SchemaDescriptor() (interface{}, error) {\n\tzr, err := gzip.NewReader(bytes.NewReader(fileDescriptor))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar buf bytes.Buffer\n\t_, err = buf.ReadFrom(zr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar v interface{}\n\tif err := json.NewDecoder(bytes.NewReader(buf.Bytes())).Decode(&v); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn v, nil\n}", "func (d *galleryDocument) Dependencies() map[string]struct{} {\n\treturn map[string]struct{}{tmplPathToName(galTmplPath): {}}\n}", "func (tree *Tree) ConstructTree(details *pb.MetricDetailsResponse) error {\n\talreadyVisited := []*caching.Node{}\n\troot, err := tree.GetNode(tree.RootName)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//cycles on all the metrics of the details response.\n\t//For each metric it splits the metric name into dot separated elements. Each\n\t//element will represent a node in the tree structure.\n\t//\n\t//All the nodes will have initial Size = 0\n\tfor metric, data := range details.Metrics {\n\t\tparts := strings.Split(metric, \".\")\n\t\tleafIndex := len(parts) - 1\n\n\t\talreadyVisited = []*caching.Node{root}\n\n\t\tfor currentIndex := 0; currentIndex <= leafIndex; currentIndex++ {\n\t\t\tcurrentName := strings.Join(parts[0:currentIndex+1], \".\")\n\t\t\tif val, _ := tree.GetNodeFromRoot(currentName); val != nil {\n\t\t\t\talreadyVisited = append(alreadyVisited, val)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif currentIndex == leafIndex {\n\t\t\t\tfor index, node := range alreadyVisited {\n\t\t\t\t\tif index != len(alreadyVisited)-1 {\n\t\t\t\t\t\tnode.Leaf = false\n\t\t\t\t\t}\n\t\t\t\t\tnode.Size += data.Size_\n\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcurrentNode := &caching.Node{\n\t\t\t\tName: tree.RootName + \".\" + currentName,\n\t\t\t\tChildren: []*caching.Node{},\n\t\t\t\tLeaf: true,\n\t\t\t\tSize: int64(0),\n\t\t\t}\n\n\t\t\ttree.AddNode(currentName, currentNode)\n\t\t\ttree.AddChild(alreadyVisited[len(alreadyVisited)-1], currentNode)\n\n\t\t\talreadyVisited = append(alreadyVisited, currentNode)\n\t\t}\n\t}\n\n\treturn nil\n}", "func FindAppDependencies(path string) (Dependencies, error) {\n\tapp, appOK, appErr := FindApp(path)\n\tif appErr != nil {\n\t\treturn Dependencies{}, appErr\n\t}\n\tif !appOK {\n\t\treturn Dependencies{}, nil\n\t}\n\n\trootDir := filepath.Join(app.RootDir, NameFunctions)\n\n\tarchives, archivesErr := filepath.Glob(filepath.Join(rootDir, nameNodeModules+\"*\"))\n\tif archivesErr != nil {\n\t\treturn Dependencies{}, archivesErr\n\t}\n\tif len(archives) == 0 {\n\t\treturn Dependencies{}, fmt.Errorf(\"node_modules archive not found at '%s'\", rootDir)\n\t}\n\n\tarchivePath, archivePathErr := filepath.Abs(archives[0])\n\tif archivePathErr != nil {\n\t\treturn Dependencies{}, archivePathErr\n\t}\n\n\treturn Dependencies{rootDir, archivePath}, nil\n}", "func FindAndParseTemplates(rootDir, ext string, funcMap template.FuncMap) (*template.Template, error) {\n\tcleanRoot := filepath.Clean(rootDir)\n\tpfx := len(cleanRoot) + 1\n\troot := template.New(\"\")\n\n\terr := filepath.Walk(cleanRoot, func(path string, info os.FileInfo, e1 error) error {\n\t\tif !info.IsDir() && strings.HasSuffix(path, ext) {\n\t\t\tif e1 != nil {\n\t\t\t\treturn e1\n\t\t\t}\n\n\t\t\tb, e2 := ioutil.ReadFile(path)\n\t\t\tif e2 != nil {\n\t\t\t\treturn e2\n\t\t\t}\n\n\t\t\tname := path[pfx:]\n\t\t\tt := root.New(name).Funcs(funcMap)\n\t\t\t_, e2 = t.Parse(string(b))\n\t\t\tif e2 != nil {\n\t\t\t\treturn e2\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn root, err\n}", "func Initialize(basePath string) error {\n log(dtalog.DBG, \"Initialize(%q) called\", basePath)\n dir, err := os.Open(basePath)\n if err != nil {\n log(dtalog.ERR, \"Initialize(%q): error opening directory for read: %s\",\n basePath, err)\n return err\n }\n \n filez, err := dir.Readdirnames(0)\n if err != nil {\n log(dtalog.ERR, \"Initialize(%q): error reading from directory: %s\",\n basePath, err)\n dir.Close()\n return err\n }\n dir.Close()\n \n Paths = make([]string, 0, len(filez))\n Limbo = make(map[string]*string)\n \n for _, fname := range filez {\n pth := filepath.Join(basePath, fname)\n f, err := os.Open(pth)\n if err != nil {\n log(dtalog.WRN, \"Initialize(): error opening file %q: %s\", pth, err)\n continue\n }\n defer f.Close()\n log(dtalog.DBG, \"Initialize(): reading file %q\", pth)\n \n Paths = append(Paths, pth)\n cur_ptr := &(Paths[len(Paths)-1])\n \n dcdr := json.NewDecoder(f)\n var raw interface{}\n var raw_slice []interface{}\n var i ref.Interface\n var idx string\n for dcdr.More() {\n err = dcdr.Decode(&raw)\n if err != nil {\n log(dtalog.WRN, \"Initialize(): error decoding from file %q: %s\",\n pth, err)\n continue\n }\n raw_slice = raw.([]interface{})\n if len(raw_slice) < 2 {\n log(dtalog.WRN, \"Initialize(): in file %q: slice too short: %q\",\n pth, raw_slice)\n continue\n }\n \n idx = raw_slice[0].(string)\n i = ref.Deref(idx)\n if i == nil {\n Limbo[idx] = cur_ptr\n } else {\n i.(Interface).SetDescPage(cur_ptr)\n }\n }\n }\n return nil\n}", "func Unmarshal(xmlPath string) (*MetaLib, error) {\n\tdata, err := ioutil.ReadFile(xmlPath)\n\tif err != nil {\n\t\tlogrus.WithError(err).Panic(\"tlogBaseService 加载 tlog.xml 失败\")\n\t\treturn nil, err\n\t}\n\tv := MetaLib{}\n\terr = xml.Unmarshal(data, &v)\n\tif err != nil {\n\t\tlogrus.WithError(err).Panic(\"tlogBaseService 解析 tlog.xml 失败\")\n\t\treturn nil, err\n\t}\n\n\tfor _, s := range v.Structs {\n\t\ts.init()\n\t}\n\n\treturn &v, nil\n}", "func parseRef(k8sRef string) (string, string, error) {\n\ts := strings.Split(strings.TrimPrefix(k8sRef, keyReference), \"/\")\n\tif len(s) != 2 {\n\t\treturn \"\", \"\", errors.New(\"kubernetes specification should be in the format k8s://<namespace>/<secret>\")\n\t}\n\treturn s[0], s[1], nil\n}", "func GetFileInfo(inputPath string) (string, []string, error) {\n\tfset := token.NewFileSet()\n\n\tf, err := parser.ParseFile(fset, inputPath, nil, 0)\n\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tpackageName := f.Name.String()\n\tstructs := []string{}\n\n\tfor name, obj := range f.Scope.Objects {\n\t\tif obj.Kind == ast.Typ {\n\t\t\tts, ok := obj.Decl.(*ast.TypeSpec)\n\t\t\tif !ok {\n\t\t\t\treturn \"\", nil, fmt.Errorf(\"Unknown type without TypeSpec: %v\", obj)\n\t\t\t}\n\n\t\t\t_, ok = ts.Type.(*ast.StructType)\n\t\t\tif !ok {\n\t\t\t\t// Not a struct, so skip it\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tstructs = append(structs, name)\n\t\t}\n\t}\n\n\treturn packageName, structs, nil\n}", "func DependencySort(ks []HelmRelease) ([]HelmRelease, error) {\n\tn := make(graph)\n\tlookup := map[string]*HelmRelease{}\n\tfor i := 0; i < len(ks); i++ {\n\t\tn[ks[i].Name] = after(ks[i].Spec.DependsOn)\n\t\tlookup[ks[i].Name] = &ks[i]\n\t}\n\tsccs := tarjanSCC(n)\n\tvar sorted []HelmRelease\n\tvar unsortable CircularDependencyError\n\tfor i := 0; i < len(sccs); i++ {\n\t\ts := sccs[i]\n\t\tif len(s) != 1 {\n\t\t\tunsortable = append(unsortable, s)\n\t\t\tcontinue\n\t\t}\n\t\tif k, ok := lookup[s[0]]; ok {\n\t\t\tsorted = append(sorted, *k.DeepCopy())\n\t\t}\n\t}\n\tif unsortable != nil {\n\t\tfor i, j := 0, len(unsortable)-1; i < j; i, j = i+1, j-1 {\n\t\t\tunsortable[i], unsortable[j] = unsortable[j], unsortable[i]\n\t\t}\n\t\treturn nil, unsortable\n\t}\n\treturn sorted, nil\n}", "func parseFiles(files []string) (*parser.Namespace, [][]schema.QualifiedName, error) {\n\tvar fileDefinitions [][]schema.QualifiedName\n\tns := parser.NewNamespace(false)\n\tfor _, f := range files {\n\t\tdata, err := os.ReadFile(f)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tvar definitions []schema.QualifiedName\n\t\t// Make a new namespace just for this file only\n\t\t// so we can tell which names are defined in this\n\t\t// file alone.\n\t\tsingleNS := parser.NewNamespace(false)\n\t\tavroType, err := singleNS.TypeForSchema(data)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"invalid schema in %s: %v\", f, err)\n\t\t}\n\t\tif _, ok := avroType.(*schema.Reference); !ok {\n\t\t\t// The schema doesn't have a top-level name.\n\t\t\t// TODO how should we cope with a schema that's not\n\t\t\t// a definition? In that case we don't have\n\t\t\t// a name for the type, and we may not be able to define\n\t\t\t// methods on it because it might be a union type which\n\t\t\t// is represented by an interface type in Go.\n\t\t\t// See https://github.com/heetch/avro/issues/13\n\t\t\treturn nil, nil, fmt.Errorf(\"cannot generate code for schema %q which hasn't got a name (%T)\", f, avroType)\n\t\t}\n\t\tfor name, def := range singleNS.Definitions {\n\t\t\tif name != def.AvroName() {\n\t\t\t\t// It's an alias, so ignore it.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdefinitions = append(definitions, name)\n\t\t}\n\t\t// Sort the definitions so we get deterministic output.\n\t\t// TODO sort topologically so we get top level definitions\n\t\t// before lower level definitions.\n\t\tsort.Slice(definitions, func(i, j int) bool {\n\t\t\treturn definitions[i].String() < definitions[j].String()\n\t\t})\n\t\tfileDefinitions = append(fileDefinitions, definitions)\n\t\t// Parse the schema again but use the global namespace\n\t\t// this time so all the schemas can share the same definitions.\n\t\tif _, err := ns.TypeForSchema(data); err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"cannot parse schema in %s: %v\", f, err)\n\t\t}\n\t}\n\t// Now we've accumulated all the available types,\n\t// resolve the names with respect to the complete\n\t// namespace.\n\tfor name, def := range ns.Roots {\n\t\tif err := resolver.ResolveDefinition(def, ns.Definitions); err != nil {\n\t\t\t// TODO find out which file(s) the definition came from\n\t\t\t// and include that file name in the error.\n\t\t\treturn nil, nil, fmt.Errorf(\"cannot resolve reference %q: %v\", name, err)\n\t\t}\n\t}\n\treturn ns, fileDefinitions, nil\n}", "func (KubeAPIs KubernetesAPIs) PopulateKubeAPIMap(config *rest.Config, swaggerfile string) (err error) {\n\n\t// Open our jsonFile\n\tjsonFile, err := os.Open(swaggerfile)\n\t// if we os.Open returns an error then handle it\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// read our opened xmlFile as a byte array.\n\tbyteValue, _ := ioutil.ReadAll(jsonFile)\n\n\terr = jsonFile.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(byteValue, &definitionsMap)\n\tif err != nil {\n\t\tfmt.Println(\"Error parsing the JSON, file might me invalid\")\n\t\treturn err\n\t}\n\n\tdefinitions := definitionsMap[\"definitions\"].(map[string]interface{})\n\n\tfor _, value := range definitions {\n\t\tval := value.(map[string]interface{})\n\t\tif kubeapivalue, valid := getKubeAPIValues(val, config); valid {\n\t\t\tvar name string\n\t\t\tif kubeapivalue.group != \"\" {\n\t\t\t\tname = fmt.Sprintf(\"%s/%s/%s\", kubeapivalue.group, kubeapivalue.version, kubeapivalue.name)\n\t\t\t} else {\n\t\t\t\tname = fmt.Sprintf(\"%s/%s\", kubeapivalue.version, kubeapivalue.name)\n\t\t\t}\n\t\t\tKubeAPIs[name] = kubeapivalue\n\t\t}\n\t}\n\treturn nil\n}", "func (g *Generator) ParseFileMap(dir, data string) error {\n\t// Parse the template data.\n\tt, err := template.New(\"\").Funcs(Preload).Parse(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Execute the template.\n\tbuf := bytes.NewBuffer(nil)\n\terr = t.Execute(buf, g.request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Parse the filemap.\n\tg.FileMap.Dir = dir\n\terr = xml.Unmarshal(buf.Bytes(), &g.FileMap)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(g.FileMap.Generate) == 0 {\n\t\treturn errors.New(\"no generate elements found in file map\")\n\t}\n\treturn nil\n}", "func (o *OpenAPI3) ParseCallbacks(ctx context.Context, cbs map[string]*openapi3.CallbackRef, opts *OpenAPI3Options) (map[string][]*spec.Path, error) {\n\tspecCbs := make(map[string][]*spec.Path)\n\n\tfor cbEvent, cbRef := range cbs {\n\t\tif cbRef == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tcbPaths := make([]*spec.Path, 0, len(*cbRef.Value))\n\n\t\tfor cbURL, cb := range *cbRef.Value {\n\t\t\tspecCb, err := o.ParsePath(ctx, cb, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tspecCb.PathString = cbURL\n\n\t\t\tvar ext OpenAPI3PathExtension\n\t\t\terr = o.GetExtension(opts.ExtensionName, cb.Extensions, &ext)\n\t\t\tif err != nil && err != ErrExtNotFound {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif ext.Name != nil && len(*ext.Name) != 0 {\n\t\t\t\tspecCb.Name = *ext.Name\n\t\t\t}\n\n\t\t\tcbPaths = append(cbPaths, specCb)\n\t\t}\n\n\t\tspecCbs[util.ToGoName(strings.Title(strcase.ToCamel(cbEvent)))] = cbPaths\n\t}\n\n\treturn specCbs, nil\n}", "func (m *defaultResourceManager) findMeshDependency(ctx context.Context, vr *appmesh.VirtualRouter) (*appmesh.Mesh, error) {\n\tif vr.Spec.MeshRef == nil {\n\t\treturn nil, errors.Errorf(\"meshRef shouldn't be nil, please check webhook setup\")\n\t}\n\tms, err := m.referencesResolver.ResolveMeshReference(ctx, *vr.Spec.MeshRef)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to resolve meshRef\")\n\t}\n\treturn ms, nil\n}", "func GetSwagger() (swagger *openapi3.T, err error) {\n\tvar resolvePath = PathToRawSpec(\"\")\n\n\tloader := openapi3.NewLoader()\n\tloader.IsExternalRefsAllowed = true\n\tloader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {\n\t\tvar pathToFile = url.String()\n\t\tpathToFile = path.Clean(pathToFile)\n\t\tgetSpec, ok := resolvePath[pathToFile]\n\t\tif !ok {\n\t\t\terr1 := fmt.Errorf(\"path not found: %s\", pathToFile)\n\t\t\treturn nil, err1\n\t\t}\n\t\treturn getSpec()\n\t}\n\tvar specData []byte\n\tspecData, err = rawSpec()\n\tif err != nil {\n\t\treturn\n\t}\n\tswagger, err = loader.LoadFromData(specData)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func GetSwagger() (swagger *openapi3.T, err error) {\n\tvar resolvePath = PathToRawSpec(\"\")\n\n\tloader := openapi3.NewLoader()\n\tloader.IsExternalRefsAllowed = true\n\tloader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {\n\t\tvar pathToFile = url.String()\n\t\tpathToFile = path.Clean(pathToFile)\n\t\tgetSpec, ok := resolvePath[pathToFile]\n\t\tif !ok {\n\t\t\terr1 := fmt.Errorf(\"path not found: %s\", pathToFile)\n\t\t\treturn nil, err1\n\t\t}\n\t\treturn getSpec()\n\t}\n\tvar specData []byte\n\tspecData, err = rawSpec()\n\tif err != nil {\n\t\treturn\n\t}\n\tswagger, err = loader.LoadFromData(specData)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func filesChangedTree(g model.TargetGraph, target model.TargetSpec, stateSet store.BuildStateSet) ([]string, error) {\n\tresult := []string{}\n\terr := g.VisitTree(target, func(current model.TargetSpec) error {\n\t\tstate := stateSet[current.ID()]\n\t\tresult = append(result, state.FilesChanged()...)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sliceutils.DedupedAndSorted(result), nil\n}", "func (rmc *RMakeConf) MakeDepTree() (*rmake.DepTreeNode, error) {\n\tjobbyout := make(map[string]*rmake.Job)\n\tfor _,j := range rmc.Jobs {\n\t\tjobbyout[j.Output] = j\n\t}\n\n\tfinal,ok := jobbyout[rmc.Output]\n\tif !ok {\n\t\treturn nil,fmt.Errorf(\"Could not find job for final output.\")\n\t}\n\tdelete(jobbyout, rmc.Output)\n\n\tfi := make(map[string]bool)\n\tfor _,f := range rmc.Files {\n\t\tfi[f.Path] = true\n\t}\n\troot := new(rmake.DepTreeNode)\n\troot.Result = rmc.Output\n\troot.Type = rmake.TBuild\n\terr := root.Build(final.Deps, jobbyout, fi)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn root,nil\n}", "func LoadBTree(\n\tctx context.Context,\n\tobjStore *objstore.ObjectStore,\n\tencConf pbobject.EncryptionConfig,\n\trootRef *storageref.StorageRef,\n) (*BTree, error) {\n\tctx = objstore.WithObjStore(ctx, objStore)\n\trootNod := &Root{}\n\tif err := rootRef.FollowRef(ctx, nil, rootNod, nil); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbt := &BTree{\n\t\tobjStore: objStore,\n\t\trootNod: rootNod,\n\t\trootNodRef: rootRef,\n\t\tencConf: encConf,\n\t\tfreeList: sync.Pool{New: func() interface{} { return &Node{} }},\n\t}\n\n\trootMemNode, err := bt.followNodeRef(rootNod.GetRootNodeRef())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbt.root = rootMemNode\n\n\treturn bt, nil\n}", "func (ld *loader) refine(response *driverResponse) ([]*Package, error) {\n\troots := response.Roots\n\trootMap := make(map[string]int, len(roots))\n\tfor i, root := range roots {\n\t\trootMap[root] = i\n\t}\n\tld.pkgs = make(map[string]*loaderPackage)\n\t// first pass, fixup and build the map and roots\n\tvar initial = make([]*loaderPackage, len(roots))\n\tfor _, pkg := range response.Packages {\n\t\trootIndex := -1\n\t\tif i, found := rootMap[pkg.ID]; found {\n\t\t\trootIndex = i\n\t\t}\n\n\t\t// Overlays can invalidate export data.\n\t\t// TODO(matloob): make this check fine-grained based on dependencies on overlaid files\n\t\texportDataInvalid := len(ld.Overlay) > 0 || pkg.ExportFile == \"\" && pkg.PkgPath != \"unsafe\"\n\t\t// This package needs type information if the caller requested types and the package is\n\t\t// either a root, or it's a non-root and the user requested dependencies ...\n\t\tneedtypes := (ld.Mode&NeedTypes|NeedTypesInfo != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0))\n\t\t// This package needs source if the call requested source (or types info, which implies source)\n\t\t// and the package is either a root, or itas a non- root and the user requested dependencies...\n\t\tneedsrc := ((ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0)) ||\n\t\t\t// ... or if we need types and the exportData is invalid. We fall back to (incompletely)\n\t\t\t// typechecking packages from source if they fail to compile.\n\t\t\t(ld.Mode&(NeedTypes|NeedTypesInfo) != 0 && exportDataInvalid)) && pkg.PkgPath != \"unsafe\"\n\t\tlpkg := &loaderPackage{\n\t\t\tPackage: pkg,\n\t\t\tneedtypes: needtypes,\n\t\t\tneedsrc: needsrc,\n\t\t\tgoVersion: response.GoVersion,\n\t\t}\n\t\tld.pkgs[lpkg.ID] = lpkg\n\t\tif rootIndex >= 0 {\n\t\t\tinitial[rootIndex] = lpkg\n\t\t\tlpkg.initial = true\n\t\t}\n\t}\n\tfor i, root := range roots {\n\t\tif initial[i] == nil {\n\t\t\treturn nil, fmt.Errorf(\"root package %v is missing\", root)\n\t\t}\n\t}\n\n\t// Materialize the import graph.\n\n\tconst (\n\t\twhite = 0 // new\n\t\tgrey = 1 // in progress\n\t\tblack = 2 // complete\n\t)\n\n\t// visit traverses the import graph, depth-first,\n\t// and materializes the graph as Packages.Imports.\n\t//\n\t// Valid imports are saved in the Packages.Import map.\n\t// Invalid imports (cycles and missing nodes) are saved in the importErrors map.\n\t// Thus, even in the presence of both kinds of errors, the Import graph remains a DAG.\n\t//\n\t// visit returns whether the package needs src or has a transitive\n\t// dependency on a package that does. These are the only packages\n\t// for which we load source code.\n\tvar stack []*loaderPackage\n\tvar visit func(lpkg *loaderPackage) bool\n\tvar srcPkgs []*loaderPackage\n\tvisit = func(lpkg *loaderPackage) bool {\n\t\tswitch lpkg.color {\n\t\tcase black:\n\t\t\treturn lpkg.needsrc\n\t\tcase grey:\n\t\t\tpanic(\"internal error: grey node\")\n\t\t}\n\t\tlpkg.color = grey\n\t\tstack = append(stack, lpkg) // push\n\t\tstubs := lpkg.Imports // the structure form has only stubs with the ID in the Imports\n\t\t// If NeedImports isn't set, the imports fields will all be zeroed out.\n\t\tif ld.Mode&NeedImports != 0 {\n\t\t\tlpkg.Imports = make(map[string]*Package, len(stubs))\n\t\t\tfor importPath, ipkg := range stubs {\n\t\t\t\tvar importErr error\n\t\t\t\timp := ld.pkgs[ipkg.ID]\n\t\t\t\tif imp == nil {\n\t\t\t\t\t// (includes package \"C\" when DisableCgo)\n\t\t\t\t\timportErr = fmt.Errorf(\"missing package: %q\", ipkg.ID)\n\t\t\t\t} else if imp.color == grey {\n\t\t\t\t\timportErr = fmt.Errorf(\"import cycle: %s\", stack)\n\t\t\t\t}\n\t\t\t\tif importErr != nil {\n\t\t\t\t\tif lpkg.importErrors == nil {\n\t\t\t\t\t\tlpkg.importErrors = make(map[string]error)\n\t\t\t\t\t}\n\t\t\t\t\tlpkg.importErrors[importPath] = importErr\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif visit(imp) {\n\t\t\t\t\tlpkg.needsrc = true\n\t\t\t\t}\n\t\t\t\tlpkg.Imports[importPath] = imp.Package\n\t\t\t}\n\t\t}\n\t\tif lpkg.needsrc {\n\t\t\tsrcPkgs = append(srcPkgs, lpkg)\n\t\t}\n\t\tif ld.Mode&NeedTypesSizes != 0 {\n\t\t\tlpkg.TypesSizes = ld.sizes\n\t\t}\n\t\tstack = stack[:len(stack)-1] // pop\n\t\tlpkg.color = black\n\n\t\treturn lpkg.needsrc\n\t}\n\n\tif ld.Mode&NeedImports == 0 {\n\t\t// We do this to drop the stub import packages that we are not even going to try to resolve.\n\t\tfor _, lpkg := range initial {\n\t\t\tlpkg.Imports = nil\n\t\t}\n\t} else {\n\t\t// For each initial package, create its import DAG.\n\t\tfor _, lpkg := range initial {\n\t\t\tvisit(lpkg)\n\t\t}\n\t}\n\tif ld.Mode&NeedImports != 0 && ld.Mode&NeedTypes != 0 {\n\t\tfor _, lpkg := range srcPkgs {\n\t\t\t// Complete type information is required for the\n\t\t\t// immediate dependencies of each source package.\n\t\t\tfor _, ipkg := range lpkg.Imports {\n\t\t\t\timp := ld.pkgs[ipkg.ID]\n\t\t\t\timp.needtypes = true\n\t\t\t}\n\t\t}\n\t}\n\t// Load type data and syntax if needed, starting at\n\t// the initial packages (roots of the import DAG).\n\tif ld.Mode&NeedTypes != 0 || ld.Mode&NeedSyntax != 0 {\n\t\tvar wg sync.WaitGroup\n\t\tfor _, lpkg := range initial {\n\t\t\twg.Add(1)\n\t\t\tgo func(lpkg *loaderPackage) {\n\t\t\t\tld.loadRecursive(lpkg)\n\t\t\t\twg.Done()\n\t\t\t}(lpkg)\n\t\t}\n\t\twg.Wait()\n\t}\n\n\tresult := make([]*Package, len(initial))\n\tfor i, lpkg := range initial {\n\t\tresult[i] = lpkg.Package\n\t}\n\tfor i := range ld.pkgs {\n\t\t// Clear all unrequested fields,\n\t\t// to catch programs that use more than they request.\n\t\tif ld.requestedMode&NeedName == 0 {\n\t\t\tld.pkgs[i].Name = \"\"\n\t\t\tld.pkgs[i].PkgPath = \"\"\n\t\t}\n\t\tif ld.requestedMode&NeedFiles == 0 {\n\t\t\tld.pkgs[i].GoFiles = nil\n\t\t\tld.pkgs[i].OtherFiles = nil\n\t\t\tld.pkgs[i].IgnoredFiles = nil\n\t\t}\n\t\tif ld.requestedMode&NeedEmbedFiles == 0 {\n\t\t\tld.pkgs[i].EmbedFiles = nil\n\t\t}\n\t\tif ld.requestedMode&NeedEmbedPatterns == 0 {\n\t\t\tld.pkgs[i].EmbedPatterns = nil\n\t\t}\n\t\tif ld.requestedMode&NeedCompiledGoFiles == 0 {\n\t\t\tld.pkgs[i].CompiledGoFiles = nil\n\t\t}\n\t\tif ld.requestedMode&NeedImports == 0 {\n\t\t\tld.pkgs[i].Imports = nil\n\t\t}\n\t\tif ld.requestedMode&NeedExportFile == 0 {\n\t\t\tld.pkgs[i].ExportFile = \"\"\n\t\t}\n\t\tif ld.requestedMode&NeedTypes == 0 {\n\t\t\tld.pkgs[i].Types = nil\n\t\t\tld.pkgs[i].Fset = nil\n\t\t\tld.pkgs[i].IllTyped = false\n\t\t}\n\t\tif ld.requestedMode&NeedSyntax == 0 {\n\t\t\tld.pkgs[i].Syntax = nil\n\t\t}\n\t\tif ld.requestedMode&NeedTypesInfo == 0 {\n\t\t\tld.pkgs[i].TypesInfo = nil\n\t\t}\n\t\tif ld.requestedMode&NeedTypesSizes == 0 {\n\t\t\tld.pkgs[i].TypesSizes = nil\n\t\t}\n\t\tif ld.requestedMode&NeedModule == 0 {\n\t\t\tld.pkgs[i].Module = nil\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func (info *Info) BuildFromFilePath(root string) (err error) {\n\tinfo.Name = filepath.Base(root)\n\tinfo.Files = nil\n\terr = filepath.Walk(root, func(path string, fi os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif fi.IsDir() {\n\t\t\t// Directories are implicit in torrent files.\n\t\t\treturn nil\n\t\t} else if path == root {\n\t\t\t// The root is a file.\n\t\t\tinfo.Length = fi.Size()\n\t\t\treturn nil\n\t\t}\n\t\trelPath, err := filepath.Rel(root, path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error getting relative path: %s\", err)\n\t\t}\n\t\tinfo.Files = append(info.Files, FileInfo{\n\t\t\tPath: strings.Split(relPath, string(filepath.Separator)),\n\t\t\tLength: fi.Size(),\n\t\t})\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\tslices.Sort(info.Files, func(l, r FileInfo) bool {\n\t\treturn strings.Join(l.Path, \"/\") < strings.Join(r.Path, \"/\")\n\t})\n\terr = info.GeneratePieces(func(fi FileInfo) (io.ReadCloser, error) {\n\t\treturn os.Open(filepath.Join(root, strings.Join(fi.Path, string(filepath.Separator))))\n\t})\n\tif err != nil {\n\t\terr = fmt.Errorf(\"error generating pieces: %s\", err)\n\t}\n\treturn\n}", "func GetJarDeps(path string) (map[string]string, error) {\n\tlog.Debugf(\"GetJarDeps %s\", path)\n\tgathered := make(map[string]string)\n\n\tjar, err := jargo.GetJarInfo(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, j := range jar.Files {\n\t\tidx := strings.LastIndex(j, \"@\")\n\n\t\tif idx == -1 || idx+1 > len(j) {\n\t\t\tgathered[j] = \"\"\n\t\t} else {\n\t\t\tgathered[j[:idx]] = j[idx+1:]\n\t\t}\n\t}\n\treturn gathered, nil\n}", "func (i *Interface) parseDependencies() {\n\tvar dependencies []string\n\tfor _, function := range i.Functions {\n\n\t\t// \"expanded\" refers to creating a parsers.from a templated type, i.e \"QMap <int, QString>\" becomes [QMap int QString]\n\t\texpandedReturnType := strings.FieldsFunc(function.ReturnType, templatedTypeSeparators) \n\t\tfor _, dataType := range(expandedReturnType) {\n\t\t\tdependencies = append(dependencies, strings.TrimSpace(dataType))\n\t\t}\n\n\t\tfor _, parameter := range function.Parameters {\n\t\t\texpandedParameter := strings.FieldsFunc(parameter.Type, templatedTypeSeparators)\n\t\t\tfor _, innerParameter := range expandedParameter {\n\t\t\t\tdependencies = append(dependencies, strings.TrimSpace(innerParameter))\n\t\t\t} \n\t\t}\n\t}\n\ti.Dependencies = dependencies\n\ti.Dependencies = parsers.RemoveConstSpecifiers(i.Dependencies)\n\ti.Dependencies = parsers.RemovePointersAndReferences(i.Dependencies)\n\ti.Dependencies = parsers.RemoveStdDataTypes(i.Dependencies)\n\ti.Dependencies = parsers.MapDataTypesToLibraryDependencies(i.Dependencies)\n\ti.Dependencies = parsers.RemoveDuplicates(i.Dependencies)\n\tsort.Strings(i.Dependencies)\n}", "func loadV2JsonPb(data []byte) (*core.Config, error) {\n\tcoreconf := &core.Config{}\n\tjsonpbloader := &protojson.UnmarshalOptions{Resolver: anyresolverv2{serial.GetResolver()}, AllowPartial: true}\n\terr := jsonpbloader.Unmarshal(data, &V2JsonProtobufFollower{coreconf.ProtoReflect()})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn coreconf, nil\n}", "func Parse(repoRoot, path string) (_ *Deployment, err error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"open the deploy file: %w\", err)\n\t}\n\tdefer func() {\n\t\tcErr := f.Close()\n\t\tif err == nil {\n\t\t\terr = cErr\n\t\t}\n\t}()\n\n\tname := filepath.Dir(path)\n\n\tdc := Deployment{\n\t\tMain: name,\n\t}\n\terr = yaml.NewDecoder(f).Decode(&dc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse the deploy file: %w\", err)\n\t}\n\n\treturn &dc, nil\n}", "func LoadWithKin(specPath string) *openapi3.Swagger {\n\tloader := openapi3.NewSwaggerLoader()\n\tloader.IsExternalRefsAllowed = true\n\toa3, err := loader.LoadSwaggerFromFile(specPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn oa3\n}", "func decodeAndRetrieveOutputs(\n\tfile *hcl.File,\n\tfilename string,\n\tterragruntOptions *options.TerragruntOptions,\n\textensions EvalContextExtensions,\n) (*cty.Value, error) {\n\tdecodedDependency := terragruntDependency{}\n\terr := decodeHcl(file, filename, &decodedDependency, terragruntOptions, extensions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn dependencyBlocksToCtyValue(decodedDependency.Dependencies, terragruntOptions)\n}", "func (m *Map) traversePath(path string, updateValue interface{}, createPaths bool) (interface{}, error) {\n\tpath = strings.TrimPrefix(path, \"/\")\n\tcomponents := strings.Split(path, \"/\")\n\n\tLog.Debug.Printf(\"Traversing path %v with value %v\", path, updateValue)\n\n\tif len(components) == 1 && components[0] == \"\" && updateValue != nil {\n\t\t// Complete replacement of root map, updateValue must be a generic map\n\t\t*m = Map(updateValue.(map[string]interface{}))\n\t\treturn m, nil\n\t}\n\n\tvar lastIndex = len(components) - 1\n\n\tref := *m\n\tvar child interface{} = nil\n\n\tfor i, component := range components {\n\t\tvar ok bool\n\n\t\tif component == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"Empty component encountered in path %v\", path)\n\t\t}\n\n\t\tisUpdate := updateValue != nil\n\n\t\tif i == lastIndex && isUpdate {\n\t\t\tLog.Debug.Printf(\"Updating component %v value %+v\", component, updateValue)\n\n\t\t\tvar jsonUpdateValue = updateValue\n\t\t\tif updateValue == Nil {\n\t\t\t\tjsonUpdateValue = nil\n\t\t\t} else if updateValue == Remove {\n\t\t\t\tdelete(ref, component)\n\t\t\t\treturn Remove, nil\n\t\t\t}\n\n\t\t\tref[component] = jsonUpdateValue\n\t\t\treturn ref[component], nil\n\t\t} else {\n\t\t\tchild, ok = ref[component]\n\t\t\t// Error if this child is not found\n\t\t\tif !ok {\n\t\t\t\tif createPaths && isUpdate {\n\t\t\t\t\tLog.Debug.Printf(\"Creating path for component %v\", component)\n\t\t\t\t\tnewPath := map[string]interface{}{}\n\t\t\t\t\tref[component] = newPath\n\t\t\t\t\tref = newPath\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Child component %v of path %v not found\", component, path)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif i == lastIndex && !isUpdate {\n\t\t\t\t// Return the queried value\n\t\t\t\tLog.Debug.Printf(\"Returning query value %+v\", child)\n\t\t\t\treturn child, nil\n\t\t\t}\n\n\t\t\t// Keep going - child must be a map to enable further traversal\n\t\t\tref, ok = child.(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Child component %v of path %v is not a map\", component, path)\n\t\t\t}\n\t\t}\n\t}\n\n\t// XXX Shouldn't get here\n\treturn nil, fmt.Errorf(\"Unexpected return from TraversePath %v\", path)\n}", "func (self *SassDependencyResolver) shallowResolve(path string) ([]string, error) {\n\tdeps, ok := self.shallowDeps[path]\n\n\tif ok {\n\t\treturn deps, nil\n\t}\n\n\t// Get the file contents\n\tcontents, err := self.filecache.Get(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Build the matches\n\tmatches := importPattern.FindAllSubmatch(contents, -1)\n\tdeps = make([]string, len(matches))\n\n\tfor i, match := range matches {\n\t\tref := string(match[3])\n\t\trefPath, err := resolveRefPath(filepath.Dir(path), ref)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdeps[i] = refPath\n\t}\n\n\tself.shallowDeps[path] = deps\n\treturn deps, nil\n}", "func ParseBuildSpec(filePath string) (bs BuildSpec, err error) {\n\tcontents, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\treturn bs, err\n\t}\n\n\terr = yaml.Unmarshal(contents, &bs)\n\tif err != nil {\n\t\treturn bs, err\n\t}\n\n\treturn bs, nil\n}", "func parseTopLevel(fset *token.FileSet, buf *Buffer) (*ast.File, error) {\n\tsrc := []byte(\"package p\\n\" + buf.String())\n\treturn parser.ParseFile(fset, \"<input>\", src, parser.DeclarationErrors|parser.ParseComments)\n}", "func ParsePods(jsonFile string) (configStruct kapiv1.Pod) {\n\tconfigFile, err := ioutil.ReadFile(jsonFile)\n\tif err != nil {\n\t\tframework.Failf(\"Cant read pod config file. Error: %v\", err)\n\t}\n\n\terr = json.Unmarshal(configFile, &configStruct)\n\tif err != nil {\n\t\te2e.Failf(\"Unable to unmarshal pod config. Error: %v\", err)\n\t}\n\n\te2e.Logf(\"The loaded config file is: %+v\", configStruct.Spec.Containers)\n\treturn\n}", "func ProtoMavenRuntimeLibraryToDependencyConfig(proto *registryv1alpha1.MavenConfig_RuntimeLibrary) bufpluginconfig.MavenDependencyConfig {\n\treturn bufpluginconfig.MavenDependencyConfig{\n\t\tGroupID: proto.GetGroupId(),\n\t\tArtifactID: proto.GetArtifactId(),\n\t\tVersion: proto.GetVersion(),\n\t\tClassifier: proto.GetClassifier(),\n\t\tExtension: proto.GetExtension(),\n\t}\n}", "func resolveExternalDependenciesForModule(module *TerraformModule, moduleMap map[string]*TerraformModule, terragruntOptions *options.TerragruntOptions, chilTerragruntConfig *config.TerragruntConfig) (map[string]*TerraformModule, error) {\n\tif module.Config.Dependencies == nil || len(module.Config.Dependencies.Paths) == 0 {\n\t\treturn map[string]*TerraformModule{}, nil\n\t}\n\n\texternalTerragruntConfigPaths := []string{}\n\tfor _, dependency := range module.Config.Dependencies.Paths {\n\t\tdependencyPath, err := util.CanonicalPath(dependency, module.Path)\n\t\tif err != nil {\n\t\t\treturn map[string]*TerraformModule{}, err\n\t\t}\n\n\t\tterragruntConfigPath := config.GetDefaultConfigPath(dependencyPath)\n\t\tif _, alreadyContainsModule := moduleMap[dependencyPath]; !alreadyContainsModule {\n\t\t\texternalTerragruntConfigPaths = append(externalTerragruntConfigPaths, terragruntConfigPath)\n\t\t}\n\t}\n\n\thowThesePathsWereFound := fmt.Sprintf(\"dependency of module at '%s'\", module.Path)\n\treturn resolveModules(externalTerragruntConfigPaths, terragruntOptions, chilTerragruntConfig, howThesePathsWereFound)\n}", "func (service *Service) GetServiceDef(path string) error {\n\tfilePath := service.ServiceFilePath(path)\n\traw, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjson.Unmarshal(raw, &service)\n\treturn nil\n}", "func UnmarshalChartfile(data []byte) (*chart.Metadata, error) {\n\ty := &chart.Metadata{}\n\terr := yaml.Unmarshal(data, y)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn y, nil\n}", "func InfoFromPath(configFilePath string) (*Info, error) {\n\tconfigSpecDir := filepath.Dir(configFilePath)\n\trepo := filepath.Base(configSpecDir)\n\tif repo == \".\" || repo == \"/\" {\n\t\treturn nil, fmt.Errorf(\"could not extract repo from '%s' (expected path like '.../ORG/REPO/ORGANIZATION-COMPONENT-BRANCH.yaml\", configFilePath)\n\t}\n\n\torg := filepath.Base(filepath.Dir(configSpecDir))\n\tif org == \".\" || org == \"/\" {\n\t\treturn nil, fmt.Errorf(\"could not extract org from '%s' (expected path like '.../ORG/REPO/ORGANIZATION-COMPONENT-BRANCH.yaml\", configFilePath)\n\t}\n\n\tfileName := filepath.Base(configFilePath)\n\ts := strings.TrimSuffix(fileName, filepath.Ext(configFilePath))\n\tbranch := strings.TrimPrefix(s, fmt.Sprintf(\"%s-%s-\", org, repo))\n\n\tvar variant string\n\tif i := strings.LastIndex(branch, \"__\"); i != -1 {\n\t\tvariant = branch[i+2:]\n\t\tbranch = branch[:i]\n\t}\n\n\treturn &Info{\n\t\tMetadata: cioperatorapi.Metadata{\n\t\t\tOrg: org,\n\t\t\tRepo: repo,\n\t\t\tBranch: branch,\n\t\t\tVariant: variant,\n\t\t},\n\t\tFilename: configFilePath,\n\t\tOrgPath: filepath.Dir(configSpecDir),\n\t\tRepoPath: configSpecDir,\n\t}, nil\n}", "func (t *importTree) ConfigTree() (*configTree, error) {\n\tconfig, err := t.Raw.Config()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"Error loading %s: %s\",\n\t\t\tt.Path,\n\t\t\terr)\n\t}\n\n\t// Build our result\n\tresult := &configTree{\n\t\tPath: t.Path,\n\t\tConfig: config,\n\t}\n\n\t// Build the config trees for the children\n\tresult.Children = make([]*configTree, len(t.Children))\n\tfor i, ct := range t.Children {\n\t\tt, err := ct.ConfigTree()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresult.Children[i] = t\n\t}\n\n\treturn result, nil\n}", "func parsePath(path string, fset *token.FileSet) (map[string]*ast.Package, 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\n\tvar pkgs map[string]*ast.Package // Assigned in either of two branches below.\n\n\tif info.IsDir() {\n\t\tpkgs, err = parser.ParseDir(fset, path, nil, 0)\n\t\tif err != nil {\n\t\t\treturn nil, wrapErr(\"failed to parse directory\", err)\n\t\t}\n\t} else {\n\t\tfile, err := parser.ParseFile(fset, path, nil, 0)\n\t\tif err != nil {\n\t\t\treturn nil, wrapErr(\"failed to parse file\", err)\n\t\t}\n\t\tpkg := &ast.Package{\n\t\t\tName: file.Name.Name,\n\t\t\tFiles: map[string]*ast.File{\n\t\t\t\tfilepath.Base(path): file,\n\t\t\t},\n\t\t}\n\t\tpkgs = map[string]*ast.Package{pkg.Name: pkg}\n\t}\n\n\treturn pkgs, nil\n}", "func findFileInDeps(s MetadataSource, m *Metadata, uri span.URI) *Metadata {\n\tseen := make(map[PackageID]bool)\n\tvar search func(*Metadata) *Metadata\n\tsearch = func(m *Metadata) *Metadata {\n\t\tif seen[m.ID] {\n\t\t\treturn nil\n\t\t}\n\t\tseen[m.ID] = true\n\t\tfor _, cgf := range m.CompiledGoFiles {\n\t\t\tif cgf == uri {\n\t\t\t\treturn m\n\t\t\t}\n\t\t}\n\t\tfor _, dep := range m.DepsByPkgPath {\n\t\t\tm := s.Metadata(dep)\n\t\t\tif m == nil {\n\t\t\t\tbug.Reportf(\"nil metadata for %q\", dep)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif found := search(m); found != nil {\n\t\t\t\treturn found\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\treturn search(m)\n}", "func MergeSwaggerDoc(currentPaths []*Path, config *Config, doc *loads.Document, validateCapturedSegments bool, pathPrefix string) ([]*Path, error) {\n\tallPaths, err := GetPathsFromSwagger(doc, config, pathPrefix)\n\tif err != nil {\n\t\tempty := []*Path{}\n\t\treturn empty, err // TODO add context to errors!\n\t}\n\treturn MergeSwaggerPaths(currentPaths, config, allPaths, validateCapturedSegments, pathPrefix)\n}", "func ParseTfmConfigs(workdirDir string) (string, error) {\n\tvar versionString string\n\tconfigRootSchema := &hcl.BodySchema{\n\t\tBlocks: []hcl.BlockHeaderSchema{\n\t\t\t{\n\t\t\t\tType: \"terraform\",\n\t\t\t},\n\t\t},\n\t}\n\tconfigFileVersionSniffBlockSchema := &hcl.BodySchema{\n\t\tAttributes: []hcl.AttributeSchema{\n\t\t\t{\n\t\t\t\tName: \"required_version\",\n\t\t\t},\n\t\t},\n\t}\n\tmatches, _ := filepath.Glob(fmt.Sprintf(\"%s/*.tf\", workdirDir))\n\tfor _, path := range matches {\n\t\tif src, err := ioutil.ReadFile(path); err == nil {\n\t\t\tfile, _ := hclparse.NewParser().ParseHCL(src, path)\n\t\t\tif file == nil || file.Body == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trootContent, _, _ := file.Body.PartialContent(configRootSchema)\n\t\t\tfor _, block := range rootContent.Blocks {\n\t\t\t\tcontent, _, _ := block.Body.PartialContent(configFileVersionSniffBlockSchema)\n\t\t\t\tattr, exists := content.Attributes[\"required_version\"]\n\t\t\t\tif !exists || len(versionString) > 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tval, diags := attr.Expr.Value(nil)\n\t\t\t\tif diags.HasErrors() {\n\t\t\t\t\terr = fmt.Errorf(\"Error in attribute value\")\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\tversionString = val.AsString()\n\t\t\t}\n\t\t}\n\t}\n\tif versionString == \"\" {\n\t\tversionString = DefaultConstraint\n\t}\n\treturn versionString, nil\n}", "func pkgDeps(imports pkgMap, pkg *ast.Package) {\n\tfor _, file := range pkg.Files {\n\t\tfor _, imp := range file.Imports {\n\t\t\timportPath := importPath(imp)\n\t\t\tif _, ok := imports[importPath]; ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tpdir := importDir(importPath)\n\t\t\tif pdir != \"\" {\n\t\t\t\tfpkg, err := getFuelPkg(pdir)\n\t\t\t\tif err != nil {\n\t\t\t\t\tprintErr(efmt(\"%v: %v\", importPath, err))\n\t\t\t\t}\n\n\t\t\t\timports[importPath] = fpkg\n\t\t\t\tif fpkg != nil && err == nil {\n\t\t\t\t\tpkgDeps(imports, fpkg.pkg.Package)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\timports[importPath] = nil\n\t\t\t}\n\t\t}\n\t}\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tif len(data) == 0 || data == \"[]\" {\n\t\treturn nil\n\t}\n\n\tarray := strings.Split(data, \",\")\n\tmaps := make(map[int64]int)\n\n\tfor _, v := range array {\n\t\tkeyValueArray := strings.Split(v, \":\")\n\t\tindex, _ := strconv.ParseInt(keyValueArray[0], 10, 64)\n\t\tvalue, _ := strconv.Atoi(keyValueArray[1])\n\t\tmaps[index] = value\n\t}\n\n\troot := TreeNode{\n\t\tVal: maps[1],\n\t\tRight: innerDeserialize(&maps, 3),\n\t\tLeft: innerDeserialize(&maps, 2),\n\t}\n\n\treturn &root\n}", "func CalTree(data [][]byte) {\r\n\tvar Root Node\r\n\tRoot.GenerateRoot(data, true)\r\n}", "func (v *Validator) getSchemaByRef(uri string) (json.Value, json.Value, error) {\n\tu, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to parse %q: %s\", uri, err)\n\t}\n\ts, ref := v.schema, u.Fragment\n\n\tif !strings.HasPrefix(uri, \"#\") {\n\t\tu.Fragment = \"\"\n\t\turi := u.String()\n\t\ts, err = v.loader.Get(uri)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\n\tr, err := resolveRef(s, ref)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to resolve ref %q: %s\", uri, err)\n\t}\n\treturn r, s, nil\n}", "func GetApplicationDefinition(filePath string) (*v2.ApplicationDefinition, []byte, error) {\n\tinfo, err := os.Stat(filePath)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar buffer []byte\n\tif info.IsDir() {\n\t\t_, content, err := resolveYamlOrJSON(path.Join(filePath, filepath.Base(filePath)))\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tbuffer = content\n\t} else {\n\t\treturn nil, nil, fmt.Errorf(\"looking for directory, found %s\", info.Name())\n\t}\n\tapi, err := extractAppDefinition(buffer)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn api, buffer, nil\n}", "func parseTerragruntConfigFile(configPath string) (*TerragruntConfig, error) {\n\tbytes, err := ioutil.ReadFile(configPath)\n\tif err != nil {\n\t\treturn nil, errors.WithStackTraceAndPrefix(err, \"Error reading Terragrunt config file %s\", configPath)\n\t}\n\n\tconfig, err := parseTerragruntConfig(string(bytes))\n\tif err != nil {\n\t\treturn nil, errors.WithStackTraceAndPrefix(err, \"Error parsing Terragrunt config file %s\", configPath)\n\t}\n\n\treturn config, nil\n}", "func (*GetSignedMapRootByRevisionRequest) Descriptor() ([]byte, []int) {\n\treturn file_trillian_map_api_proto_rawDescGZIP(), []int{15}\n}", "func OapiValidatorFromYamlFile(path string) (fiber.Handler, error) {\n\n\tdata, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading %s: %s\", path, err)\n\t}\n\n\tswagger, err := openapi3.NewLoader().LoadFromData(data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing %s as Swagger YAML: %s\",\n\t\t\tpath, err)\n\t}\n\n\treturn OapiRequestValidator(swagger), nil\n}", "func (d DownloadCacheLayer) Metadata(root string) string {\n\treturn filepath.Join(root, \"dependency.toml\")\n}", "func ParseConfigFile(configPath string) (map[string][]dns.RR, error) {\n\tconf, err := ioutil.ReadFile(configPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar dat map[string][]string\n\tif err := json.Unmarshal(conf, &dat); err == nil {\n\t\treturn ParseDNSRecordsMap(dat)\n\t} else {\n\t\treturn nil, err\n\t}\n}", "func ParseDockerRef(ref string) (Named, error) {\n\tnamed, err := ParseNormalizedNamed(ref)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, ok := named.(NamedTagged); ok {\n\t\tif canonical, ok := named.(Canonical); ok {\n\t\t\t// The reference is both tagged and digested, only\n\t\t\t// return digested.\n\t\t\tnewNamed, err := WithName(canonical.Name())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnewCanonical, err := WithDigest(newNamed, canonical.Digest())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn newCanonical, nil\n\t\t}\n\t}\n\treturn TagNameOnly(named), nil\n}", "func (p *Parser) Parse(_ string, fileContent []byte) ([]model.Document, error) {\n\tvar documents []model.Document\n\tcom, err := dockerfile.ParseReader(bytes.NewReader(fileContent))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to parse Dockerfile\")\n\t}\n\n\tdoc := &model.Document{}\n\n\tvar resource Resource\n\tresource.CommandList = com\n\n\tj, err := json.Marshal(resource)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to Marshal Dockerfile\")\n\t}\n\n\tif err := json.Unmarshal(j, &doc); err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to Unmarshal Dockerfile\")\n\t}\n\n\tdocuments = append(documents, *doc)\n\n\treturn documents, nil\n}", "func (d *Dao) Tree(c context.Context, token string) (data interface{}, err error) {\n\tvar (\n\t\treq *http.Request\n\t\ttmp map[string]interface{}\n\t\tok bool\n\t)\n\tif req, err = http.NewRequest(\"GET\", dataURI, nil); err != nil {\n\t\tlog.Error(\"Status url(%s) error(%v)\", dataURI, err)\n\t\treturn\n\t}\n\treq.Header.Set(\"X-Authorization-Token\", token)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tvar res struct {\n\t\tCode int `json:\"code\"`\n\t\tData map[string]map[string]interface{} `json:\"data\"`\n\t\tMessage string `json:\"message\"`\n\t\tStatus int `json:\"status\"`\n\t}\n\tif err = d.client.Do(c, req, &res); err != nil {\n\t\tlog.Error(\"d.Status url(%s) res($s) err(%v)\", dataURI, res, err)\n\t\treturn\n\t}\n\tif res.Code != 90000 {\n\t\terr = fmt.Errorf(\"error code :%d\", res.Code)\n\t\tlog.Error(\"Status url(%s) res(%v)\", dataURI, res)\n\t\treturn\n\t}\n\tif tmp, ok = res.Data[\"bilibili\"]; ok {\n\t\tdata, ok = tmp[\"children\"]\n\t}\n\tif !ok {\n\t\terr = ecode.NothingFound\n\t}\n\treturn\n}", "func dependencyBlocksToCtyValue(dependencyConfigs []Dependency, terragruntOptions *options.TerragruntOptions) (*cty.Value, error) {\n\tpaths := []string{}\n\t// dependencyMap is the top level map that maps dependency block names to the encoded version, which includes\n\t// various attributes for accessing information about the target config (including the module outputs).\n\tdependencyMap := map[string]cty.Value{}\n\n\tfor _, dependencyConfig := range dependencyConfigs {\n\t\t// Loose struct to hold the attributes of the dependency. This includes:\n\t\t// - outputs: The module outputs of the target config\n\t\tdependencyEncodingMap := map[string]cty.Value{}\n\n\t\t// Encode the outputs and nest under `outputs` attribute\n\t\tpaths = append(paths, dependencyConfig.ConfigPath)\n\t\toutputVal, err := getTerragruntOutput(dependencyConfig, terragruntOptions)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdependencyEncodingMap[\"outputs\"] = *outputVal\n\n\t\t// Once the dependency is encoded into a map, we need to conver to a cty.Value again so that it can be fed to\n\t\t// the higher order dependency map.\n\t\tdependencyEncodingMapEncoded, err := gocty.ToCtyValue(dependencyEncodingMap, generateTypeFromValuesMap(dependencyEncodingMap))\n\t\tif err != nil {\n\t\t\terr = TerragruntOutputListEncodingError{Paths: paths, Err: err}\n\t\t}\n\n\t\t// Finally, feed the encoded dependency into the higher order map under the block name\n\t\tdependencyMap[dependencyConfig.Name] = dependencyEncodingMapEncoded\n\t}\n\n\t// We need to convert the value map to a single cty.Value at the end so that it can be used in the execution context\n\tconvertedOutput, err := gocty.ToCtyValue(dependencyMap, generateTypeFromValuesMap(dependencyMap))\n\tif err != nil {\n\t\terr = TerragruntOutputListEncodingError{Paths: paths, Err: err}\n\t}\n\treturn &convertedOutput, errors.WithStackTrace(err)\n}", "func (t *Tables) FileTree() filetree.FileTree { return t }" ]
[ "0.44742846", "0.4455825", "0.43550068", "0.43006805", "0.4232624", "0.41817617", "0.40636328", "0.40288898", "0.39767098", "0.39680606", "0.39440867", "0.3909975", "0.38882518", "0.38842115", "0.38663462", "0.3862431", "0.38287383", "0.38224056", "0.3783585", "0.37813827", "0.37639192", "0.37486592", "0.37433174", "0.37286022", "0.3721877", "0.37083578", "0.36979386", "0.36836642", "0.367974", "0.36631432", "0.3647026", "0.36445725", "0.36437666", "0.3635032", "0.3634338", "0.3632871", "0.3626514", "0.36227846", "0.36211073", "0.3613153", "0.36109856", "0.36097935", "0.36097935", "0.36082813", "0.36025965", "0.35987264", "0.35921654", "0.35903168", "0.35890982", "0.358801", "0.3573279", "0.35724053", "0.35707882", "0.35627824", "0.356094", "0.3560749", "0.35465425", "0.35431337", "0.35431337", "0.35403985", "0.352545", "0.3518159", "0.35102183", "0.35057622", "0.35049734", "0.3502346", "0.349671", "0.3492842", "0.3492825", "0.34811604", "0.34708306", "0.34683165", "0.3460186", "0.345218", "0.34519652", "0.34502313", "0.34495205", "0.34470445", "0.3446722", "0.34420782", "0.34382278", "0.34367344", "0.3434756", "0.34338874", "0.34322926", "0.3430879", "0.3426195", "0.34184948", "0.341566", "0.34151047", "0.34125984", "0.34099418", "0.34054303", "0.34028476", "0.3398432", "0.33951178", "0.33941945", "0.33895996", "0.33881992", "0.33871156" ]
0.8142745
0
MarshalToYAML marshals a MagmaSwaggerSpec to a YAMLformatted string.
MarshalToYAML сериализует MagmaSwaggerSpec в строку в формате YAML.
func (m *MagmaSwaggerSpec) MarshalToYAML() (string, error) { d, err := yaml.Marshal(&m) if err != nil { return "", err } return string(d), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d LegacyDec) MarshalYAML() (interface{}, error) {\n\treturn d.String(), nil\n}", "func (c *Components) MarshalYAML() (interface{}, error) {\n\tnb := high.NewNodeBuilder(c, c.low)\n\treturn nb.Render(), nil\n}", "func (f Fixed8) MarshalYAML() (interface{}, error) {\n\treturn f.String(), nil\n}", "func (p *Parameter) MarshalYAML() (interface{}, error) {\n\tnb := high.NewNodeBuilder(p, p.low)\n\treturn nb.Render(), nil\n}", "func (r ParseKind) MarshalYAML() ([]byte, error) {\n\tif s, ok := interface{}(r).(fmt.Stringer); ok {\n\t\treturn yaml.Marshal(s.String())\n\t}\n\ts, ok := _ParseKindValueToName[r]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid ParseKind: %d\", r)\n\t}\n\treturn yaml.Marshal(s)\n}", "func (s *Spec020) Marshal() ([]byte, error) {\n\treturn yaml.Marshal(s)\n}", "func (p Params) MarshalYAML() (interface{}, error) {\n\treturn p.String(), nil\n}", "func (r *Regexp) MarshalYAML() (interface{}, error) {\n\treturn r.String(), nil\n}", "func (ep Endpoint) MarshalYAML() (interface{}, error) {\n\ts, err := ep.toString()\n\treturn s, err\n}", "func (re Regexp) MarshalYAML() (interface{}, error) {\n\tif re.original != \"\" {\n\t\treturn re.original, nil\n\t}\n\treturn nil, nil\n}", "func (re Regexp) MarshalYAML() (interface{}, error) {\n\tif re.original != \"\" {\n\t\treturn re.original, nil\n\t}\n\treturn nil, nil\n}", "func (schema SchemaType) MarshalYAML() (interface{}, error) {\n\treturn schema.String(), nil\n}", "func (a ApprovalStrategy) MarshalYAML() (interface{}, error) {\n\treturn approvalStrategyToString[a], nil\n\t//buffer := bytes.NewBufferString(`\"`)\n\t//buffer.WriteString(approvalStrategyToString[*s])\n\t//buffer.WriteString(`\"`)\n\t//return buffer.Bytes(), nil\n}", "func (s GitEvent) MarshalYAML() (interface{}, error) {\n\treturn toString[s], nil\n}", "func (d Rate) MarshalYAML() (interface{}, error) {\n\treturn d.String(), nil\n}", "func (i UOM) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}", "func (o *OAuthFlow) MarshalYAML() (interface{}, error) {\n\tnb := high.NewNodeBuilder(o, o.low)\n\treturn nb.Render(), nil\n}", "func (d Duration) MarshalYAML() (interface{}, error) {\n\treturn d.String(), nil\n}", "func (o Op) MarshalYAML() (interface{}, error) {\n\treturn map[string]interface{}{\n\t\to.Type(): o.OpApplier,\n\t}, nil\n}", "func (u *URL) MarshalYAML() (interface{}, error) {\n\treturn u.String(), nil\n}", "func (i ChannelName) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}", "func specYAMLToJSON(specContent []byte) []byte {\n\tspecMap := make(map[string]interface{})\n\t// check if the content is already json\n\terr := json.Unmarshal(specContent, &specMap)\n\tif err == nil {\n\t\treturn specContent\n\t}\n\n\t// check if the content is already yaml\n\terr = yaml.Unmarshal(specContent, &specMap)\n\tif err != nil {\n\t\t// Not yaml, nothing more to be done\n\t\treturn specContent\n\t}\n\n\ttranscoded, err := yaml.YAMLToJSON(specContent)\n\tif err != nil {\n\t\t// Not json encodeable, nothing more to be done\n\t\treturn specContent\n\t}\n\treturn transcoded\n}", "func (s String) MarshalYAML() (interface{}, error) {\n\tif !s.IsPresent() {\n\t\treturn nil, nil\n\t}\n\treturn s.value, nil\n}", "func (v Validator) MarshalYAML() (interface{}, error) {\n\tbs, err := yaml.Marshal(struct {\n\t\tStatus sdk.BondStatus\n\t\tJailed bool\n\t\tUnbondingHeight int64\n\t\tConsPubKey string\n\t\tOperatorAddress sdk.ValAddress\n\t\tTokens sdk.Int\n\t\tDelegatorShares sdk.Dec\n\t\tDescription Description\n\t\tUnbondingCompletionTime time.Time\n\t\tCommission Commission\n\t\tMinSelfDelegation sdk.Dec\n\t}{\n\t\tOperatorAddress: v.OperatorAddress,\n\t\tConsPubKey: MustBech32ifyConsPub(v.ConsPubKey),\n\t\tJailed: v.Jailed,\n\t\tStatus: v.Status,\n\t\tTokens: v.Tokens,\n\t\tDelegatorShares: v.DelegatorShares,\n\t\tDescription: v.Description,\n\t\tUnbondingHeight: v.UnbondingHeight,\n\t\tUnbondingCompletionTime: v.UnbondingCompletionTime,\n\t\tCommission: v.Commission,\n\t\tMinSelfDelegation: v.MinSelfDelegation,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn string(bs), nil\n}", "func (f Flag) MarshalYAML() (interface{}, error) {\n\treturn f.Name, nil\n}", "func (key PrivateKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}", "func (m OrderedMap[K, V]) MarshalYAML() ([]byte, error) {\n\tvar s yaml.MapSlice\n\tfor _, item := range m.ToSlice() {\n\t\ts = append(s, yaml.MapItem{\n\t\t\tKey: item.Key,\n\t\t\tValue: item.Value,\n\t\t})\n\t}\n\treturn yaml.Marshal(s)\n}", "func (b *Backend) MarshalYAML() (interface{}, error) {\n\tb.mu.RLock()\n\tdefer b.mu.RUnlock()\n\n\tpayload := struct {\n\t\tAddress string\n\t\tDisabledUntil time.Time `yaml:\"disabledUntil\"`\n\t\tForcePromotionsAfter time.Duration `yaml:\"forcePromotionsAfter\"`\n\t\tLatency time.Duration `yaml:\"latency\"`\n\t\tMaxConnections int `yaml:\"maxConnections\"`\n\t\tTier int `yaml:\"tier\"`\n\t}{\n\t\tAddress: b.addr.String(),\n\t\tDisabledUntil: b.mu.disabledUntil,\n\t\tForcePromotionsAfter: b.mu.forcePromotionAfter,\n\t\tLatency: b.mu.lastLatency,\n\t\tMaxConnections: b.mu.maxConnections,\n\t\tTier: b.mu.tier,\n\t}\n\treturn payload, nil\n}", "func (m MixinDeclaration) MarshalYAML() (interface{}, error) {\n\tif m.Config == nil {\n\t\treturn m.Name, nil\n\t}\n\n\traw := map[string]interface{}{\n\t\tm.Name: m.Config,\n\t}\n\treturn raw, nil\n}", "func (m *BootstrapMode) MarshalYAML() (interface{}, error) {\n\treturn m.String(), nil\n}", "func (s Secret) MarshalYAML() (interface{}, error) {\n\tif s != \"\" {\n\t\treturn \"<secret>\", nil\n\t}\n\treturn nil, nil\n}", "func (s Secret) MarshalYAML() (interface{}, error) {\n\tif s != \"\" {\n\t\treturn \"<secret>\", nil\n\t}\n\treturn nil, nil\n}", "func (d Duration) MarshalYAML() (interface{}, error) {\n\treturn d.Duration.String(), nil\n}", "func (d *DefaultOptions) MarshalYAML() (interface{}, error) {\n\treturn util.MarshalYAMLWithDescriptions(d)\n}", "func ExportYAMLForSpec(ctx context.Context, client *gapic.RegistryClient, message *rpc.Spec) {\n\tprintDocAsYaml(docForMapping(exportSpec(ctx, client, message)))\n}", "func (z Z) MarshalYAML() (interface{}, error) {\n\ttype Z struct {\n\t\tS string `json:\"s\"`\n\t\tI int32 `json:\"iVal\"`\n\t\tHash string\n\t\tMultiplyIByTwo int64 `json:\"multipliedByTwo\"`\n\t}\n\tvar enc Z\n\tenc.S = z.S\n\tenc.I = z.I\n\tenc.Hash = z.Hash()\n\tenc.MultiplyIByTwo = int64(z.MultiplyIByTwo())\n\treturn &enc, nil\n}", "func MarshalMetricsYAML(metrics pmetric.Metrics) ([]byte, error) {\n\tunmarshaler := &pmetric.JSONMarshaler{}\n\tfileBytes, err := unmarshaler.MarshalMetrics(metrics)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar jsonVal map[string]interface{}\n\tif err = json.Unmarshal(fileBytes, &jsonVal); err != nil {\n\t\treturn nil, err\n\t}\n\tb := &bytes.Buffer{}\n\tenc := yaml.NewEncoder(b)\n\tenc.SetIndent(2)\n\tif err := enc.Encode(jsonVal); err != nil {\n\t\treturn nil, err\n\t}\n\treturn b.Bytes(), nil\n}", "func (v *VersionInfo) MarshalYAML() (interface{}, error) {\n\n\treturn &struct {\n\t\tSemVer string `yaml:\"semver\"`\n\t\tShaLong string `yaml:\"shaLong\"`\n\t\tBuildTimestamp int64 `yaml:\"buildTimestamp\"`\n\t\tBranch string `yaml:\"branch\"`\n\t\tArch string `yaml:\"arch\"`\n\t}{\n\t\tSemVer: v.SemVer,\n\t\tShaLong: v.ShaLong,\n\t\tBuildTimestamp: v.BuildTimestamp.Unix(),\n\t\tBranch: v.Branch,\n\t\tArch: v.Arch,\n\t}, nil\n}", "func (r OAuthFlow) MarshalYAML() (interface{}, error) {\n\tobj := make(map[string]interface{})\n\n\tobj[\"authorizationUrl\"] = r.AuthorizationURL\n\n\tobj[\"tokenUrl\"] = r.TokenURL\n\n\tif r.RefreshURL != \"\" {\n\t\tobj[\"refreshUrl\"] = r.RefreshURL\n\t}\n\n\tobj[\"scopes\"] = r.Scopes\n\n\tfor key, val := range r.Extensions {\n\t\tobj[key] = val\n\t}\n\n\treturn obj, nil\n}", "func (d *WebAuthnDevice) MarshalYAML() (any, error) {\n\treturn d.ToData(), nil\n}", "func (s String) MarshalYAML() (interface{}, error) {\n\tif len(string(s)) == 0 || string(s) == `\"\"` {\n\t\treturn nil, nil\n\t}\n\treturn string(s), nil\n}", "func (bc *ByteCount) MarshalYAML() (interface{}, error) {\n\treturn uint64(AtomicLoadByteCount(bc)), nil\n}", "func (u *URL) MarshalYAML() (interface{}, error) {\n\tif u.url == nil {\n\t\treturn nil, nil\n\t}\n\treturn u.url.String(), nil\n}", "func (i Instance) MarshalYAML() (interface{}, error) {\n\treturn i.Vars, nil\n}", "func (f BodyField) MarshalYAML() (interface{}, error) {\n\treturn toJSONDot(f), nil\n}", "func Marshal(v interface{}) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tenc := yaml.NewEncoder(&buf)\n\tenc.SetIndent(2)\n\terr := enc.Encode(v)\n\treturn buf.Bytes(), err\n}", "func (ss StdSignature) MarshalYAML() (interface{}, error) {\n\tpk := \"\"\n\tif ss.PubKey != nil {\n\t\tpk = ss.PubKey.String()\n\t}\n\n\tbz, err := yaml.Marshal(struct {\n\t\tPubKey string `json:\"pub_key\"`\n\t\tSignature string `json:\"signature\"`\n\t}{\n\t\tpk,\n\t\tfmt.Sprintf(\"%X\", ss.Signature),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn string(bz), err\n}", "func (v *Int8) MarshalYAML() (interface{}, error) {\n\tif v.IsAssigned {\n\t\treturn v.Val, nil\n\t}\n\treturn nil, nil\n}", "func (u URL) MarshalYAML() (interface{}, error) {\n\tif u.URL != nil {\n\t\treturn u.String(), nil\n\t}\n\treturn nil, nil\n}", "func (d Document) MarshalYAML() (interface{}, error) {\n\treturn d.raw, nil\n}", "func configSpecToYaml(configSpec opv1alpha1.NetworkAddonsConfigSpec) string {\n\tmanifest, err := yaml.Marshal(configSpec)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tmanifestLines := strings.Split(string(manifest), \"\\n\")\n\n\t// We don't want to show non-set (default) values, usually null. Try our best to filter those out.\n\tmanifestLinesWithoutEmptyValues := []string{}\n\tfor _, line := range manifestLines {\n\t\t// If root attribute (e.g. ImagePullPolicy) is set to default, drop it. If it\n\t\t// is a nested attribute (e.g. KubeMacPool's RangeEnd), keep it.\n\t\trootAttributeSetToDefault := !strings.Contains(line, \" \") && (strings.Contains(line, \": \\\"\\\"\") || strings.Contains(line, \": null\"))\n\t\tif line != \"\" && !rootAttributeSetToDefault {\n\t\t\tmanifestLinesWithoutEmptyValues = append(manifestLinesWithoutEmptyValues, line)\n\t\t}\n\t}\n\n\t// If any values has been set, return Spec in a nice YAML format\n\tif len(manifestLinesWithoutEmptyValues) > 0 {\n\t\tindentedManifest := strings.TrimSpace(strings.Join(manifestLinesWithoutEmptyValues, \"\\n\"))\n\t\treturn indentedManifest\n\t}\n\n\t// Note that it is empty otherwise\n\treturn \"Empty Spec\"\n}", "func (o *OpenAPI3SchemaExtension) MarshalYAML() (interface{}, error) {\n\treturn util.MarshalYAMLWithDescriptions(o)\n}", "func (n Nil) MarshalYAML() (interface{}, error) {\n\treturn nil, nil\n}", "func (d DurationMillis) MarshalYAML() (interface{}, error) {\n\tif !d.IsPresent() {\n\t\treturn nil, nil\n\t}\n\treturn int(d.value / time.Millisecond), nil\n}", "func (export WebAuthnDeviceExport) MarshalYAML() (any, error) {\n\treturn export.ToData(), nil\n}", "func (i Interface) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}", "func (op OpRemove) MarshalYAML() (interface{}, error) {\n\treturn op.Field.String(), nil\n}", "func (o *Output) MarshalYAML() (interface{}, error) {\n\tif o.ShowValue {\n\t\treturn withvalue(*o), nil\n\t}\n\to.Value = nil // explicitly make empty\n\to.Sensitive = false // explicitly make empty\n\treturn *o, nil\n}", "func (r RetryConfig) MarshalYAML() (interface{}, error) {\n\tdummy := dummyRetryConfig{\n\t\tOutput: r.Output,\n\t\tConfig: r.Config,\n\t}\n\tif r.Output == nil {\n\t\tdummy.Output = struct{}{}\n\t}\n\treturn dummy, nil\n}", "func (o *OpenAPI3Options) MarshalYAML() (interface{}, error) {\n\treturn util.MarshalYAMLWithDescriptions(o)\n}", "func (d DurationMinutes) MarshalYAML() (interface{}, error) {\n\tif !d.IsPresent() {\n\t\treturn nil, nil\n\t}\n\treturn int(d.value / time.Minute), nil\n}", "func (v *Uint16) MarshalYAML() (interface{}, error) {\n\tif v.IsAssigned {\n\t\treturn v.Val, nil\n\t}\n\treturn nil, nil\n}", "func (b ByteCount) MarshalYAML() (interface{}, error) {\n\treturn uint64(b), nil\n}", "func (date Date) MarshalYAML() (interface{}, error) {\n\tvar d = string(date)\n\tif err := checkDateFormat(d); err != nil {\n\t\treturn nil, err\n\t}\n\treturn d, nil\n}", "func (op OpFlatten) MarshalYAML() (interface{}, error) {\n\treturn op.Field.String(), nil\n}", "func (c CompressionType) MarshalYAML() (interface{}, error) {\n\treturn compressionTypeID[c], nil\n}", "func MarshalYAML(v interface{}, extensions map[string]interface{}) (interface{}, error) {\n\tif len(extensions) == 0 {\n\t\treturn v, nil\n\t}\n\tmarshaled, err := yaml.Marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar unmarshaled map[string]interface{}\n\tif err := yaml.Unmarshal(marshaled, &unmarshaled); err != nil {\n\t\treturn nil, err\n\t}\n\tfor k, v := range extensions {\n\t\tunmarshaled[k] = v\n\t}\n\treturn unmarshaled, nil\n}", "func (key PublicKey) MarshalYAML() (interface{}, error) {\n\treturn key.String(), nil\n}", "func (o *OpenAPI3PathExtension) MarshalYAML() (interface{}, error) {\n\treturn util.MarshalYAMLWithDescriptions(o)\n}", "func (d *Discriminator) MarshalYAML() (interface{}, error) {\n\tnb := low2.NewNodeBuilder(d, d.low)\n\treturn nb.Render(), nil\n}", "func (r ReadUntilConfig) MarshalYAML() (interface{}, error) {\n\tdummy := dummyReadUntilConfig{\n\t\tInput: r.Input,\n\t\tRestart: r.Restart,\n\t\tCheck: r.Check,\n\t}\n\tif r.Input == nil {\n\t\tdummy.Input = struct{}{}\n\t}\n\treturn dummy, nil\n}", "func (p *ServiceDefinition) Marshal() (string, error) {\n\toutput, err := yaml.Marshal(p)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(output), nil\n}", "func (f Float64) MarshalYAML() (interface{}, error) {\n\tif !f.IsPresent() {\n\t\treturn nil, nil\n\t}\n\treturn f.value, nil\n}", "func ParseAppSpecToYaml(appSpec *godo.AppSpec) ([]byte, error) {\n\tnewYaml, err := yaml.Marshal(appSpec)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Error in building yaml\")\n\t}\n\treturn newYaml, nil\n}", "func (i UserGroupAccess) MarshalYAML() (interface{}, error) {\n\treturn i.String(), nil\n}", "func (ec EllipticCurve) MarshalYAML() (interface{}, error) {\n\treturn ec.String(), nil\n}", "func (op OpRetain) MarshalYAML() (interface{}, error) {\n\treturn op.Fields, nil\n}", "func SPrintYAML(a interface{}) (string, error) {\n\tb, err := MarshalJSON(a)\n\t// doing yaml this way because at times you have nested proto structs\n\t// that need to be cleaned.\n\tyam, err := yamlconv.JSONToYAML(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(yam), nil\n}", "func (s *spiff) Marshal(node Node) ([]byte, error) {\n\treturn yaml.Marshal(node)\n}", "func (o *OpenAPI3ResponseExtension) MarshalYAML() (interface{}, error) {\n\treturn util.MarshalYAMLWithDescriptions(o)\n}", "func (s SensitiveString) MarshalYAML() (interface{}, error) {\n\treturn s.String(), nil\n}", "func Marshal(o interface{}) ([]byte, error) {\n\tj, err := json.Marshal(o)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling into JSON: %v\", err)\n\t}\n\n\ty, err := JSONToYAML(j)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error converting JSON to YAML: %v\", err)\n\t}\n\n\treturn y, nil\n}", "func MarshalToYaml(obj runtime.Object, gv schema.GroupVersion) ([]byte, error) {\n\treturn MarshalToYamlForCodecs(obj, gv, clientsetscheme.Codecs)\n}", "func (i Int) MarshalYAML() (interface{}, error) {\n\tif !i.IsPresent() {\n\t\treturn nil, nil\n\t}\n\treturn i.value, nil\n}", "func (b Bool) MarshalYAML() (interface{}, error) {\n\tif !b.IsPresent() {\n\t\treturn nil, nil\n\t}\n\treturn b.value, nil\n}", "func (vm ValidationMap) AsYAML() (string, error) {\n\tdata, err := yaml.Marshal(vm)\n\treturn string(data), err\n}", "func MarshalToYamlForCodecs(obj runtime.Object, gv schema.GroupVersion, codecs serializer.CodecFactory) ([]byte, error) {\n\tconst mediaType = runtime.ContentTypeYAML\n\tinfo, ok := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), mediaType)\n\tif !ok {\n\t\treturn []byte{}, errors.Errorf(\"unsupported media type %q\", mediaType)\n\t}\n\n\tencoder := codecs.EncoderForVersion(info.Serializer, gv)\n\treturn runtime.Encode(encoder, obj)\n}", "func ProtoToYAML(m protoreflect.ProtoMessage) ([]byte, error) {\n\tmarshalOptions := protojson.MarshalOptions{\n\t\tUseProtoNames: true,\n\t}\n\tconfigJSON, err := marshalOptions.Marshal(m)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Error marshaling proto to JSON\")\n\t\treturn nil, err\n\t}\n\n\tconfigYAML, err := yaml.JSONToYAML(configJSON)\n\tif err != nil {\n\t\tlog.Error().Err(err).Msgf(\"Error converting JSON to YAML\")\n\t\treturn nil, err\n\t}\n\treturn configYAML, err\n}", "func NewSpec(yamlConfig string) (*Spec, error) {\n\ts := &Spec{\n\t\tyamlConfig: yamlConfig,\n\t}\n\n\tmeta := &MetaSpec{}\n\terr := yaml.Unmarshal([]byte(yamlConfig), meta)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal failed: %v\", err)\n\t}\n\tvr := v.Validate(meta, []byte(yamlConfig))\n\tif !vr.Valid() {\n\t\treturn nil, fmt.Errorf(\"validate metadata failed: \\n%s\", vr)\n\t}\n\n\trootObject, exists := objectRegistry[meta.Kind]\n\tif !exists {\n\t\treturn nil, fmt.Errorf(\"kind %s not found\", meta.Kind)\n\t}\n\n\ts.meta, s.objectSpec = meta, rootObject.DefaultSpec()\n\n\terr = yaml.Unmarshal([]byte(yamlConfig), s.objectSpec)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal failed: %v\", err)\n\t}\n\tvr = v.Validate(s.objectSpec, []byte(yamlConfig))\n\tif !vr.Valid() {\n\t\treturn nil, fmt.Errorf(\"validate spec failed: \\n%s\", vr)\n\t}\n\n\treturn s, nil\n}", "func (d DurationSeconds) MarshalYAML() (interface{}, error) {\n\tif !d.IsPresent() {\n\t\treturn nil, nil\n\t}\n\n\treturn int(d.value / time.Second), nil\n}", "func Marshal(ds interface{}, spec *Spec) (buf *bytes.Buffer) {\n\tMap(buf, ds, spec)\n\treturn\n}", "func (i *Info) YAMLString() string {\n\treturn marshal.SafeYAML(i.ctx, netPrinter{i})\n}", "func (k *Kluster) YAML() ([]byte, error) {\n\treturn yaml.Marshal(k)\n}", "func MarshalYAMLWithDescriptions(val interface{}) (interface{}, error) {\n\ttp := reflect.TypeOf(val)\n\tif tp.Kind() == reflect.Ptr {\n\t\ttp = tp.Elem()\n\t}\n\n\tif tp.Kind() != reflect.Struct {\n\t\treturn nil, fmt.Errorf(\"only structs are supported\")\n\t}\n\n\tv := reflect.ValueOf(val)\n\tif v.Kind() == reflect.Ptr {\n\t\tv = v.Elem()\n\t}\n\n\tb, err := yaml.Marshal(v.Interface())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar node yaml.Node\n\terr = yaml.Unmarshal(b, &node)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !DisableYAMLMarshalComments {\n\t\tfor _, n := range node.Content[0].Content {\n\t\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\t\tfieldType := tp.Field(i)\n\t\t\t\tname := strings.Split(fieldType.Tag.Get(\"yaml\"), \",\")[0]\n\n\t\t\t\tif name == \"\" {\n\t\t\t\t\tname = fieldType.Name\n\t\t\t\t}\n\n\t\t\t\tif n.Value == name {\n\t\t\t\t\tdesc := fieldType.Tag.Get(\"description\")\n\t\t\t\t\tn.HeadComment = wordwrap.WrapString(desc, 80) + \".\"\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\n\tnode.Kind = yaml.MappingNode\n\tnode.Content = node.Content[0].Content\n\n\treturn &node, nil\n}", "func (s *Spec) YAMLConfig() string {\n\treturn s.yamlConfig\n}", "func Marshal(ctx context.Context, obj interface{}, paths ...string) (string, error) {\n\trequestYaml, err := yaml.MarshalContext(ctx, obj)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfile, err := parser.ParseBytes(requestYaml, 0)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// normalize the structure converting the byte slice fields to string\n\tfor _, path := range paths {\n\t\tpathString, err := yaml.PathString(path)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tvar byteSlice []byte\n\t\terr = pathString.Read(strings.NewReader(string(requestYaml)), &byteSlice)\n\t\tif err != nil && !errors.Is(err, yaml.ErrNotFoundNode) {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif err := pathString.ReplaceWithReader(file,\n\t\t\tstrings.NewReader(string(byteSlice)),\n\t\t); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn file.String(), nil\n}", "func (pva PeriodicVestingAccount) MarshalYAML() (interface{}, error) {\n\taccAddr, err := sdk.AccAddressFromBech32(pva.Address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := vestingAccountYAML{\n\t\tAddress: accAddr,\n\t\tAccountNumber: pva.AccountNumber,\n\t\tPubKey: getPKString(pva),\n\t\tSequence: pva.Sequence,\n\t\tOriginalVesting: pva.OriginalVesting,\n\t\tDelegatedFree: pva.DelegatedFree,\n\t\tDelegatedVesting: pva.DelegatedVesting,\n\t\tEndTime: pva.EndTime,\n\t\tStartTime: pva.StartTime,\n\t\tVestingPeriods: pva.VestingPeriods,\n\t}\n\treturn marshalYaml(out)\n}", "func (cp *CertPool) MarshalYAML() (interface{}, error) {\n\treturn cp.Files, nil\n}", "func (c *Config) YAML() ([]byte, error) {\n\treturn yaml.Marshal(c)\n}", "func (c Configuration) YAML() ([]byte, error) {\n\treturn yaml.Marshal(c)\n}" ]
[ "0.6445463", "0.6326264", "0.63029575", "0.63027453", "0.6261498", "0.6249017", "0.6187328", "0.6172001", "0.61505026", "0.6124385", "0.6124385", "0.60929036", "0.6092049", "0.6075512", "0.6065055", "0.6051939", "0.60301274", "0.6030115", "0.59681195", "0.5957629", "0.5953704", "0.5945245", "0.59346616", "0.5909714", "0.5906009", "0.59037775", "0.5888819", "0.58877563", "0.58747125", "0.5853025", "0.5847595", "0.5847595", "0.5839862", "0.583814", "0.57943624", "0.57855004", "0.57724804", "0.5764962", "0.575372", "0.5744729", "0.5737275", "0.5733952", "0.5727749", "0.57028157", "0.5699345", "0.5690758", "0.56791556", "0.5663087", "0.5655797", "0.5628871", "0.5624484", "0.56092685", "0.55970806", "0.55577993", "0.5537346", "0.55356485", "0.55245644", "0.5509427", "0.55083025", "0.55067366", "0.55059403", "0.5491867", "0.5478284", "0.5471918", "0.5466596", "0.5452316", "0.54491645", "0.5448204", "0.5445538", "0.5419312", "0.54036134", "0.5380504", "0.53796977", "0.53733927", "0.53657824", "0.5339991", "0.5335069", "0.5323552", "0.5321177", "0.53053194", "0.529901", "0.5292113", "0.5282602", "0.52774143", "0.52687675", "0.52466124", "0.52345896", "0.52194", "0.5203625", "0.5148877", "0.5118096", "0.5096668", "0.50576216", "0.50437355", "0.5042614", "0.50336516", "0.5029468", "0.50288075", "0.5007143", "0.50058573" ]
0.77819127
0
/ The function NewObjectLength calls NewUnaryFunctionBase to create a function named OBJECT_LENGTH with an expression as input.
Функция NewObjectLength вызывает NewUnaryFunctionBase для создания функции с именем OBJECT_LENGTH и выражением в качестве входных данных.
func NewObjectLength(operand Expression) Function { rv := &ObjectLength{ *NewUnaryFunctionBase("object_length", operand), } rv.expr = rv return rv }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (o *FakeObject) Length() int { return reflect.ValueOf(o.Value).Len() }", "func (String) Length(c *compiler.Compiler, this compiler.Expression) (expression compiler.Expression) {\n\texpression = c.NewExpression()\n\texpression.Type = Integer{}\n\texpression.Go.WriteString(`ctx.CountString(`)\n\texpression.Go.WriteB(this.Go)\n\texpression.Go.WriteString(`)`)\n\treturn expression\n}", "func (this *ObjectLength) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\treturn value.NewValue(float64(len(oa))), nil\n}", "func (this *ObjectLength) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\treturn value.NewValue(float64(len(oa))), nil\n}", "func builtinLen(args ...Object) (Object, error) {\n\tif len(args) != 1 {\n\t\treturn nil, ErrWrongNumArguments\n\t}\n\tswitch arg := args[0].(type) {\n\tcase *Array:\n\t\treturn &Int{Value: int64(len(arg.Value))}, nil\n\tcase *String:\n\t\treturn &Int{Value: int64(len(arg.Value))}, nil\n\tcase *Bytes:\n\t\treturn &Int{Value: int64(len(arg.Value))}, nil\n\tcase *Map:\n\t\treturn &Int{Value: int64(len(arg.Value))}, nil\n\tdefault:\n\t\treturn nil, ErrInvalidArgumentType{\n\t\t\tName: \"first\",\n\t\t\tExpected: \"array/string/bytes/map\",\n\t\t\tFound: arg.TypeName(),\n\t\t}\n\t}\n}", "func (object Object) Length() int {\n\treturn len(object)\n}", "func BlobLength32() LengthTypeInstance {\n return &blobLength32{}\n}", "func (this *ObjectLength) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectLength) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func EvalLength(ev *Evaluator, node *ast.CallExpr) (r *ISEXP) {\n\tTRACE := ev.Trace\n\tif TRACE {\n\t\tprintln(\"Length\")\n\t}\n\tex := node.Args[0]\n\tswitch ex.(type) {\n\tcase *ast.IndexExpr:\n\t\titerator := EvalIndexExpressionToIterator(ev, ex.(*ast.IndexExpr).Index)\n\t\treturn &ISEXP{ValuePos: node.Fun.Pos(), Integer: iterator.Length()}\n\tdefault:\n\t\tval := EvalExpr(ev, node.Args[0])\n\t\treturn &ISEXP{ValuePos: node.Fun.Pos(), Integer: val.Length()}\n\t}\n}", "func BlobLength64() LengthTypeInstance {\n return &blobLength64{}\n}", "func (sequence Sequence) Length(c *Compiler, this Expression) (expression Expression) {\n\treturn SequenceLength(c, this)\n}", "func BlobLength16() LengthTypeInstance {\n return &blobLength16{}\n}", "func (b *Builder) Length() *Builder {\n\tb.p.RegisterTransformation(impl.Length())\n\treturn b\n}", "func Len(obj string, length int, a ...any) {\n\tl := len(obj)\n\n\tif l != length {\n\t\tdefMsg := fmt.Sprintf(assertionMsg+\": got '%d', want '%d'\", l, length)\n\t\tDefault().reportAssertionFault(defMsg, a...)\n\t}\n}", "func len(v Type) int32 {}", "func BlobLength8() LengthTypeInstance {\n return &blobLength8{}\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (p Path) Length(reference, value interface{}) Path { return p.with(Length, reference, value) }", "func JSONObjLen(conn redis.Conn, key, path string) (res interface{}, err error) {\n\tname, args, _ := CommandBuilder(\"JSON.OBJLEN\", key, path)\n\treturn conn.Do(name, args...)\n}", "func ClosureNewObject(sizeofClosure uint32, object *Object) *Closure {\n\tc_sizeof_closure := (C.guint)(sizeofClosure)\n\n\tc_object := (*C.GObject)(C.NULL)\n\tif object != nil {\n\t\tc_object = (*C.GObject)(object.ToC())\n\t}\n\n\tretC := C.g_closure_new_object(c_sizeof_closure, c_object)\n\tretGo := ClosureNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "func (this *ObjectRemove) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectRemove(operands[0], operands[1])\n\t}\n}", "func NewRawDataLength(val int) RawDataLengthField {\n\treturn RawDataLengthField{quickfix.FIXInt(val)}\n}", "func (s *TestSuite) Len(object interface{}, length int, msgAndArgs ...interface{}) {\n\ts.Require().Len(object, length, msgAndArgs...)\n}", "func (this *ObjectLength) Type() value.Type { return value.NUMBER }", "func (this *ObjectLength) Type() value.Type { return value.NUMBER }", "func Length(min int, max int) BuiltInFieldRule {\n\treturn newLengthRule(MsgInvalidLengthFormat, &min, &max)\n}", "func (g *mapGen) genLen() {\n\tg.P(\"func (x *\", g.typeName, \") Len() int {\")\n\t// invalid map\n\tg.P(\"if x.m == nil {\")\n\tg.P(\"return 0\")\n\tg.P(\"}\")\n\t// valid map\n\tg.P(\"return len(*x.m)\")\n\tg.P(\"}\")\n\tg.P()\n}", "func length(i Instruction, ls *LuaState) {\n\ta, b, _ := i.ABC()\n\ta += 1\n\tb += 1\n\n\tluaLen(ls, b)\n\tluaReplace(ls, a)\n}", "func (jz *Jzon) Length() (l int, err error) {\n\tif jz.Type == JzTypeArr {\n\t\treturn len(jz.data.([]*Jzon)), nil\n\t}\n\n\tif jz.Type == JzTypeObj {\n\t\treturn len(jz.data.(map[string]*Jzon)), nil\n\t}\n\n\treturn -1, errors.New(\"expect node of type JzTypeArr or JzTypeObj\" +\n\t\t\", but the real type is \" + typeStrings[jz.Type])\n}", "func rcLength(p *TCompiler, code *TCode) (*value.Value, error) {\n\tvb := p.regGet(code.B)\n\tva := value.NewIntPtr(vb.Length())\n\tp.regSet(code.A, va)\n\tp.moveNext()\n\treturn va, nil\n}", "func (gdt *Vector3) Length() Real {\n\targ0 := gdt.getBase()\n\n\tret := C.go_godot_vector3_length(GDNative.api, arg0)\n\n\treturn Real(ret)\n}", "func (o Args) Len() int { return len(o) }", "func LengthModifier(i interface{}) (interface{}, error) {\n\tswitch v := i.(type) {\n\tcase string:\n\t\treturn len(v), nil\n\tcase float64:\n\t\t// TODO: this is not counting decimal portion\n\t\t// (probably because float error can make it really long for some values)\n\t\treturn getIntLength(int(v)), nil\n\tcase int:\n\t\treturn getIntLength(v), nil\n\tcase int64:\n\t\treturn getInt64Length(v), nil\n\tcase map[string]interface{}:\n\t\treturn len(v), nil\n\tcase []interface{}:\n\t\treturn len(v), nil\n\tcase []string:\n\t\treturn len(v), nil\n\tcase []int:\n\t\treturn len(v), nil\n\tcase []float64:\n\t\treturn len(v), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Invalid type (%v) for len()\", reflect.TypeOf(i))\n\t}\n}", "func Vec3Length(a Vec3) float32", "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func NewBodyLength(val int) BodyLengthField {\n\treturn BodyLengthField{quickfix.FIXInt(val)}\n}", "func (f *Fs) newObjectSizeAndNameOnly(o fs.Object, moName string, size int64) *Object {\n\treturn &Object{\n\t\tObject: o,\n\t\tf: f,\n\t\tmo: nil,\n\t\tmoName: moName,\n\t\tsize: size,\n\t\tmeta: nil,\n\t}\n}", "func (n Number) Length() int {\n\treturn 0\n}", "func (fn *formulaFuncs) LEN(argsList *list.List) formulaArg {\n\tif argsList.Len() != 1 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, \"LEN requires 1 string argument\")\n\t}\n\treturn newStringFormulaArg(strconv.Itoa(utf8.RuneCountInString(argsList.Front().Value.(formulaArg).String)))\n}", "func (this *ObjectLength) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectLength) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (*FunctionLength) Name() string {\n\treturn \"function-length\"\n}", "func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {\n\treturn Len(a.t, object, length, msgAndArgs...)\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func LengthOfValue(value interface{}) (int, error) {\n\tv := reflect.ValueOf(value)\n\tswitch v.Kind() {\n\tcase reflect.String, reflect.Slice, reflect.Map, reflect.Array:\n\t\treturn v.Len(), nil\n\t}\n\treturn 0, fmt.Errorf(\"cannot get the length of %v\", v.Kind())\n}", "func (t *dataType) Length(n int) *dataType {\n\tt.str.Length(n)\n\treturn t\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (_AccessIndexor *AccessIndexorCaller) GetContentObjectsLength(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _AccessIndexor.contract.Call(opts, &out, \"getContentObjectsLength\")\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 (f *PingFrame) Length(_ protocol.VersionNumber) protocol.ByteCount {\n\treturn 1\n}", "func (s newrelicByName) Len() int { return len(s) }", "func NewFileObject(obj *swift.ObjectOpenFile) (f *FileObject, err error) {\n\tf = &FileObject{obj: obj, loc: 0}\n\tf.length, err = obj.Length()\n\treturn f, err\n}", "func TestLen(t *testing.T) {\n\tv := New(1)\n\tv.Set(0, 2) // has length 2\n\tif v.Len() != 2 {\n\t\tt.Error(\"Len returned a wrong length\")\n\t}\n}", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewLuaObject(L *lua.State, idx int) *LuaObject {\n tp := L.LTypename(idx)\n L.PushValue(idx)\n ref := L.Ref(lua.LUA_REGISTRYINDEX)\n return &LuaObject{L, ref, tp}\n}", "func (t CreatableRenewers38) Size(version int16) int32 {\n\tvar sz int32\n\tsz += sizeof.String(t.PrincipalType) // PrincipalType\n\tsz += sizeof.String(t.PrincipalName) // PrincipalName\n\treturn sz\n}", "func Len(scope common.Scope, args ...interface{}) interface{} {\n\tif s, ok := args[0].(string); ok {\n\t\treturn int64(len(s))\n\t}\n\treturn 0\n}", "func (t DescribedDelegationTokenRenewer41) Size(version int16) int32 {\n\tvar sz int32\n\tsz += sizeof.String(t.PrincipalType) // PrincipalType\n\tsz += sizeof.String(t.PrincipalName) // PrincipalName\n\treturn sz\n}", "func NewSignatureLength(val int) SignatureLengthField {\n\treturn SignatureLengthField{quickfix.FIXInt(val)}\n}", "func fnLen(ctx Context, doc *JDoc, params []string) interface{} {\n\tstats := ctx.Value(EelTotalStats).(*ServiceStats)\n\tif params == nil || len(params) != 1 {\n\t\tctx.Log().Error(\"error_type\", \"func_len\", \"op\", \"len\", \"cause\", \"wrong_number_of_parameters\", \"params\", params)\n\t\tstats.IncErrors()\n\t\tAddError(ctx, SyntaxError{fmt.Sprintf(\"wrong number of parameters in call to len function\"), \"len\", params})\n\t\treturn nil\n\t}\n\tvar obj interface{}\n\terr := json.Unmarshal([]byte(extractStringParam(params[0])), &obj)\n\tif err != nil {\n\t\treturn len(extractStringParam(params[0]))\n\t}\n\tswitch obj.(type) {\n\tcase []interface{}:\n\t\treturn len(obj.([]interface{}))\n\tcase map[string]interface{}:\n\t\treturn len(obj.(map[string]interface{}))\n\t}\n\treturn 0\n}", "func (d commandDefault) strlen(str string) string {\n\treturn markerLength + strconv.Itoa(len(str))\n}", "func (_BaseAccessControlGroup *BaseAccessControlGroupCaller) GetContentObjectsLength(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _BaseAccessControlGroup.contract.Call(opts, &out, \"getContentObjectsLength\")\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 (this *ObjectPut) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPut(operands[0], operands[1], operands[2])\n\t}\n}", "func NewObjectRemove(first, second Expression) Function {\n\trv := &ObjectRemove{\n\t\t*NewBinaryFunctionBase(\"object_remove\", first, second),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Argsize(t *Type) int", "func (b *Base) GetObjectSize(req *GetObjectSizeReq) (*GetObjectSizeResp, error) {\n\treturn nil, ErrFunctionNotSupported\n}", "func (jbobject *JavaLangCharSequence) Length() int {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"length\", javabind.Int)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret.(int)\n}", "func NewPattern(length int) Pattern {\n return Pattern{ length }\n}", "func (_BaseAccessWallet *BaseAccessWalletCaller) GetContentObjectsLength(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _BaseAccessWallet.contract.Call(opts, &out, \"getContentObjectsLength\")\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 (node *GoValueNode) Length() (int, error) {\n\tif node.IsArray() || node.IsMap() || node.IsString() {\n\n\t\treturn node.thisValue.Len(), nil\n\t}\n\n\treturn 0, fmt.Errorf(\"this node identified as \\\"%s\\\" is not referencing an array, slice, map or string\", node.IdentifiedAs())\n}", "func (hm HashMap) Len(ctx context.Context) (int64, error) {\n\treq := newRequest(\"*2\\r\\n$4\\r\\nHLEN\\r\\n$\")\n\treq.addString(hm.name)\n\treturn hm.c.cmdInt(ctx, req)\n}", "func (a *Arguments) Len() int {\n\treturn len(a.exprs)\n}", "func CompactLength() LengthTypeInstance {\n return &compactLength{}\n}", "func (jbobject *JavaNioCharBuffer) Length() int {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"length\", javabind.Int)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret.(int)\n}", "func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\treturn Len(t, object, length, append([]interface{}{msg}, args...)...)\n}", "func (*testObject) MaxHeaderLength() uint16 {\n\treturn 0\n}", "func (f *PathResponseFrame) Length(_ protocol.VersionNumber) protocol.ByteCount {\n\treturn 1 + 8\n}", "func (self *Rectangle) Size1O(output *Point) *Point{\n return &Point{self.Object.Call(\"size\", output)}\n}", "func Sizeof(objs ...interface{}) (sz uint64) {\n\tfor i := range objs {\n\t\tsz += sizeofInternal(reflect.ValueOf(objs[i]), false, 0)\n\t}\n\treturn\n}", "func Sizeof(objs ...interface{}) (sz uint64) {\n\tfor i := range objs {\n\t\tsz += sizeofInternal(reflect.ValueOf(objs[i]), false, 0)\n\t}\n\treturn\n}", "func length(v interface{}) (int, error) {\n\tswitch val := v.(type) {\n\tcase string:\n\t\treturn len(val), nil\n\tcase []interface{}:\n\t\treturn len(val), nil\n\tcase map[string]interface{}:\n\t\treturn len(val), nil\n\tdefault:\n\t\treturn -1, errors.New(\"invalid type for length\")\n\t}\n}", "func (p *PathOptions) length(b *sql.Builder) {\n\tswitch {\n\tcase b.Dialect() == dialect.Postgres:\n\t\tb.WriteString(\"JSONB_ARRAY_LENGTH(\")\n\t\tp.pgTextPath(b)\n\t\tb.WriteByte(')')\n\tcase b.Dialect() == dialect.MySQL:\n\t\tp.mysqlFunc(\"JSON_LENGTH\", b)\n\tdefault:\n\t\tp.mysqlFunc(\"JSON_ARRAY_LENGTH\", b)\n\t}\n}", "func (com *hornComponent) Length() int {\n\treturn 222\n}", "func (this *Dcmp0_Chunk_LiteralBody) LenLiteral() (v int, err error) {\n\tif (this._f_lenLiteral) {\n\t\treturn this.lenLiteral, nil\n\t}\n\ttmp20, err := this.LenLiteralDiv2()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tthis.lenLiteral = int((tmp20 * 2))\n\tthis._f_lenLiteral = true\n\treturn this.lenLiteral, nil\n}", "func (t *BaseType) GetLength(v *Value) int32 {\n\treturn -1\n}", "func (obj object) Len() int {\n\treturn len(obj.keys)\n}", "func Length(i interface{}) (l int, ok bool) {\n\tv, k := preprocess(i)\n\tswitch k {\n\tcase reflect.Map, reflect.Array, reflect.Slice, reflect.String:\n\t\treturn v.Len(), true\n\t}\n\treturn 0, false\n}", "func (objs objectList) Len() int { return len(objs) }", "func (a Vector3) Length() float32 {\n\treturn float32(math.Sqrt(float64(a.X*a.X + a.Y*a.Y + a.Z*a.Z)))\n}", "func (f *Fields) Len() int", "func (v Vector3) Length() float64 {\n\treturn math.Sqrt(math.Pow(float64(v.X), 2) + math.Pow(float64(v.Y), 2) + math.Pow(float64(v.Z), 2))\n}", "func (radius *RADIUS) Len() (int, error) {\n\tn := radiusMinimumRecordSizeInBytes\n\tfor _, v := range radius.Attributes {\n\t\talen, err := attributeValueLength(v.Value)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tn += int(alen) + 2 // Added Type and Length\n\t}\n\treturn n, nil\n}", "func (m *CommandLineOptions) GetMaxObjNameLen() uint64 {\n\tif m != nil {\n\t\treturn m.MaxObjNameLen\n\t}\n\treturn 0\n}", "func (geom Geometry) Length() float64 {\n\tlength := C.OGR_G_Length(geom.cval)\n\treturn float64(length)\n}", "func (a *AdditionalGUTI) GetLen() (len uint16) {}" ]
[ "0.6523122", "0.6523122", "0.5879528", "0.585225", "0.57606673", "0.57606673", "0.57047075", "0.56010866", "0.5507508", "0.5425705", "0.5425705", "0.5403266", "0.53994787", "0.53820825", "0.5202233", "0.5193633", "0.5174063", "0.5164767", "0.5130811", "0.5112785", "0.5112785", "0.51125306", "0.51115525", "0.5045999", "0.5038918", "0.5018331", "0.49812493", "0.4955568", "0.4955568", "0.4924533", "0.48879114", "0.48660207", "0.48533323", "0.48517218", "0.48263907", "0.48063627", "0.48034155", "0.4792094", "0.4780229", "0.47770116", "0.47691065", "0.47645834", "0.47495502", "0.47464165", "0.47464165", "0.47339308", "0.47307196", "0.47216335", "0.47206673", "0.47175813", "0.47097516", "0.47097516", "0.4685058", "0.46848637", "0.4682387", "0.46581316", "0.46441278", "0.46273196", "0.46230918", "0.4620884", "0.45957115", "0.45686087", "0.45605862", "0.45568487", "0.45346886", "0.4529132", "0.4521522", "0.45186362", "0.45169815", "0.44896385", "0.44877398", "0.44843918", "0.44839975", "0.4482648", "0.44656578", "0.4464855", "0.44646165", "0.44629568", "0.4455946", "0.4453374", "0.4453191", "0.44392055", "0.44374666", "0.44374666", "0.44315565", "0.44302744", "0.44215858", "0.4419121", "0.44136137", "0.44115245", "0.4408191", "0.43909854", "0.43904725", "0.43728906", "0.43645683", "0.4360508", "0.43554425", "0.4351833", "0.4349061" ]
0.84461415
1
/ The constructor returns a NewObjectLength with the an operand cast to a Function as the FunctionConstructor.
Конструктор возвращает NewObjectLength с операндом, приведенным к Function как FunctionConstructor.
func (this *ObjectLength) Constructor() FunctionConstructor { return func(operands ...Expression) Function { return NewObjectLength(operands[0]) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectRemove) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectRemove(operands[0], operands[1])\n\t}\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func (this *ObjectPut) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPut(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *DateAddMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *DateAddStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddStr(operands[0], operands[1], operands[2])\n\t}\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (this *DateDiffMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *DateDiffStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffStr(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *Mod) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewMod(operands[0], operands[1])\n\t}\n}", "func (this *ObjectInnerValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerValues(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func NewConstructor(x interface{}) (*Constructor, error) {\n\tif x == nil {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tft := reflect.TypeOf(x)\n\tfv := reflect.ValueOf(x)\n\tif ft.Kind() != reflect.Func {\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function expected, %s given\", ft)\n\t}\n\tif fv.IsNil() {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tc := &Constructor{\n\t\tfunction: fv,\n\t}\n\tnumIn := ft.NumIn()\n\tif ft.IsVariadic() {\n\t\tnumIn--\n\t}\n\tc.inTypes = make([]reflect.Type, numIn)\n\tfor i := 0; i < numIn; i++ {\n\t\tc.inTypes[i] = ft.In(i)\n\t}\n\tswitch ft.NumOut() {\n\tdefault:\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\tcase 1:\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = -1\n\tcase 2:\n\t\tif ft.Out(1) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = 1\n\tcase 3:\n\t\tif ft.Out(1) != destructorType || ft.Out(2) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = 1\n\t\tc.errorOutIndex = 2\n\t}\n\treturn c, nil\n}", "func (this *NowMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _NOW_MILLIS }\n}", "func (this *DateTruncStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncStr(operands[0], operands[1])\n\t}\n}", "func (this *DatePartStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartStr(operands[0], operands[1])\n\t}\n}", "func (this *StrToMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToMillis(operands[0])\n\t}\n}", "func (this *DatePartMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartMillis(operands[0], operands[1])\n\t}\n}", "func (this *StrToZoneName) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToZoneName(operands[0], operands[1])\n\t}\n}", "func (this *Element) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewElement(operands[0], operands[1])\n\t}\n}", "func (this *ObjectInnerPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerPairs(operands[0])\n\t}\n}", "func (this *DateTruncMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncMillis(operands[0], operands[1])\n\t}\n}", "func (this *NowStr) Constructor() FunctionConstructor { return NewNowStr }", "func (this *ClockMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _CLOCK_MILLIS }\n}", "func Function(args ...Type) *Operator {\n\treturn &Operator{functionName, args}\n}", "func New(spec *Spec) Function {\n\tf := Function{\n\t\tspec: spec,\n\t}\n\treturn f\n}", "func (this *StrToUTC) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToUTC(operands[0])\n\t}\n}", "func (this *Not) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewNot(operands[0])\n\t}\n}", "func (f Function) New(ctx string) error {\n\treturn f.unsafeWrap(errors.New(ctx), ctx, \"\")\n}", "func NewFunction(retType types.WaccType, ident *Ident, params ParamList,\n\tstats Statement, pos errors.Position) *Function {\n\tfn := &Function{\n\t\tretType: retType,\n\t\tident: ident,\n\t\tparams: params,\n\t\tpos: pos,\n\t}\n\tswitch st := stats.(type) {\n\tcase StatMultiple:\n\t\tfn.stats = st\n\tdefault:\n\t\tfn.stats = StatMultiple{st}\n\t}\n\treturn fn\n}", "func (this *MillisToStr) Constructor() FunctionConstructor { return NewMillisToStr }", "func NewFunction(name string, typ semantic.Type, call func(args Object) (Value, error), sideEffect bool) Function {\n\treturn &function{\n\t\tname: name,\n\t\tt: typ,\n\t\tcall: call,\n\t\thasSideEffect: sideEffect,\n\t}\n}", "func NewFunction(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, true, funcName, retType, args...)\n}", "func tcNew(n *ir.UnaryExpr) ir.Node {\n\tif n.X == nil {\n\t\t// Fatalf because the OCALL above checked for us,\n\t\t// so this must be an internally-generated mistake.\n\t\tbase.Fatalf(\"missing argument to new\")\n\t}\n\tl := n.X\n\tl = typecheck(l, ctxType)\n\tt := l.Type()\n\tif t == nil {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tn.X = l\n\tn.SetType(types.NewPtr(t))\n\treturn n\n}", "func NewFunc(name string, typ Type) *Func {\n\treturn &Func{object: object{scope: nil, name: name, typ: typ}}\n}", "func NewFunction(ifunc IFunction, name string) IQueryField {\n\treturn &SFunctionFieldBase{\n\t\tIFunction: ifunc,\n\t\talias: name,\n\t}\n}", "func (this *ClockStr) Constructor() FunctionConstructor { return NewClockStr }", "func newFunction(p *Package, fl *File, f *ast.FuncDecl) *Function {\n\tres := &Function{\n\t\tpkg: p,\n\t\tfile: fl,\n\t\tfn: f,\n\t\tname: nameFromIdent(f.Name),\n\t\tdef: getFunc(p, fl, f.Type).(*FuncType),\n\t}\n\n\tif res.fn.Recv != nil {\n\t\tn := \"\"\n\t\tif res.fn.Recv.List[0].Names != nil {\n\t\t\tn = nameFromIdent(res.fn.Recv.List[0].Names[0])\n\t\t}\n\t\tres.receiver = newVariableFromExpr(res.pkg, res.file, n, res.fn.Recv.List[0].Type)\n\t\tvar def Definition\n\t\tvar def2 *StarType\n\t\tdef = res.receiver.def\n\t\tdef2, res.receiverPointer = def.(*StarType)\n\t\tif res.receiverPointer {\n\t\t\tdef = def2.Target()\n\t\t}\n\t\tres.receiverClass = def.String()\n\t}\n\treturn res\n}", "func (this *MillisToZoneName) Constructor() FunctionConstructor { return NewMillisToZoneName }", "func NewFunction(name, cname, comment, member string, typ Type) *Function {\n\tfunctionName := UpperFirstCharacter(name)\n\treceiverType := TrimLanguagePrefix(cname)\n\treceiverName := CommonReceiverName(receiverType)\n\n\tf := &Function{\n\t\tIncludeFiles: NewIncludeFiles(),\n\t\tName: functionName,\n\t\tCName: cname,\n\t\tComment: comment,\n\t\tParameters: []FunctionParameter{ // TODO(go-clang): this might not be needed if the receiver code is refactored: https://github.com/go-clang/gen/issues/52\n\t\t\t{\n\t\t\t\tName: receiverName,\n\t\t\t\tCName: cname,\n\t\t\t\tType: Type{\n\t\t\t\t\tGoName: receiverType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tReturnType: typ,\n\t\tReceiver: Receiver{\n\t\t\tName: receiverName,\n\t\t\tType: Type{\n\t\t\t\tGoName: receiverType,\n\t\t\t},\n\t\t},\n\t\tMember: &FunctionParameter{\n\t\t\tName: member,\n\t\t\tType: typ,\n\t\t},\n\t}\n\n\treturn f\n}", "func (this *MillisToUTC) Constructor() FunctionConstructor { return NewMillisToUTC }", "func NewFunction(fnLit *ast.FunctionLiteral, env *Environment) *Function {\n\treturn &Function{\n\t\tParameters: fnLit.Parameters,\n\t\tBody: fnLit.Body,\n\t\tEnv: env,\n\t}\n}", "func Constructor() MapSum {\n\treturn MapSum{}\n}", "func execNewFunc(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewFunc(token.Pos(args[0].(int)), args[1].(*types.Package), args[2].(string), args[3].(*types.Signature))\n\tp.Ret(4, ret)\n}", "func NewFunction(config *truce.HTTP, function truce.Function) (*Function, error) {\n\tif function.Transports.HTTP == nil {\n\t\treturn nil, nil\n\t}\n\n\ttransport := *function.Transports.HTTP\n\n\tb := &Function{\n\t\tDefinition: function,\n\t\tQuery: map[string]QueryParam{},\n\t}\n\n\ttype argument struct {\n\t\tvariable string\n\t\tposVariable string\n\t\ttyp string\n\t}\n\n\tvar (\n\t\tpathMappings = map[string]string{}\n\t\targs = map[string]argument{}\n\t)\n\n\tfor i, field := range function.Arguments {\n\t\targs[field.Name] = argument{\n\t\t\ttyp: string(field.Type),\n\t\t\tposVariable: fmt.Sprintf(\"v%d\", i),\n\t\t\tvariable: field.Name,\n\t\t}\n\t}\n\n\tif function.Return.Present && function.Return.Name != \"\" {\n\t\tb.HasReturn = true\n\t\tb.ReturnType = string(function.Return.Type)\n\n\t\tif len(b.ReturnType) < 1 {\n\t\t\treturn nil, errors.New(\"return type cannot be empty\")\n\t\t}\n\n\t\tif b.ReturnType[0] == '*' {\n\t\t\tb.ReturnType = b.ReturnType[1:]\n\t\t\tb.ReturnIsPtr = true\n\t\t}\n\t}\n\n\tb.Method = transport.Method\n\n\t// Sort the arguments by name for consistent positional ordering.\n\tvar argVals []truce.ArgumentValue\n\tfor _, arg := range transport.Arguments {\n\t\targVals = append(argVals, arg)\n\t}\n\tsort.Slice(argVals, func(i, j int) bool {\n\t\treturn argVals[i].Name < argVals[j].Name\n\t})\n\n\tvar qpos int\n\tfor _, arg := range argVals {\n\t\ta, ok := args[arg.Name]\n\n\t\tswitch arg.From {\n\t\tcase \"body\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.BodyVar = a.posVariable\n\t\t\tb.BodyType = a.typ\n\t\tcase \"path\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpathMappings[arg.Var] = args[arg.Name].variable\n\t\tcase \"query\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.Query[arg.Var] = QueryParam{\n\t\t\t\tPos: qpos,\n\t\t\t\tQueryVar: arg.Var,\n\t\t\t\tGoVar: a.posVariable,\n\t\t\t\tType: a.typ,\n\t\t\t}\n\n\t\t\tqpos++\n\t\tcase \"static\":\n\t\t\t// TODO(georgemac)\n\t\t}\n\t}\n\n\tfor _, part := range strings.Split(config.Prefix, \"/\") {\n\t\tif part == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tb.Path = append(b.Path, Element{Type: \"static\", Value: part})\n\t}\n\n\tb.Path = append(b.Path, parsePath(pathMappings, transport.Path)...)\n\n\treturn b, nil\n}", "func NewConstructor(o Options) func(http.Handler) http.Handler {\n\tif o.Timeout <= 0 {\n\t\treturn xhttp.NilConstructor\n\t}\n\n\t// nolint: typecheck\n\tif o.TimedOut == nil {\n\t\to.TimedOut = defaultTimedOut\n\t}\n\n\treturn func(next http.Handler) http.Handler {\n\t\treturn &timeoutHandler{\n\t\t\ttimeout: o.Timeout,\n\t\t\ttimedOut: o.TimedOut,\n\t\t\tnext: next,\n\t\t}\n\t}\n}", "func (o *FakeObject) New(args ...interface{}) Object { return o.Invoke(args) }", "func (er *expressionRewriter) newFunction(funcName string, retType *types.FieldType, args ...expression.Expression) (expression.Expression, error) {\n\ttrace_util_0.Count(_expression_rewriter_00000, 275)\n\tif er.disableFoldCounter > 0 {\n\t\ttrace_util_0.Count(_expression_rewriter_00000, 277)\n\t\treturn expression.NewFunctionBase(er.ctx, funcName, retType, args...)\n\t}\n\ttrace_util_0.Count(_expression_rewriter_00000, 276)\n\treturn expression.NewFunction(er.ctx, funcName, retType, args...)\n}", "func (s *Prototype) Constructor() Value { return s.constructor }", "func NewFunction(ctx openedge.Context, cfg FunctionInfo) *Function {\n\tf := &Function{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tids: make(chan string, cfg.Instance.Max),\n\t\tlog: logger.WithField(\"function\", cfg.Name),\n\t}\n\tfor index := 1; index <= cfg.Instance.Max; index++ {\n\t\tf.ids <- fmt.Sprintf(\"f%d\", index)\n\t}\n\tpc := pool.NewDefaultPoolConfig()\n\tpc.MinIdle = cfg.Instance.Min\n\tpc.MaxIdle = cfg.Instance.Max\n\tpc.MaxTotal = cfg.Instance.Max\n\tpc.MinEvictableIdleTime = cfg.Instance.IdleTime\n\tpc.TimeBetweenEvictionRuns = cfg.Instance.EvictTime\n\tf.pool = pool.NewObjectPool(context.Background(), newFactory(f), pc)\n\treturn f\n}", "func newInstance0(frame *rtda.Frame) {\n\tvars := frame.LocalVars()\n\tconstructorObj := vars.GetRef(0)\n\targArrObj := vars.GetRef(1)\n\n\tgoConstructor := getExtra(constructorObj)\n\tgoClass := goConstructor.Class()\n\tobj := goClass.NewObj()\n\tstack := frame.OperandStack()\n\tstack.PushRef(obj)\n\n\t// call <init>\n\targs := actualConstructorArgs(obj, argArrObj, goConstructor)\n\tframe.Thread().InvokeMethodWithShim(goConstructor, args)\n}", "func New() *Compiler {\n\tmainScope := CompilationScope{\n\t\tinstructions: code.Instructions{},\n\t\tlastInstruction: EmittedInstruction{},\n\t\tpreviousInstruction: EmittedInstruction{},\n\t}\n\ttable := NewSymbolTable()\n\tfor i, fn := range object.GetBuiltins() {\n\t\ttable.DefineBuiltin(i, fn.Name)\n\t}\n\treturn &Compiler{\n\t\tconstants: []object.Object{},\n\t\tscopes: []CompilationScope{mainScope},\n\t\tscopeIndex: 0,\n\t\tsymbolTable: table,\n\t}\n}", "func NewCommand(cmd uint32, count int) Command {\n\treturn Command((cmd & 0x7) | (uint32(count) << 3))\n}", "func New(chainFunc ...interface{}) *Chain {\n\tc := &Chain{}\n\tc.Add(chainFunc...)\n\treturn c\n}", "func TermConstructor(t TermT) TermConstructorT {\n\treturn TermConstructorT(C.yices_term_constructor(C.term_t(t)))\n}", "func NewConstructor() *Constructor {\n\treturn &Constructor{}\n}", "func NewFunction0(name string, sqlType Type, logic EvalLogic) Function0 {\n\tfn := func() Expression {\n\t\treturn NoArgFunc{name, sqlType, logic}\n\t}\n\n\treturn Function0{Name: name, Fn: fn}\n}", "func NewConstructor() Constructor {\n\treturn func(ctx context.Context, cmw configmap.Watcher) *controller.Impl {\n\t\treturn NewController(ctx, cmw)\n\t}\n}", "func Constructor() MapSum {\n \n}", "func Constructor() MyStack {\n\treturn MyStack{New(), New(), 1}\n}", "func Constructor() MapSum {\n\treturn MapSum{\n\t\troot: &TrieNode{},\n\t}\n}", "func ClosureNew(f interface{}) *C.GClosure {\n\tclosure := C._g_closure_new()\n\tclosures.Lock()\n\tclosures.m[closure] = reflect.ValueOf(f)\n\tclosures.Unlock()\n\treturn closure\n}", "func (sf *ScalarFunction) Clone() Expression {\n\tc := &ScalarFunction{\n\t\tFuncName: sf.FuncName,\n\t\tRetType: sf.RetType,\n\t\tFunction: sf.Function.Clone(),\n\t}\n\treturn c\n}", "func Function(sig *CallSignature) Type {\n\treturn Type{functionImpl{sig: sig}}\n}", "func newFunctionImpl(ctx sctx.Context, fold bool, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\tif retType == nil {\n\t\treturn nil, errors.Errorf(\"RetType cannot be nil for ScalarFunction.\")\n\t}\n\tfc, ok := funcs[funcName]\n\tif !ok {\n\t\tdb := ctx.GetSessionVars().CurrentDB\n\t\tif db == \"\" {\n\t\t\treturn nil, errors.Trace(ErrNoDB)\n\t\t}\n\n\t\treturn nil, errFunctionNotExists.GenWithStackByArgs(\"FUNCTION\", db+\".\"+funcName)\n\t}\n\tfuncArgs := make([]Expression, len(args))\n\tcopy(funcArgs, args)\n\tf, err := fc.getFunction(ctx, funcArgs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif builtinRetTp := f.getRetTp(); builtinRetTp.Tp != mysql.TypeUnspecified || retType.Tp == mysql.TypeUnspecified {\n\t\tretType = builtinRetTp\n\t}\n\tsf := &ScalarFunction{\n\t\tFuncName: model.NewCIStr(funcName),\n\t\tRetType: retType,\n\t\tFunction: f,\n\t}\n\treturn sf, nil\n}", "func NewSelf() Function {\n\trv := &Self{\n\t\t*NewNullaryFunctionBase(\"self\"),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Constructor() Trie {\n\treturn Trie{100, false, [26]*Trie{}}\n}", "func (c *Constructor) Create(a ...reflect.Value) (reflect.Value, kdone.Destructor, error) {\n\tif c == nil {\n\t\treturn reflect.Value{}, kdone.Noop, nil\n\t}\n\tif len(a) != len(c.inTypes) {\n\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\"%s constructor expects %d argument(s), %d given\",\n\t\t\tc.t, len(c.inTypes), len(a))\n\t}\n\tfor i, v := range a {\n\t\tif v.Type() != c.inTypes[i] {\n\t\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\t\"%s constructor expects argument %d to be of %s type, %s given\",\n\t\t\t\tc.t, i+1, c.inTypes[i], v.Type())\n\t\t}\n\t}\n\tout := c.function.Call(a)\n\tobj := out[c.objectOutIndex]\n\tvar dtor kdone.Destructor = kdone.Noop\n\tif c.destructorOutIndex >= 0 {\n\t\tif v := out[c.destructorOutIndex].Interface(); v != nil {\n\t\t\tdtor = v.(kdone.Destructor)\n\t\t}\n\t}\n\tvar err error\n\tif c.errorOutIndex >= 0 {\n\t\tif v := out[c.errorOutIndex].Interface(); v != nil {\n\t\t\terr = v.(error)\n\t\t}\n\t}\n\treturn obj, dtor, err\n}", "func New(length int) func() *Float32s {\r\n\treturn func() *Float32s {\r\n\t\tresult := make(Float32s, length)\r\n\t\tfor i := 0; i < length; i++ {\r\n\t\t\tresult[i] = randFloat32()\r\n\t\t}\r\n\t\treturn &result\r\n\t}\r\n}", "func NewFunctionCall(callee Expression, arguments []Expression, trailing *TrailingFunction, metadata *Metadata) *FunctionCall {\n\treturn &FunctionCall{callee, arguments, trailing, metadata}\n}", "func ClosureNewObject(sizeofClosure uint32, object *Object) *Closure {\n\tc_sizeof_closure := (C.guint)(sizeofClosure)\n\n\tc_object := (*C.GObject)(C.NULL)\n\tif object != nil {\n\t\tc_object = (*C.GObject)(object.ToC())\n\t}\n\n\tretC := C.g_closure_new_object(c_sizeof_closure, c_object)\n\tretGo := ClosureNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "func NewFunc(name string, nestDepth uint32) *FuncInfo {\n\tif name != \"\" {\n\t\treturn &FuncInfo{name: name}\n\t}\n\treturn &FuncInfo{closure: &printer.ReservedExpr{}}\n}", "func NewFunctionBase(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, false, funcName, retType, args...)\n}", "func NewOperator(kind string, in, out reflect.Type, f func(ctx context.Context, field string, object interface{}) (interface{}, error)) Operator {\n\treturn &operator{\n\t\tkind: kind,\n\t\tin: in,\n\t\tout: out,\n\t\tf: f,\n\t}\n}", "func New(fn interface{}, validateFunc func(*FunctionCache) error) (*GenericFunc, error) {\n\tcache := &FunctionCache{}\n\tcache.FnValue = reflect.ValueOf(fn)\n\n\tif cache.FnValue.Kind() != reflect.Func {\n\t\treturn nil, errors.New(\"GenericFunc.New: fn is not a function\")\n\t}\n\n\tcache.FnType = cache.FnValue.Type()\n\tnumTypesIn := cache.FnType.NumIn()\n\tcache.TypesIn = make([]reflect.Type, numTypesIn)\n\tfor i := 0; i < numTypesIn; i++ {\n\t\tcache.TypesIn[i] = cache.FnType.In(i)\n\t}\n\n\tnumTypesOut := cache.FnType.NumOut()\n\tcache.TypesOut = make([]reflect.Type, numTypesOut)\n\tfor i := 0; i < numTypesOut; i++ {\n\t\tcache.TypesOut[i] = cache.FnType.Out(i)\n\t}\n\tif err := validateFunc(cache); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &GenericFunc{Cache: cache}, nil\n}", "func Constructor() Trie {\n\treturn Trie{\n\t\tnext: [26]*Trie{},\n\t}\n}", "func NewFunction(f func(float64) float64) *Function {\n\treturn &Function{\n\t\tF: f,\n\t\tSamples: 50,\n\t\tLineStyle: plotter.DefaultLineStyle,\n\t}\n}", "func NewFunctionCall(name string, params []Expression, returnType Type) Expression {\n\treturn &functionCall{\n\t\tname: name,\n\t\tparams: params,\n\t\treturnType: returnType,\n\t}\n}", "func NewCurry(fn interface{}) (*Curry, error) {\n\ttyp := reflect.TypeOf(fn)\n\n\tif typ.Kind() != reflect.Func {\n\t\treturn nil, fmt.Errorf(\"Handler is not a function!\")\n\t}\n\n\tc := &Curry{\n\t\tname: getFunctionName(fn),\n\t\tfnType: typ,\n\t\tfn: fn,\n\t}\n\n\treturn c, nil\n}", "func New() Object {\n\treturn Object{}\n}", "func new_(e interface{}) func() Event {\n\ttyp := reflect.TypeOf(e)\n\treturn func() Event {\n\t\treturn reflect.New(typ).Interface().(Event)\n\t}\n}", "func NewFunctionCall(name string, context string, args ...interface{}) FunctionCall {\n\treturn FunctionCall{name, context, args}\n}", "func NewLambda(vs []Argument, u bool, as []Argument, e Expression, t types.Type) Lambda {\n\treturn Lambda{as, e, t, vs, u}\n}", "func Constructor() MinStack {\r\n\treturn MinStack{}\r\n}", "func Constructor() MinStack {\n\treturn MinStack{atoms: []atom{}}\n}", "func New(hashFunc func(i interface{}) int64) *rbTree {\n\treturn &rbTree{hashFunc: hashFunc}\n}", "func NewFunction(pkg, name string,\n\tparams, ret, block []jen.Code) *Function {\n\treturn &Function{\n\t\tqual: jen.Qual(pkg, name),\n\t\tname: name,\n\t\tparams: params,\n\t\tret: ret,\n\t\tblock: block,\n\t}\n}", "func Constructor() TwoSum {\n\treturn TwoSum{data: map[int]int{}}\n}", "func NewMapper(m func(srcPtr interface{}, destPtr interface{}) error) Mapper {\n return funcMapper(m)\n}", "func Constructor() MinStack {\n\treturn MinStack{}\n}", "func Constructor() MinStack {\n\treturn MinStack{}\n}", "func Constructor() MinStack {\n\treturn MinStack{}\n}", "func Constructor() MinStack {\n\treturn MinStack{}\n}" ]
[ "0.7275384", "0.69671285", "0.6962341", "0.68921953", "0.6845353", "0.6845353", "0.68416286", "0.68416286", "0.6744794", "0.6708235", "0.6654913", "0.6654913", "0.66427934", "0.6617833", "0.6557411", "0.6531051", "0.65282565", "0.65282565", "0.6448263", "0.6430938", "0.642644", "0.6416298", "0.6379176", "0.6367499", "0.6366126", "0.62883306", "0.62635535", "0.62385595", "0.6231371", "0.62291867", "0.6165766", "0.6147356", "0.6105036", "0.6083122", "0.6003783", "0.5977542", "0.5927735", "0.5885979", "0.58768934", "0.5810873", "0.57859194", "0.5747765", "0.5736086", "0.57057744", "0.56806284", "0.55061185", "0.5496205", "0.5493704", "0.5482538", "0.54738533", "0.54588", "0.5443965", "0.54094404", "0.5387287", "0.5387196", "0.5361126", "0.53487706", "0.53166324", "0.5306954", "0.52919453", "0.52906483", "0.52859384", "0.52840936", "0.52802795", "0.52708143", "0.52690405", "0.5266685", "0.526243", "0.52523154", "0.52483165", "0.5243988", "0.52162164", "0.5211306", "0.5206393", "0.5202841", "0.5189611", "0.51715684", "0.5158675", "0.5157257", "0.5144621", "0.5138274", "0.51364094", "0.512137", "0.5120366", "0.51169324", "0.5115708", "0.5115569", "0.51068395", "0.5095257", "0.5093496", "0.5088127", "0.50878847", "0.50815326", "0.5076853", "0.507033", "0.5065051", "0.5065051", "0.5065051", "0.5065051" ]
0.79440147
1
/ The function NewObjectNames calls NewUnaryFunctionBase to create a function named OBJECT_NAMES with an expression as input.
Функция NewObjectNames вызывает NewUnaryFunctionBase для создания функции с именем OBJECT_NAMES и выражением в качестве входных данных.
func NewObjectNames(operand Expression) Function { rv := &ObjectNames{ *NewUnaryFunctionBase("object_names", operand), } rv.expr = rv return rv }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (s Obj_value) NewName(n int32) (capnp.TextList, error) {\n\ts.Struct.SetUint16(4, 0)\n\tl, err := capnp.NewTextList(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn capnp.TextList{}, err\n\t}\n\terr = s.Struct.SetPtr(0, l.List.ToPtr())\n\treturn l, err\n}", "func execNewNamed(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\tret := types.NewNamed(args[0].(*types.TypeName), args[1].(types.Type), args[2].([]*types.Func))\n\tp.Ret(3, ret)\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func InitNames() {\n\tsyscall.Syscall(gpInitNames, 0, 0, 0, 0)\n}", "func Names(v interface{}) []string {\n\treturn New(v).Names()\n}", "func createList(arg string) []string {\n\tvar retObject = []string{arg}\n\treturn retObject\n}", "func NewNameIn(vs ...string) predicate.User {\n\treturn predicate.User(sql.FieldIn(FieldNewName, vs...))\n}", "func NewNameIn(vs ...string) predicate.User {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.User(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldNewName), v...))\n\t})\n}", "func RegisterObject(name string, f NewObjectFct) {\n\tObjectList[name] = f\n}", "func NewNameGTE(v string) predicate.User {\n\treturn predicate.User(sql.FieldGTE(FieldNewName, v))\n}", "func NewOperationNamesStorage(\n\tsession cassandra.Session,\n\twriteCacheTTL time.Duration,\n\tmetricsFactory metrics.Factory,\n\tlogger *zap.Logger,\n) *OperationNamesStorage {\n\treturn &OperationNamesStorage{\n\t\tsession: session,\n\t\tInsertStmt: insertOperationName,\n\t\tQueryStmt: queryOperationNames,\n\t\tmetrics: casMetrics.NewTable(metricsFactory, \"OperationNames\"),\n\t\twriteCacheTTL: writeCacheTTL,\n\t\tlogger: logger,\n\t\toperationNames: cache.NewLRUWithOptions(\n\t\t\t100000,\n\t\t\t&cache.Options{\n\t\t\t\tTTL: writeCacheTTL,\n\t\t\t\tInitialCapacity: 0000,\n\t\t\t}),\n\t}\n}", "func newnamel(pos src.XPos, s *types.Sym) *Node {\n\tif s == nil {\n\t\tFatalf(\"newnamel nil\")\n\t}\n\n\tvar x struct {\n\t\tn Node\n\t\tm Name\n\t\tp Param\n\t}\n\tn := &x.n\n\tn.Name = &x.m\n\tn.Name.Param = &x.p\n\n\tn.Op = ONAME\n\tn.Pos = pos\n\tn.Orig = n\n\n\tn.Sym = s\n\treturn n\n}", "func objToNames(obj interface{}, names []string, tag string) []string {\n\tvar typ reflect.Type\n\n\tif sf, ok := obj.(reflect.StructField); ok {\n\t\ttyp = sf.Type\n\t} else {\n\t\ttyp = reflect.TypeOf(obj)\n\t\tif typ.Kind() == reflect.Ptr {\n\t\t\ttyp = typ.Elem()\n\t\t}\n\t}\n\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tfield := typ.Field(i)\n\n\t\tif field.Type.Kind() == reflect.Struct {\n\t\t\tnames = objToNames(field, names, tag)\n\t\t\tcontinue\n\t\t}\n\n\t\t// If tag is passed to the function, we only append if the field is tagged and that it matches tag.\n\t\tif tag == \"\" || field.Tag.Get(tag) != \"\" {\n\t\t\tnames = append(names, field.Name)\n\t\t}\n\t}\n\n\treturn names\n}", "func NewObject(t ...[2]*Term) Object {\n\tobj := newobject(len(t))\n\tfor i := range t {\n\t\tobj.Insert(t[i][0], t[i][1])\n\t}\n\treturn obj\n}", "func NewObjectRemove(first, second Expression) Function {\n\trv := &ObjectRemove{\n\t\t*NewBinaryFunctionBase(\"object_remove\", first, second),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func GetNewRegisteredUserNames(miscTable *db.Table) ([]string, error) {\n\tnewRegisteredUserNames := []string{}\n\terr := miscTable.GetObj(keyNewRegisteredUsers, &newRegisteredUserNames)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newRegisteredUserNames, nil\n}", "func (s *BasePlSqlParserListener) EnterRename_object(ctx *Rename_objectContext) {}", "func InitNames() {\n\tC.glowInitNames(gpInitNames)\n}", "func newname(s *types.Sym) *Node {\n\tn := newnamel(lineno, s)\n\tn.Name.Curfn = Curfn\n\treturn n\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewActionNames() *ActionNames {\n\tv := &ActionNames{}\n\treturn v\n}", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (*Object) Name() string { return \"object\" }", "func NamesFrom(list []string) Names {\n\tn := []Name{}\n\tfor _, v := range list {\n\t\tn = append(n, Name(v))\n\t}\n\treturn Names(n)\n}", "func NNames(w http.ResponseWriter) error {\n\tv, err := getProperty(\"NNames\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprop := Property{\n\t\tProperty: \"NNames\",\n\t\tValue: fmt.Sprint(v.Value().(uint32)),\n\t}\n\n\treturn share.JSONResponse(prop, w)\n}", "func FieldArgNames(obj any, allArgs map[string]reflect.Value) {\n\tfieldArgNamesStruct(obj, \"\", false, allArgs)\n}", "func execNewTypeName(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewTypeName(token.Pos(args[0].(int)), args[1].(*types.Package), args[2].(string), args[3].(types.Type))\n\tp.Ret(4, ret)\n}", "func (this *ObjectNames) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectNames) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func GenerateLabels(object CommonInterface) map[string]string {\n\tkind := object.GroupVersionKind().Kind\n\tgroup := object.GroupVersionKind().Group\n\tname := object.GetName()\n\tkey := strings.ToLower(kind) + \".\" + group + \"/name\"\n\tlabels := make(map[string]string)\n\tlabels[key] = name\n\treturn labels\n}", "func GenerateLabels(object CommonInterface) map[string]string {\n\tkind := object.GroupVersionKind().Kind\n\tgroup := object.GroupVersionKind().Group\n\tname := object.GetName()\n\tkey := strings.ToLower(kind) + \".\" + group + \"/name\"\n\tlabels := make(map[string]string)\n\tlabels[key] = name\n\treturn labels\n}", "func NewGNames(\n\tcfg config.Config,\n\tvf verifier.Verifier,\n\tfc facet.Facet,\n) GNames {\n\treturn gnames{\n\t\tcfg: cfg,\n\t\tvf: vf,\n\t\tfacet: fc,\n\t\tmatcher: matcher.New(cfg.MatcherURL),\n\t}\n}", "func Names() []string {\n\t// TODO eliminate duplicates\n\tvar names []string\n\tfor _, f := range factories {\n\t\tnames = append(names, f.Names()...)\n\t}\n\treturn names\n}", "func UConverterOpenStandardNames(arg1 string, arg2 string, arg3 *UErrorCode) (_swig_ret X_UEnumeration)", "func NewLiteral(value Object) Expression {\n\treturn &literal{value: value}\n}", "func (e *Enforcer) GetAllNamedObjects(ctx context.Context, ptype string) ([]string, error) {\n\tres, err := e.client.remoteClient.GetAllNamedObjects(ctx, &pb.SimpleGetRequest{\n\t\tEnforcerHandler: e.handler,\n\t\tPType: ptype,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.Array, nil\n}", "func NewNameGTE(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldNewName), v))\n\t})\n}", "func NewtnsnamesParser(input antlr.TokenStream) *tnsnamesParser {\n\tthis := new(tnsnamesParser)\n\tdeserializer := antlr.NewATNDeserializer(nil)\n\tdeserializedATN := deserializer.DeserializeFromUInt16(parserATN)\n\tdecisionToDFA := make([]*antlr.DFA, len(deserializedATN.DecisionToState))\n\tfor index, ds := range deserializedATN.DecisionToState {\n\t\tdecisionToDFA[index] = antlr.NewDFA(ds, index)\n\t}\n\tthis.BaseParser = antlr.NewBaseParser(input)\n\n\tthis.Interpreter = antlr.NewParserATNSimulator(this, deserializedATN, decisionToDFA, antlr.NewPredictionContextCache())\n\tthis.RuleNames = ruleNames\n\tthis.LiteralNames = literalNames\n\tthis.SymbolicNames = symbolicNames\n\tthis.GrammarFileName = \"tnsnamesParser.g4\"\n\n\treturn this\n}", "func (this *ObjectNames) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = k\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func NewObjectInnerValues(operand Expression) Function {\n\trv := &ObjectInnerValues{\n\t\t*NewUnaryFunctionBase(\"object_innervalues\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func mustGetNames(objects []runtime.Object) []string {\n\tvar names []string\n\tfor _, obj := range objects {\n\t\tmetaAccessor, err := meta.Accessor(obj)\n\t\tif err != nil {\n\t\t\tframework.Failf(\"error getting accessor for %T: %v\", obj, err)\n\t\t}\n\t\tname := metaAccessor.GetName()\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\treturn names\n}", "func VisitObjectStrings(obj interface{}, visitor func(string) string) {\n\tvisitValue(reflect.ValueOf(obj), visitor)\n}", "func (g *grpc) objectNamed(name string) generator.Object {\n\tg.gen.RecordTypeUse(name)\n\treturn g.gen.ObjectNamed(name)\n}", "func newObjectList() *ObjectList {\n\treturn &ObjectList{\n\t\tObjectIDs: make([]int, 0, 200),\n\t}\n}", "func (s *BasePlSqlParserListener) EnterObject_name(ctx *Object_nameContext) {}", "func NewNameArray(sVars ...string) PDFArray {\n\n\ta := PDFArray{}\n\n\tfor _, s := range sVars {\n\t\ta = append(a, PDFName(s))\n\t}\n\n\treturn a\n}", "func Names(v interface{}, prev ...string) [][]string {\n\tval := reflect.ValueOf(v)\n\treturn names(val, prev)\n}", "func InitNames() {\n C.glowInitNames(gpInitNames)\n}", "func UConverterOpenAllNames(arg1 *UErrorCode) (_swig_ret X_UEnumeration)", "func NewNameContains(v string) predicate.User {\n\treturn predicate.User(sql.FieldContains(FieldNewName, v))\n}", "func (r *Registry) RegisteredObjects() map[string]client.Object {\n\tout := make(map[string]client.Object, len(r.nameToObject))\n\tfor name, object := range r.nameToObject {\n\t\tout[name] = object.obj\n\t}\n\treturn out\n}", "func TestIsValidObjectName(t *testing.T) {\n\ttestCases := []struct {\n\t\tobjectName string\n\t\tshouldPass bool\n\t}{\n\t\t// cases which should pass the test.\n\t\t// passing in valid object name.\n\t\t{\"object\", true},\n\t\t{\"The Shining Script <v1>.pdf\", true},\n\t\t{\"Cost Benefit Analysis (2009-2010).pptx\", true},\n\t\t{\"117Gn8rfHL2ACARPAhaFd0AGzic9pUbIA/5OCn5A\", true},\n\t\t{\"SHØRT\", true},\n\t\t{\"There are far too many object names, and far too few bucket names!\", true},\n\t\t// cases for which test should fail.\n\t\t// passing invalid object names.\n\t\t{\"\", false},\n\t\t{string([]byte{0xff, 0xfe, 0xfd}), false},\n\t}\n\n\tfor i, testCase := range testCases {\n\t\tisValidObjectName := IsValidObjectName(testCase.objectName)\n\t\tif testCase.shouldPass && !isValidObjectName {\n\t\t\tt.Errorf(\"Test case %d: Expected \\\"%s\\\" to be a valid object name\", i+1, testCase.objectName)\n\t\t}\n\t\tif !testCase.shouldPass && isValidObjectName {\n\t\t\tt.Errorf(\"Test case %d: Expected object name \\\"%s\\\" to be invalid\", i+1, testCase.objectName)\n\t\t}\n\t}\n}", "func ClosureNewObject(sizeofClosure uint32, object *Object) *Closure {\n\tc_sizeof_closure := (C.guint)(sizeofClosure)\n\n\tc_object := (*C.GObject)(C.NULL)\n\tif object != nil {\n\t\tc_object = (*C.GObject)(object.ToC())\n\t}\n\n\tretC := C.g_closure_new_object(c_sizeof_closure, c_object)\n\tretGo := ClosureNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "func CloneTableNames(n TableNames) TableNames {\n\tres := make(TableNames, 0, len(n))\n\tfor _, x := range n {\n\t\tres = append(res, CloneTableName(x))\n\t}\n\treturn res\n}", "func getSwiftObjectNames(t *testing.T, osClient *gophercloud.ServiceClient, container string) (objectNames []string) {\n\t_ = objects.List(osClient, container, nil).EachPage(func(page pagination.Page) (bool, error) {\n\t\t// Get a slice of object names\n\t\tnames, err := objects.ExtractNames(page)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error extracting object names from page: %s\", err)\n\t\t}\n\t\tfor _, object := range names {\n\t\t\tobjectNames = append(objectNames, object)\n\t\t}\n\n\t\treturn true, nil\n\t})\n\treturn\n}", "func (a *Client) ReplaceInstancesObjectsObjectNameDefinitions(params *ReplaceInstancesObjectsObjectNameDefinitionsParams) (*ReplaceInstancesObjectsObjectNameDefinitionsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewReplaceInstancesObjectsObjectNameDefinitionsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"replaceInstancesObjectsObjectNameDefinitions\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/instances/objects/{objectName}/definitions\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ReplaceInstancesObjectsObjectNameDefinitionsReader{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.(*ReplaceInstancesObjectsObjectNameDefinitionsOK), nil\n\n}", "func (o *Object) Rename(n, m string) {\n\tfor _, nat := range *o {\n\t\tif nat.Name == n {\n\t\t\tnat.Name = m\n\t\t\treturn\n\t\t}\n\t}\n}", "func (*unifinames) Name() string { return \"unifi-names\" }", "func NewSlice(a ...Name) []Name {\n\treturn a\n}", "func NewLuaObjectFromName(L *lua.State, path string) *LuaObject {\n Lookup(L, path, 0)\n return NewLuaObject(L, -1)\n}", "func NewLuaObject(L *lua.State, idx int) *LuaObject {\n tp := L.LTypename(idx)\n L.PushValue(idx)\n ref := L.Ref(lua.LUA_REGISTRYINDEX)\n return &LuaObject{L, ref, tp}\n}", "func (f *Fs) newObjectSizeAndNameOnly(o fs.Object, moName string, size int64) *Object {\n\treturn &Object{\n\t\tObject: o,\n\t\tf: f,\n\t\tmo: nil,\n\t\tmoName: moName,\n\t\tsize: size,\n\t\tmeta: nil,\n\t}\n}", "func objectName(u *unstructured.Unstructured) string {\n\treturn strings.ToLower(fmt.Sprintf(\"%s-%s\", u.GetKind(), strings.Replace(u.GetName(), \":\", \"-\", -1)))\n}", "func (n *LibPcreRegexp) SubexpNames() []string {\n\treturn n.namedGroups\n}", "func (s *BasePlSqlParserListener) ExitRename_object(ctx *Rename_objectContext) {}", "func ObjectName(obj *Object) (string, error) {\n\taccessor, err := meta.Accessor(obj)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get metadata accessor from object: %v\", err)\n\t}\n\treturn accessor.GetName(), nil\n}", "func NewObjectUnwrap(operand Expression) Function {\n\trv := &ObjectUnwrap{\n\t\t*NewUnaryFunctionBase(\"object_unwrap\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectInnerPairs(operand Expression) Function {\n\trv := &ObjectInnerPairs{\n\t\t*NewUnaryFunctionBase(\"object_innerpairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func makeNames(fullMethod string) (names api.Names) {\n\t// Strip the leading slash. It should always be present in practice.\n\tif len(fullMethod) > 0 && fullMethod[0] == '/' {\n\t\tfullMethod = fullMethod[1:]\n\t}\n\n\t// Parse the slash separated service and method name. The separating slash\n\t// should always be present in practice.\n\tif slashIndex := strings.Index(fullMethod, \"/\"); slashIndex != -1 {\n\t\tnames.RawService = fullMethod[0:slashIndex]\n\t\tnames.Method = fullMethod[slashIndex+1:]\n\t}\n\n\tnames.Service = serviceReplacer.Replace(names.RawService)\n\tnames.MetricKey = append(names.MetricKey, strings.Split(names.Service, \".\")...)\n\tnames.MetricKey = append(names.MetricKey, methodMetricKeyReplacer.Replace(names.Method))\n\tfor i := range names.MetricKey {\n\t\tnames.MetricKey[i] = metricKey(names.MetricKey[i])\n\t}\n\treturn names\n}", "func (l Lambda) ArgumentNames() []string {\n\treturn argumentsToNames(l.arguments)\n}", "func NewNameContains(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldNewName), v))\n\t})\n}", "func NewName(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldNewName), v))\n\t})\n}", "func IncludeNamesFilter(names ...string) factory.EventFilterFunc {\n\tnameSet := sets.NewString(names...)\n\treturn func(obj interface{}) bool {\n\t\tmetaObj := obj.(metav1.Object)\n\t\treturn nameSet.Has(metaObj.GetName())\n\t}\n}", "func NewName(v string) predicate.User {\n\treturn predicate.User(sql.FieldEQ(FieldNewName, v))\n}", "func NewObjectExpression() *ObjectExpression {\n\treturn &ObjectExpression{\n\t\tprops: make(map[string]Expression),\n\t}\n}", "func NewCardNames() *CardNames {\n\tcounts := make(map[string]int)\n\treturn &CardNames{Counts: counts}\n}", "func NewObjectDependencies(\n\tobj interface{},\n) (ObjectDependency, ObjectDependencies) {\n\tdeps := make(ObjectDependencies)\n\tvirtual := obj.(*cisapiv1.VirtualServer)\n\t// TODO => dep can be replaced with internal DS rqkey\n\tkey := ObjectDependency{\n\t\tKind: VirtualServer,\n\t\tName: virtual.ObjectMeta.Name,\n\t\tNamespace: virtual.ObjectMeta.Namespace,\n\t}\n\n\tdeps[key] = 1\n\tfor _, pool := range virtual.Spec.Pools {\n\t\tdep := ObjectDependency{\n\t\t\tKind: RuleDep,\n\t\t\tNamespace: virtual.ObjectMeta.Namespace,\n\t\t\tName: virtual.Spec.Host + pool.Path,\n\t\t\tService: pool.Service,\n\t\t}\n\t\tdeps[dep]++\n\t}\n\treturn key, deps\n}", "func addStrings(s *scope, name string, obj pyObject, f func(string)) {\n\tif obj != nil && obj != None {\n\t\tl, ok := asList(obj)\n\t\tif !ok {\n\t\t\ts.Error(\"Argument %s must be a list, not %s\", name, obj.Type())\n\t\t}\n\t\tfor _, li := range l {\n\t\t\tstr, ok := li.(pyString)\n\t\t\tif !ok && li != None {\n\t\t\t\ts.Error(\"%s must be strings\", name)\n\t\t\t}\n\t\t\tif str != \"\" && li != None {\n\t\t\t\tf(string(str))\n\t\t\t}\n\t\t}\n\t}\n}", "func getNames(sub pkix.Name) []Name {\n\t// anonymous func for finding the max of a list of integer\n\tmax := func(v1 int, vn ...int) (max int) {\n\t\tmax = v1\n\t\tfor i := 0; i < len(vn); i++ {\n\t\t\tif vn[i] > max {\n\t\t\t\tmax = vn[i]\n\t\t\t}\n\t\t}\n\t\treturn max\n\t}\n\n\tnc := len(sub.Country)\n\tnorg := len(sub.Organization)\n\tnou := len(sub.OrganizationalUnit)\n\tnl := len(sub.Locality)\n\tnp := len(sub.Province)\n\n\tn := max(nc, norg, nou, nl, np)\n\n\tnames := make([]Name, n)\n\tfor i := range names {\n\t\tif i < nc {\n\t\t\tnames[i].C = sub.Country[i]\n\t\t}\n\t\tif i < norg {\n\t\t\tnames[i].O = sub.Organization[i]\n\t\t}\n\t\tif i < nou {\n\t\t\tnames[i].OU = sub.OrganizationalUnit[i]\n\t\t}\n\t\tif i < nl {\n\t\t\tnames[i].L = sub.Locality[i]\n\t\t}\n\t\tif i < np {\n\t\t\tnames[i].ST = sub.Province[i]\n\t\t}\n\t}\n\treturn names\n}", "func (o *objectSet) nameMatches(nameRegex string) *objectSet {\n\tret := &objectSet{}\n\tfor k, v := range o.objMap {\n\t\t_, _, objName := object.FromHash(k)\n\t\tm, err := regexp.MatchString(nameRegex, objName)\n\t\tif err != nil && m {\n\t\t\tret.append(v)\n\t\t}\n\t}\n\treturn ret\n}", "func setPatchNames(patches []string, jsonPatches []kustomize.PatchJSON6902) ([]string, []kustomize.PatchJSON6902) {\n\tfixedPatches := make([]string, len(patches))\n\tfixedJSONPatches := make([]kustomize.PatchJSON6902, len(jsonPatches))\n\tfor i, patch := range patches {\n\t\t// insert the generated name metadata\n\t\tfixedPatches[i] = fmt.Sprintf(\"metadata:\\nname: %s\\n%s\", kubeadm.ObjectName, patch)\n\t}\n\tfor i, patch := range jsonPatches {\n\t\t// insert the generated name metadata\n\t\tpatch.Name = kubeadm.ObjectName\n\t\tfixedJSONPatches[i] = patch\n\t}\n\treturn fixedPatches, fixedJSONPatches\n}", "func (n *piName) FreeNames() []Name {\n\treturn []Name{n}\n}", "func NewListName(val string) ListNameField {\n\treturn ListNameField{quickfix.FIXString(val)}\n}", "func execNewPkgName(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewPkgName(token.Pos(args[0].(int)), args[1].(*types.Package), args[2].(string), args[3].(*types.Package))\n\tp.Ret(4, ret)\n}", "func New(e *eme.EMECipher, longNames bool, raw64 bool) *NameTransform {\n\tb64 := base64.URLEncoding\n\tif raw64 {\n\t\tb64 = base64.RawURLEncoding\n\t}\n\treturn &NameTransform{\n\t\temeCipher: e,\n\t\tlongNames: longNames,\n\t\tB64: b64,\n\t}\n}", "func NewFunctionCall(name string, params []Expression, returnType Type) Expression {\n\treturn &functionCall{\n\t\tname: name,\n\t\tparams: params,\n\t\treturnType: returnType,\n\t}\n}", "func (t *targetrunner) renameObject(w http.ResponseWriter, r *http.Request, msg *cmn.ActionMsg) {\n\tapitems, err := t.checkRESTItems(w, r, 2, false, cmn.Version, cmn.Objects)\n\tif err != nil {\n\t\treturn\n\t}\n\tbucket, objNameFrom := apitems[0], apitems[1]\n\tbck, err := newBckFromQuery(bucket, r.URL.Query())\n\tif err != nil {\n\t\tt.invalmsghdlr(w, r, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tlom := &cluster.LOM{T: t, ObjName: objNameFrom}\n\tif err = lom.Init(bck.Bck); err != nil {\n\t\tt.invalmsghdlr(w, r, err.Error())\n\t\treturn\n\t}\n\tif lom.Bck().IsRemote() {\n\t\tt.invalmsghdlr(w, r, fmt.Sprintf(\"%s: cannot rename object from remote bucket\", lom))\n\t\treturn\n\t}\n\tif lom.Bck().Props.EC.Enabled {\n\t\tt.invalmsghdlr(w, r, fmt.Sprintf(\"%s: cannot rename erasure-coded object\", lom))\n\t\treturn\n\t}\n\n\tbuf, slab := t.gmm.Alloc()\n\tri := &replicInfo{smap: t.owner.smap.get(), t: t, bckTo: lom.Bck(), buf: buf, localOnly: false, finalize: true}\n\tcopied, err := ri.copyObject(lom, msg.Name /* new object name */)\n\tslab.Free(buf)\n\tif err != nil {\n\t\tt.invalmsghdlr(w, r, err.Error())\n\t\treturn\n\t}\n\tif copied {\n\t\tlom.Lock(true)\n\t\tif err = lom.Remove(); err != nil {\n\t\t\tt.invalmsghdlr(w, r, err.Error())\n\t\t}\n\t\tlom.Unlock(true)\n\t}\n}", "func (e *Enforcer) GetAllNamedObjects(ptype string) []string {\n\treturn e.model.GetValuesForFieldInPolicy(\"p\", ptype, 1)\n}", "func (a *Client) GetInstancesObjectsObjectNameDefinitions(params *GetInstancesObjectsObjectNameDefinitionsParams) (*GetInstancesObjectsObjectNameDefinitionsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetInstancesObjectsObjectNameDefinitionsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getInstancesObjectsObjectNameDefinitions\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/instances/objects/{objectName}/definitions\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetInstancesObjectsObjectNameDefinitionsReader{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.(*GetInstancesObjectsObjectNameDefinitionsOK), nil\n\n}", "func (m *MockIDistributedEnforcer) GetAllNamedObjects(arg0 string) []string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAllNamedObjects\", arg0)\n\tret0, _ := ret[0].([]string)\n\treturn ret0\n}", "func (b *JSONSupportGeneratorBuilder) Names(value *NamesCalculator) *JSONSupportGeneratorBuilder {\n\tb.names = value\n\treturn b\n}", "func NewFunctionCall(name string, context string, args ...interface{}) FunctionCall {\n\treturn FunctionCall{name, context, args}\n}", "func SetIterationNames(names []string) CustomizeIterationFunc {\n\treturn func(fxt *TestFixture, idx int) error {\n\t\tif len(fxt.Iterations) != len(names) {\n\t\t\treturn errs.Errorf(\"number of names (%d) must match number of iterations to create (%d)\", len(names), len(fxt.Iterations))\n\t\t}\n\t\tfxt.Iterations[idx].Name = names[idx]\n\t\treturn nil\n\t}\n}" ]
[ "0.58631206", "0.58631206", "0.5818655", "0.5258608", "0.5123252", "0.5123252", "0.50969934", "0.5032237", "0.50116974", "0.5003598", "0.49712798", "0.48637605", "0.48614097", "0.4857428", "0.48428673", "0.4813975", "0.48088303", "0.4790116", "0.478159", "0.478159", "0.47766036", "0.4755525", "0.47224835", "0.47171596", "0.47112864", "0.47112864", "0.4705204", "0.4694117", "0.46838522", "0.46733025", "0.46570423", "0.4647531", "0.4644537", "0.46311185", "0.46311185", "0.46196118", "0.46196118", "0.46177626", "0.46132615", "0.46020743", "0.45829603", "0.45678264", "0.45461628", "0.45407197", "0.45389766", "0.45360643", "0.45280933", "0.45241615", "0.45132384", "0.45014986", "0.45002106", "0.44986975", "0.44884658", "0.44849864", "0.4468415", "0.44632208", "0.44623184", "0.44584042", "0.44497758", "0.44382828", "0.4434107", "0.44134033", "0.4406137", "0.44021538", "0.43966252", "0.438765", "0.43843558", "0.43735844", "0.4363224", "0.43632093", "0.43620384", "0.4353397", "0.43489394", "0.4343304", "0.43261543", "0.43088523", "0.43066993", "0.43056569", "0.43054876", "0.42953077", "0.42924753", "0.42914975", "0.4289419", "0.42845523", "0.428279", "0.42779234", "0.42585278", "0.42527956", "0.4248512", "0.42462602", "0.42201364", "0.42196143", "0.4219444", "0.42172572", "0.4215325", "0.42120495", "0.42098132", "0.42085797", "0.41999185" ]
0.8870936
1
/ The constructor returns a NewObjectNames with the an operand cast to a Function as the FunctionConstructor.
Конструктор возвращает NewObjectNames с операндом, приведенным к Function как FunctionConstructor.
func (this *ObjectNames) Constructor() FunctionConstructor { return func(operands ...Expression) Function { return NewObjectNames(operands[0]) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *StrToZoneName) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToZoneName(operands[0], operands[1])\n\t}\n}", "func (this *DateAddStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddStr(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectRemove) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectRemove(operands[0], operands[1])\n\t}\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (this *DateDiffStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffStr(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func (this *DatePartStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartStr(operands[0], operands[1])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func NewConstructor(x interface{}) (*Constructor, error) {\n\tif x == nil {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tft := reflect.TypeOf(x)\n\tfv := reflect.ValueOf(x)\n\tif ft.Kind() != reflect.Func {\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function expected, %s given\", ft)\n\t}\n\tif fv.IsNil() {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tc := &Constructor{\n\t\tfunction: fv,\n\t}\n\tnumIn := ft.NumIn()\n\tif ft.IsVariadic() {\n\t\tnumIn--\n\t}\n\tc.inTypes = make([]reflect.Type, numIn)\n\tfor i := 0; i < numIn; i++ {\n\t\tc.inTypes[i] = ft.In(i)\n\t}\n\tswitch ft.NumOut() {\n\tdefault:\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\tcase 1:\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = -1\n\tcase 2:\n\t\tif ft.Out(1) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = 1\n\tcase 3:\n\t\tif ft.Out(1) != destructorType || ft.Out(2) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = 1\n\t\tc.errorOutIndex = 2\n\t}\n\treturn c, nil\n}", "func (this *DateAddMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *StrToMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToMillis(operands[0])\n\t}\n}", "func (this *NowStr) Constructor() FunctionConstructor { return NewNowStr }", "func (this *ObjectPut) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPut(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectInnerValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerValues(operands[0])\n\t}\n}", "func (this *DateDiffMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func Function(args ...Type) *Operator {\n\treturn &Operator{functionName, args}\n}", "func (this *MillisToZoneName) Constructor() FunctionConstructor { return NewMillisToZoneName }", "func (this *ObjectInnerPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerPairs(operands[0])\n\t}\n}", "func (this *MillisToStr) Constructor() FunctionConstructor { return NewMillisToStr }", "func (this *NowMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _NOW_MILLIS }\n}", "func (this *StrToUTC) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToUTC(operands[0])\n\t}\n}", "func (this *Mod) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewMod(operands[0], operands[1])\n\t}\n}", "func (this *DateTruncStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncStr(operands[0], operands[1])\n\t}\n}", "func (this *DatePartMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartMillis(operands[0], operands[1])\n\t}\n}", "func (this *Element) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewElement(operands[0], operands[1])\n\t}\n}", "func (this *Not) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewNot(operands[0])\n\t}\n}", "func (this *ClockMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _CLOCK_MILLIS }\n}", "func NewFunc(name string, typ Type) *Func {\n\treturn &Func{object: object{scope: nil, name: name, typ: typ}}\n}", "func tcNew(n *ir.UnaryExpr) ir.Node {\n\tif n.X == nil {\n\t\t// Fatalf because the OCALL above checked for us,\n\t\t// so this must be an internally-generated mistake.\n\t\tbase.Fatalf(\"missing argument to new\")\n\t}\n\tl := n.X\n\tl = typecheck(l, ctxType)\n\tt := l.Type()\n\tif t == nil {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tn.X = l\n\tn.SetType(types.NewPtr(t))\n\treturn n\n}", "func (object *Object) GenerateConstructor(suffix string) string {\n\tobjectType := object.getType(suffix)\n\tcode := fmt.Sprintf(\n\t\t\"func Make%s() %s {\\n\\treturn &%s{\\n\",\n\t\tobjectType,\n\t\tobject.Type(suffix),\n\t\tobjectType,\n\t)\n\n\tproperties := object.properties.ToArray()\n\tfor _, property := range properties {\n\t\tpropertyCode := property.(*Property).GenerateConstructor(suffix)\n\t\tif propertyCode != \"\" {\n\t\t\tcode += fmt.Sprintf(\n\t\t\t\t\"\\t\\t%s,\\n\",\n\t\t\t\tpropertyCode,\n\t\t\t)\n\t\t}\n\t}\n\treturn code + \"\\t}\\n}\\n\"\n}", "func (this *DateTruncMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncMillis(operands[0], operands[1])\n\t}\n}", "func (this *ClockStr) Constructor() FunctionConstructor { return NewClockStr }", "func NewFunction(ifunc IFunction, name string) IQueryField {\n\treturn &SFunctionFieldBase{\n\t\tIFunction: ifunc,\n\t\talias: name,\n\t}\n}", "func (c *Constructor) Create(a ...reflect.Value) (reflect.Value, kdone.Destructor, error) {\n\tif c == nil {\n\t\treturn reflect.Value{}, kdone.Noop, nil\n\t}\n\tif len(a) != len(c.inTypes) {\n\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\"%s constructor expects %d argument(s), %d given\",\n\t\t\tc.t, len(c.inTypes), len(a))\n\t}\n\tfor i, v := range a {\n\t\tif v.Type() != c.inTypes[i] {\n\t\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\t\"%s constructor expects argument %d to be of %s type, %s given\",\n\t\t\t\tc.t, i+1, c.inTypes[i], v.Type())\n\t\t}\n\t}\n\tout := c.function.Call(a)\n\tobj := out[c.objectOutIndex]\n\tvar dtor kdone.Destructor = kdone.Noop\n\tif c.destructorOutIndex >= 0 {\n\t\tif v := out[c.destructorOutIndex].Interface(); v != nil {\n\t\t\tdtor = v.(kdone.Destructor)\n\t\t}\n\t}\n\tvar err error\n\tif c.errorOutIndex >= 0 {\n\t\tif v := out[c.errorOutIndex].Interface(); v != nil {\n\t\t\terr = v.(error)\n\t\t}\n\t}\n\treturn obj, dtor, err\n}", "func TermConstructor(t TermT) TermConstructorT {\n\treturn TermConstructorT(C.yices_term_constructor(C.term_t(t)))\n}", "func NewFunction(name, cname, comment, member string, typ Type) *Function {\n\tfunctionName := UpperFirstCharacter(name)\n\treceiverType := TrimLanguagePrefix(cname)\n\treceiverName := CommonReceiverName(receiverType)\n\n\tf := &Function{\n\t\tIncludeFiles: NewIncludeFiles(),\n\t\tName: functionName,\n\t\tCName: cname,\n\t\tComment: comment,\n\t\tParameters: []FunctionParameter{ // TODO(go-clang): this might not be needed if the receiver code is refactored: https://github.com/go-clang/gen/issues/52\n\t\t\t{\n\t\t\t\tName: receiverName,\n\t\t\t\tCName: cname,\n\t\t\t\tType: Type{\n\t\t\t\t\tGoName: receiverType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tReturnType: typ,\n\t\tReceiver: Receiver{\n\t\t\tName: receiverName,\n\t\t\tType: Type{\n\t\t\t\tGoName: receiverType,\n\t\t\t},\n\t\t},\n\t\tMember: &FunctionParameter{\n\t\t\tName: member,\n\t\t\tType: typ,\n\t\t},\n\t}\n\n\treturn f\n}", "func NewFunction(retType types.WaccType, ident *Ident, params ParamList,\n\tstats Statement, pos errors.Position) *Function {\n\tfn := &Function{\n\t\tretType: retType,\n\t\tident: ident,\n\t\tparams: params,\n\t\tpos: pos,\n\t}\n\tswitch st := stats.(type) {\n\tcase StatMultiple:\n\t\tfn.stats = st\n\tdefault:\n\t\tfn.stats = StatMultiple{st}\n\t}\n\treturn fn\n}", "func New(spec *Spec) Function {\n\tf := Function{\n\t\tspec: spec,\n\t}\n\treturn f\n}", "func NewOperators(ops ...*Symbol) *Operators {\n\t// Construct the root\n\troot := &Operators{children: map[rune]*Operators{}}\n\n\t// Add each of the symbols to it\n\tfor _, op := range ops {\n\t\troot.Add(op)\n\t}\n\n\treturn root\n}", "func execNewNamed(_ int, p *gop.Context) {\n\targs := p.GetArgs(3)\n\tret := types.NewNamed(args[0].(*types.TypeName), args[1].(types.Type), args[2].([]*types.Func))\n\tp.Ret(3, ret)\n}", "func NewFunction(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, true, funcName, retType, args...)\n}", "func New() *Compiler {\n\tmainScope := CompilationScope{\n\t\tinstructions: code.Instructions{},\n\t\tlastInstruction: EmittedInstruction{},\n\t\tpreviousInstruction: EmittedInstruction{},\n\t}\n\ttable := NewSymbolTable()\n\tfor i, fn := range object.GetBuiltins() {\n\t\ttable.DefineBuiltin(i, fn.Name)\n\t}\n\treturn &Compiler{\n\t\tconstants: []object.Object{},\n\t\tscopes: []CompilationScope{mainScope},\n\t\tscopeIndex: 0,\n\t\tsymbolTable: table,\n\t}\n}", "func NewFunction(name string, typ semantic.Type, call func(args Object) (Value, error), sideEffect bool) Function {\n\treturn &function{\n\t\tname: name,\n\t\tt: typ,\n\t\tcall: call,\n\t\thasSideEffect: sideEffect,\n\t}\n}", "func execNewFunc(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewFunc(token.Pos(args[0].(int)), args[1].(*types.Package), args[2].(string), args[3].(*types.Signature))\n\tp.Ret(4, ret)\n}", "func NewFunctionCall(name string, params []Expression, returnType Type) Expression {\n\treturn &functionCall{\n\t\tname: name,\n\t\tparams: params,\n\t\treturnType: returnType,\n\t}\n}", "func generateGoPrimitiveTypesNewFuncs() ([]byte, error) {\n\tb := bytes.NewBufferString(`\nfunc newString(s string) *string {\n\treturn &s\n}\n\nfunc newInt(i int) *int {\n\treturn &i\n}\n\nfunc newFloat(f float64) *float64 {\n\treturn &f\n}\n\nfunc newBool(b bool) *bool {\n\treturn &b\n}\n\t`)\n\n\treturn format.Source(b.Bytes())\n}", "func newFunction(p *Package, fl *File, f *ast.FuncDecl) *Function {\n\tres := &Function{\n\t\tpkg: p,\n\t\tfile: fl,\n\t\tfn: f,\n\t\tname: nameFromIdent(f.Name),\n\t\tdef: getFunc(p, fl, f.Type).(*FuncType),\n\t}\n\n\tif res.fn.Recv != nil {\n\t\tn := \"\"\n\t\tif res.fn.Recv.List[0].Names != nil {\n\t\t\tn = nameFromIdent(res.fn.Recv.List[0].Names[0])\n\t\t}\n\t\tres.receiver = newVariableFromExpr(res.pkg, res.file, n, res.fn.Recv.List[0].Type)\n\t\tvar def Definition\n\t\tvar def2 *StarType\n\t\tdef = res.receiver.def\n\t\tdef2, res.receiverPointer = def.(*StarType)\n\t\tif res.receiverPointer {\n\t\t\tdef = def2.Target()\n\t\t}\n\t\tres.receiverClass = def.String()\n\t}\n\treturn res\n}", "func NewFunctionCall(name string) *FunctionCall {\n\tfc := new(FunctionCall)\n\tfc.addr = C.LookupSymAddr(C.CString(name))\n\treturn fc\n}", "func ClosureNew(f interface{}) *C.GClosure {\n\tclosure := C._g_closure_new()\n\tclosures.Lock()\n\tclosures.m[closure] = reflect.ValueOf(f)\n\tclosures.Unlock()\n\treturn closure\n}", "func NewFunctionCall(name string, context string, args ...interface{}) FunctionCall {\n\treturn FunctionCall{name, context, args}\n}", "func newFuncExpr(funcName FuncName, funcs ...Expr) (*funcExpr, error) {\n\tswitch funcName {\n\tcase Avg, Max, Min, Sum:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errParseNonUnaryAgregateFunctionCall(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isNumberKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v, not number\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Count:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errParseNonUnaryAgregateFunctionCall(err)\n\t\t}\n\n\t\tswitch funcs[0].ReturnType() {\n\t\tcase Null, Bool, Int, Float, String, Timestamp, column, record:\n\t\tdefault:\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v is incompatible\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase CharLength, CharacterLength, Trim, Lower, Upper, ToTimestamp:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isStringKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v, not string\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Coalesce:\n\t\tif len(funcs) < 1 {\n\t\t\terr := fmt.Errorf(\"%v(): one or more argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tfor i := range funcs {\n\t\t\tif !funcs[i].ReturnType().isBaseKind() {\n\t\t\t\terr := fmt.Errorf(\"%v(): argument-%v %v evaluate to %v is incompatible\", funcName, i+1, funcs[i], funcs[i].ReturnType())\n\t\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t\t}\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase NullIf:\n\t\tif len(funcs) != 2 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly two arguments expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isBaseKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-1 %v evaluate to %v is incompatible\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif !funcs[1].ReturnType().isBaseKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-2 %v evaluate to %v is incompatible\", funcName, funcs[1], funcs[1].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase UTCNow:\n\t\tif len(funcs) != 0 {\n\t\t\terr := fmt.Errorf(\"%v(): no argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Substring:\n\t\tif len(funcs) < 2 || len(funcs) > 3 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly two or three arguments expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isStringKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-1 %v evaluate to %v, not string\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif !funcs[1].ReturnType().isIntKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-2 %v evaluate to %v, not int\", funcName, funcs[1], funcs[1].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif len(funcs) > 2 {\n\t\t\tif !funcs[2].ReturnType().isIntKind() {\n\t\t\t\terr := fmt.Errorf(\"%v(): argument-3 %v evaluate to %v, not int\", funcName, funcs[2], funcs[2].ReturnType())\n\t\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t\t}\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\t}\n\n\treturn nil, errUnsupportedFunction(fmt.Errorf(\"unknown function name %v\", funcName))\n}", "func NewFunction0(name string, sqlType Type, logic EvalLogic) Function0 {\n\tfn := func() Expression {\n\t\treturn NoArgFunc{name, sqlType, logic}\n\t}\n\n\treturn Function0{Name: name, Fn: fn}\n}", "func NewLiteral(value Object) Expression {\n\treturn &literal{value: value}\n}", "func NewFunction(config *truce.HTTP, function truce.Function) (*Function, error) {\n\tif function.Transports.HTTP == nil {\n\t\treturn nil, nil\n\t}\n\n\ttransport := *function.Transports.HTTP\n\n\tb := &Function{\n\t\tDefinition: function,\n\t\tQuery: map[string]QueryParam{},\n\t}\n\n\ttype argument struct {\n\t\tvariable string\n\t\tposVariable string\n\t\ttyp string\n\t}\n\n\tvar (\n\t\tpathMappings = map[string]string{}\n\t\targs = map[string]argument{}\n\t)\n\n\tfor i, field := range function.Arguments {\n\t\targs[field.Name] = argument{\n\t\t\ttyp: string(field.Type),\n\t\t\tposVariable: fmt.Sprintf(\"v%d\", i),\n\t\t\tvariable: field.Name,\n\t\t}\n\t}\n\n\tif function.Return.Present && function.Return.Name != \"\" {\n\t\tb.HasReturn = true\n\t\tb.ReturnType = string(function.Return.Type)\n\n\t\tif len(b.ReturnType) < 1 {\n\t\t\treturn nil, errors.New(\"return type cannot be empty\")\n\t\t}\n\n\t\tif b.ReturnType[0] == '*' {\n\t\t\tb.ReturnType = b.ReturnType[1:]\n\t\t\tb.ReturnIsPtr = true\n\t\t}\n\t}\n\n\tb.Method = transport.Method\n\n\t// Sort the arguments by name for consistent positional ordering.\n\tvar argVals []truce.ArgumentValue\n\tfor _, arg := range transport.Arguments {\n\t\targVals = append(argVals, arg)\n\t}\n\tsort.Slice(argVals, func(i, j int) bool {\n\t\treturn argVals[i].Name < argVals[j].Name\n\t})\n\n\tvar qpos int\n\tfor _, arg := range argVals {\n\t\ta, ok := args[arg.Name]\n\n\t\tswitch arg.From {\n\t\tcase \"body\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.BodyVar = a.posVariable\n\t\t\tb.BodyType = a.typ\n\t\tcase \"path\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpathMappings[arg.Var] = args[arg.Name].variable\n\t\tcase \"query\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.Query[arg.Var] = QueryParam{\n\t\t\t\tPos: qpos,\n\t\t\t\tQueryVar: arg.Var,\n\t\t\t\tGoVar: a.posVariable,\n\t\t\t\tType: a.typ,\n\t\t\t}\n\n\t\t\tqpos++\n\t\tcase \"static\":\n\t\t\t// TODO(georgemac)\n\t\t}\n\t}\n\n\tfor _, part := range strings.Split(config.Prefix, \"/\") {\n\t\tif part == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tb.Path = append(b.Path, Element{Type: \"static\", Value: part})\n\t}\n\n\tb.Path = append(b.Path, parsePath(pathMappings, transport.Path)...)\n\n\treturn b, nil\n}", "func (this *MillisToUTC) Constructor() FunctionConstructor { return NewMillisToUTC }", "func NewFuncs(ctx context.Context, enums []xo.Enum) *Funcs {\n\tdriver, _, _ := xo.DriverSchemaNthParam(ctx)\n\tenumMap := make(map[string]xo.Enum)\n\tif driver == \"mysql\" {\n\t\tfor _, e := range enums {\n\t\t\tenumMap[e.Name] = e\n\t\t}\n\t}\n\treturn &Funcs{\n\t\tdriver: driver,\n\t\tenumMap: enumMap,\n\t\tconstraint: Constraint(ctx),\n\t\tescCols: Esc(ctx, \"columns\"),\n\t\tescTypes: Esc(ctx, \"types\"),\n\t\tengine: Engine(ctx),\n\t}\n}", "func NewFunc(name string, nestDepth uint32) *FuncInfo {\n\tif name != \"\" {\n\t\treturn &FuncInfo{name: name}\n\t}\n\treturn &FuncInfo{closure: &printer.ReservedExpr{}}\n}", "func (f *Function) Type() ObjectType { return FUNCTION_OBJ }", "func NewLambda(vs []Argument, u bool, as []Argument, e Expression, t types.Type) Lambda {\n\treturn Lambda{as, e, t, vs, u}\n}", "func (f Function) New(ctx string) error {\n\treturn f.unsafeWrap(errors.New(ctx), ctx, \"\")\n}", "func Construct(ops ...AnsiCode) string {\n\tres := \"\\x1b[\"\n\tfor i, v := range ops {\n\t\tres += strconv.Itoa(int(v))\n\n\t\tif i != len(ops)-1 {\n\t\t\tres += \";\"\n\t\t}\n\t}\n\tres += \"m\"\n\n\treturn res\n}", "func (er *expressionRewriter) newFunction(funcName string, retType *types.FieldType, args ...expression.Expression) (expression.Expression, error) {\n\ttrace_util_0.Count(_expression_rewriter_00000, 275)\n\tif er.disableFoldCounter > 0 {\n\t\ttrace_util_0.Count(_expression_rewriter_00000, 277)\n\t\treturn expression.NewFunctionBase(er.ctx, funcName, retType, args...)\n\t}\n\ttrace_util_0.Count(_expression_rewriter_00000, 276)\n\treturn expression.NewFunction(er.ctx, funcName, retType, args...)\n}", "func (s *Prototype) Constructor() Value { return s.constructor }", "func (s StorageType) Constructor(optionalLiteralArgs string) string {\n\n\targs := \"\"\n\n\tswitch s {\n\tcase StorageFilesystem:\n\t\targs = \"\\\"games/\\\"\"\n\tcase StorageBolt:\n\t\targs = \"\\\".database\\\"\"\n\tcase StorageMysql:\n\t\targs = \"false\"\n\t}\n\n\tif optionalLiteralArgs != \"\" {\n\t\targs = optionalLiteralArgs\n\t}\n\n\treturn s.String() + \".NewStorageManager(\" + args + \")\"\n\n}", "func newInstance0(frame *rtda.Frame) {\n\tvars := frame.LocalVars()\n\tconstructorObj := vars.GetRef(0)\n\targArrObj := vars.GetRef(1)\n\n\tgoConstructor := getExtra(constructorObj)\n\tgoClass := goConstructor.Class()\n\tobj := goClass.NewObj()\n\tstack := frame.OperandStack()\n\tstack.PushRef(obj)\n\n\t// call <init>\n\targs := actualConstructorArgs(obj, argArrObj, goConstructor)\n\tframe.Thread().InvokeMethodWithShim(goConstructor, args)\n}", "func NewFunctionCall(callee Expression, arguments []Expression, trailing *TrailingFunction, metadata *Metadata) *FunctionCall {\n\treturn &FunctionCall{callee, arguments, trailing, metadata}\n}", "func (sf *ScalarFunction) Clone() Expression {\n\tc := &ScalarFunction{\n\t\tFuncName: sf.FuncName,\n\t\tRetType: sf.RetType,\n\t\tFunction: sf.Function.Clone(),\n\t}\n\treturn c\n}", "func NewConstructor() *Constructor {\n\treturn &Constructor{}\n}", "func New(chainFunc ...interface{}) *Chain {\n\tc := &Chain{}\n\tc.Add(chainFunc...)\n\treturn c\n}", "func NewMeta(operands ...Expression) Function {\n\trv := &Meta{\n\t\t*NewFunctionBase(\"meta\", operands...),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Constructor() MinStack {\n\treturn MinStack{atoms: []atom{}}\n}", "func Constructor() MyStack {\n\treturn MyStack{New(), New(), 1}\n}", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewFunction(fnLit *ast.FunctionLiteral, env *Environment) *Function {\n\treturn &Function{\n\t\tParameters: fnLit.Parameters,\n\t\tBody: fnLit.Body,\n\t\tEnv: env,\n\t}\n}", "func NewOperator(kind string, in, out reflect.Type, f func(ctx context.Context, field string, object interface{}) (interface{}, error)) Operator {\n\treturn &operator{\n\t\tkind: kind,\n\t\tin: in,\n\t\tout: out,\n\t\tf: f,\n\t}\n}", "func (e *exprHelper) NewCall(function string, args ...ast.Expr) ast.Expr {\n\treturn e.exprFactory.NewCall(e.nextMacroID(), function, args...)\n}", "func NewObject(t ...[2]*Term) Object {\n\tobj := newobject(len(t))\n\tfor i := range t {\n\t\tobj.Insert(t[i][0], t[i][1])\n\t}\n\treturn obj\n}", "func NewFunction(ctx openedge.Context, cfg FunctionInfo) *Function {\n\tf := &Function{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tids: make(chan string, cfg.Instance.Max),\n\t\tlog: logger.WithField(\"function\", cfg.Name),\n\t}\n\tfor index := 1; index <= cfg.Instance.Max; index++ {\n\t\tf.ids <- fmt.Sprintf(\"f%d\", index)\n\t}\n\tpc := pool.NewDefaultPoolConfig()\n\tpc.MinIdle = cfg.Instance.Min\n\tpc.MaxIdle = cfg.Instance.Max\n\tpc.MaxTotal = cfg.Instance.Max\n\tpc.MinEvictableIdleTime = cfg.Instance.IdleTime\n\tpc.TimeBetweenEvictionRuns = cfg.Instance.EvictTime\n\tf.pool = pool.NewObjectPool(context.Background(), newFactory(f), pc)\n\treturn f\n}", "func new_(e interface{}) func() Event {\n\ttyp := reflect.TypeOf(e)\n\treturn func() Event {\n\t\treturn reflect.New(typ).Interface().(Event)\n\t}\n}", "func ListConstructor(context RunContext, arguments []Argument) Value {\n\tvalues := make([]Value, len(arguments))\n\tfor i, arg := range arguments {\n\t\tvar value = EvalArgument(context, arg)\n\n\t\t// accept blocks within a list\n\t\t// as dictionaries in order to support\n\t\t// [{...} {...} ...] constructions\n\t\t//\n\t\tif value.Type() == TypeBlock {\n\t\t\tvalue = NewDictionaryWithBlock(context, value.(Block))\n\t\t}\n\n\t\tvalues[i] = value\n\t}\n\treturn NewListValue(values)\n}", "func MakeFunc(regVars []args.Var, inputs ...interface{}) (*Function, error) {\n\tfunction := new(Function)\n\n\tfunction.regVars = regVars\n\tvar varNum = make(map[args.Var]int)\n\tvar numVars int\n\tvar tempOpsStack []string\n\tvar postfixStack []interface{}\n\tfor i, v := range regVars {\n\t\tif _, ok := varNum[v]; !ok {\n\t\t\tvarNum[v] = numVars\n\t\t\tnumVars++\n\t\t\tcontinue\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Error registering variables. Variable at index %d, is a duplicate\", i)\n\n\t}\n\tvar inputType = make(map[int]args.Type)\n\tfor i, n := range inputs {\n\t\ttopIndexInPostfixStack := len(postfixStack) - 1\n\t\tswitch n.(type) {\n\t\tcase string:\n\t\t\toperation := n.(string)\n\t\t\tvar finishComparing bool\n\t\t\ttopIndexInTempOpsStack := len(tempOpsStack) - 1\n\t\t\tif len(tempOpsStack) == 0 ||\n\t\t\t\t(tempOpsStack[topIndexInTempOpsStack] == leftParen && operation != rightParen) {\n\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t} else if operation == leftParen {\n\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t} else if operation == rightParen {\n\t\t\t\tfor !finishComparing {\n\t\t\t\t\tif len(tempOpsStack) == 0 {\n\t\t\t\t\t\treturn nil, errors.New(\"Mismatch of Parentheses found\")\n\t\t\t\t\t}\n\t\t\t\t\ttopOperationInTempOpsStack := tempOpsStack[topIndexInTempOpsStack]\n\t\t\t\t\tif topOperationInTempOpsStack == leftParen {\n\t\t\t\t\t\ttempOpsStack = tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\t\t\t\t\tpostfixStack, tempOpsStack = append(postfixStack, topOperationInTempOpsStack), tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t}\n\t\t\t\t\ttopIndexInTempOpsStack = len(tempOpsStack) - 1\n\t\t\t\t\ttopIndexInPostfixStack = len(postfixStack) - 1\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttopOperationInTempOpsStack := tempOpsStack[topIndexInTempOpsStack]\n\t\t\t\tvar isPreviousUnary bool\n\t\t\t\tvar isUnary bool\n\t\t\t\tif _, ok := unaryFuncs[topOperationInTempOpsStack]; ok {\n\t\t\t\t\tisPreviousUnary = true\n\t\t\t\t}\n\t\t\t\tif _, ok := unaryFuncs[operation]; ok {\n\t\t\t\t\tisUnary = true\n\t\t\t\t}\n\t\t\t\tif isPreviousUnary || orderOfOperations[operation] < orderOfOperations[topOperationInTempOpsStack] {\n\t\t\t\t\tfor !finishComparing {\n\t\t\t\t\t\tif isUnary && isPreviousUnary {\n\t\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t\t} else if (topOperationInTempOpsStack == leftParen ||\n\t\t\t\t\t\t\torderOfOperations[operation] > orderOfOperations[topOperationInTempOpsStack] ||\n\t\t\t\t\t\t\tisUnary) &&\n\t\t\t\t\t\t\t!isPreviousUnary {\n\t\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t\t} else if orderOfOperations[operation] == orderOfOperations[topOperationInTempOpsStack] {\n\t\t\t\t\t\t\tif operation == pow {\n\t\t\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\t\t\t\t\t\t\tpostfixStack, tempOpsStack = append(postfixStack, topOperationInTempOpsStack), tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t\t\t\ttopIndexInTempOpsStack = len(tempOpsStack) - 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if orderOfOperations[operation] < orderOfOperations[topOperationInTempOpsStack] || isPreviousUnary {\n\t\t\t\t\t\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\t\t\t\t\t\tpostfixStack, tempOpsStack = append(postfixStack, topOperationInTempOpsStack), tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t\t\ttopIndexInTempOpsStack = len(tempOpsStack) - 1\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif len(tempOpsStack) == 0 {\n\t\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t\t\tfinishComparing = true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttopOperationInTempOpsStack = tempOpsStack[topIndexInTempOpsStack]\n\t\t\t\t\t\t\ttopIndexInPostfixStack = len(postfixStack) - 1\n\t\t\t\t\t\t\tif _, ok := unaryFuncs[topOperationInTempOpsStack]; !ok {\n\t\t\t\t\t\t\t\tisPreviousUnary = false\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} else if orderOfOperations[operation] > orderOfOperations[topOperationInTempOpsStack] {\n\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t} else if orderOfOperations[operation] == orderOfOperations[topOperationInTempOpsStack] {\n\t\t\t\t\tif operation == pow {\n\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\t\t\t\t\tpostfixStack, tempOpsStack = append(postfixStack, topOperationInTempOpsStack), tempOpsStack[:topIndexInTempOpsStack]\n\t\t\t\t\t\ttempOpsStack = append(tempOpsStack, operation)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase int, int32, int64, float32, float64, complex64, complex128, gcv.Value, v.Vector, m.Matrix:\n\t\t\tpostfixStack = append(postfixStack, args.MakeConst(inputs[i]))\n\t\t\tinputType[topIndexInPostfixStack+1] = args.Constant\n\t\tcase args.Const:\n\t\t\tpostfixStack = append(postfixStack, n)\n\t\t\tinputType[topIndexInPostfixStack+1] = args.Constant\n\t\tcase args.Var:\n\t\t\tif _, ok := varNum[n.(args.Var)]; !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Variable at index %d, was not registered\", i)\n\n\t\t\t}\n\t\t\tpostfixStack = append(postfixStack, n)\n\t\t\tinputType[topIndexInPostfixStack+1] = args.Variable\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Input type not supported\")\n\t\t}\n\t}\n\n\tfor len(tempOpsStack) > 0 {\n\t\ttopIndexInTempOpsStack := len(tempOpsStack) - 1\n\t\ttopIndexInPostfixStack := len(postfixStack) - 1\n\t\tvar operation string\n\t\toperation, tempOpsStack = tempOpsStack[topIndexInTempOpsStack], tempOpsStack[:topIndexInTempOpsStack]\n\t\tif operation == \"(\" {\n\t\t\treturn nil, errors.New(\"Mismatch of Parentheses found\")\n\t\t}\n\t\tinputType[topIndexInPostfixStack+1] = args.Operation\n\t\tpostfixStack = append(postfixStack, operation)\n\t}\n\n\tfunction.inputTypes = inputType\n\tfunction.numVars = numVars\n\tfunction.varNum = varNum\n\tfunction.Args = postfixStack\n\treturn function, nil\n}", "func NewSelf() Function {\n\trv := &Self{\n\t\t*NewNullaryFunctionBase(\"self\"),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewFunctions() Functions {\n\treturn dynaml.NewFunctions()\n}", "func NewFunctionBase(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, false, funcName, retType, args...)\n}", "func NewCurry(fn interface{}) (*Curry, error) {\n\ttyp := reflect.TypeOf(fn)\n\n\tif typ.Kind() != reflect.Func {\n\t\treturn nil, fmt.Errorf(\"Handler is not a function!\")\n\t}\n\n\tc := &Curry{\n\t\tname: getFunctionName(fn),\n\t\tfnType: typ,\n\t\tfn: fn,\n\t}\n\n\treturn c, nil\n}", "func NewFunction(pkg, name string,\n\tparams, ret, block []jen.Code) *Function {\n\treturn &Function{\n\t\tqual: jen.Qual(pkg, name),\n\t\tname: name,\n\t\tparams: params,\n\t\tret: ret,\n\t\tblock: block,\n\t}\n}", "func Constructor() MapSum {\n\treturn MapSum{}\n}", "func (o *FakeObject) New(args ...interface{}) Object { return o.Invoke(args) }", "func NewConstructor() Constructor {\n\treturn func(ctx context.Context, cmw configmap.Watcher) *controller.Impl {\n\t\treturn NewController(ctx, cmw)\n\t}\n}", "func parseFuncDecl(bci *BenchClientInfo, decl *ast.FuncDecl) {\n\tif !strings.HasPrefix(decl.Name.String(), \"New\") {\n\t\treturn\n\t}\n\n\tfuncName := decl.Name.String()\n\tfor _, r := range decl.Type.Results.List {\n\t\tretName := types.ExprString(r.Type)\n\t\tif s, ok := bci.Services[retName]; ok {\n\t\t\t// s has already been added in parseGenDecl()\n\t\t\ts.Factory = funcName\n\t\t}\n\t}\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}" ]
[ "0.7036529", "0.6818059", "0.67975676", "0.6667405", "0.66347975", "0.66347975", "0.66178346", "0.65968144", "0.65968144", "0.65434146", "0.65172905", "0.6424325", "0.6424325", "0.641571", "0.63585794", "0.6329511", "0.6329511", "0.6309147", "0.6287411", "0.6280646", "0.6214294", "0.6196266", "0.6126052", "0.6097895", "0.6062177", "0.60584515", "0.60473454", "0.60315204", "0.6030186", "0.60016966", "0.6000327", "0.585112", "0.58025867", "0.5747753", "0.57385254", "0.5614321", "0.5601523", "0.5551406", "0.5546488", "0.55286205", "0.5491208", "0.54055727", "0.5379269", "0.5364316", "0.5355526", "0.53401476", "0.53310925", "0.53122747", "0.5296172", "0.52830225", "0.5273873", "0.52616894", "0.5257792", "0.5224439", "0.5186851", "0.5178486", "0.515678", "0.51486593", "0.5148182", "0.51481396", "0.5128279", "0.5124688", "0.5117706", "0.51036257", "0.5103022", "0.50986475", "0.50704956", "0.5061644", "0.5056158", "0.49909496", "0.4986926", "0.49712572", "0.49703315", "0.49675047", "0.49645776", "0.49492168", "0.49399224", "0.49399146", "0.49380735", "0.49322143", "0.49319184", "0.4921877", "0.49149275", "0.48981756", "0.48855713", "0.48841634", "0.48812827", "0.48759952", "0.4847985", "0.4845226", "0.48359388", "0.48344636", "0.48194623", "0.48074317", "0.48070437", "0.47857314", "0.4775789", "0.47756872", "0.47756872" ]
0.78175247
1
/ The function NewObjectPairs calls NewUnaryFunctionBase to create a function named OBJECT_PAIRS with an expression as input.
Функция NewObjectPairs вызывает NewUnaryFunctionBase для создания функции с именем OBJECT_PAIRS и выражением в качестве входных данных.
func NewObjectPairs(operand Expression) Function { rv := &ObjectPairs{ *NewUnaryFunctionBase("object_pairs", operand), } rv.expr = rv return rv }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewObjectInnerPairs(operand Expression) Function {\n\trv := &ObjectInnerPairs{\n\t\t*NewUnaryFunctionBase(\"object_innerpairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewPairs(array *expression.ArrayConstruct) (pairs Pairs, err error) {\n\toperands := array.Operands()\n\tpairs = make(Pairs, len(operands))\n\tfor i, op := range operands {\n\t\tpairs[i], err = NewPair(op)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn\n}", "func NewPair(expr expression.Expression) (*Pair, error) {\n\tarray, ok := expr.(*expression.ArrayConstruct)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Invalid VALUES expression %s\", expr.String())\n\t}\n\n\toperands := array.Operands()\n\tif len(operands) != 2 {\n\t\treturn nil, fmt.Errorf(\"Invalid VALUES expression %s\", expr.String())\n\t}\n\n\tpair := &Pair{\n\t\tKey: operands[0],\n\t\tValue: operands[1],\n\t}\n\n\treturn pair, nil\n}", "func (s Record) NewPairs(n int32) (Pair_List, error) {\n\tl, err := NewPair_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn Pair_List{}, err\n\t}\n\terr = s.Struct.SetPtr(7, l.List.ToPtr())\n\treturn l, err\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func NewObject(t ...[2]*Term) Object {\n\tobj := newobject(len(t))\n\tfor i := range t {\n\t\tobj.Insert(t[i][0], t[i][1])\n\t}\n\treturn obj\n}", "func (this *ObjectInnerPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerPairs(operands[0])\n\t}\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (o *Object) AddPair(key, value string) {\n\to.Pairs = append(o.Pairs, Pair{Key: key, Value: value})\n}", "func NewPair(key string, value interface{}) *Pair {\n\treturn &Pair{\n\t\tkey: key,\n\t\tvalue: value,\n\t}\n}", "func NewPairs(local, remote Candidates) Pairs {\n\tp := make(Pairs, 0, 100)\n\tfor l := range local {\n\t\tfor r := range remote {\n\t\t\t// Same data stream.\n\t\t\tif local[l].ComponentID != remote[r].ComponentID {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar (\n\t\t\t\tipL, ipR = local[l].Addr.IP, remote[r].Addr.IP\n\t\t\t)\n\t\t\t// Same IP address family.\n\t\t\tif !sameFamily(ipL, ipR) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ipL.To4() == nil && ipL.IsLinkLocalUnicast() {\n\t\t\t\t// IPv6 link-local addresses MUST NOT be paired with other\n\t\t\t\t// than link-local addresses.\n\t\t\t\tif !ipR.IsLinkLocalUnicast() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tp = append(p, Pair{\n\t\t\t\tLocal: local[l], Remote: local[r],\n\t\t\t})\n\t\t}\n\t}\n\treturn p\n}", "func NewPair(base, counter Asset) Pair {\n\treturn Pair{\n\t\tBase: base,\n\t\tCounter: counter,\n\t}\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Make(e1, e2 interface{}) (p Pair) {\n\tp[0] = e1\n\tp[1] = e2\n\n\treturn p\n}", "func NewPair(baseCurrency, quoteCurrency Code) Pair {\n\treturn Pair{\n\t\tBase: baseCurrency,\n\t\tQuote: quoteCurrency,\n\t}\n}", "func NewPair_List(s *capnp.Segment, sz int32) (Pair_List, error) {\n\tl, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2}, sz)\n\treturn Pair_List{l}, err\n}", "func NewObjectInnerValues(operand Expression) Function {\n\trv := &ObjectInnerValues{\n\t\t*NewUnaryFunctionBase(\"object_innervalues\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (_SushiV2Factory *SushiV2FactorySession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.CreatePair(&_SushiV2Factory.TransactOpts, tokenA, tokenB)\n}", "func newPair(key, value []byte) *item {\n\treturn &item{key: key, value: value}\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryFilterer) FilterPairCreated(opts *bind.FilterOpts, token0 []common.Address, token1 []common.Address) (*IUniswapV2FactoryPairCreatedIterator, error) {\r\n\r\n\tvar token0Rule []interface{}\r\n\tfor _, token0Item := range token0 {\r\n\t\ttoken0Rule = append(token0Rule, token0Item)\r\n\t}\r\n\tvar token1Rule []interface{}\r\n\tfor _, token1Item := range token1 {\r\n\t\ttoken1Rule = append(token1Rule, token1Item)\r\n\t}\r\n\r\n\tlogs, sub, err := _IUniswapV2Factory.contract.FilterLogs(opts, \"PairCreated\", token0Rule, token1Rule)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn &IUniswapV2FactoryPairCreatedIterator{contract: _IUniswapV2Factory.contract, event: \"PairCreated\", logs: logs, sub: sub}, nil\r\n}", "func EvalPairlist(ev *Evaluator, node *ast.CallExpr) (r *RSEXP) {\n\tTRACE := ev.Trace\n\tif TRACE {\n\t\tprintln(\"Pairlist\")\n\t}\n\n\treturn &RSEXP{ValuePos: node.Fun.Pos(),\n\t\tCAR: EvalExprOrAssignment(ev, node.Args[0]),\n\t\tCDR: EvalExprOrAssignment(ev, node.Args[1])}\n}", "func (_SushiV2Factory *SushiV2FactoryFilterer) FilterPairCreated(opts *bind.FilterOpts, token0 []common.Address, token1 []common.Address) (*SushiV2FactoryPairCreatedIterator, error) {\n\n\tvar token0Rule []interface{}\n\tfor _, token0Item := range token0 {\n\t\ttoken0Rule = append(token0Rule, token0Item)\n\t}\n\tvar token1Rule []interface{}\n\tfor _, token1Item := range token1 {\n\t\ttoken1Rule = append(token1Rule, token1Item)\n\t}\n\n\tlogs, sub, err := _SushiV2Factory.contract.FilterLogs(opts, \"PairCreated\", token0Rule, token1Rule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &SushiV2FactoryPairCreatedIterator{contract: _SushiV2Factory.contract, event: \"PairCreated\", logs: logs, sub: sub}, nil\n}", "func FromPairs(data interface{}) (interface{}, error) {\n\tvar err error\n\n\tresult := func(err *error) interface{} {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn nil\n\t\t}\n\n\t\tdataValue, dataValueType, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif dataValueType.Elem().Kind() != reflect.Interface {\n\t\t\t*err = errors.New(\"supported type only []interface{}\")\n\t\t\treturn nil\n\t\t}\n\n\t\tresult := make(map[interface{}]interface{}, 0)\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn result\n\t\t}\n\n\t\tforEachSliceStoppable(dataValue, dataValueLen, func(each reflect.Value, i int) bool {\n\t\t\tif *err != nil {\n\t\t\t\tresult = nil\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\teachSlice := each.Elem()\n\t\t\teachSliceLen := eachSlice.Len()\n\n\t\t\tif eachSliceLen > 2 {\n\t\t\t\teachSliceLen = 2\n\t\t\t}\n\n\t\t\tif eachSliceLen > 0 {\n\t\t\t\teachSliceKey := eachSlice.Index(0).Interface()\n\t\t\t\tresult[eachSliceKey] = nil\n\n\t\t\t\tif eachSliceLen > 1 {\n\t\t\t\t\teachSliceVal := eachSlice.Index(1).Interface()\n\t\t\t\t\tresult[eachSliceKey] = eachSliceVal\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true\n\t\t})\n\n\t\treturn result\n\t}(&err)\n\n\treturn result, err\n}", "func (_SushiV2Factory *SushiV2FactoryTransactorSession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.Contract.CreatePair(&_SushiV2Factory.TransactOpts, tokenA, tokenB)\n}", "func (_SushiV2Factory *SushiV2FactoryTransactor) CreatePair(opts *bind.TransactOpts, tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\n\treturn _SushiV2Factory.contract.Transact(opts, \"createPair\", tokenA, tokenB)\n}", "func Pair(arg1 TermT, arg2 TermT) TermT {\n\treturn TermT(C.yices_pair(C.term_t(arg1), C.term_t(arg2)))\n}", "func NewPairFromStrings(baseCurrency, quoteCurrency string) Pair {\n\treturn Pair{\n\t\tBase: NewCode(baseCurrency),\n\t\tQuote: NewCode(quoteCurrency),\n\t}\n}", "func (this *ObjectPairs) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = map[string]interface{}{\"name\": k, \"value\": oa[k]}\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (this *ObjectPairs) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = map[string]interface{}{\"name\": k, \"value\": oa[k]}\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (_IUniswapV2Factory *IUniswapV2FactorySession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.Contract.CreatePair(&_IUniswapV2Factory.TransactOpts, tokenA, tokenB)\r\n}", "func GenerateNewKeypair() *Keypair {\n\n\tpk, _ := ecdsa.GenerateKey(elliptic.P224(), rand.Reader)\n\n\tb := bigJoin(KEY_SIZE, pk.PublicKey.X, pk.PublicKey.Y)\n\n\tpublic := base58.EncodeBig([]byte{}, b)\n\tprivate := base58.EncodeBig([]byte{}, pk.D)\n\n\tkp := Keypair{Public: public, Private: private}\n\n\treturn &kp\n}", "func execNewTuple(arity int, p *gop.Context) {\n\targs := p.GetArgs(arity)\n\tconv := func(args []interface{}) []*types.Var {\n\t\tret := make([]*types.Var, len(args))\n\t\tfor i, arg := range args {\n\t\t\tret[i] = arg.(*types.Var)\n\t\t}\n\t\treturn ret\n\t}\n\tret := types.NewTuple(conv(args[0:])...)\n\tp.Ret(arity, ret)\n}", "func NewHashPair(pos int, line int) *HashPair {\n\treturn &HashPair{\n\t\tNodeType: NodeHashPair,\n\t\tLoc: Loc{pos, line},\n\t}\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryTransactorSession) CreatePair(tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.Contract.CreatePair(&_IUniswapV2Factory.TransactOpts, tokenA, tokenB)\r\n}", "func (this *ObjectInnerPairs) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := removeMissing(arg)\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = map[string]interface{}{\"name\": k, \"value\": oa[k]}\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (lscript *Scripting) registerPairType() {\n\tmt := lscript.NewTypeMetatable(luaPairTypeName)\n\tlscript.SetGlobal(\"pair\", mt)\n\t// static attributes\n\tlscript.SetField(mt, \"new\", lscript.NewFunction(newPair))\n\t// methods\n\tlscript.SetField(mt, \"__index\", lscript.SetFuncs(lscript.NewTable(), pairMethods))\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryTransactor) CreatePair(opts *bind.TransactOpts, tokenA common.Address, tokenB common.Address) (*types.Transaction, error) {\r\n\treturn _IUniswapV2Factory.contract.Transact(opts, \"createPair\", tokenA, tokenB)\r\n}", "func (p *SliceOfMap) Pair() (first, second *Object) {\n\tfirst, second = &Object{}, &Object{}\n\tif p == nil {\n\t\treturn\n\t}\n\tif len(*p) > 0 {\n\t\tfirst = p.At(0)\n\t}\n\tif len(*p) > 1 {\n\t\tsecond = p.At(1)\n\t}\n\treturn\n}", "func NewPatternExprPair(pattern Pattern, expr Expr) PatternExprPair {\n\treturn PatternExprPair{pattern, expr}\n}", "func Pair(x, y interface{}) Node {\n\treturn Expr(\":\", x, y)\n}", "func NewKeypair() (*Keypair, error) {\n\tpub, priv, err := GenerateKeypair()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Keypair{\n\t\tpriv: *priv,\n\t\tpub: *pub,\n\t}, nil\n}", "func NewKeyPair(rootKey RootKeyable, chainKey ChainKeyable) *KeyPair {\n\tkeyPair := KeyPair{\n\t\tRootKey: rootKey,\n\t\tChainKey: chainKey,\n\t}\n\n\treturn &keyPair\n}", "func NewPair[T1, T2 any](first T1, second T2) Pair[T1, T2] {\n\treturn Pair[T1, T2]{First: first, Second: second}\n}", "func NewKeyValuePair(key QualifiedName, value Variant) *_KeyValuePair {\n\t_result := &_KeyValuePair{\n\t\tKey: key,\n\t\tValue: value,\n\t\t_ExtensionObjectDefinition: NewExtensionObjectDefinition(),\n\t}\n\t_result._ExtensionObjectDefinition._ExtensionObjectDefinitionChildRequirements = _result\n\treturn _result\n}", "func newPagePairHandlerFunc(params *pages.HandlerParams) *pages.Result {\n\tdecoder := json.NewDecoder(params.R.Body)\n\tvar data newPagePairData\n\terr := decoder.Decode(&data)\n\tif err != nil {\n\t\treturn pages.Fail(\"Couldn't decode json\", err).Status(http.StatusBadRequest)\n\t}\n\n\treturn newPagePairHandlerInternal(params.DB, params.U, &data)\n}", "func Pair(children ...Element) *CompoundElement { return newCE(\"Pair\", children) }", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (s *GitTestHelper) NewRepoPair(basedir string) {\n\tgit := s.Git()\n\ttarget := s.toAbsPath(basedir)\n\ts.Chdir(target)\n\ts.Mkdir(\"source\")\n\ts.Chdir(\"source\")\n\ts.Exec(git, \"init\", \"--bare\")\n\ts.Chdir(\"..\")\n\ts.Exec(git, \"clone\", \"source\", \"dest\")\n\n\ts.Chdir(\"dest\")\n\ts.TouchAndCommit(\"init.txt\", \"init\")\n\ts.Exec(git, \"push\", \"origin\")\n}", "func NewKeyPair(pub crypto.PublicKey, privArmor string) KeyPair {\n\treturn KeyPair{\n\t\tPublicKey: pub,\n\t\tPrivKeyArmor: privArmor,\n\t}\n}", "func (_SushiV2Factory *SushiV2FactoryCaller) AllPairs(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SushiV2Factory.contract.Call(opts, &out, \"allPairs\", arg0)\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func NewObjectExpression() *ObjectExpression {\n\treturn &ObjectExpression{\n\t\tprops: make(map[string]Expression),\n\t}\n}", "func NewAttributePair(attributeVals []string, attrOwner *AttributeOwner) (*AttributePair, error) {\n\tif len(attributeVals) < 6 {\n\t\treturn nil, errors.New(\"Invalid attribute entry\")\n\t}\n\tvar attrPair = *new(AttributePair)\n\tif attrOwner != nil {\n\t\tattrPair.SetOwner(attrOwner)\n\t} else {\n\t\tattrPair.SetOwner(&AttributeOwner{strings.TrimSpace(attributeVals[0]), strings.TrimSpace(attributeVals[1])})\n\t}\n\tattrPair.SetAttributeName(strings.TrimSpace(attributeVals[2]))\n\tattrPair.SetAttributeValue([]byte(strings.TrimSpace(attributeVals[3])))\n\t//Reading validFrom date\n\tdateStr := strings.TrimSpace(attributeVals[4])\n\tif dateStr != \"\" {\n\t\tvar t time.Time\n\t\tvar err error\n\t\tif t, err = time.Parse(time.RFC3339, dateStr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattrPair.SetValidFrom(t)\n\t}\n\t//Reading validTo date\n\tdateStr = strings.TrimSpace(attributeVals[5])\n\tif dateStr != \"\" {\n\t\tvar t time.Time\n\t\tvar err error\n\t\tif t, err = time.Parse(time.RFC3339, dateStr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattrPair.SetValidTo(t)\n\t}\n\treturn &attrPair, nil\n}", "func NewPairWithDelimiter(base, quote, delimiter string) Pair {\n\treturn Pair{\n\t\tBase: NewCode(base),\n\t\tQuote: NewCode(quote),\n\t\tDelimiter: delimiter,\n\t}\n}", "func GenericHpairFunction(env *Zlisp, name string, args []Sexp) (Sexp, error) {\n\tif len(args) != 2 {\n\t\treturn SexpNull, WrongNargs\n\t}\n\n\tposreq, isInt := args[1].(*SexpInt)\n\tif !isInt {\n\t\treturn SexpNull, fmt.Errorf(\"hpair position request must be an integer\")\n\t}\n\tpos := int(posreq.Val)\n\n\tswitch seq := args[0].(type) {\n\tcase *SexpHash:\n\t\tif pos < 0 || pos >= len(seq.KeyOrder) {\n\t\t\treturn SexpNull, fmt.Errorf(\"hpair position request %d out of bounds\", pos)\n\t\t}\n\t\treturn seq.HashPairi(pos)\n\tcase *SexpArray:\n\t\tif pos < 0 || pos >= len(seq.Val) {\n\t\t\treturn SexpNull, fmt.Errorf(\"hpair position request %d out of bounds\", pos)\n\t\t}\n\t\treturn Cons(&SexpInt{Val: int64(pos)}, Cons(seq.Val[pos], SexpNull)), nil\n\tdefault:\n\t\treturn SexpNull, errors.New(\"first argument of to hpair function must be hash, list, or array\")\n\t}\n\t//return SexpNull, nil\n}", "func NewPair(p *big.Int, g int64) (private, public *big.Int) {\n\tprivate = PrivateKey(p)\n\tpublic = PublicKey(private, p, g)\n\treturn\n}", "func NewPair(p *big.Int, g int64) (*big.Int, *big.Int) {\n\tprivateKey := PrivateKey(p)\n\tpublicKey := PublicKey(privateKey, p, g)\n\treturn privateKey, publicKey\n}", "func (e *Engine) AddPair(g1 *PointG1, g2 *PointG2) *Engine {\n\tp := newPair(g1, g2)\n\tif !(e.G1.IsZero(p.g1) || e.G2.IsZero(p.g2)) {\n\t\te.G1.Affine(p.g1)\n\t\te.G2.Affine(p.g2)\n\t\te.pairs = append(e.pairs, p)\n\t}\n\treturn e\n}", "func CreateVethPairs(veth1 string, veth2 string) (err error) {\n\terr = exec.Command(\"ip\", \"link\", \"add\", veth1, \"type\", \"veth\", \"peer\", \"name\", veth2).Run()\n\tif err != nil {\n\t\tlogger.WithFields(log.Fields{\n\t\t\t\"veth1\": veth1,\n\t\t\t\"veth2\": veth2,\n\t\t}).Error(\"Fail to createVethPair()\", err.Error())\n\t\treturn\n\t}\n\tlogger.Info(\"%s & %s was created.\", veth1, veth2)\n\terr = exec.Command(\"ip\", \"link\", \"set\", veth1, \"up\").Run()\n\tif err != nil {\n\t\tlogger.Error(\"Fail to createVeth() veth1 up: %v\", err)\n\t\treturn\n\t}\n\terr = exec.Command(\"ip\", \"link\", \"set\", veth2, \"up\").Run()\n\tif err != nil {\n\t\tlogger.Error(\"Fail to createVeth() veth2 up: %v\", err)\n\t\treturn\n\t}\n\tlogger.Info(\"%s & %s was up.\", veth1, veth2)\n\treturn\n}", "func (_SushiV2Factory *SushiV2FactoryCallerSession) AllPairs(arg0 *big.Int) (common.Address, error) {\n\treturn _SushiV2Factory.Contract.AllPairs(&_SushiV2Factory.CallOpts, arg0)\n}", "func NewKeyPair(config CreateKeyPairConfig) (KeyPair, error) {\n\tif config.Type == Default {\n\t\tconfig.Type = Ecdsa\n\t}\n\n\tswitch config.Type {\n\tcase Ecdsa:\n\t\treturn newEcdsaKeyPair(config)\n\tcase Rsa:\n\t\treturn newRsaKeyPair(config)\n\t}\n\n\treturn KeyPair{}, fmt.Errorf(\"Unable to generate new key pair, type %s is not supported\",\n\t\tconfig.Type.String())\n}", "func (_SushiV2Factory *SushiV2FactorySession) AllPairs(arg0 *big.Int) (common.Address, error) {\n\treturn _SushiV2Factory.Contract.AllPairs(&_SushiV2Factory.CallOpts, arg0)\n}", "func NewAutorepair(opts AutorepairOptions, kubeClient kube_client.Interface,\n\tkubeEventRecorder kube_record.EventRecorder, listerRegistry kube_util.ListerRegistry) (Autorepair, errors.AutorepairError) {\n\n\tautorepairBuilder := NewAutorepairBuilder(opts.AutorepairingOptions, kubeClient, kubeEventRecorder, listerRegistry )\n\treturn NewDynamicAutorepair(autorepairBuilder)\n}", "func NewPairFromString(currencyPair string) Pair {\n\tdelimiters := []string{\"_\", \"-\", \"/\"}\n\tvar delimiter string\n\tfor _, x := range delimiters {\n\t\tif strings.Contains(currencyPair, x) {\n\t\t\tdelimiter = x\n\t\t\treturn NewPairDelimiter(currencyPair, delimiter)\n\t\t}\n\t}\n\treturn NewPairFromStrings(currencyPair[0:3], currencyPair[3:])\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryFilterer) ParsePairCreated(log types.Log) (*IUniswapV2FactoryPairCreated, error) {\r\n\tevent := new(IUniswapV2FactoryPairCreated)\r\n\tif err := _IUniswapV2Factory.contract.UnpackLog(event, \"PairCreated\", log); err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tevent.Raw = log\r\n\treturn event, nil\r\n}", "func (s stack) CreateKeyPair(ctx context.Context, name string) (_ *abstract.KeyPair, ferr fail.Error) {\n\tif valid.IsNil(s) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif name == \"\" {\n\t\treturn nil, fail.InvalidParameterError(\"name\", \"cannot be empty string\")\n\t}\n\n\treturn abstract.NewKeyPair(name)\n}", "func NewPairing(address common.Address, backend bind.ContractBackend) (*Pairing, error) {\n\tcontract, err := bindPairing(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Pairing{PairingCaller: PairingCaller{contract: contract}, PairingTransactor: PairingTransactor{contract: contract}, PairingFilterer: PairingFilterer{contract: contract}}, nil\n}", "func NewSliceStringPairs(s [][2]string) StringPairs {\n\treturn sliceStringPairs(s)\n}", "func (this *ObjectPairs) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectPairs) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryCaller) AllPairs(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {\r\n\tvar out []interface{}\r\n\terr := _IUniswapV2Factory.contract.Call(opts, &out, \"allPairs\", arg0)\r\n\r\n\tif err != nil {\r\n\t\treturn *new(common.Address), err\r\n\t}\r\n\r\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\r\n\r\n\treturn out0, err\r\n\r\n}", "func (s *clusterPairLister) ClusterPairs(namespace string) ClusterPairNamespaceLister {\n\treturn clusterPairNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "func NewPairing(controller *pair.PairingController) *Pairing {\n\thandler := Pairing{\n\t\tcontroller: controller,\n\t}\n\n\treturn &handler\n}", "func NewKeyPair() (*keyPair, error) {\n\tprivKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprivKey.Precompute()\n\n\tpubKey := &privKey.PublicKey\n\treturn &keyPair{Private: privKey, Public: pubKey}, nil\n}", "func (_SushiV2Factory *SushiV2FactoryFilterer) ParsePairCreated(log types.Log) (*SushiV2FactoryPairCreated, error) {\n\tevent := new(SushiV2FactoryPairCreated)\n\tif err := _SushiV2Factory.contract.UnpackLog(event, \"PairCreated\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func newPairsHash(c []Card) pairsHash {\n\tpairs := make(pairsHash)\n\tfor _, v := range c {\n\t\tif _, ok := pairs[v.Rank()]; ok {\n\t\t\tpairs[v.Rank()]++\n\t\t} else {\n\t\t\tpairs[v.Rank()] = 1\n\t\t}\n\t}\n\treturn pairs\n}", "func createKeypair() *keypair.Full {\n\tpair, err := keypair.Random()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Println(\"Seed:\", pair.Seed())\n\tlog.Println(\"Address:\", pair.Address())\n\n\treturn pair\n}", "func (_IUniswapV2Factory *IUniswapV2FactoryCallerSession) AllPairs(arg0 *big.Int) (common.Address, error) {\r\n\treturn _IUniswapV2Factory.Contract.AllPairs(&_IUniswapV2Factory.CallOpts, arg0)\r\n}", "func NewObjectPut(first, second, third Expression) Function {\n\trv := &ObjectPut{\n\t\t*NewTernaryFunctionBase(\"object_put\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewEnvironmentVariablePair1(name string, value string) *EnvironmentVariablePair1 {\n\tthis := EnvironmentVariablePair1{}\n\tthis.Name = name\n\tthis.Value = value\n\treturn &this\n}", "func NewPair(p *big.Int, g int64) (private, public *big.Int) {\n\tprivKey := PrivateKey(p)\n\tpubKey := PublicKey(privKey, p, g)\n\treturn privKey, pubKey\n}", "func CreateTree(pairs []string) (root Node) {\n\troot = Node{Name: \"COM\", Parent: nil, Children: nil}\n\trecursiveInsertToTree(&root, pairs)\n\treturn\n}", "func CreateKeyPair(conn *ec2.EC2) (KeyPair, error) {\n\tname := generateKeyPairName()\n\tvar kp KeyPair\n\tkp.KeyName = name\n\n\tparams := &ec2.CreateKeyPairInput{\n\t\tKeyName: aws.String(name),\n\t}\n\n\tresp, err := conn.CreateKeyPair(params)\n\tif err != nil {\n\t\treturn kp, err\n\t}\n\n\tkp.Fingerprint = *resp.KeyFingerprint\n\tkp.PrivateKeyPEM = *resp.KeyMaterial\n\tkp.Created = true\n\n\treturn kp, nil\n}", "func (f *FieldsWithValue) Pairs(separator string) []string {\n\tpairs := make([]string, len(f.fields))\n\tfor i, v := range f.fields {\n\t\tpairs[i] = fmt.Sprintf(\"%s%s%s\", v.Name, separator, v.Value)\n\t}\n\treturn pairs\n}", "func NewObjectUnwrap(operand Expression) Function {\n\trv := &ObjectUnwrap{\n\t\t*NewUnaryFunctionBase(\"object_unwrap\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (_IUniswapV2Factory *IUniswapV2FactorySession) AllPairs(arg0 *big.Int) (common.Address, error) {\r\n\treturn _IUniswapV2Factory.Contract.AllPairs(&_IUniswapV2Factory.CallOpts, arg0)\r\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func Pairs(word string, opts ...FuncOpt) []Pair {\n\tvar m funcMod\n\tfor _, opt := range opts {\n\t\topt(&m)\n\t}\n\tif m.buf == nil && len(word) > 0 {\n\t\tm.buf = make([]Pair, 0, len([]rune(word))-1)\n\t}\n\n\treturn pairs(word, m.buf)\n}", "func NewTable(syms []obj.Sym) *Table {\n\t// Put syms in address order for fast address lookup.\n\tsort.Slice(syms, func(i, j int) bool {\n\t\treturn syms[i].Value < syms[j].Value\n\t})\n\n\t// Create name map for fast name lookup.\n\tname := make(map[string]int)\n\tfor i, s := range syms {\n\t\tname[s.Name] = i\n\t}\n\n\treturn &Table{syms, name}\n}", "func NewCryptorPair(key [keyLen]byte, nonce [nonceLen]byte, when int64) (\n\tstoi *Cryptor, /* Shift to Insert stream */\n\titos *Cryptor, /* Insert to Shift stream */\n\terr error) {\n\n\t/* Generate the time-adjusted nonce */\n\ttimedNonce := make([]byte, 8)\n\tfor i, n := range nonce {\n\t\t/* Should never happen */\n\t\tif 0 > i {\n\t\t\treturn nil, nil,\n\t\t\t\tfmt.Errorf(\"unpossible negative nonce index\")\n\t\t}\n\t\ttimedNonce[i] = n ^ byte((when>>(8*uint(i)))&0xFF)\n\t}\n\tdebug(\"Time-adjusted nonce: %02X\", timedNonce)\n\n\t/* Make the cryptors */\n\ttimedNonce[0] &= 0xFC\n\ts, err := chacha20.New(key[:], timedNonce)\n\tif nil != err {\n\t\treturn nil, nil, err\n\t}\n\tstoi = &Cryptor{s}\n\ttimedNonce[0] |= 0x03\n\ti, err := chacha20.New(key[:], timedNonce)\n\tif nil != err {\n\t\treturn nil, nil, err\n\t}\n\titos = &Cryptor{i}\n\t/* TODO: Make sure key is 32 bytes long early */\n\treturn\n}", "func NewObject(x, y, w, h int, s string) Object {\n\treturn Object{\n\t\tpoint: Point{X: x, Y: y},\n\t\tsize: Size{Width: w, Height: h},\n\t\tstr: s,\n\t}\n}", "func CreateTokenPair(userID string) (*TokenPair, error) {\n\n\trefreshTokenExp := time.Now().Add(time.Hour * 24 * 7).Unix()\n\trefreshTokenUUID := uuid.New().String()\n\trefreshToken, err := createRefreshToken(userID, refreshTokenUUID, refreshTokenExp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccessTokenExp := time.Now().Add(time.Hour * 24 * 7).Unix()\n\taccessToken, err := createAccessToken(userID, refreshTokenUUID, accessTokenExp)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn nil, err\n\t}\n\n\ttokens := &TokenPair{\n\t\tAccessToken: AccessToken{\n\t\t\tToken: accessToken,\n\t\t\tExpiresAt: accessTokenExp,\n\t\t},\n\t\tRefreshToken: RefreshToken{\n\t\t\tUserID: userID,\n\t\t\tUUID: refreshTokenUUID,\n\t\t\tToken: refreshToken,\n\t\t\tExpiresAt: refreshTokenExp,\n\t\t\tUsed: false,\n\t\t},\n\t}\n\treturn tokens, nil\n}", "func NewPairDelimiter(currencyPair, delimiter string) Pair {\n\tresult := strings.Split(currencyPair, delimiter)\n\treturn Pair{\n\t\tDelimiter: delimiter,\n\t\tBase: NewCode(result[0]),\n\t\tQuote: NewCode(result[1]),\n\t}\n}", "func SecretObjectWrapper(create SecretCreator) ObjectCreator {\n\treturn func(existing runtime.Object) (runtime.Object, error) {\n\t\tif existing != nil {\n\t\t\treturn create(existing.(*corev1.Secret))\n\t\t}\n\t\treturn create(&corev1.Secret{})\n\t}\n}", "func (this *Pair) Expression() expression.Expression {\n\treturn expression.NewArrayConstruct(this.Key, this.Value)\n}", "func execNewSignature(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewSignature(args[0].(*types.Var), args[1].(*types.Tuple), args[2].(*types.Tuple), args[3].(bool))\n\tp.Ret(4, ret)\n}" ]
[ "0.77096313", "0.681373", "0.6260862", "0.61187327", "0.5915429", "0.5915429", "0.55906564", "0.5551416", "0.55439746", "0.55439746", "0.5494457", "0.5456087", "0.5395901", "0.52397954", "0.52306813", "0.52306813", "0.5191114", "0.5183652", "0.50730604", "0.5071748", "0.50323707", "0.5000556", "0.49824095", "0.49402797", "0.49374795", "0.49330083", "0.48987958", "0.48858437", "0.48843855", "0.4837739", "0.48075974", "0.48075974", "0.48062378", "0.48058397", "0.47867522", "0.47482663", "0.47295603", "0.47034577", "0.4690848", "0.46796137", "0.46550348", "0.46428305", "0.46425322", "0.46410403", "0.46301135", "0.46277732", "0.4626216", "0.46231946", "0.46226606", "0.4613411", "0.46023062", "0.45954734", "0.4565777", "0.4561767", "0.45466456", "0.45461842", "0.45425412", "0.45391974", "0.45331043", "0.4520012", "0.45195407", "0.44953293", "0.4468698", "0.44655803", "0.4460085", "0.44586506", "0.44555813", "0.44500566", "0.44392452", "0.4434785", "0.4418887", "0.4418887", "0.4418184", "0.44173518", "0.44122982", "0.44058698", "0.44023958", "0.4388038", "0.43830162", "0.4381459", "0.43789434", "0.4342684", "0.4315637", "0.4312647", "0.43051913", "0.4302888", "0.42798987", "0.42777643", "0.42696467", "0.42696467", "0.42672274", "0.42631987", "0.4249676", "0.42470747", "0.42457303", "0.4243811", "0.4236493", "0.42360723", "0.42340407" ]
0.83893144
1
/ The constructor returns a NewObjectPairs with the an operand cast to a Function as the FunctionConstructor.
Конструктор возвращает NewObjectPairs с операндом, приведенным к типу Function как FunctionConstructor.
func (this *ObjectPairs) Constructor() FunctionConstructor { return func(operands ...Expression) Function { return NewObjectPairs(operands[0]) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *ObjectInnerPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerPairs(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectPut) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPut(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *ObjectInnerValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerValues(operands[0])\n\t}\n}", "func (this *DateAddStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddStr(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectRemove) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectRemove(operands[0], operands[1])\n\t}\n}", "func (this *DateAddMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *DateDiffStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffStr(operands[0], operands[1], operands[2])\n\t}\n}", "func Function(args ...Type) *Operator {\n\treturn &Operator{functionName, args}\n}", "func NewConstructor(x interface{}) (*Constructor, error) {\n\tif x == nil {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tft := reflect.TypeOf(x)\n\tfv := reflect.ValueOf(x)\n\tif ft.Kind() != reflect.Func {\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function expected, %s given\", ft)\n\t}\n\tif fv.IsNil() {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tc := &Constructor{\n\t\tfunction: fv,\n\t}\n\tnumIn := ft.NumIn()\n\tif ft.IsVariadic() {\n\t\tnumIn--\n\t}\n\tc.inTypes = make([]reflect.Type, numIn)\n\tfor i := 0; i < numIn; i++ {\n\t\tc.inTypes[i] = ft.In(i)\n\t}\n\tswitch ft.NumOut() {\n\tdefault:\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\tcase 1:\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = -1\n\tcase 2:\n\t\tif ft.Out(1) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = 1\n\tcase 3:\n\t\tif ft.Out(1) != destructorType || ft.Out(2) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = 1\n\t\tc.errorOutIndex = 2\n\t}\n\treturn c, nil\n}", "func (this *DatePartStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartStr(operands[0], operands[1])\n\t}\n}", "func (this *Mod) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewMod(operands[0], operands[1])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *DateDiffMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *Element) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewElement(operands[0], operands[1])\n\t}\n}", "func (this *StrToZoneName) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToZoneName(operands[0], operands[1])\n\t}\n}", "func (this *StrToMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToMillis(operands[0])\n\t}\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (this *NowStr) Constructor() FunctionConstructor { return NewNowStr }", "func (this *DatePartMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartMillis(operands[0], operands[1])\n\t}\n}", "func (this *StrToUTC) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToUTC(operands[0])\n\t}\n}", "func New(spec *Spec) Function {\n\tf := Function{\n\t\tspec: spec,\n\t}\n\treturn f\n}", "func (c *Constructor) Create(a ...reflect.Value) (reflect.Value, kdone.Destructor, error) {\n\tif c == nil {\n\t\treturn reflect.Value{}, kdone.Noop, nil\n\t}\n\tif len(a) != len(c.inTypes) {\n\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\"%s constructor expects %d argument(s), %d given\",\n\t\t\tc.t, len(c.inTypes), len(a))\n\t}\n\tfor i, v := range a {\n\t\tif v.Type() != c.inTypes[i] {\n\t\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\t\"%s constructor expects argument %d to be of %s type, %s given\",\n\t\t\t\tc.t, i+1, c.inTypes[i], v.Type())\n\t\t}\n\t}\n\tout := c.function.Call(a)\n\tobj := out[c.objectOutIndex]\n\tvar dtor kdone.Destructor = kdone.Noop\n\tif c.destructorOutIndex >= 0 {\n\t\tif v := out[c.destructorOutIndex].Interface(); v != nil {\n\t\t\tdtor = v.(kdone.Destructor)\n\t\t}\n\t}\n\tvar err error\n\tif c.errorOutIndex >= 0 {\n\t\tif v := out[c.errorOutIndex].Interface(); v != nil {\n\t\t\terr = v.(error)\n\t\t}\n\t}\n\treturn obj, dtor, err\n}", "func (this *NowMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _NOW_MILLIS }\n}", "func NewFunction(retType types.WaccType, ident *Ident, params ParamList,\n\tstats Statement, pos errors.Position) *Function {\n\tfn := &Function{\n\t\tretType: retType,\n\t\tident: ident,\n\t\tparams: params,\n\t\tpos: pos,\n\t}\n\tswitch st := stats.(type) {\n\tcase StatMultiple:\n\t\tfn.stats = st\n\tdefault:\n\t\tfn.stats = StatMultiple{st}\n\t}\n\treturn fn\n}", "func tcNew(n *ir.UnaryExpr) ir.Node {\n\tif n.X == nil {\n\t\t// Fatalf because the OCALL above checked for us,\n\t\t// so this must be an internally-generated mistake.\n\t\tbase.Fatalf(\"missing argument to new\")\n\t}\n\tl := n.X\n\tl = typecheck(l, ctxType)\n\tt := l.Type()\n\tif t == nil {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tn.X = l\n\tn.SetType(types.NewPtr(t))\n\treturn n\n}", "func (this *DateTruncStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncStr(operands[0], operands[1])\n\t}\n}", "func (this *Not) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewNot(operands[0])\n\t}\n}", "func NewMapper(m func(srcPtr interface{}, destPtr interface{}) error) Mapper {\n return funcMapper(m)\n}", "func (this *ClockMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _CLOCK_MILLIS }\n}", "func newFunction(p *Package, fl *File, f *ast.FuncDecl) *Function {\n\tres := &Function{\n\t\tpkg: p,\n\t\tfile: fl,\n\t\tfn: f,\n\t\tname: nameFromIdent(f.Name),\n\t\tdef: getFunc(p, fl, f.Type).(*FuncType),\n\t}\n\n\tif res.fn.Recv != nil {\n\t\tn := \"\"\n\t\tif res.fn.Recv.List[0].Names != nil {\n\t\t\tn = nameFromIdent(res.fn.Recv.List[0].Names[0])\n\t\t}\n\t\tres.receiver = newVariableFromExpr(res.pkg, res.file, n, res.fn.Recv.List[0].Type)\n\t\tvar def Definition\n\t\tvar def2 *StarType\n\t\tdef = res.receiver.def\n\t\tdef2, res.receiverPointer = def.(*StarType)\n\t\tif res.receiverPointer {\n\t\t\tdef = def2.Target()\n\t\t}\n\t\tres.receiverClass = def.String()\n\t}\n\treturn res\n}", "func (this *MillisToStr) Constructor() FunctionConstructor { return NewMillisToStr }", "func NewFunction(config *truce.HTTP, function truce.Function) (*Function, error) {\n\tif function.Transports.HTTP == nil {\n\t\treturn nil, nil\n\t}\n\n\ttransport := *function.Transports.HTTP\n\n\tb := &Function{\n\t\tDefinition: function,\n\t\tQuery: map[string]QueryParam{},\n\t}\n\n\ttype argument struct {\n\t\tvariable string\n\t\tposVariable string\n\t\ttyp string\n\t}\n\n\tvar (\n\t\tpathMappings = map[string]string{}\n\t\targs = map[string]argument{}\n\t)\n\n\tfor i, field := range function.Arguments {\n\t\targs[field.Name] = argument{\n\t\t\ttyp: string(field.Type),\n\t\t\tposVariable: fmt.Sprintf(\"v%d\", i),\n\t\t\tvariable: field.Name,\n\t\t}\n\t}\n\n\tif function.Return.Present && function.Return.Name != \"\" {\n\t\tb.HasReturn = true\n\t\tb.ReturnType = string(function.Return.Type)\n\n\t\tif len(b.ReturnType) < 1 {\n\t\t\treturn nil, errors.New(\"return type cannot be empty\")\n\t\t}\n\n\t\tif b.ReturnType[0] == '*' {\n\t\t\tb.ReturnType = b.ReturnType[1:]\n\t\t\tb.ReturnIsPtr = true\n\t\t}\n\t}\n\n\tb.Method = transport.Method\n\n\t// Sort the arguments by name for consistent positional ordering.\n\tvar argVals []truce.ArgumentValue\n\tfor _, arg := range transport.Arguments {\n\t\targVals = append(argVals, arg)\n\t}\n\tsort.Slice(argVals, func(i, j int) bool {\n\t\treturn argVals[i].Name < argVals[j].Name\n\t})\n\n\tvar qpos int\n\tfor _, arg := range argVals {\n\t\ta, ok := args[arg.Name]\n\n\t\tswitch arg.From {\n\t\tcase \"body\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.BodyVar = a.posVariable\n\t\t\tb.BodyType = a.typ\n\t\tcase \"path\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpathMappings[arg.Var] = args[arg.Name].variable\n\t\tcase \"query\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.Query[arg.Var] = QueryParam{\n\t\t\t\tPos: qpos,\n\t\t\t\tQueryVar: arg.Var,\n\t\t\t\tGoVar: a.posVariable,\n\t\t\t\tType: a.typ,\n\t\t\t}\n\n\t\t\tqpos++\n\t\tcase \"static\":\n\t\t\t// TODO(georgemac)\n\t\t}\n\t}\n\n\tfor _, part := range strings.Split(config.Prefix, \"/\") {\n\t\tif part == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tb.Path = append(b.Path, Element{Type: \"static\", Value: part})\n\t}\n\n\tb.Path = append(b.Path, parsePath(pathMappings, transport.Path)...)\n\n\treturn b, nil\n}", "func (this *ClockStr) Constructor() FunctionConstructor { return NewClockStr }", "func NewFunction(name string, typ semantic.Type, call func(args Object) (Value, error), sideEffect bool) Function {\n\treturn &function{\n\t\tname: name,\n\t\tt: typ,\n\t\tcall: call,\n\t\thasSideEffect: sideEffect,\n\t}\n}", "func New(chainFunc ...interface{}) *Chain {\n\tc := &Chain{}\n\tc.Add(chainFunc...)\n\treturn c\n}", "func NewFunction(name, cname, comment, member string, typ Type) *Function {\n\tfunctionName := UpperFirstCharacter(name)\n\treceiverType := TrimLanguagePrefix(cname)\n\treceiverName := CommonReceiverName(receiverType)\n\n\tf := &Function{\n\t\tIncludeFiles: NewIncludeFiles(),\n\t\tName: functionName,\n\t\tCName: cname,\n\t\tComment: comment,\n\t\tParameters: []FunctionParameter{ // TODO(go-clang): this might not be needed if the receiver code is refactored: https://github.com/go-clang/gen/issues/52\n\t\t\t{\n\t\t\t\tName: receiverName,\n\t\t\t\tCName: cname,\n\t\t\t\tType: Type{\n\t\t\t\t\tGoName: receiverType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tReturnType: typ,\n\t\tReceiver: Receiver{\n\t\t\tName: receiverName,\n\t\t\tType: Type{\n\t\t\t\tGoName: receiverType,\n\t\t\t},\n\t\t},\n\t\tMember: &FunctionParameter{\n\t\t\tName: member,\n\t\t\tType: typ,\n\t\t},\n\t}\n\n\treturn f\n}", "func NewFunction(ctx openedge.Context, cfg FunctionInfo) *Function {\n\tf := &Function{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tids: make(chan string, cfg.Instance.Max),\n\t\tlog: logger.WithField(\"function\", cfg.Name),\n\t}\n\tfor index := 1; index <= cfg.Instance.Max; index++ {\n\t\tf.ids <- fmt.Sprintf(\"f%d\", index)\n\t}\n\tpc := pool.NewDefaultPoolConfig()\n\tpc.MinIdle = cfg.Instance.Min\n\tpc.MaxIdle = cfg.Instance.Max\n\tpc.MaxTotal = cfg.Instance.Max\n\tpc.MinEvictableIdleTime = cfg.Instance.IdleTime\n\tpc.TimeBetweenEvictionRuns = cfg.Instance.EvictTime\n\tf.pool = pool.NewObjectPool(context.Background(), newFactory(f), pc)\n\treturn f\n}", "func NewFunction(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, true, funcName, retType, args...)\n}", "func (this *DateTruncMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncMillis(operands[0], operands[1])\n\t}\n}", "func NewObject(t ...[2]*Term) Object {\n\tobj := newobject(len(t))\n\tfor i := range t {\n\t\tobj.Insert(t[i][0], t[i][1])\n\t}\n\treturn obj\n}", "func NewFunc(name string, typ Type) *Func {\n\treturn &Func{object: object{scope: nil, name: name, typ: typ}}\n}", "func execNewFunc(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewFunc(token.Pos(args[0].(int)), args[1].(*types.Package), args[2].(string), args[3].(*types.Signature))\n\tp.Ret(4, ret)\n}", "func New(args ...float64) Tuple {\n\treturn args\n}", "func (f Function) New(ctx string) error {\n\treturn f.unsafeWrap(errors.New(ctx), ctx, \"\")\n}", "func Constructor() MapSum {\n \n}", "func NewFunction(ifunc IFunction, name string) IQueryField {\n\treturn &SFunctionFieldBase{\n\t\tIFunction: ifunc,\n\t\talias: name,\n\t}\n}", "func NewOperators(ops ...*Symbol) *Operators {\n\t// Construct the root\n\troot := &Operators{children: map[rune]*Operators{}}\n\n\t// Add each of the symbols to it\n\tfor _, op := range ops {\n\t\troot.Add(op)\n\t}\n\n\treturn root\n}", "func (this *MillisToZoneName) Constructor() FunctionConstructor { return NewMillisToZoneName }", "func NewOperator(kind string, in, out reflect.Type, f func(ctx context.Context, field string, object interface{}) (interface{}, error)) Operator {\n\treturn &operator{\n\t\tkind: kind,\n\t\tin: in,\n\t\tout: out,\n\t\tf: f,\n\t}\n}", "func NewMeta(operands ...Expression) Function {\n\trv := &Meta{\n\t\t*NewFunctionBase(\"meta\", operands...),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Constructor() MapSum {\n\treturn MapSum{}\n}", "func ParsConstructor(lex *lexer.Lexer) *Parser {\n\tpars := &Parser{lex: lex}\n\n\tpars.prefixParseFns = make(map[lexer.TokenType]prefixParseFn)\n\tpars.infixParseFns = make(map[lexer.TokenType]infixParseFn)\n\n\tpars.registerInfix(lexer.PLUS, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MINUS, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.DIVIDE, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MULTIP, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MODULO, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.EQUAL, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.N_EQUAL, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.LESS, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.LESS_EQ, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MORE, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.MORE_EQ, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.OR, pars.parseInfixExpression)\n\tpars.registerInfix(lexer.AND, pars.parseInfixExpression)\n\n\tpars.registerPrefix(lexer.IDENT, pars.parseIdentifier)\n\tpars.registerPrefix(lexer.NUM, pars.parseIntegerLiteral)\n\tpars.registerPrefix(lexer.LPAR, pars.parseGroupedExpression)\n\tpars.registerPrefix(lexer.IF, pars.parseIfExpression)\n\tpars.registerPrefix(lexer.WHILE, pars.parseWhileExpression)\n\n\t// read two tokens, one for thisToken and one for peekToken\n\tpars.nextToken()\n\tpars.nextToken()\n\n\treturn pars\n}", "func (o *FakeObject) New(args ...interface{}) Object { return o.Invoke(args) }", "func Constructor() TwoSum {\n\treturn TwoSum{data: map[int]int{}}\n}", "func NewFunction(fnLit *ast.FunctionLiteral, env *Environment) *Function {\n\treturn &Function{\n\t\tParameters: fnLit.Parameters,\n\t\tBody: fnLit.Body,\n\t\tEnv: env,\n\t}\n}", "func newInstance0(frame *rtda.Frame) {\n\tvars := frame.LocalVars()\n\tconstructorObj := vars.GetRef(0)\n\targArrObj := vars.GetRef(1)\n\n\tgoConstructor := getExtra(constructorObj)\n\tgoClass := goConstructor.Class()\n\tobj := goClass.NewObj()\n\tstack := frame.OperandStack()\n\tstack.PushRef(obj)\n\n\t// call <init>\n\targs := actualConstructorArgs(obj, argArrObj, goConstructor)\n\tframe.Thread().InvokeMethodWithShim(goConstructor, args)\n}", "func NewPair(expr expression.Expression) (*Pair, error) {\n\tarray, ok := expr.(*expression.ArrayConstruct)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Invalid VALUES expression %s\", expr.String())\n\t}\n\n\toperands := array.Operands()\n\tif len(operands) != 2 {\n\t\treturn nil, fmt.Errorf(\"Invalid VALUES expression %s\", expr.String())\n\t}\n\n\tpair := &Pair{\n\t\tKey: operands[0],\n\t\tValue: operands[1],\n\t}\n\n\treturn pair, nil\n}", "func NewObjectInnerPairs(operand Expression) Function {\n\trv := &ObjectInnerPairs{\n\t\t*NewUnaryFunctionBase(\"object_innerpairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewPairs(array *expression.ArrayConstruct) (pairs Pairs, err error) {\n\toperands := array.Operands()\n\tpairs = make(Pairs, len(operands))\n\tfor i, op := range operands {\n\t\tpairs[i], err = NewPair(op)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn\n}", "func Constructor() MinStack {\n\treturn MinStack{atoms: []atom{}}\n}", "func Constructor() MyStack {\n\treturn MyStack{New(), New(), 1}\n}", "func NewFunction(pkg, name string,\n\tparams, ret, block []jen.Code) *Function {\n\treturn &Function{\n\t\tqual: jen.Qual(pkg, name),\n\t\tname: name,\n\t\tparams: params,\n\t\tret: ret,\n\t\tblock: block,\n\t}\n}", "func CreateNewExpr() Expr {\n\tc11 := Constant{value: 1.1}\n\tc22 := Constant{value: 2.2}\n\tc33 := Constant{value: 3.3}\n\tbp := BinaryPlus{left: &BinaryPlus{left: &c11, right: &c22}, right: &c33}\n\treturn &bp\n}", "func Make(e1, e2 interface{}) (p Pair) {\n\tp[0] = e1\n\tp[1] = e2\n\n\treturn p\n}", "func New(root *ssa.Function) *Graph {\n\tg := &Graph{Nodes: make(map[*ssa.Function]*Node)}\n\tg.Root = g.CreateNode(root)\n\treturn g\n}", "func New() *Compiler {\n\tmainScope := CompilationScope{\n\t\tinstructions: code.Instructions{},\n\t\tlastInstruction: EmittedInstruction{},\n\t\tpreviousInstruction: EmittedInstruction{},\n\t}\n\ttable := NewSymbolTable()\n\tfor i, fn := range object.GetBuiltins() {\n\t\ttable.DefineBuiltin(i, fn.Name)\n\t}\n\treturn &Compiler{\n\t\tconstants: []object.Object{},\n\t\tscopes: []CompilationScope{mainScope},\n\t\tscopeIndex: 0,\n\t\tsymbolTable: table,\n\t}\n}", "func (this *MillisToUTC) Constructor() FunctionConstructor { return NewMillisToUTC }", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func TermConstructor(t TermT) TermConstructorT {\n\treturn TermConstructorT(C.yices_term_constructor(C.term_t(t)))\n}", "func (e *exprHelper) NewCall(function string, args ...ast.Expr) ast.Expr {\n\treturn e.exprFactory.NewCall(e.nextMacroID(), function, args...)\n}", "func NewFunctionCall(name string, params []Expression, returnType Type) Expression {\n\treturn &functionCall{\n\t\tname: name,\n\t\tparams: params,\n\t\treturnType: returnType,\n\t}\n}", "func New[V any]() ConcurrentMap[string, V] {\n\treturn create[string, V](fnv32)\n}", "func Constructor() MyHashMap {\n\treturn MyHashMap{\n\t\t[1111]*Node{},\n\t}\n}", "func (bfp *FunctionProvider) NewFunction(key string) (dataflow.Function, error) {\n\tfor i := range bfp.functions {\n\t\tcur := bfp.functions[i]\n\t\tif cur.FunctionSpec.Key == key {\n\t\t\treturn cur.NewFunction(), nil\n\t\t}\n\t}\n\n\treturn nil, nil\n}", "func (s Obj_value) NewDeleg() (PublicKey, error) {\n\ts.Struct.SetUint16(4, 4)\n\tss, err := NewPublicKey(s.Struct.Segment())\n\tif err != nil {\n\t\treturn PublicKey{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "func ClosureNew(f interface{}) *C.GClosure {\n\tclosure := C._g_closure_new()\n\tclosures.Lock()\n\tclosures.m[closure] = reflect.ValueOf(f)\n\tclosures.Unlock()\n\treturn closure\n}", "func NewLambda(vs []Argument, u bool, as []Argument, e Expression, t types.Type) Lambda {\n\treturn Lambda{as, e, t, vs, u}\n}", "func NewFunctionCall(callee Expression, arguments []Expression, trailing *TrailingFunction, metadata *Metadata) *FunctionCall {\n\treturn &FunctionCall{callee, arguments, trailing, metadata}\n}", "func (l *Lifter) NewFunc(asmFunc *x86.Func) *Func {\n\tentry := asmFunc.Addr\n\tf, ok := l.Funcs[entry]\n\tif !ok {\n\t\t// TODO: Add proper support for type signatures once type analysis has\n\t\t// been conducted.\n\t\tname := fmt.Sprintf(\"f_%06X\", uint64(entry))\n\t\tsig := types.NewFunc(types.Void)\n\t\ttyp := types.NewPointer(sig)\n\t\tf = &Func{\n\t\t\tFunc: &ir.Func{\n\t\t\t\tTyp: typ,\n\t\t\t\tSig: sig,\n\t\t\t},\n\t\t}\n\t\tf.SetName(name)\n\t\tmd := &metadata.Attachment{\n\t\t\tName: \"addr\",\n\t\t\tNode: &metadata.Tuple{\n\t\t\t\tFields: []metadata.Field{&metadata.String{Value: entry.String()}},\n\t\t\t},\n\t\t}\n\t\tf.Metadata = append(f.Metadata, md)\n\t}\n\tf.AsmFunc = asmFunc\n\tf.blocks = make(map[bin.Address]*ir.Block)\n\tf.regs = make(map[x86asm.Reg]*ir.InstAlloca)\n\tf.statusFlags = make(map[StatusFlag]*ir.InstAlloca)\n\tf.fstatusFlags = make(map[FStatusFlag]*ir.InstAlloca)\n\tf.locals = make(map[string]*ir.InstAlloca)\n\tf.l = l\n\t// Prepare output LLVM IR basic blocks.\n\tfor addr := range asmFunc.Blocks {\n\t\tlabel := fmt.Sprintf(\"block_%06X\", uint64(addr))\n\t\tblock := ir.NewBlock(label)\n\t\tf.blocks[addr] = block\n\t}\n\t// Preprocess the function to assess if any instruction makes use of EDX:EAX\n\t// (e.g. IDIV).\n\tfor _, bb := range asmFunc.Blocks {\n\t\tfor _, inst := range bb.Insts {\n\t\t\tswitch inst.Op {\n\t\t\t// TODO: Identify more instructions which makes use of the FPU register\n\t\t\t// stack.\n\t\t\tcase x86asm.F2XM1, x86asm.FABS, x86asm.FADD, x86asm.FADDP, x86asm.FBLD,\n\t\t\t\tx86asm.FBSTP, x86asm.FCHS, x86asm.FCMOVB, x86asm.FCMOVBE,\n\t\t\t\tx86asm.FCMOVE, x86asm.FCMOVNB, x86asm.FCMOVNBE, x86asm.FCMOVNE,\n\t\t\t\tx86asm.FCMOVNU, x86asm.FCMOVU, x86asm.FCOM, x86asm.FCOMI,\n\t\t\t\tx86asm.FCOMIP, x86asm.FCOMP, x86asm.FCOMPP, x86asm.FCOS,\n\t\t\t\tx86asm.FDECSTP, x86asm.FDIV, x86asm.FDIVP, x86asm.FDIVR, x86asm.FDIVRP,\n\t\t\t\tx86asm.FFREE, x86asm.FFREEP, x86asm.FIADD, x86asm.FICOM, x86asm.FICOMP,\n\t\t\t\tx86asm.FIDIV, x86asm.FIDIVR, x86asm.FILD, x86asm.FIMUL, x86asm.FINCSTP,\n\t\t\t\tx86asm.FIST, x86asm.FISTP, x86asm.FISTTP, x86asm.FISUB, x86asm.FISUBR,\n\t\t\t\tx86asm.FLD, x86asm.FLD1, x86asm.FLDCW, x86asm.FLDENV, x86asm.FLDL2E,\n\t\t\t\tx86asm.FLDL2T, x86asm.FLDLG2, x86asm.FLDLN2, x86asm.FLDPI, x86asm.FLDZ,\n\t\t\t\tx86asm.FMUL, x86asm.FMULP, x86asm.FNCLEX, x86asm.FNINIT, x86asm.FNOP,\n\t\t\t\tx86asm.FNSAVE, x86asm.FNSTCW, x86asm.FNSTENV, x86asm.FNSTSW,\n\t\t\t\tx86asm.FPATAN, x86asm.FPREM, x86asm.FPREM1, x86asm.FPTAN,\n\t\t\t\tx86asm.FRNDINT, x86asm.FRSTOR, x86asm.FSCALE, x86asm.FSIN,\n\t\t\t\tx86asm.FSINCOS, x86asm.FSQRT, x86asm.FST, x86asm.FSTP, x86asm.FSUB,\n\t\t\t\tx86asm.FSUBP, x86asm.FSUBR, x86asm.FSUBRP, x86asm.FTST, x86asm.FUCOM,\n\t\t\t\tx86asm.FUCOMI, x86asm.FUCOMIP, x86asm.FUCOMP, x86asm.FUCOMPP,\n\t\t\t\tx86asm.FWAIT, x86asm.FXAM, x86asm.FXCH, x86asm.FXRSTOR,\n\t\t\t\tx86asm.FXRSTOR64, x86asm.FXSAVE, x86asm.FXSAVE64, x86asm.FXTRACT,\n\t\t\t\tx86asm.FYL2X, x86asm.FYL2XP1:\n\t\t\t\tf.usesFPU = true\n\t\t\t// TODO: Identify more instructions which makes use of EDX:EAX.\n\t\t\tcase x86asm.IDIV:\n\t\t\t\tf.usesEDX_EAX = true\n\t\t\t}\n\t\t}\n\t}\n\treturn f\n}", "func NewCurry(fn interface{}) (*Curry, error) {\n\ttyp := reflect.TypeOf(fn)\n\n\tif typ.Kind() != reflect.Func {\n\t\treturn nil, fmt.Errorf(\"Handler is not a function!\")\n\t}\n\n\tc := &Curry{\n\t\tname: getFunctionName(fn),\n\t\tfnType: typ,\n\t\tfn: fn,\n\t}\n\n\treturn c, nil\n}", "func (s *Prototype) Constructor() Value { return s.constructor }", "func NewConstructor() *Constructor {\n\treturn &Constructor{}\n}", "func NewConversion(from, to Unit, formula string) {\n\texpr, err := govaluate.NewEvaluableExpression(formula)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// create conversion function\n\tfn := func(x float64) float64 {\n\t\tparams := make(map[string]interface{})\n\t\tparams[\"x\"] = x\n\n\t\tres, err := expr.Evaluate(params)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn res.(float64)\n\t}\n\n\tNewConversionFromFn(from, to, fn, formula)\n}", "func NewFuncs(ctx context.Context, enums []xo.Enum) *Funcs {\n\tdriver, _, _ := xo.DriverSchemaNthParam(ctx)\n\tenumMap := make(map[string]xo.Enum)\n\tif driver == \"mysql\" {\n\t\tfor _, e := range enums {\n\t\t\tenumMap[e.Name] = e\n\t\t}\n\t}\n\treturn &Funcs{\n\t\tdriver: driver,\n\t\tenumMap: enumMap,\n\t\tconstraint: Constraint(ctx),\n\t\tescCols: Esc(ctx, \"columns\"),\n\t\tescTypes: Esc(ctx, \"types\"),\n\t\tengine: Engine(ctx),\n\t}\n}", "func Constructor() MyHashMap {\n\treturn MyHashMap{0, InitContainer, make([]*Node, InitContainer)}\n}", "func New() Object {\n\treturn Object{}\n}", "func ListConstructor(context RunContext, arguments []Argument) Value {\n\tvalues := make([]Value, len(arguments))\n\tfor i, arg := range arguments {\n\t\tvar value = EvalArgument(context, arg)\n\n\t\t// accept blocks within a list\n\t\t// as dictionaries in order to support\n\t\t// [{...} {...} ...] constructions\n\t\t//\n\t\tif value.Type() == TypeBlock {\n\t\t\tvalue = NewDictionaryWithBlock(context, value.(Block))\n\t\t}\n\n\t\tvalues[i] = value\n\t}\n\treturn NewListValue(values)\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func New(lhs, rhs string, binds pattern.Binds) (*T, error) {\n\tlp, err := pattern.Parse(lhs, binds)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing %q: %v\", lhs, err)\n\t}\n\trp, err := lp.Derive(rhs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &T{lhs: lp, rhs: rp}, nil\n}", "func NewFunctionCall(name string, context string, args ...interface{}) FunctionCall {\n\treturn FunctionCall{name, context, args}\n}" ]
[ "0.7153522", "0.7010794", "0.7010794", "0.694256", "0.6708602", "0.66994077", "0.66873187", "0.66873187", "0.66498196", "0.64264494", "0.64111173", "0.62730813", "0.62703615", "0.6267153", "0.6256307", "0.6193001", "0.6129393", "0.6126082", "0.6126082", "0.6101058", "0.60760236", "0.6072029", "0.5984461", "0.5939033", "0.5939033", "0.5936689", "0.58843106", "0.5846959", "0.5815502", "0.57907766", "0.5777012", "0.57463175", "0.569001", "0.56670046", "0.56302834", "0.55515933", "0.55432844", "0.55205935", "0.5510465", "0.54995996", "0.5470192", "0.5465858", "0.5464387", "0.54333854", "0.54066384", "0.5374162", "0.5367669", "0.5366333", "0.5362443", "0.5335453", "0.53314584", "0.5327979", "0.53260267", "0.5323436", "0.53132766", "0.5270561", "0.52670395", "0.52641875", "0.5261494", "0.5252892", "0.5220263", "0.52045107", "0.5187529", "0.5176019", "0.5150126", "0.5148201", "0.5147201", "0.5126834", "0.51176184", "0.51050305", "0.5100466", "0.50934637", "0.50805783", "0.5079722", "0.50743484", "0.50670266", "0.50666845", "0.5065435", "0.5063771", "0.5062426", "0.5052929", "0.5046649", "0.50454557", "0.5041206", "0.5029653", "0.50189084", "0.50009984", "0.49994525", "0.49876493", "0.4977041", "0.49720594", "0.4953011", "0.49245733", "0.49242386", "0.49142313", "0.4904817", "0.4904817", "0.4902918", "0.48963943" ]
0.7555158
1
/ The function NewObjectValues calls NewUnaryFunctionBase to create a function named OBJECT_VALUES with an expression as input.
Функция NewObjectValues вызывает NewUnaryFunctionBase для создания функции с именем OBJECT_VALUES и выражением в качестве входных данных.
func NewObjectValues(operand Expression) Function { rv := &ObjectValues{ *NewUnaryFunctionBase("object_values", operand), } rv.expr = rv return rv }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewObjectInnerValues(operand Expression) Function {\n\trv := &ObjectInnerValues{\n\t\t*NewUnaryFunctionBase(\"object_innervalues\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValuesFunc(ctx sessionctx.Context, offset int, retTp *types.FieldType) *ScalarFunction {\n\tfc := &valuesFunctionClass{baseFunctionClass{ast.Values, 0, 0}, offset, retTp}\n\tbt, err := fc.getFunction(ctx, nil)\n\tterror.Log(err)\n\treturn &ScalarFunction{\n\t\tFuncName: model.NewCIStr(ast.Values),\n\t\tRetType: retTp,\n\t\tFunction: bt,\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func (this *ObjectValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectValues(operands[0])\n\t}\n}", "func NewValues(col sql.Expression) sql.Expression {\n\treturn &Values{\n\t\tUnaryExpression: expression.UnaryExpression{Child: col},\n\t\tValue: nil,\n\t}\n}", "func NewValues() *Values {\n\tv := &Values{\n\t\tm: map[string]interface{}{\n\t\t\tInputKey: map[string]interface{}{},\n\t\t\tResolverInputKey: map[string]interface{}{},\n\t\t\tStepKey: map[string]interface{}{},\n\t\t\tTaskKey: map[string]interface{}{},\n\t\t\tConfigKey: map[string]interface{}{},\n\t\t\tVarKey: map[string]*Variable{},\n\t\t\tIteratorKey: nil,\n\t\t},\n\t}\n\tv.funcMap = sprig.FuncMap()\n\tv.funcMap[\"field\"] = v.fieldTmpl\n\tv.funcMap[\"jsonfield\"] = v.jsonFieldTmpl\n\tv.funcMap[\"jsonmarshal\"] = v.jsonMarshal\n\tv.funcMap[\"eval\"] = v.varEval\n\treturn v\n}", "func NewObjectValue(key string, v Value) Value {\n\treturn ObjectValue{key, v}\n}", "func (s Stream) NewValues(n int32) (capnp.Float64List, error) {\n\tl, err := capnp.NewFloat64List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn capnp.Float64List{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "func NewValues() Values {\n\treturn Values{}\n}", "func NewObject() *Value {\n\treturn &Value{kind: kindObject, objectContent: make(map[string]Value)}\n}", "func (this *ObjectInnerValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerValues(operands[0])\n\t}\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectNames(operand Expression) Function {\n\trv := &ObjectNames{\n\t\t*NewUnaryFunctionBase(\"object_names\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectPairs(operand Expression) Function {\n\trv := &ObjectPairs{\n\t\t*NewUnaryFunctionBase(\"object_pairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValues() Values {\n\treturn make(values)\n}", "func NewValues() *Values {\n\treturn &Values{\n\t\tlock: &sync.RWMutex{},\n\t\troot: newNode(),\n\t}\n}", "func NewFromValues(values map[string]interface{}) *Values {\n\treturn &Values{values}\n}", "func NewObjectInnerPairs(operand Expression) Function {\n\trv := &ObjectInnerPairs{\n\t\t*NewUnaryFunctionBase(\"object_innerpairs\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObject(t ...[2]*Term) Object {\n\tobj := newobject(len(t))\n\tfor i := range t {\n\t\tobj.Insert(t[i][0], t[i][1])\n\t}\n\treturn obj\n}", "func NewLiteral(value Object) Expression {\n\treturn &literal{value: value}\n}", "func NewObjectExpression() *ObjectExpression {\n\treturn &ObjectExpression{\n\t\tprops: make(map[string]Expression),\n\t}\n}", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func newSeriesValues(values []float64) *seriesValues {\n\t// Copy to avoid external modifications. See #174.\n\tv := make([]float64, len(values))\n\tcopy(v, values)\n\n\tmin, max := minMax(v)\n\treturn &seriesValues{\n\t\tvalues: v,\n\t\tmin: min,\n\t\tmax: max,\n\t}\n}", "func NewObject(t token.Token, value Block) *ObjectLiteral {\n\treturn &ObjectLiteral{\n\t\tToken: t,\n\t\tTypeOf: NewObjectType(),\n\t\tValue: value,\n\t}\n}", "func NewValue(val interface{}) (*Value, error) {\n\tvar ptr *C.struct__engine_value\n\tvar err error\n\n\t// Determine value type and create PHP value from the concrete type.\n\tv := reflect.ValueOf(val)\n\tswitch v.Kind() {\n\t// Bind integer to PHP int type.\n\tcase reflect.Int:\n\t\tptr, err = C.value_create_long(C.long(v.Int()))\n\t// Bind floating point number to PHP double type.\n\tcase reflect.Float64:\n\t\tptr, err = C.value_create_double(C.double(v.Float()))\n\t// Bind boolean to PHP bool type.\n\tcase reflect.Bool:\n\t\tptr, err = C.value_create_bool(C.bool(v.Bool()))\n\t// Bind string to PHP string type.\n\tcase reflect.String:\n\t\tstr := C.CString(v.String())\n\n\t\tptr, err = C.value_create_string(str)\n\t\tC.free(unsafe.Pointer(str))\n\t// Bind slice to PHP indexed array type.\n\tcase reflect.Slice:\n\t\tif ptr, err = C.value_create_array(C.uint(v.Len())); err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tvs, err := NewValue(v.Index(i).Interface())\n\t\t\tif err != nil {\n\t\t\t\tC.value_destroy(ptr)\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tC.value_array_next_set(ptr, vs.value)\n\t\t}\n\t// Bind map (with integer or string keys) to PHP associative array type.\n\tcase reflect.Map:\n\t\tkt := v.Type().Key().Kind()\n\n\t\tif kt == reflect.Int || kt == reflect.String {\n\t\t\tif ptr, err = C.value_create_array(C.uint(v.Len())); err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tfor _, key := range v.MapKeys() {\n\t\t\t\tkv, err := NewValue(v.MapIndex(key).Interface())\n\t\t\t\tif err != nil {\n\t\t\t\t\tC.value_destroy(ptr)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tif kt == reflect.Int {\n\t\t\t\t\tC.value_array_index_set(ptr, C.ulong(key.Int()), kv.value)\n\t\t\t\t} else {\n\t\t\t\t\tstr := C.CString(key.String())\n\n\t\t\t\t\tC.value_array_key_set(ptr, str, kv.value)\n\t\t\t\t\tC.free(unsafe.Pointer(str))\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, errInvalidType(val)\n\t\t}\n\t// Bind struct to PHP object (stdClass) type.\n\tcase reflect.Struct:\n\t\tvt := v.Type()\n\t\tif ptr, err = C.value_create_object(); err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\t// Skip unexported fields.\n\t\t\tif vt.Field(i).PkgPath != \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfv, err := NewValue(v.Field(i).Interface())\n\t\t\tif err != nil {\n\t\t\t\tC.value_destroy(ptr)\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tstr := C.CString(vt.Field(i).Name)\n\n\t\t\tC.value_object_property_add(ptr, str, fv.value)\n\t\t\tC.free(unsafe.Pointer(str))\n\t\t}\n\tdefault:\n\t\treturn nil, errInvalidType(val)\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to create PHP value from Go value '%v'\", val)\n\t}\n\n\treturn &Value{value: ptr}, nil\n}", "func NewObjectTypeValue(name string) *TypeValue {\n\treturn NewTypeValue(name,\n\t\ttraits.FieldTesterType,\n\t\ttraits.IndexerType)\n}", "func New(v interface{}) Value {\n\treturn Value{v}\n}", "func ValueNew(typ Type) *Value {\n\tvar gvalue C.GValue\n\tvalue := ValueNewFromC(unsafe.Pointer(&gvalue))\n\tvalue.Init(typ)\n\n\treturn value\n}", "func (def *Definition) CreateValues(forStoring bool) (err error) {\n\t// Reset values\n\tdef.Values = nil\n\tif Central.IsDebugLevel() {\n\t\tCentral.Log.Debugf(\"Create values from types for storing=%v -> %#v\", forStoring, def.activeFieldTree)\n\t}\n\tparameter := &stackParameter{definition: def, forStoring: forStoring, stack: NewStack()}\n\tt := TraverserMethods{EnterFunction: traverserCreateValue}\n\terr = def.TraverseTypes(t, true, parameter)\n\tif Central.IsDebugLevel() {\n\t\tCentral.Log.Debugf(\"Done creating values ... %v\", err)\n\t\tCentral.Log.Debugf(\"Created %d values\", len(def.Values))\n\t\tdef.DumpValues(true)\n\t}\n\treturn\n}", "func NewGoObject(val interface{}) Object {\n\tif reflect.ValueOf(val).Kind() == reflect.Func {\n\t\t// Functions have a special type\n\t\treturn GoFunc{val: val}\n\t} else {\n\t\treturn GoObject{val: val}\n\t}\n}", "func NewObjectUnwrap(operand Expression) Function {\n\trv := &ObjectUnwrap{\n\t\t*NewUnaryFunctionBase(\"object_unwrap\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValue(val interface{}) *Value {\n\tswitch val := val.(type) {\n\tcase nil:\n\t\treturn newNullValue()\n\tcase bool:\n\t\treturn newBooleanValue(val)\n\tcase float64:\n\t\treturn newNumberValue(val)\n\tcase string:\n\t\treturn newStringValue(val)\n\tcase []interface{}:\n\t\treturn newArrayValue(val)\n\tcase map[string]interface{}:\n\t\treturn newObjectValue(val)\n\tcase *Value:\n\t\treturn val\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Cannot create value for type %T\", val))\n\t}\n}", "func NewValue() *Value { return &Value{} }", "func CloneRefOfValuesFuncExpr(n *ValuesFuncExpr) *ValuesFuncExpr {\n\tif n == nil {\n\t\treturn nil\n\t}\n\tout := *n\n\tout.Name = CloneRefOfColName(n.Name)\n\treturn &out\n}", "func ObjectValue(id TypeID, value interface{}) (*graph.Value, error) {\n\tdef := &graph.Value{&graph.Value_StrVal{\"\"}}\n\tvar ok bool\n\t// Lets set the object value according to the storage type.\n\tswitch id {\n\tcase StringID:\n\t\tvar v string\n\t\tif v, ok = value.(string); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type string. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_StrVal{v}}, nil\n\tcase DefaultID:\n\t\tvar v string\n\t\tif v, ok = value.(string); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type string. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_DefaultVal{v}}, nil\n\tcase Int32ID:\n\t\tvar v int32\n\t\tif v, ok = value.(int32); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type int32. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_IntVal{v}}, nil\n\tcase FloatID:\n\t\tvar v float64\n\t\tif v, ok = value.(float64); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type float64. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_DoubleVal{v}}, nil\n\tcase BoolID:\n\t\tvar v bool\n\t\tif v, ok = value.(bool); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type bool. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_BoolVal{v}}, nil\n\tcase BinaryID:\n\t\tvar v []byte\n\t\tif v, ok = value.([]byte); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type []byte. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_BytesVal{v}}, nil\n\t// Geo, date and datetime are stored in binary format in the NQuad, so lets\n\t// convert them here.\n\tcase GeoID:\n\t\tb, err := toBinary(id, value)\n\t\tif err != nil {\n\t\t\treturn def, err\n\t\t}\n\t\treturn &graph.Value{&graph.Value_GeoVal{b}}, nil\n\tcase DateID:\n\t\tb, err := toBinary(id, value)\n\t\tif err != nil {\n\t\t\treturn def, err\n\t\t}\n\t\treturn &graph.Value{&graph.Value_DateVal{b}}, nil\n\tcase DateTimeID:\n\t\tb, err := toBinary(id, value)\n\t\tif err != nil {\n\t\t\treturn def, err\n\t\t}\n\t\treturn &graph.Value{&graph.Value_DatetimeVal{b}}, nil\n\tcase PasswordID:\n\t\tvar v string\n\t\tif v, ok = value.(string); !ok {\n\t\t\treturn def, x.Errorf(\"Expected value of type password. Got : %v\", value)\n\t\t}\n\t\treturn &graph.Value{&graph.Value_PasswordVal{v}}, nil\n\tdefault:\n\t\treturn def, x.Errorf(\"ObjectValue not available for: %v\", id)\n\t}\n\treturn def, nil\n}", "func NewWithValues(r, c int, vals []Frac) M {\n\treturn M{r: r, c: c, values: vals}\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectLength(operand Expression) Function {\n\trv := &ObjectLength{\n\t\t*NewUnaryFunctionBase(\"object_length\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValue(x interface{}) (types.Value, error) {\n\tswitch v := x.(type) {\n\tcase nil:\n\t\treturn types.NewNullValue(), nil\n\tcase types.Document:\n\t\treturn types.NewDocumentValue(v), nil\n\tcase types.Array:\n\t\treturn types.NewArrayValue(v), nil\n\tcase int:\n\t\treturn types.NewIntegerValue(int64(v)), nil\n\tcase bool:\n\t\treturn types.NewBoolValue(v), nil\n\tcase float64:\n\t\treturn types.NewDoubleValue(v), nil\n\tcase string:\n\t\treturn types.NewTextValue(v), nil\n\t}\n\n\treturn nil, &ErrUnsupportedType{x, \"\"}\n}", "func Object(k string, v valf.ValueObject) Field {\n\treturn Field{Key: k, Value: valf.Object(v)}\n}", "func NewValueArray(array []Value) *ValueArray {\n\t// return &ValueArray{*NewListerValue(valueList(array))}\n\tres := ValueArray(array)\n\treturn &res\n}", "func (p *Parser) FromValues(ctx context.Context, env *rellenv.Env, values url.Values) (*Object, error) {\n\tobject := &Object{\n\t\tcontext: ctx,\n\t\tenv: env,\n\t\tstatic: p.Static,\n\t}\n\tfor key, values := range values {\n\t\tif strings.Contains(key, \":\") {\n\t\t\tfor _, value := range values {\n\t\t\t\tobject.AddPair(key, value)\n\t\t\t}\n\t\t}\n\t}\n\n\tif object.shouldGenerate(\"og:url\") {\n\t\tcopiedValues := copyValues(values)\n\t\tcopiedValues.Del(\"og:type\")\n\t\tcopiedValues.Del(\"og:title\")\n\t\turl := url.URL{\n\t\t\tScheme: env.Scheme,\n\t\t\tHost: env.Host,\n\t\t\tPath: \"/og/\" + object.Type() + \"/\" + object.Title(),\n\t\t\tRawQuery: sortedEncode(copiedValues),\n\t\t}\n\t\tobject.AddPair(\"og:url\", url.String())\n\t}\n\n\togType := object.Type()\n\tisGlobalOGType := !strings.Contains(ogType, \":\")\n\tisOwnedOGType := strings.HasPrefix(ogType, rellenv.FbApp(ctx).Namespace()+\":\")\n\tif object.shouldGenerate(\"fb:app_id\") && (isGlobalOGType || isOwnedOGType) {\n\t\tobject.AddPair(\"fb:app_id\", strconv.FormatUint(rellenv.FbApp(ctx).ID(), 10))\n\t}\n\n\terr := object.generateDefaults()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn object, nil\n}", "func NewValues(kvs ...string) Values {\n\tif len(kvs)%2 == 1 {\n\t\tpanic(\"twister: even number args required for NewParam\")\n\t}\n\tm := make(Values)\n\tfor i := 0; i < len(kvs); i += 2 {\n\t\tm.Add(kvs[i], kvs[i+1])\n\t}\n\treturn m\n}", "func NewMultilinearByValues(Table []frontend.Variable) MultilinearByValues {\n\treturn MultilinearByValues{Table: Table}\n}", "func CreateValues(m map[string]string) common.Values {\n\tvalues := make([]*common.Value, len(m))\n\ti := 0\n\tfor k, v := range m {\n\t\tvalue := &common.Value{}\n\t\tvalue.Name = k\n\t\tvalue.Value = v\n\t\tvalues[i] = value\n\t\ti++\n\t}\n\n\treturn common.Values{values}\n}", "func NewValue(v interface{}) Value {\n\tswitch val := v.(type) {\n\tcase nil:\n\t\treturn &NullValue{}\n\tcase int:\n\t\treturn NewIntegerValue(val)\n\tcase int64:\n\t\treturn NewLongValue(val)\n\tcase string:\n\t\treturn NewStringValue(val)\n\tcase []Value:\n\t\treturn NewValueArray(val)\n\tcase []byte:\n\t\treturn NewBytesValue(val)\n\tcase int8:\n\t\treturn NewIntegerValue(int(val))\n\tcase int16:\n\t\treturn NewIntegerValue(int(val))\n\tcase int32:\n\t\treturn NewIntegerValue(int(val))\n\tcase uint8: // byte supported here\n\t\treturn NewIntegerValue(int(val))\n\tcase uint16:\n\t\treturn NewIntegerValue(int(val))\n\tcase uint32:\n\t\treturn NewIntegerValue(int(val))\n\tcase float32:\n\t\treturn NewFloatValue(float64(val))\n\tcase float64:\n\t\treturn NewFloatValue(val)\n\tcase uint:\n\t\tif !Buffer.Arch64Bits || (val <= math.MaxInt64) {\n\t\t\treturn NewLongValue(int64(val))\n\t\t}\n\tcase []interface{}:\n\t\treturn NewListValue(val)\n\tcase map[interface{}]interface{}:\n\t\treturn NewMapValue(val)\n\tcase Value:\n\t\treturn val\n\tcase AerospikeBlob:\n\t\treturn NewBlobValue(val)\n\t}\n\n\t// check for array and map\n\trv := reflect.ValueOf(v)\n\tswitch rv.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\tl := rv.Len()\n\t\tarr := make([]interface{}, l)\n\t\tfor i := 0; i < l; i++ {\n\t\t\tarr[i] = rv.Index(i).Interface()\n\t\t}\n\n\t\treturn NewListValue(arr)\n\tcase reflect.Map:\n\t\tl := rv.Len()\n\t\tamap := make(map[interface{}]interface{}, l)\n\t\tfor _, i := range rv.MapKeys() {\n\t\t\tamap[i.Interface()] = rv.MapIndex(i).Interface()\n\t\t}\n\n\t\treturn NewMapValue(amap)\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn NewLongValue(reflect.ValueOf(v).Int())\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32:\n\t\treturn NewLongValue(int64(reflect.ValueOf(v).Uint()))\n\tcase reflect.String:\n\t\treturn NewStringValue(rv.String())\n\t}\n\n\t// panic for anything that is not supported.\n\tpanic(NewAerospikeError(TYPE_NOT_SUPPORTED, \"Value type '\"+reflect.TypeOf(v).Name()+\"' not supported\"))\n}", "func Values(v interface{}) []interface{} {\n\treturn New(v).Values()\n}", "func (s *BasePlSqlParserListener) EnterNew_values_clause(ctx *New_values_clauseContext) {}", "func New(value ...interface{}) Stack {\n\ts := Stack{}\n\tfor _, e := range value {\n\t\ts.Push(e)\n\t}\n\treturn s\n}", "func NewValue(v interface{}) Value {\n\tif value := tryConcreteValue(v); value != nil {\n\t\treturn value\n\t}\n\n\tif newValueReflect != nil {\n\t\tif res := newValueReflect(v); res != nil {\n\t\t\treturn res\n\t\t}\n\t}\n\n\t// panic for anything that is not supported.\n\tpanic(types.NewAerospikeError(types.TYPE_NOT_SUPPORTED, fmt.Sprintf(\"Value type '%v' (%s) not supported (if you are compiling via 'as_performance' tag, use cast either to primitives, or use ListIter or MapIter interfaces.)\", v, reflect.TypeOf(v).String())))\n}", "func ClosureNewObject(sizeofClosure uint32, object *Object) *Closure {\n\tc_sizeof_closure := (C.guint)(sizeofClosure)\n\n\tc_object := (*C.GObject)(C.NULL)\n\tif object != nil {\n\t\tc_object = (*C.GObject)(object.ToC())\n\t}\n\n\tretC := C.g_closure_new_object(c_sizeof_closure, c_object)\n\tretGo := ClosureNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "func NewArray(values []*Value) *Value {\n\treturn &Value{values, Array}\n}", "func NewValue(data interface{}, startSeconds int64, endSeconds int64) Value {\n\treturn Value{data, startSeconds, endSeconds}\n}", "func (this *ObjectValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func NewListValue(list []interface{}) ListValue {\n\treturn ListValue(list)\n}", "func NewValue(e expr.Expr, ts time.Time, params expr.Params, metadata goexpr.Params) Sequence {\n\tseq := NewSequence(e.EncodedWidth(), 1)\n\tseq.SetUntil(ts)\n\tseq.UpdateValueAt(0, e, params, metadata)\n\treturn seq\n}", "func NewValue(t Type, val interface{}) Value {\n\tv, err := newValue(t, val)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func convertFloatsToObjects(vals []float64) []interface{} {\n\tresult := make([]interface{}, 0, len(vals))\n\tfor _, f := range vals {\n\t\tresult = append(result, f)\n\t}\n\treturn result\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func NewObjectRemove(first, second Expression) Function {\n\trv := &ObjectRemove{\n\t\t*NewBinaryFunctionBase(\"object_remove\", first, second),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValue(value string, id *Ident) *Value {\n\t*id = New(value)\n\treturn (*Value)(id)\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func Valueize(values ...reflect.Value) []reflect.Value {\n\treturn values\n}", "func CreateObject(v *Instance, config interface{}) (interface{}, error) {\n\tctx := context.Background()\n\tif v != nil {\n\t\tctx = context.WithValue(ctx, v2rayKey, v)\n\t}\n\treturn common.CreateObject(ctx, config)\n}", "func NewValueArray(array []Value) *ValueArray {\n\tres := &ValueArray{\n\t\tarray: array,\n\t}\n\n\tres.bytes, _ = packValueArray(array)\n\n\treturn res\n}", "func CloneValues(n Values) Values {\n\tres := make(Values, 0, len(n))\n\tfor _, x := range n {\n\t\tres = append(res, CloneValTuple(x))\n\t}\n\treturn res\n}", "func (this *ObjectValues) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = oa[k]\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func (this *ObjectValues) Apply(context Context, arg value.Value) (value.Value, error) {\n\tif arg.Type() == value.MISSING {\n\t\treturn value.MISSING_VALUE, nil\n\t} else if arg.Type() != value.OBJECT {\n\t\treturn value.NULL_VALUE, nil\n\t}\n\n\toa := arg.Actual().(map[string]interface{})\n\tkeys := make(sort.StringSlice, 0, len(oa))\n\tfor key, _ := range oa {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Sort(keys)\n\tra := make([]interface{}, len(keys))\n\tfor i, k := range keys {\n\t\tra[i] = oa[k]\n\t}\n\n\treturn value.NewValue(ra), nil\n}", "func NewValueRef(ref unsafe.Pointer) *Value {\n\tif ref == nil {\n\t\treturn nil\n\t}\n\tobj := new(Value)\n\tobj.ref23e8c9e3 = (*C.YGValue)(unsafe.Pointer(ref))\n\treturn obj\n}", "func NewValuesHelper(config *config.GardenletConfiguration, imageVector imagevector.ImageVector) ValuesHelper {\n\treturn &valuesHelper{\n\t\tconfig: config,\n\t\timageVector: imageVector,\n\t}\n}", "func New() *Objects {\n\to := &Objects{\n\t\tvalues: map[string]*Object{},\n\t\tgcInterval: 60,\n\t\tgcMaxOnce: 100,\n\t\tgcExit: make(chan int),\n\t}\n\n\tgo o.gc()\n\n\treturn o\n}", "func (this *ObjectInnerValues) Evaluate(item value.Value, context Context) (value.Value, error) {\n\treturn this.UnaryEval(this, item, context)\n}", "func ValExpandFunction(model ModelT, yval *YvalT, def *YvalT) (vector []YvalT) {\n\tvar tv C.yval_vector_t\n\tC.yices_init_yval_vector(&tv)\n\terrcode := int32(C.yices_val_expand_function(ymodel(model), (*C.yval_t)(yval), (*C.yval_t)(def), (*C.yval_vector_t)(&tv)))\n\tif errcode != -1 {\n\t\tcount := int(tv.size)\n\t\tvector = make([]YvalT, count, count)\n\t\t// defined in the preamble yices_term_vector_get(term_vector_t* vec, uint32_t elem)\n\t\tfor i := 0; i < count; i++ {\n\t\t\tvar yv C.yval_t\n\t\t\tC.yices_yval_vector_get(&tv, C.uint32_t(i), (*C.yval_t)(&yv))\n\t\t\tvector[i] = YvalT(yv)\n\t\t}\n\t}\n\tC.yices_delete_yval_vector(&tv)\n\treturn\n}", "func NewValue(raw []byte) *Value {\n\treturn &Value{Raw: raw}\n}", "func (this *ObjectValues) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func (this *ObjectValues) Accept(visitor Visitor) (interface{}, error) {\n\treturn visitor.VisitFunction(this)\n}", "func NewExecuteFunction(name functions.FunctionName, exprs expression.Expressions) *ExecuteFunction {\n\trv := &ExecuteFunction{\n\t\tname: name,\n\t\texprs: exprs,\n\t}\n\n\trv.stmt = rv\n\treturn rv\n}", "func (n *JsonParseNode) GetCollectionOfObjectValues(ctor absser.ParsableFactory) ([]absser.Parsable, error) {\n\tif n == nil || n.value == nil {\n\t\treturn nil, nil\n\t}\n\tif ctor == nil {\n\t\treturn nil, errors.New(\"ctor is nil\")\n\t}\n\tnodes, ok := n.value.([]*JsonParseNode)\n\tif !ok {\n\t\treturn nil, errors.New(\"value is not a collection\")\n\t}\n\tresult := make([]absser.Parsable, len(nodes))\n\tfor i, v := range nodes {\n\t\tval, err := (*v).GetObjectValue(ctor)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult[i] = val\n\t}\n\treturn result, nil\n}", "func NewObject() (Object) {\n\tvar newobj Object = Object{\n\t\tObject : make(map[string]interface{}, 0),\n\t}\n\treturn newobj\n}", "func ValueInit(t Type) *Value {\n\tin := libc.Malloc(24) // 8bytes x 3\n\tlibc.Memset(in, 0, 24)\n\tout := Candy().Guify(\"g_value_init\", in, t).String()\n\tobj := NewValue(Candy(), out)\n\treturn obj\n}", "func (ot *ObjectType) assignValues(values ...interface{}) error {\n\tif m, n := len(values), len(objecttype.Columns); m < n {\n\t\treturn fmt.Errorf(\"mismatch number of scan values: %d != %d\", m, n)\n\t}\n\tvalue, ok := values[0].(*sql.NullInt64)\n\tif !ok {\n\t\treturn fmt.Errorf(\"unexpected type %T for field id\", value)\n\t}\n\tot.ID = int(value.Int64)\n\tvalues = values[1:]\n\tif value, ok := values[0].(*sql.NullString); !ok {\n\t\treturn fmt.Errorf(\"unexpected type %T for field name\", values[0])\n\t} else if value.Valid {\n\t\tot.Name = value.String\n\t}\n\tif value, ok := values[1].(*sql.NullString); !ok {\n\t\treturn fmt.Errorf(\"unexpected type %T for field kind\", values[1])\n\t} else if value.Valid {\n\t\tot.Kind = value.String\n\t}\n\tif value, ok := values[2].(*sql.NullString); !ok {\n\t\treturn fmt.Errorf(\"unexpected type %T for field description\", values[2])\n\t} else if value.Valid {\n\t\tot.Description = value.String\n\t}\n\treturn nil\n}", "func NEW_VECTOR(indices []int, values []float64, n int) VECTOR_TYPE {\n if len(indices) != len(values) {\n panic(\"number of indices does not match number of values\")\n }\n r := NIL_VECTOR(n)\n for i, k := range indices {\n if k >= n {\n panic(\"index larger than vector dimension\")\n }\n if _, ok := r.values[k]; ok {\n panic(\"index appeared multiple times\")\n } else {\n if values[i] != 0.0 {\n r.values[k] = NEW_SCALAR(values[i])\n r.indexInsert(k)\n }\n }\n }\n return r\n}", "func NewObject(handle int, t ObjectType, id string, enigmaobject interface{}) *Object {\n\tobj := &Object{\n\t\tHandle: handle,\n\t\tType: t,\n\t\tID: id,\n\t\tEnigmaObject: enigmaobject,\n\t}\n\treturn obj\n}", "func New(values ...interface{}) *Set {\n\tset := &Set{items: make(map[interface{}]struct{})}\n\tif len(values) > 0 {\n\t\tset.Add(values...)\n\t}\n\treturn set\n}", "func (c MethodsCollection) ProcessCreateValues() pProcessCreateValues {\n\treturn pProcessCreateValues{\n\t\tMethod: c.MustGet(\"ProcessCreateValues\"),\n\t}\n}", "func (o *JS) New(args []interface{}) Object {\n\treturn &JS{o.object.New(args...)}\n}", "func NewObjectArray(vs []*Object) *Array {\n\tvar ja Array\n\tif len(vs) > 0 {\n\t\tja.Values = make([]Value, len(vs))\n\t\tfor i, v := range vs {\n\t\t\tja.Values[i] = v\n\t\t}\n\t}\n\treturn &ja\n}", "func NewObjectPut(first, second, third Expression) Function {\n\trv := &ObjectPut{\n\t\t*NewTernaryFunctionBase(\"object_put\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewValueFromPtr(val unsafe.Pointer) (*Value, error) {\n\tif val == nil {\n\t\treturn nil, fmt.Errorf(\"Cannot create value from 'nil' pointer\")\n\t}\n\n\tv, err := C.value_new((*C.zval)(val))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to create PHP value from pointer\")\n\t}\n\n\treturn &Value{value: v}, nil\n}", "func New(vals ...interface{}) *List {\n\thead := list.New()\n\tfor _, v := range vals {\n\t\thead.PushBack(v)\n\t}\n\treturn &List{head}\n}", "func (j *Env) NewObject(className string, args ...interface{}) (*ObjectRef, error) {\n\tclass, err := j.callFindClass(className)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := replaceConvertedArgs(args); err != nil {\n\t\treturn nil, err\n\t}\n\tvar methodSig string\n\tif j.preCalcSig != \"\" {\n\t\tmethodSig = j.preCalcSig\n\t\tj.preCalcSig = \"\"\n\t} else {\n\t\tcalcSig, err := sigForMethod(Void, \"\", args)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmethodSig = calcSig\n\t}\n\n\tmid, err := j.callGetMethodID(false, class, \"<init>\", methodSig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create args for jni call\n\tjniArgs, refs, err := j.createArgs(args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tcleanUpArgs(jniArgs)\n\t\tfor _, ref := range refs {\n\t\t\tdeleteLocalRef(j.jniEnv, ref)\n\t\t}\n\t}()\n\n\tobj := newObjectA(j.jniEnv, class, mid, jniArgs)\n\tif obj == 0 {\n\t\treturn nil, j.handleException()\n\t}\n\n\treturn &ObjectRef{obj, className, false}, nil\n}", "func ConstObject(k string, v valf.ValueObject) Field {\n\treturn Field{Key: k, Value: valf.ConstObject(v)}\n}", "func (e Entry) ObjectFunc(k string, v func(Entry)) Entry {\n\te.enc.ObjectKey(k, Object(func(enc *Encoder) {\n\t\tv(e)\n\t}))\n\treturn e\n}", "func NewValue(v *sqlparser.SQLVal) (*Value, error) {\n\tswitch v.Type {\n\tcase sqlparser.StrVal:\n\t\treturn NewString(string(v.Val)), nil\n\tcase sqlparser.IntVal:\n\t\ti64, err := strconv.ParseInt(string(v.Val), 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewInt(i64), nil\n\tcase sqlparser.FloatVal:\n\t\tf64, err := strconv.ParseFloat(string(v.Val), 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewFloat(f64), nil\n\tcase sqlparser.HexNum: // represented as 0xDD\n\t\ti64, err := strconv.ParseInt(string(v.Val), 16, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewInt(i64), nil\n\tcase sqlparser.HexVal: // represented as X'0DD'\n\t\ti64, err := strconv.ParseInt(string(v.Val), 16, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewInt(i64), nil\n\tcase sqlparser.BitVal: // represented as B'00'\n\t\ti64, err := strconv.ParseInt(string(v.Val), 2, 64)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewInt(i64), nil\n\tcase sqlparser.ValArg:\n\t\t// FIXME: the format is unknown and not sure how to handle it.\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown SQL value %v; %v \", v, v.Type)\n}", "func (set ReadableConversionEndpointSet) CreateValueFunctionEndpoints(sourceType astmodel.Type) int {\n\t// Add more endpoints for any value functions we can read\n\treturn set.addForEachValueFunction(sourceType, func(fn astmodel.ValueFunction) *ReadableConversionEndpoint {\n\t\treturn NewReadableConversionEndpointReadingValueFunction(fn.Name(), fn.ReturnType())\n\t})\n}" ]
[ "0.751708", "0.63653314", "0.6325895", "0.6325895", "0.621891", "0.6025096", "0.58745253", "0.5860087", "0.5854441", "0.57969606", "0.5770344", "0.57039964", "0.57039964", "0.5660476", "0.5660476", "0.5658049", "0.5558985", "0.54201657", "0.5405711", "0.5354272", "0.53477496", "0.53025335", "0.5297057", "0.52873605", "0.5252346", "0.5236855", "0.52179193", "0.52081513", "0.5180284", "0.5158768", "0.5069697", "0.50609624", "0.5001707", "0.49926218", "0.49743062", "0.49639452", "0.4946432", "0.49421304", "0.49421304", "0.4933853", "0.49260026", "0.48862493", "0.48679423", "0.48563868", "0.48327494", "0.47878215", "0.4785791", "0.47751448", "0.47728702", "0.47359145", "0.47327122", "0.47242185", "0.47094685", "0.46996573", "0.46923658", "0.46923658", "0.46916726", "0.46753", "0.46739984", "0.4663983", "0.46384203", "0.46375877", "0.46375877", "0.46267712", "0.46021032", "0.4589818", "0.45851785", "0.45755413", "0.4569549", "0.4567076", "0.4556229", "0.4556229", "0.4538459", "0.45239872", "0.45043358", "0.45012194", "0.44982302", "0.44878495", "0.44874752", "0.44874752", "0.44859505", "0.44854382", "0.4475825", "0.44724953", "0.44711387", "0.44669607", "0.44649172", "0.44545618", "0.44487122", "0.44455904", "0.44455162", "0.44423756", "0.444015", "0.44375694", "0.44355786", "0.44353783", "0.44339275", "0.4433597", "0.44303298" ]
0.83485734
1
/ The constructor returns a NewObjectValues with the an operand cast to a Function as the FunctionConstructor.
Конструктор возвращает NewObjectValues с операндом, приведенным к Function как FunctionConstructor.
func (this *ObjectValues) Constructor() FunctionConstructor { return func(operands ...Expression) Function { return NewObjectValues(operands[0]) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *ObjectInnerValues) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerValues(operands[0])\n\t}\n}", "func (this *ObjectAdd) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectAdd(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *DateAddMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPairs(operands[0])\n\t}\n}", "func (this *ObjectUnwrap) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectUnwrap(operands[0])\n\t}\n}", "func (this *ObjectPut) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectPut(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *DateAddStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateAddStr(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *ObjectNames) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectNames(operands[0])\n\t}\n}", "func (this *DateDiffMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffMillis(operands[0], operands[1], operands[2])\n\t}\n}", "func (this *ObjectRemove) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectRemove(operands[0], operands[1])\n\t}\n}", "func (this *ObjectInnerPairs) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectInnerPairs(operands[0])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *ObjectLength) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewObjectLength(operands[0])\n\t}\n}", "func (this *DateDiffStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateDiffStr(operands[0], operands[1], operands[2])\n\t}\n}", "func Function(args ...Type) *Operator {\n\treturn &Operator{functionName, args}\n}", "func (this *DatePartMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartMillis(operands[0], operands[1])\n\t}\n}", "func (this *DatePartStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDatePartStr(operands[0], operands[1])\n\t}\n}", "func (this *Mod) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewMod(operands[0], operands[1])\n\t}\n}", "func (this *NowMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _NOW_MILLIS }\n}", "func (this *StrToMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToMillis(operands[0])\n\t}\n}", "func (this *StrToUTC) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToUTC(operands[0])\n\t}\n}", "func (this *Element) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewElement(operands[0], operands[1])\n\t}\n}", "func NewValuesFunc(ctx sessionctx.Context, offset int, retTp *types.FieldType) *ScalarFunction {\n\tfc := &valuesFunctionClass{baseFunctionClass{ast.Values, 0, 0}, offset, retTp}\n\tbt, err := fc.getFunction(ctx, nil)\n\tterror.Log(err)\n\treturn &ScalarFunction{\n\t\tFuncName: model.NewCIStr(ast.Values),\n\t\tRetType: retTp,\n\t\tFunction: bt,\n\t}\n}", "func (this *DateTruncStr) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncStr(operands[0], operands[1])\n\t}\n}", "func (this *StrToZoneName) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewStrToZoneName(operands[0], operands[1])\n\t}\n}", "func (this *DateTruncMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewDateTruncMillis(operands[0], operands[1])\n\t}\n}", "func NewConstructor(x interface{}) (*Constructor, error) {\n\tif x == nil {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tft := reflect.TypeOf(x)\n\tfv := reflect.ValueOf(x)\n\tif ft.Kind() != reflect.Func {\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function expected, %s given\", ft)\n\t}\n\tif fv.IsNil() {\n\t\treturn nil, kerror.New(kerror.EViolation, \"function expected, nil given\")\n\t}\n\tc := &Constructor{\n\t\tfunction: fv,\n\t}\n\tnumIn := ft.NumIn()\n\tif ft.IsVariadic() {\n\t\tnumIn--\n\t}\n\tc.inTypes = make([]reflect.Type, numIn)\n\tfor i := 0; i < numIn; i++ {\n\t\tc.inTypes[i] = ft.In(i)\n\t}\n\tswitch ft.NumOut() {\n\tdefault:\n\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\tcase 1:\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = -1\n\tcase 2:\n\t\tif ft.Out(1) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = -1\n\t\tc.errorOutIndex = 1\n\tcase 3:\n\t\tif ft.Out(1) != destructorType || ft.Out(2) != errorType {\n\t\t\treturn nil, kerror.Newf(kerror.EViolation, \"function %s is not a constructor\", ft)\n\t\t}\n\t\tc.t = ft.Out(0)\n\t\tc.objectOutIndex = 0\n\t\tc.destructorOutIndex = 1\n\t\tc.errorOutIndex = 2\n\t}\n\treturn c, nil\n}", "func New(v interface{}) Value {\n\treturn Value{v}\n}", "func New(spec *Spec) Function {\n\tf := Function{\n\t\tspec: spec,\n\t}\n\treturn f\n}", "func NewFunction(retType types.WaccType, ident *Ident, params ParamList,\n\tstats Statement, pos errors.Position) *Function {\n\tfn := &Function{\n\t\tretType: retType,\n\t\tident: ident,\n\t\tparams: params,\n\t\tpos: pos,\n\t}\n\tswitch st := stats.(type) {\n\tcase StatMultiple:\n\t\tfn.stats = st\n\tdefault:\n\t\tfn.stats = StatMultiple{st}\n\t}\n\treturn fn\n}", "func (this *NowStr) Constructor() FunctionConstructor { return NewNowStr }", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewObjectValues(operand Expression) Function {\n\trv := &ObjectValues{\n\t\t*NewUnaryFunctionBase(\"object_values\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewFunction(name string, typ semantic.Type, call func(args Object) (Value, error), sideEffect bool) Function {\n\treturn &function{\n\t\tname: name,\n\t\tt: typ,\n\t\tcall: call,\n\t\thasSideEffect: sideEffect,\n\t}\n}", "func (f Function) New(ctx string) error {\n\treturn f.unsafeWrap(errors.New(ctx), ctx, \"\")\n}", "func (this *ClockMillis) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function { return _CLOCK_MILLIS }\n}", "func (this *Not) Constructor() FunctionConstructor {\n\treturn func(operands ...Expression) Function {\n\t\treturn NewNot(operands[0])\n\t}\n}", "func NewFunction(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, true, funcName, retType, args...)\n}", "func NewFunction(ifunc IFunction, name string) IQueryField {\n\treturn &SFunctionFieldBase{\n\t\tIFunction: ifunc,\n\t\talias: name,\n\t}\n}", "func newFunction(p *Package, fl *File, f *ast.FuncDecl) *Function {\n\tres := &Function{\n\t\tpkg: p,\n\t\tfile: fl,\n\t\tfn: f,\n\t\tname: nameFromIdent(f.Name),\n\t\tdef: getFunc(p, fl, f.Type).(*FuncType),\n\t}\n\n\tif res.fn.Recv != nil {\n\t\tn := \"\"\n\t\tif res.fn.Recv.List[0].Names != nil {\n\t\t\tn = nameFromIdent(res.fn.Recv.List[0].Names[0])\n\t\t}\n\t\tres.receiver = newVariableFromExpr(res.pkg, res.file, n, res.fn.Recv.List[0].Type)\n\t\tvar def Definition\n\t\tvar def2 *StarType\n\t\tdef = res.receiver.def\n\t\tdef2, res.receiverPointer = def.(*StarType)\n\t\tif res.receiverPointer {\n\t\t\tdef = def2.Target()\n\t\t}\n\t\tres.receiverClass = def.String()\n\t}\n\treturn res\n}", "func (this *MillisToStr) Constructor() FunctionConstructor { return NewMillisToStr }", "func NewFunc(name string, typ Type) *Func {\n\treturn &Func{object: object{scope: nil, name: name, typ: typ}}\n}", "func tcNew(n *ir.UnaryExpr) ir.Node {\n\tif n.X == nil {\n\t\t// Fatalf because the OCALL above checked for us,\n\t\t// so this must be an internally-generated mistake.\n\t\tbase.Fatalf(\"missing argument to new\")\n\t}\n\tl := n.X\n\tl = typecheck(l, ctxType)\n\tt := l.Type()\n\tif t == nil {\n\t\tn.SetType(nil)\n\t\treturn n\n\t}\n\tn.X = l\n\tn.SetType(types.NewPtr(t))\n\treturn n\n}", "func NewFunction(config *truce.HTTP, function truce.Function) (*Function, error) {\n\tif function.Transports.HTTP == nil {\n\t\treturn nil, nil\n\t}\n\n\ttransport := *function.Transports.HTTP\n\n\tb := &Function{\n\t\tDefinition: function,\n\t\tQuery: map[string]QueryParam{},\n\t}\n\n\ttype argument struct {\n\t\tvariable string\n\t\tposVariable string\n\t\ttyp string\n\t}\n\n\tvar (\n\t\tpathMappings = map[string]string{}\n\t\targs = map[string]argument{}\n\t)\n\n\tfor i, field := range function.Arguments {\n\t\targs[field.Name] = argument{\n\t\t\ttyp: string(field.Type),\n\t\t\tposVariable: fmt.Sprintf(\"v%d\", i),\n\t\t\tvariable: field.Name,\n\t\t}\n\t}\n\n\tif function.Return.Present && function.Return.Name != \"\" {\n\t\tb.HasReturn = true\n\t\tb.ReturnType = string(function.Return.Type)\n\n\t\tif len(b.ReturnType) < 1 {\n\t\t\treturn nil, errors.New(\"return type cannot be empty\")\n\t\t}\n\n\t\tif b.ReturnType[0] == '*' {\n\t\t\tb.ReturnType = b.ReturnType[1:]\n\t\t\tb.ReturnIsPtr = true\n\t\t}\n\t}\n\n\tb.Method = transport.Method\n\n\t// Sort the arguments by name for consistent positional ordering.\n\tvar argVals []truce.ArgumentValue\n\tfor _, arg := range transport.Arguments {\n\t\targVals = append(argVals, arg)\n\t}\n\tsort.Slice(argVals, func(i, j int) bool {\n\t\treturn argVals[i].Name < argVals[j].Name\n\t})\n\n\tvar qpos int\n\tfor _, arg := range argVals {\n\t\ta, ok := args[arg.Name]\n\n\t\tswitch arg.From {\n\t\tcase \"body\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.BodyVar = a.posVariable\n\t\t\tb.BodyType = a.typ\n\t\tcase \"path\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpathMappings[arg.Var] = args[arg.Name].variable\n\t\tcase \"query\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.Query[arg.Var] = QueryParam{\n\t\t\t\tPos: qpos,\n\t\t\t\tQueryVar: arg.Var,\n\t\t\t\tGoVar: a.posVariable,\n\t\t\t\tType: a.typ,\n\t\t\t}\n\n\t\t\tqpos++\n\t\tcase \"static\":\n\t\t\t// TODO(georgemac)\n\t\t}\n\t}\n\n\tfor _, part := range strings.Split(config.Prefix, \"/\") {\n\t\tif part == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tb.Path = append(b.Path, Element{Type: \"static\", Value: part})\n\t}\n\n\tb.Path = append(b.Path, parsePath(pathMappings, transport.Path)...)\n\n\treturn b, nil\n}", "func NewLiteral(value Object) Expression {\n\treturn &literal{value: value}\n}", "func (this *MillisToUTC) Constructor() FunctionConstructor { return NewMillisToUTC }", "func NewFunction(ctx openedge.Context, cfg FunctionInfo) *Function {\n\tf := &Function{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tids: make(chan string, cfg.Instance.Max),\n\t\tlog: logger.WithField(\"function\", cfg.Name),\n\t}\n\tfor index := 1; index <= cfg.Instance.Max; index++ {\n\t\tf.ids <- fmt.Sprintf(\"f%d\", index)\n\t}\n\tpc := pool.NewDefaultPoolConfig()\n\tpc.MinIdle = cfg.Instance.Min\n\tpc.MaxIdle = cfg.Instance.Max\n\tpc.MaxTotal = cfg.Instance.Max\n\tpc.MinEvictableIdleTime = cfg.Instance.IdleTime\n\tpc.TimeBetweenEvictionRuns = cfg.Instance.EvictTime\n\tf.pool = pool.NewObjectPool(context.Background(), newFactory(f), pc)\n\treturn f\n}", "func (sf *ScalarFunction) Clone() Expression {\n\tc := &ScalarFunction{\n\t\tFuncName: sf.FuncName,\n\t\tRetType: sf.RetType,\n\t\tFunction: sf.Function.Clone(),\n\t}\n\treturn c\n}", "func NewFunction(f func(float64) float64) *Function {\n\treturn &Function{\n\t\tF: f,\n\t\tSamples: 50,\n\t\tLineStyle: plotter.DefaultLineStyle,\n\t}\n}", "func NewFunction(fnLit *ast.FunctionLiteral, env *Environment) *Function {\n\treturn &Function{\n\t\tParameters: fnLit.Parameters,\n\t\tBody: fnLit.Body,\n\t\tEnv: env,\n\t}\n}", "func (c *Constructor) Create(a ...reflect.Value) (reflect.Value, kdone.Destructor, error) {\n\tif c == nil {\n\t\treturn reflect.Value{}, kdone.Noop, nil\n\t}\n\tif len(a) != len(c.inTypes) {\n\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\"%s constructor expects %d argument(s), %d given\",\n\t\t\tc.t, len(c.inTypes), len(a))\n\t}\n\tfor i, v := range a {\n\t\tif v.Type() != c.inTypes[i] {\n\t\t\treturn reflect.Value{}, nil, kerror.Newf(kerror.EViolation,\n\t\t\t\t\"%s constructor expects argument %d to be of %s type, %s given\",\n\t\t\t\tc.t, i+1, c.inTypes[i], v.Type())\n\t\t}\n\t}\n\tout := c.function.Call(a)\n\tobj := out[c.objectOutIndex]\n\tvar dtor kdone.Destructor = kdone.Noop\n\tif c.destructorOutIndex >= 0 {\n\t\tif v := out[c.destructorOutIndex].Interface(); v != nil {\n\t\t\tdtor = v.(kdone.Destructor)\n\t\t}\n\t}\n\tvar err error\n\tif c.errorOutIndex >= 0 {\n\t\tif v := out[c.errorOutIndex].Interface(); v != nil {\n\t\t\terr = v.(error)\n\t\t}\n\t}\n\treturn obj, dtor, err\n}", "func (this *MillisToZoneName) Constructor() FunctionConstructor { return NewMillisToZoneName }", "func (c ValueColumn) FromFunction(fn func() interface{}) ValueColumn {\n\tc.fns[\"insert\"] = fn\n\treturn c\n}", "func ClosureNew(f interface{}) *C.GClosure {\n\tclosure := C._g_closure_new()\n\tclosures.Lock()\n\tclosures.m[closure] = reflect.ValueOf(f)\n\tclosures.Unlock()\n\treturn closure\n}", "func NewOperator(kind string, in, out reflect.Type, f func(ctx context.Context, field string, object interface{}) (interface{}, error)) Operator {\n\treturn &operator{\n\t\tkind: kind,\n\t\tin: in,\n\t\tout: out,\n\t\tf: f,\n\t}\n}", "func NewValue() *Value { return &Value{} }", "func (e *exprHelper) NewCall(function string, args ...ast.Expr) ast.Expr {\n\treturn e.exprFactory.NewCall(e.nextMacroID(), function, args...)\n}", "func newFunctionImpl(ctx sctx.Context, fold bool, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\tif retType == nil {\n\t\treturn nil, errors.Errorf(\"RetType cannot be nil for ScalarFunction.\")\n\t}\n\tfc, ok := funcs[funcName]\n\tif !ok {\n\t\tdb := ctx.GetSessionVars().CurrentDB\n\t\tif db == \"\" {\n\t\t\treturn nil, errors.Trace(ErrNoDB)\n\t\t}\n\n\t\treturn nil, errFunctionNotExists.GenWithStackByArgs(\"FUNCTION\", db+\".\"+funcName)\n\t}\n\tfuncArgs := make([]Expression, len(args))\n\tcopy(funcArgs, args)\n\tf, err := fc.getFunction(ctx, funcArgs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif builtinRetTp := f.getRetTp(); builtinRetTp.Tp != mysql.TypeUnspecified || retType.Tp == mysql.TypeUnspecified {\n\t\tretType = builtinRetTp\n\t}\n\tsf := &ScalarFunction{\n\t\tFuncName: model.NewCIStr(funcName),\n\t\tRetType: retType,\n\t\tFunction: f,\n\t}\n\treturn sf, nil\n}", "func NewValues(col sql.Expression) sql.Expression {\n\treturn &Values{\n\t\tUnaryExpression: expression.UnaryExpression{Child: col},\n\t\tValue: nil,\n\t}\n}", "func NewFunctionCall(callee Expression, arguments []Expression, trailing *TrailingFunction, metadata *Metadata) *FunctionCall {\n\treturn &FunctionCall{callee, arguments, trailing, metadata}\n}", "func NewMeta(operands ...Expression) Function {\n\trv := &Meta{\n\t\t*NewFunctionBase(\"meta\", operands...),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func NewFunction(name, cname, comment, member string, typ Type) *Function {\n\tfunctionName := UpperFirstCharacter(name)\n\treceiverType := TrimLanguagePrefix(cname)\n\treceiverName := CommonReceiverName(receiverType)\n\n\tf := &Function{\n\t\tIncludeFiles: NewIncludeFiles(),\n\t\tName: functionName,\n\t\tCName: cname,\n\t\tComment: comment,\n\t\tParameters: []FunctionParameter{ // TODO(go-clang): this might not be needed if the receiver code is refactored: https://github.com/go-clang/gen/issues/52\n\t\t\t{\n\t\t\t\tName: receiverName,\n\t\t\t\tCName: cname,\n\t\t\t\tType: Type{\n\t\t\t\t\tGoName: receiverType,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tReturnType: typ,\n\t\tReceiver: Receiver{\n\t\t\tName: receiverName,\n\t\t\tType: Type{\n\t\t\t\tGoName: receiverType,\n\t\t\t},\n\t\t},\n\t\tMember: &FunctionParameter{\n\t\t\tName: member,\n\t\t\tType: typ,\n\t\t},\n\t}\n\n\treturn f\n}", "func NewConversion(from, to Unit, formula string) {\n\texpr, err := govaluate.NewEvaluableExpression(formula)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// create conversion function\n\tfn := func(x float64) float64 {\n\t\tparams := make(map[string]interface{})\n\t\tparams[\"x\"] = x\n\n\t\tres, err := expr.Evaluate(params)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn res.(float64)\n\t}\n\n\tNewConversionFromFn(from, to, fn, formula)\n}", "func (this *ClockStr) Constructor() FunctionConstructor { return NewClockStr }", "func CreateNewExpr() Expr {\n\tc11 := Constant{value: 1.1}\n\tc22 := Constant{value: 2.2}\n\tc33 := Constant{value: 3.3}\n\tbp := BinaryPlus{left: &BinaryPlus{left: &c11, right: &c22}, right: &c33}\n\treturn &bp\n}", "func NewFunctionCall(name string, params []Expression, returnType Type) Expression {\n\treturn &functionCall{\n\t\tname: name,\n\t\tparams: params,\n\t\treturnType: returnType,\n\t}\n}", "func NewFunctionCall(name string, context string, args ...interface{}) FunctionCall {\n\treturn FunctionCall{name, context, args}\n}", "func (o *JS) New(args []interface{}) Object {\n\treturn &JS{o.object.New(args...)}\n}", "func (o *FakeObject) New(args ...interface{}) Object { return o.Invoke(args) }", "func NewObjectAdd(first, second, third Expression) Function {\n\trv := &ObjectAdd{\n\t\t*NewTernaryFunctionBase(\"object_add\", first, second, third),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Constructor() MapSum {\n\treturn MapSum{}\n}", "func New(args ...float64) Tuple {\n\treturn args\n}", "func NewLiteral(arg interface{}) Expression {\n\treturn &Literal{Literal: NewDatum(arg)}\n}", "func Constructor() MapSum {\n \n}", "func ValueNew(typ Type) *Value {\n\tvar gvalue C.GValue\n\tvalue := ValueNewFromC(unsafe.Pointer(&gvalue))\n\tvalue.Init(typ)\n\n\treturn value\n}", "func execNewFunc(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tret := types.NewFunc(token.Pos(args[0].(int)), args[1].(*types.Package), args[2].(string), args[3].(*types.Signature))\n\tp.Ret(4, ret)\n}", "func newFuncExpr(funcName FuncName, funcs ...Expr) (*funcExpr, error) {\n\tswitch funcName {\n\tcase Avg, Max, Min, Sum:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errParseNonUnaryAgregateFunctionCall(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isNumberKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v, not number\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Count:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errParseNonUnaryAgregateFunctionCall(err)\n\t\t}\n\n\t\tswitch funcs[0].ReturnType() {\n\t\tcase Null, Bool, Int, Float, String, Timestamp, column, record:\n\t\tdefault:\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v is incompatible\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase CharLength, CharacterLength, Trim, Lower, Upper, ToTimestamp:\n\t\tif len(funcs) != 1 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly one argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isStringKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument %v evaluate to %v, not string\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Coalesce:\n\t\tif len(funcs) < 1 {\n\t\t\terr := fmt.Errorf(\"%v(): one or more argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tfor i := range funcs {\n\t\t\tif !funcs[i].ReturnType().isBaseKind() {\n\t\t\t\terr := fmt.Errorf(\"%v(): argument-%v %v evaluate to %v is incompatible\", funcName, i+1, funcs[i], funcs[i].ReturnType())\n\t\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t\t}\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase NullIf:\n\t\tif len(funcs) != 2 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly two arguments expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isBaseKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-1 %v evaluate to %v is incompatible\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif !funcs[1].ReturnType().isBaseKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-2 %v evaluate to %v is incompatible\", funcName, funcs[1], funcs[1].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase UTCNow:\n\t\tif len(funcs) != 0 {\n\t\t\terr := fmt.Errorf(\"%v(): no argument expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\n\tcase Substring:\n\t\tif len(funcs) < 2 || len(funcs) > 3 {\n\t\t\terr := fmt.Errorf(\"%v(): exactly two or three arguments expected; got %v\", funcName, len(funcs))\n\t\t\treturn nil, errEvaluatorInvalidArguments(err)\n\t\t}\n\n\t\tif !funcs[0].ReturnType().isStringKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-1 %v evaluate to %v, not string\", funcName, funcs[0], funcs[0].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif !funcs[1].ReturnType().isIntKind() {\n\t\t\terr := fmt.Errorf(\"%v(): argument-2 %v evaluate to %v, not int\", funcName, funcs[1], funcs[1].ReturnType())\n\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t}\n\n\t\tif len(funcs) > 2 {\n\t\t\tif !funcs[2].ReturnType().isIntKind() {\n\t\t\t\terr := fmt.Errorf(\"%v(): argument-3 %v evaluate to %v, not int\", funcName, funcs[2], funcs[2].ReturnType())\n\t\t\t\treturn nil, errIncorrectSQLFunctionArgumentType(err)\n\t\t\t}\n\t\t}\n\n\t\treturn &funcExpr{\n\t\t\targs: funcs,\n\t\t\tname: funcName,\n\t\t}, nil\n\t}\n\n\treturn nil, errUnsupportedFunction(fmt.Errorf(\"unknown function name %v\", funcName))\n}", "func NewFunctionBase(ctx sctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error) {\n\treturn newFunctionImpl(ctx, false, funcName, retType, args...)\n}", "func (v Value) New(args ...interface{}) Value {\n\tpanic(message)\n}", "func NewLambda(vs []Argument, u bool, as []Argument, e Expression, t types.Type) Lambda {\n\treturn Lambda{as, e, t, vs, u}\n}", "func FunctionVal(impl FunctionImpl) Value {\n\treturn Value{\n\t\tty: Function(impl.Signature),\n\t\tv: &impl,\n\t}\n}", "func FunctionValue(c Callable) Value {\n\treturn Value{iface: c}\n}", "func NewFunction(fn string) *JFunction {\n\t//stats := gctx.Value(EelTotalStats).(*ServiceStats)\n\tswitch fn {\n\tcase \"curl\":\n\t\t// hit external web service\n\t\t// method - POST, GET etc.\n\t\t// url - url of external service\n\t\t// payload - payload to be sent to external service\n\t\t// headers - headers to be sent to external service\n\t\t// retries - if true, applies retry policy as specified in config.json in case of failure, no retries if false\n\t\t// curl('<method>','<url>',['<payload>'],['<header-map>'],['<retries>'])\n\t\t// example curl('POST', 'http://foo.com/bar/json', 'foo-{{/content/bar}}')\n\t\treturn &JFunction{fnCurl, 2, 5}\n\tcase \"hmac\":\n\t\t// hmac(\"<hashFunc>\", '<input>', '<key>')\n\t\treturn &JFunction{fnHmac, 3, 3}\n\tcase \"oauth2\":\n\t\t// perform a HTTP request to a given url using 2-legged oauth2 authentication.\n\t\t// url - the url\n\t\t// oauth2Cred - the oauth2 credential in the custom property. It is expected to have the following 3 property\n\t\t// values - ClientId, ClientSecret, TokenURL.\n\t\t// method - optional. The http method. Default is GET\n\t\t// payload - optional. The body payload normally for POST or PUT method\n\t\t// oauth2(\"<url>\", '<oauth2Cred>')\n\t\treturn &JFunction{fnOauth2, 2, 4}\n\tcase \"loadfile\":\n\t\t// loadfile(\"<filename>')\n\t\treturn &JFunction{fnLoadFile, 1, 1}\n\tcase \"uuid\":\n\t\t// returns UUID string\n\t\t// uuid()\n\t\treturn &JFunction{fnUuid, 0, 0}\n\tcase \"header\":\n\t\t// returns a value given the http request header key, or all headers if no key is given\n\t\t// header('mykey')\n\t\treturn &JFunction{fnHeader, 0, 1}\n\tcase \"param\":\n\t\t// returns a value given the http request query string parameter key, or all headers if no key is given\n\t\t// param('mykey')\n\t\treturn &JFunction{fnParam, 0, 1}\n\tcase \"ident\":\n\t\t// returns input parameter unchanged, for debugging only\n\t\t// ident('foo')\n\t\treturn &JFunction{fnIdent, 1, 1}\n\tcase \"upper\":\n\t\t// upper case input string, example upper('foo')\n\t\treturn &JFunction{fnUpper, 1, 1}\n\tcase \"lower\":\n\t\t// lower case input string, example lower('foo')\n\t\treturn &JFunction{fnLower, 1, 1}\n\tcase \"base64decode\":\n\t\t// base64 decode input string, example base64decode('foo')\n\t\treturn &JFunction{fnBase64Decode, 1, 1}\n\tcase \"substr\":\n\t\t// substring by start and end index, example substr('foo', 0, 1)\n\t\treturn &JFunction{fnSubstr, 3, 3}\n\tcase \"eval\":\n\t\t// evaluates simple path expression on current document and returns result\n\t\treturn &JFunction{fnEval, 1, 2}\n\tcase \"prop\":\n\t\t// return property from CustomProperties section in config.json\n\t\treturn &JFunction{fnProp, 1, 1}\n\tcase \"propexists\":\n\t\t// check whether or not a property exists\n\t\treturn &JFunction{fnPropExists, 1, 1}\n\tcase \"js\":\n\t\t// execute arbitrary javascript and return result\n\t\treturn &JFunction{fnJs, 1, 100}\n\tcase \"alt\":\n\t\t// return first non blank parameter (alternative)\n\t\treturn &JFunction{fnAlt, 2, 100}\n\tcase \"case\":\n\t\t// simplification of nested ifte(equals(),'foo', ifte(equals(...),...)) cascade\n\t\t// case('<path_1>','<comparison_value_1>','<return_value_1>', '<path_2>','<comparison_value_2>','<return_value_2>,...,'<default>')\n\t\treturn &JFunction{fnCase, 3, 100}\n\tcase \"regex\":\n\t\t// apply regex to string value and return (first) result: regex('<string>', '<regex>')\n\t\treturn &JFunction{fnRegex, 2, 3}\n\tcase \"match\":\n\t\t// apply regex to string value and return true if matches: match('<string>', '<regex>')\n\t\treturn &JFunction{fnMatch, 2, 2}\n\tcase \"hassuffix\":\n\t\t// check whether or not a string has suffix: match('<string>', '<suffix>')\n\t\treturn &JFunction{fnHasSuffix, 2, 2}\n\tcase \"and\":\n\t\t// boolean and: and('<bool>', '<bool>', ...)\n\t\treturn &JFunction{fnAnd, 1, 100}\n\tcase \"or\":\n\t\t// boolean or: or('<bool>', '<bool>', ...)\n\t\treturn &JFunction{fnOr, 1, 100}\n\tcase \"not\":\n\t\t// boolean not: not('<bool>')\n\t\treturn &JFunction{fnNot, 1, 1}\n\tcase \"contains\":\n\t\t// checks if document contains another document: contains('<doc1>', ['<doc2>'])\n\t\treturn &JFunction{fnContains, 1, 2}\n\tcase \"equals\":\n\t\t// checks if document is equal to another json document or if two strings are equal: equals('<doc1>',['<doc2>'])\n\t\treturn &JFunction{fnEquals, 1, 2}\n\tcase \"join\":\n\t\t// merges two json documents into one, key conflicts are resolved at random\n\t\treturn &JFunction{fnJoin, 2, 2}\n\tcase \"stringtojson\":\n\t\t// input is a string and output is json object\n\t\t// input example:{\\\"timestamp\\\": 1602873483}\n\t\treturn &JFunction{fnStringToJson, 1, 1}\n\tcase \"format\":\n\t\t// formats time string: format('<ms>',['<layout>'],['<timezone>']), example: format('1439962298000','Mon Jan 2 15:04:05 2006','PST')\n\t\treturn &JFunction{fnFormat, 1, 3}\n\tcase \"ifte\":\n\t\t// if condition then this else that: ifte('<condition>','<then>',['<else>']), example: ifte('{{equals('{{/data/name}}','')}}','','by {{/data/name}}')\n\t\treturn &JFunction{fnIfte, 1, 3}\n\tcase \"transform\":\n\t\t// apply transformation: transform('<name_of_transformation>', '<doc>', ['<pattern>'], ['<join>']), example: transform('my_transformation', '{{/content}}')\n\t\t// - the transformation is selected by name from an optional transformation map in the handler config\n\t\t// - if the document is an array, the transformation will be iteratively applied to all array elements\n\t\t// - if a pattern is provided will only be applied if document is matching the pattern\n\t\t// - if a join is provided it will be joined with the document before applying the transformation\n\t\treturn &JFunction{fnTransform, 1, 4}\n\tcase \"itransform\":\n\t\t// apply transformation iteratively: transform('<name_of_transformation>', '<doc>', ['<pattern>'], ['<join>']), example: transform('my_transformation', '{{/content}}')\n\t\t// - the transformation is selected by name from an optional transformation map in the handler config\n\t\t// - if the document is an array, the transformation will be iteratively applied to all array elements\n\t\t// - if a pattern is provided will only be applied if document is matching the pattern\n\t\t// - if a join is provided it will be joined with the document before applying the transformation\n\t\treturn &JFunction{fnITransform, 1, 4}\n\tcase \"etransform\":\n\t\t// apply external transformation and return single result (efficient shortcut for and equivalent to curl http://localhost:8080/proc)\n\t\treturn &JFunction{fnETransform, 1, 1}\n\tcase \"ptransform\":\n\t\t// apply external transformation and execute publisher(s) (efficient shortcut for and equivalent to curl http://localhost:8080/proxy)\n\t\treturn &JFunction{fnPTransform, 1, 1}\n\tcase \"true\":\n\t\t// returns always true, shorthand for equals('1', '1')\n\t\treturn &JFunction{fnTrue, 0, 0}\n\tcase \"false\":\n\t\t// returns always false, shorthand for equals('1', '2')\n\t\treturn &JFunction{fnFalse, 0, 0}\n\tcase \"time\":\n\t\t// returns current time as timestamp\n\t\treturn &JFunction{fnTime, 0, 0}\n\tcase \"tenant\":\n\t\t// returns tenant of current handler\n\t\treturn &JFunction{fnTenant, 0, 0}\n\tcase \"partner\":\n\t\t// returns partner of current handler\n\t\treturn &JFunction{fnPartner, 0, 0}\n\tcase \"traceid\":\n\t\t// returns current trace id used for logging\n\t\treturn &JFunction{fnTraceId, 0, 0}\n\tcase \"choose\":\n\t\t// chooses elements for list or array based on pattern\n\t\treturn &JFunction{fnChoose, 2, 2}\n\tcase \"crush\":\n\t\t// collapse a JSON document into a flat array\n\t\treturn &JFunction{fnCrush, 1, 1}\n\tcase \"len\":\n\t\t// returns length of object (string, array, map)\n\t\treturn &JFunction{fnLen, 1, 1}\n\tcase \"string\":\n\t\t// returns length of object (string, array, map)\n\t\treturn &JFunction{fnString, 2, 2}\n\tcase \"exists\":\n\t\t// returns true if path exists in document\n\t\treturn &JFunction{fnExists, 1, 2}\n\tcase \"calc\":\n\t\t// evaluates simple arithmetic expressions in native go and returns result\n\t\treturn &JFunction{fnCalc, 1, 1}\n\tcase \"log\":\n\t\t// logs parameter for debuging\n\t\treturn &JFunction{fnLog, 1, 1}\n\tcase \"hash\":\n\t\t// hash a given string\n\t\treturn &JFunction{fnHash, 1, 1}\n\tcase \"hashmod\":\n\t\t// hash a given string and then mod it by the given divider\n\t\treturn &JFunction{fnHashMod, 2, 2}\n\tcase \"toTS\":\n\t\t//Take a timestamp string and convert it to unix ts in milliseconds\n\t\treturn &JFunction{fnToTS, 2, 2}\n\tdefault:\n\t\t//gctx.Log.Error(\"error_type\", \"func_\", \"op\", fn, \"cause\", \"not_implemented\")\n\t\t//stats.IncErrors()\n\t\treturn nil\n\t}\n}", "func New(value interface{}) interface{} {\n\trv := reflect.ValueOf(value)\n\tif rv.Type().Kind() == reflect.Ptr {\n\t\treturn value\n\t}\n\trp := reflect.New(rv.Type())\n\trp.Elem().Set(rv)\n\treturn rp.Interface()\n}", "func (l *Lifter) NewFunc(asmFunc *x86.Func) *Func {\n\tentry := asmFunc.Addr\n\tf, ok := l.Funcs[entry]\n\tif !ok {\n\t\t// TODO: Add proper support for type signatures once type analysis has\n\t\t// been conducted.\n\t\tname := fmt.Sprintf(\"f_%06X\", uint64(entry))\n\t\tsig := types.NewFunc(types.Void)\n\t\ttyp := types.NewPointer(sig)\n\t\tf = &Func{\n\t\t\tFunc: &ir.Func{\n\t\t\t\tTyp: typ,\n\t\t\t\tSig: sig,\n\t\t\t},\n\t\t}\n\t\tf.SetName(name)\n\t\tmd := &metadata.Attachment{\n\t\t\tName: \"addr\",\n\t\t\tNode: &metadata.Tuple{\n\t\t\t\tFields: []metadata.Field{&metadata.String{Value: entry.String()}},\n\t\t\t},\n\t\t}\n\t\tf.Metadata = append(f.Metadata, md)\n\t}\n\tf.AsmFunc = asmFunc\n\tf.blocks = make(map[bin.Address]*ir.Block)\n\tf.regs = make(map[x86asm.Reg]*ir.InstAlloca)\n\tf.statusFlags = make(map[StatusFlag]*ir.InstAlloca)\n\tf.fstatusFlags = make(map[FStatusFlag]*ir.InstAlloca)\n\tf.locals = make(map[string]*ir.InstAlloca)\n\tf.l = l\n\t// Prepare output LLVM IR basic blocks.\n\tfor addr := range asmFunc.Blocks {\n\t\tlabel := fmt.Sprintf(\"block_%06X\", uint64(addr))\n\t\tblock := ir.NewBlock(label)\n\t\tf.blocks[addr] = block\n\t}\n\t// Preprocess the function to assess if any instruction makes use of EDX:EAX\n\t// (e.g. IDIV).\n\tfor _, bb := range asmFunc.Blocks {\n\t\tfor _, inst := range bb.Insts {\n\t\t\tswitch inst.Op {\n\t\t\t// TODO: Identify more instructions which makes use of the FPU register\n\t\t\t// stack.\n\t\t\tcase x86asm.F2XM1, x86asm.FABS, x86asm.FADD, x86asm.FADDP, x86asm.FBLD,\n\t\t\t\tx86asm.FBSTP, x86asm.FCHS, x86asm.FCMOVB, x86asm.FCMOVBE,\n\t\t\t\tx86asm.FCMOVE, x86asm.FCMOVNB, x86asm.FCMOVNBE, x86asm.FCMOVNE,\n\t\t\t\tx86asm.FCMOVNU, x86asm.FCMOVU, x86asm.FCOM, x86asm.FCOMI,\n\t\t\t\tx86asm.FCOMIP, x86asm.FCOMP, x86asm.FCOMPP, x86asm.FCOS,\n\t\t\t\tx86asm.FDECSTP, x86asm.FDIV, x86asm.FDIVP, x86asm.FDIVR, x86asm.FDIVRP,\n\t\t\t\tx86asm.FFREE, x86asm.FFREEP, x86asm.FIADD, x86asm.FICOM, x86asm.FICOMP,\n\t\t\t\tx86asm.FIDIV, x86asm.FIDIVR, x86asm.FILD, x86asm.FIMUL, x86asm.FINCSTP,\n\t\t\t\tx86asm.FIST, x86asm.FISTP, x86asm.FISTTP, x86asm.FISUB, x86asm.FISUBR,\n\t\t\t\tx86asm.FLD, x86asm.FLD1, x86asm.FLDCW, x86asm.FLDENV, x86asm.FLDL2E,\n\t\t\t\tx86asm.FLDL2T, x86asm.FLDLG2, x86asm.FLDLN2, x86asm.FLDPI, x86asm.FLDZ,\n\t\t\t\tx86asm.FMUL, x86asm.FMULP, x86asm.FNCLEX, x86asm.FNINIT, x86asm.FNOP,\n\t\t\t\tx86asm.FNSAVE, x86asm.FNSTCW, x86asm.FNSTENV, x86asm.FNSTSW,\n\t\t\t\tx86asm.FPATAN, x86asm.FPREM, x86asm.FPREM1, x86asm.FPTAN,\n\t\t\t\tx86asm.FRNDINT, x86asm.FRSTOR, x86asm.FSCALE, x86asm.FSIN,\n\t\t\t\tx86asm.FSINCOS, x86asm.FSQRT, x86asm.FST, x86asm.FSTP, x86asm.FSUB,\n\t\t\t\tx86asm.FSUBP, x86asm.FSUBR, x86asm.FSUBRP, x86asm.FTST, x86asm.FUCOM,\n\t\t\t\tx86asm.FUCOMI, x86asm.FUCOMIP, x86asm.FUCOMP, x86asm.FUCOMPP,\n\t\t\t\tx86asm.FWAIT, x86asm.FXAM, x86asm.FXCH, x86asm.FXRSTOR,\n\t\t\t\tx86asm.FXRSTOR64, x86asm.FXSAVE, x86asm.FXSAVE64, x86asm.FXTRACT,\n\t\t\t\tx86asm.FYL2X, x86asm.FYL2XP1:\n\t\t\t\tf.usesFPU = true\n\t\t\t// TODO: Identify more instructions which makes use of EDX:EAX.\n\t\t\tcase x86asm.IDIV:\n\t\t\t\tf.usesEDX_EAX = true\n\t\t\t}\n\t\t}\n\t}\n\treturn f\n}", "func (n *TableValuedFunction) Clone() *TableValuedFunction {\n\tif n == nil {\n\t\treturn nil\n\t}\n\tother := *n\n\tother.Name = n.Name.Clone()\n\tother.Alias = n.Alias.Clone()\n\treturn &other\n}", "func New(fn interface{}, validateFunc func(*FunctionCache) error) (*GenericFunc, error) {\n\tcache := &FunctionCache{}\n\tcache.FnValue = reflect.ValueOf(fn)\n\n\tif cache.FnValue.Kind() != reflect.Func {\n\t\treturn nil, errors.New(\"GenericFunc.New: fn is not a function\")\n\t}\n\n\tcache.FnType = cache.FnValue.Type()\n\tnumTypesIn := cache.FnType.NumIn()\n\tcache.TypesIn = make([]reflect.Type, numTypesIn)\n\tfor i := 0; i < numTypesIn; i++ {\n\t\tcache.TypesIn[i] = cache.FnType.In(i)\n\t}\n\n\tnumTypesOut := cache.FnType.NumOut()\n\tcache.TypesOut = make([]reflect.Type, numTypesOut)\n\tfor i := 0; i < numTypesOut; i++ {\n\t\tcache.TypesOut[i] = cache.FnType.Out(i)\n\t}\n\tif err := validateFunc(cache); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &GenericFunc{Cache: cache}, nil\n}", "func NewValue(val interface{}) *Value {\n\tswitch val := val.(type) {\n\tcase nil:\n\t\treturn newNullValue()\n\tcase bool:\n\t\treturn newBooleanValue(val)\n\tcase float64:\n\t\treturn newNumberValue(val)\n\tcase string:\n\t\treturn newStringValue(val)\n\tcase []interface{}:\n\t\treturn newArrayValue(val)\n\tcase map[string]interface{}:\n\t\treturn newObjectValue(val)\n\tcase *Value:\n\t\treturn val\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Cannot create value for type %T\", val))\n\t}\n}", "func NewCallback(fnc func(v []Value)) Callback {\n\treturn CallbackOf(fnc)\n}", "func NewObjectInnerValues(operand Expression) Function {\n\trv := &ObjectInnerValues{\n\t\t*NewUnaryFunctionBase(\"object_innervalues\", operand),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func (er *expressionRewriter) newFunction(funcName string, retType *types.FieldType, args ...expression.Expression) (expression.Expression, error) {\n\ttrace_util_0.Count(_expression_rewriter_00000, 275)\n\tif er.disableFoldCounter > 0 {\n\t\ttrace_util_0.Count(_expression_rewriter_00000, 277)\n\t\treturn expression.NewFunctionBase(er.ctx, funcName, retType, args...)\n\t}\n\ttrace_util_0.Count(_expression_rewriter_00000, 276)\n\treturn expression.NewFunction(er.ctx, funcName, retType, args...)\n}", "func NewValues() *Values {\n\tv := &Values{\n\t\tm: map[string]interface{}{\n\t\t\tInputKey: map[string]interface{}{},\n\t\t\tResolverInputKey: map[string]interface{}{},\n\t\t\tStepKey: map[string]interface{}{},\n\t\t\tTaskKey: map[string]interface{}{},\n\t\t\tConfigKey: map[string]interface{}{},\n\t\t\tVarKey: map[string]*Variable{},\n\t\t\tIteratorKey: nil,\n\t\t},\n\t}\n\tv.funcMap = sprig.FuncMap()\n\tv.funcMap[\"field\"] = v.fieldTmpl\n\tv.funcMap[\"jsonfield\"] = v.jsonFieldTmpl\n\tv.funcMap[\"jsonmarshal\"] = v.jsonMarshal\n\tv.funcMap[\"eval\"] = v.varEval\n\treturn v\n}", "func NewSelf() Function {\n\trv := &Self{\n\t\t*NewNullaryFunctionBase(\"self\"),\n\t}\n\n\trv.expr = rv\n\treturn rv\n}", "func Constructor() TwoSum {\n\treturn TwoSum{data: map[int]int{}}\n}", "func NewFunctionCall(name string) *FunctionCall {\n\tfc := new(FunctionCall)\n\tfc.addr = C.LookupSymAddr(C.CString(name))\n\treturn fc\n}", "func New() *Compiler {\n\tmainScope := CompilationScope{\n\t\tinstructions: code.Instructions{},\n\t\tlastInstruction: EmittedInstruction{},\n\t\tpreviousInstruction: EmittedInstruction{},\n\t}\n\ttable := NewSymbolTable()\n\tfor i, fn := range object.GetBuiltins() {\n\t\ttable.DefineBuiltin(i, fn.Name)\n\t}\n\treturn &Compiler{\n\t\tconstants: []object.Object{},\n\t\tscopes: []CompilationScope{mainScope},\n\t\tscopeIndex: 0,\n\t\tsymbolTable: table,\n\t}\n}", "func NewMapper(m func(srcPtr interface{}, destPtr interface{}) error) Mapper {\n return funcMapper(m)\n}" ]
[ "0.73529464", "0.7189014", "0.6843478", "0.6823034", "0.6823034", "0.67909425", "0.67158616", "0.6683737", "0.66169643", "0.66169643", "0.65581906", "0.65378344", "0.6475921", "0.64629835", "0.64629835", "0.64201945", "0.63533115", "0.63398314", "0.6316713", "0.63069826", "0.6253961", "0.6219394", "0.6204833", "0.6179284", "0.6076211", "0.6047216", "0.60444695", "0.60120755", "0.5978478", "0.59101886", "0.5908223", "0.5906591", "0.59060675", "0.5885702", "0.5885702", "0.58703417", "0.5866278", "0.5864386", "0.5828599", "0.57983434", "0.5727054", "0.56855655", "0.56396276", "0.56370735", "0.5622132", "0.56082165", "0.5567968", "0.55559546", "0.55389684", "0.5534401", "0.55164576", "0.547767", "0.5435908", "0.5381186", "0.5373272", "0.53531337", "0.53404194", "0.5339884", "0.53394175", "0.53337073", "0.5332218", "0.5331294", "0.5322541", "0.53212875", "0.5314067", "0.53058827", "0.53013843", "0.52998775", "0.5280981", "0.5271829", "0.52665025", "0.52418345", "0.523326", "0.5224023", "0.5210567", "0.5197249", "0.5192305", "0.5187232", "0.51810205", "0.5168242", "0.5167752", "0.51560557", "0.5146329", "0.5144341", "0.5142319", "0.51359576", "0.51253015", "0.5097682", "0.50972664", "0.5096979", "0.5092192", "0.50838447", "0.5075114", "0.5074675", "0.50697786", "0.5066166", "0.50608003", "0.50601923", "0.5059925" ]
0.78348684
1
NewTransform creates a new default transform, corresponding to identity.
NewTransform создает новый стандартный преобразователь, соответствующий тождеству.
func NewTransform() *Transform { return &Transform{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewTransform() *Transform {\n\treturn transformPool.Get().(*Transform)\n}", "func NewTransform() Transform {\n\tt := transform{\n\t\tmodelView: mgl32.Ident4(),\n\t\trotation: mgl32.Vec3{0, 0, 0},\n\t\ttranslation: mgl32.Vec3{0, 0, 0},\n\t}\n\treturn &t\n}", "func (t *Transform) New() *Transform {\n\tret := NewTransform()\n\tret.SetParent(t)\n\treturn ret\n}", "func NewTransform() *Transform {\n\treturn &Transform{\n\t\tPosition: NewVector(0, 0),\n\t\tRotation: 0,\n\t\tScale: NewVector(1, 1),\n\t\tDim: NewVector(0, 0),\n\t}\n}", "func NewTransform2DIdentity() *Transform2D {\n\tvar dest C.godot_transform2d\n\tC.go_godot_transform2d_new_identity(GDNative.api, &dest)\n\treturn &Transform2D{base: &dest}\n}", "func New() *Transformer {\n\treturn &Transformer{}\n}", "func NewTransform(cfg *viper.Viper) (interface{}, error) {\n\tgremlinClient, err := client.NewGremlinQueryHelperFromConfig(core.CfgAuthOpts(cfg))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &vpclogsFlowTransformer{\n\t\tinterfaceIpCache: cache.New(10*time.Minute, 10*time.Minute),\n\t\tgremlinClient: gremlinClient,\n\t}, nil\n}", "func (s *schema) NewTransform(name string, input io.Reader, ctx *transformctx.Ctx) (Transform, error) {\n\tbr, err := ios.StripBOM(s.header.ParserSettings.WrapEncoding(input))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ctx.InputName != name {\n\t\tctx.InputName = name\n\t}\n\tingester, err := s.handler.NewIngester(ctx, br)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// If caller already specified a way to do context aware error formatting, use it;\n\t// otherwise (vast majority cases), use the Ingester (which implements CtxAwareErr\n\t// interface) created by the schema handler.\n\tif ctx.CtxAwareErr == nil {\n\t\tctx.CtxAwareErr = ingester\n\t}\n\treturn &transform{ingester: ingester}, nil\n}", "func NewTransformation(ctx *pulumi.Context,\n\tname string, args *TransformationArgs, opts ...pulumi.ResourceOption) (*Transformation, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Path == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Path'\")\n\t}\n\tvar resource Transformation\n\terr := ctx.RegisterResource(\"vault:transform/transformation:Transformation\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (eval *evaluator) LinearTransformNew(ctIn *Ciphertext, linearTransform interface{}) (ctOut []*Ciphertext) {\n\n\tswitch element := linearTransform.(type) {\n\tcase []PtDiagMatrix:\n\t\tctOut = make([]*Ciphertext, len(element))\n\n\t\tvar maxLevel int\n\t\tfor _, matrix := range element {\n\t\t\tmaxLevel = utils.MaxInt(maxLevel, matrix.Level)\n\t\t}\n\n\t\tminLevel := utils.MinInt(maxLevel, ctIn.Level())\n\n\t\teval.DecomposeNTT(minLevel, eval.params.PCount()-1, eval.params.PCount(), ctIn.Value[1], eval.PoolDecompQP)\n\n\t\tfor i, matrix := range element {\n\t\t\tctOut[i] = NewCiphertext(eval.params, 1, minLevel, ctIn.Scale)\n\n\t\t\tif matrix.Naive {\n\t\t\t\teval.MultiplyByDiagMatrix(ctIn, matrix, eval.PoolDecompQP, ctOut[i])\n\t\t\t} else {\n\t\t\t\teval.MultiplyByDiagMatrixBSGS(ctIn, matrix, eval.PoolDecompQP, ctOut[i])\n\t\t\t}\n\t\t}\n\n\tcase PtDiagMatrix:\n\n\t\tminLevel := utils.MinInt(element.Level, ctIn.Level())\n\t\teval.DecomposeNTT(minLevel, eval.params.PCount()-1, eval.params.PCount(), ctIn.Value[1], eval.PoolDecompQP)\n\n\t\tctOut = []*Ciphertext{NewCiphertext(eval.params, 1, minLevel, ctIn.Scale)}\n\n\t\tif element.Naive {\n\t\t\teval.MultiplyByDiagMatrix(ctIn, element, eval.PoolDecompQP, ctOut[0])\n\t\t} else {\n\t\t\teval.MultiplyByDiagMatrixBSGS(ctIn, element, eval.PoolDecompQP, ctOut[0])\n\t\t}\n\t}\n\treturn\n}", "func NewTransformComponent(parent *Entity, position Vector3, size Vector3, origin Vector3, rotation float64) *TransformComponent {\n\ttransformComponent := &TransformComponent{\n\t\tID: \"transform\",\n\t\tParent: parent,\n\t\tPosition: position,\n\t\tSize: size,\n\t\tOrigin: origin,\n\t\tRotation: rotation,\n\t}\n\treturn transformComponent\n}", "func (t *Transform) Transform() *Transform {\n\treturn t\n}", "func CreateTransform(lowerLeft, upperRight *Point, width, height int,\n\tgd *GridDef) *PointTransform {\n\tworldNx := math.Abs(lowerLeft.X() - upperRight.X())\n\tworldNy := math.Abs(lowerLeft.Y() - upperRight.Y())\n\tdx := worldNx / float64(width)\n\tdy := worldNy / float64(height)\n\tmaxx := math.Max(lowerLeft.X(), upperRight.X())\n\tmaxy := math.Max(lowerLeft.Y(), upperRight.Y())\n\tmax := NewPoint2D(maxx, maxy)\n\treturn &PointTransform{dx, dy, max, width, height, gd}\n}", "func Transform() TRANSFORM {\n\treturn TRANSFORM{\n\t\ttags: []ONETRANSFORM{},\n\t}\n}", "func NewIdentity() (*Identity, error) {\n\tident := &Identity{}\n\terr := ident.Default()\n\treturn ident, err\n}", "func NewTransformable() *Transformable {\n\ttransformable := &Transformable{C.sfTransformable_create()}\n\truntime.SetFinalizer(transformable, (*Transformable).destroy)\n\n\treturn transformable\n}", "func NewDoubleTransform( /* TODO */ ) *DoubleTransform {\n\t// TODO\n\treturn nil\n}", "func Transform() TransformComponent {\n\treturn TransformComponent{\n\t\tLocal: Affine{Scale: vec3{1, 1, 1}},\n\t\tWorld: Affine{Scale: vec3{1, 1, 1}},\n\t}\n}", "func NewCfnMLTransform(scope constructs.Construct, id *string, props *CfnMLTransformProps) CfnMLTransform {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnMLTransform{}\n\n\t_jsii_.Create(\n\t\t\"aws-cdk-lib.aws_glue.CfnMLTransform\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "func NewTransformer() Transformer {\n\treturn &execFigletTransformer{}\n}", "func NewTransformer() *Transformer {\n\treturn &Transformer{\n\t\tprevReqs: NewPrevReqPool(5),\n\t}\n}", "func NewCfnMLTransform_Override(c CfnMLTransform, scope constructs.Construct, id *string, props *CfnMLTransformProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"aws-cdk-lib.aws_glue.CfnMLTransform\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "func New(e *eme.EMECipher, longNames bool, raw64 bool) *NameTransform {\n\tb64 := base64.URLEncoding\n\tif raw64 {\n\t\tb64 = base64.RawURLEncoding\n\t}\n\treturn &NameTransform{\n\t\temeCipher: e,\n\t\tlongNames: longNames,\n\t\tB64: b64,\n\t}\n}", "func NewTransformCmd() *TransformCmd {\n\n\ttc := &TransformCmd{\n\t\tfs: flag.NewFlagSet(\"transform\", flag.ContinueOnError),\n\t}\n\n\ttc.fs.StringVar(&tc.outDir, \"o\", \"\", \"The directory where output file are written to\")\n\ttc.fs.StringVar(&tc.transFile, \"t\", \"\", \"Transformation file (required)\")\n\n\treturn tc\n}", "func (tr *transform) newExpression(iVar interface{}) *expression {\n\tvar id string\n\n\tif iVar != nil {\n\t\tswitch tVar := iVar.(type) {\n\t\tcase *ast.Ident:\n\t\t\tid = tVar.Name\n\t\tcase string:\n\t\t\tid = tVar\n\t\t}\n\t}\n\n\treturn &expression{\n\t\ttr,\n\t\tnew(bytes.Buffer),\n\t\tid,\n\t\t\"\",\n\t\t\"\",\n\t\t\"\",\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tfalse,\n\t\tmake([]string, 0),\n\t\tmake([]string, 0),\n\t}\n}", "func NewMyTransformer() *myTransformer {\n\treturn &myTransformer{}\n}", "func NewAffine(c anyvec.Creator, scaler, bias float64) *Affine {\n\tscalerVec := c.MakeVector(1)\n\tbiasVec := c.MakeVector(1)\n\tscalerVec.AddScalar(c.MakeNumeric(scaler))\n\tbiasVec.AddScalar(c.MakeNumeric(bias))\n\treturn &Affine{\n\t\tScalers: anydiff.NewVar(scalerVec),\n\t\tBiases: anydiff.NewVar(biasVec),\n\t}\n}", "func NewTransformDataNodes() *transformDataNodes {\n\treturn &transformDataNodes{}\n}", "func MakeTransformFor(archiveID int64, transform transforms.RequestTransform) (*Transform, error) {\n\t// e.g. 'ConstantTransform' or 'HeaderInjectionTransform'\n\ttransformType := strings.Split(reflect.TypeOf(transform).String(), \".\")[1]\n\tmarshaled, err := json.MarshalIndent(transform, \"\", \" \")\n\treturn &Transform{\n\t\tArchiveID: archiveID,\n\t\tMarshaledJSON: string(marshaled),\n\t\tType: transformType,\n\t}, err\n}", "func NewIdentity(log *util.Logger) *Identity {\n\tv := &Identity{\n\t\tHelper: request.NewHelper(log),\n\t}\n\n\treturn v\n}", "func noTransformation(xs []string) (transform.Transformation, error) {\n\tif len(xs) != 0 {\n\t\treturn nil, ErrBadTransformation\n\t}\n\treturn transform.NoTransformation(), nil\n}", "func (self Text) Transform() Transform {\n\tt := C.sfText_getTransform(self.Cref)\n\treturn Transform{&t}\n}", "func (a *API) CreateTransformation(ctx context.Context, params CreateTransformationParams) (*TransformationResult, error) {\n\tres := &TransformationResult{}\n\t_, err := a.post(ctx, api.BuildPath(transformations), params, res)\n\n\treturn res, err\n}", "func (p Profile) NewTransformer() *Transformer {\n\tvar ts []transform.Transformer\n\n\tif p.options.allowwidechars {\n\t\tts = append(ts, width.Fold)\n\t}\n\n\tts = append(ts, checker{p: p})\n\n\tif p.options.width != nil {\n\t\tts = append(ts, width.Fold)\n\t}\n\n\tfor _, f := range p.options.additional {\n\t\tts = append(ts, f())\n\t}\n\n\tif p.options.cases != nil {\n\t\tts = append(ts, p.options.cases)\n\t}\n\n\tts = append(ts, p.options.norm)\n\n\t// TODO: Apply directionality rule (blocking on the Bidi package)\n\t// TODO: Add the disallow empty rule with a dummy transformer?\n\n\treturn &Transformer{transform.Chain(ts...)}\n}", "func NewIdentity(signer Signer, name string, metadata []byte) (*Identity, error) {\n\tqname, err := fields.NewQualifiedContent(fields.ContentTypeUTF8String, []byte(name))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create qualified content of type %d from %s\", fields.ContentTypeUTF8String, name)\n\t}\n\tqmeta, err := fields.NewQualifiedContent(fields.ContentTypeTwig, metadata)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create qualified content of type %d from %s\", fields.ContentTypeTwig, metadata)\n\t}\n\treturn NewIdentityQualified(signer, qname, qmeta)\n}", "func NewIdentity(log *util.Logger) *Identity {\n\treturn &Identity{\n\t\tHelper: request.NewHelper(log),\n\t}\n}", "func NewCameraWithTransform(horizontalSize int, verticalSize int, fieldOfView float64,\n\ttransform *matrix.Matrix) *Camera {\n\n\tc := &Camera{\n\t\thorizontalSizeInPixels: horizontalSize,\n\t\tverticalSizeInPixels: verticalSize,\n\t\tfieldOfView: fieldOfView,\n\t\ttransform: transform,\n\t}\n\tc.prepareWorldSpaceUnits()\n\n\t// Cache the inverse of the transform, which never\n\t// changes and is used in rendering routines often.\n\tinverseTransform, _ := matrix.Inverse(transform)\n\tc.inverseTransform = inverseTransform\n\n\treturn c\n}", "func (m Matrix) Transform(a vec.Vec) vec.Vec {\n\treturn vec.New(\n\t\ta.X*m[0]+a.Y*m[2]+m[4],\n\t\ta.X*m[1]+a.Y*m[3]+m[5])\n}", "func New(e *eme.EMECipher, longNames bool, longNameMax uint8, raw64 bool, badname []string, deterministicNames bool) *NameTransform {\n\ttlog.Debug.Printf(\"nametransform.New: longNameMax=%v, raw64=%v, badname=%q\",\n\t\tlongNameMax, raw64, badname)\n\tb64 := base64.URLEncoding\n\tif raw64 {\n\t\tb64 = base64.RawURLEncoding\n\t}\n\tvar effectiveLongNameMax int = math.MaxInt32\n\tif longNames {\n\t\tif longNameMax == 0 {\n\t\t\teffectiveLongNameMax = NameMax\n\t\t} else {\n\t\t\teffectiveLongNameMax = int(longNameMax)\n\t\t}\n\t}\n\treturn &NameTransform{\n\t\temeCipher: e,\n\t\tlongNameMax: effectiveLongNameMax,\n\t\tB64: b64,\n\t\tbadnamePatterns: badname,\n\t\tdeterministicNames: deterministicNames,\n\t}\n}", "func Transform(t transform.Transformer, filename string) error {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tw, err := Writer(filename, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer w.Close()\n\n\tif _, err := io.Copy(w, transform.NewReader(f, t)); err != nil {\n\t\treturn err\n\t}\n\treturn w.Commit()\n}", "func (entity *Base) Transform() *Transform {\n\treturn &entity.transform\n}", "func (self Text) InverseTransform() Transform {\n\tt := C.sfText_getInverseTransform(self.Cref)\n\treturn Transform{&t}\n}", "func NewTransformsRecord() *TransformsRecord {\n\tr := &TransformsRecord{}\n\n\treturn r\n}", "func (c *Curve) NewIdentityPoint() CurvePoint {\n\treturn CurvePoint{\n\t\tx: math.Inf(0),\n\t\ty: math.Inf(0),\n\t\tcurve: c,\n\t}\n}", "func (h *Headers) NoTransform() *Headers {\n\th.noTransform = true\n\treturn h\n}", "func (in *Transform) DeepCopy() *Transform {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Transform)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func Identity() *Pub {\n\treturn NewPub(IdentityMuxer())\n}", "func newSigningIdentity(id identity.Identity, sign identity.Sign, hash hash.Hash) (*signingIdentity, error) {\n\tserializedIdentity := &msp.SerializedIdentity{\n\t\tMspid: id.MspID(),\n\t\tIdBytes: id.Credentials(),\n\t}\n\tserializedID, err := proto.Marshal(serializedIdentity)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := &signingIdentity{\n\t\tserializedID: serializedID,\n\t\tsign: sign,\n\t\thash: hash,\n\t}\n\treturn result, nil\n}", "func (tt *TransformTable) NewComp(entity engi.Entity) (xf *Transform) {\n\tif size := len(tt.comps); tt.index >= size {\n\t\ttt.comps = transformResize(tt.comps, size + STEP)\n\t}\n\tei := entity.Index()\n\tif v, ok := tt._map[ei]; ok {\n\t\txf = &tt.comps[v]\n\t\treturn\n\t}\n\n\txf = &tt.comps[tt.index]\n\ttt._map[ei] = tt.index\n\txf.Entity = entity\n\txf.Scale = mgl32.Vec2{1, 1}\n\ttt.index += 1\n\treturn\n}", "func (canvas *Canvas) Transform(a, b, c, d, e, f float32) {\n\twriteCommand(canvas.contents, \"cm\", a, b, c, d, e, f)\n}", "func (t *Transform) Create(db *DB) error {\n\tif t.CreatedAt != nil {\n\t\treturn errors.New(\"Transform already appears to be persisted\")\n\t}\n\n\tnow := util.TimePtr(time.Now())\n\tt.CreatedAt = now\n\tt.UpdatedAt = now\n\terr := db.Insert(t)\n\treturn err\n}", "func TestSimplestTransform(t *testing.T) {\n\tassert := assert.New(t)\n\tmessage := map[string]interface{}{\n\t\t\"a\": \"b\",\n\t}\n\ttransform := map[string]interface{}{\n\t\t\"x\": \"y\",\n\t}\n\ttransformErr := Transform(&message, transform)\n\tassert.Nil(transformErr)\n\tassert.Equal(message[\"a\"], \"b\")\n\tassert.NotNil(message[\"x\"])\n\tassert.Equal(message[\"x\"], \"y\")\n}", "func Identity() *Mtx {\n\treturn NewMat(\n\t\t1, 0, 0, 0,\n\t\t0, 1, 0, 0,\n\t\t0, 0, 1, 0,\n\t\t0, 0, 0, 1,\n\t)\n}", "func (ir Range) TransformToNew(start, end time.Time) period.Period {\n\treturn Range{\n\t\tStartFrame: fromTimeAndFPS(start, ir.FPS),\n\t\tEndFrame: fromTimeAndFPS(end, ir.FPS),\n\t\tFPS: ir.FPS,\n\t}\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func NewMatrixTranslate(x, y, z float32) Matrix {\n\treturn Matrix{\n\t\tM0: 1, M1: 0, M2: 0, M3: x,\n\t\tM4: 0, M5: 1, M6: 0, M7: y,\n\t\tM8: 0, M9: 0, M10: 1, M11: z,\n\t\tM12: 0, M13: 0, M14: 0, M15: 1,\n\t}\n}", "func NewMatrixIdentity() Matrix {\n\treturn Matrix{\n\t\tM0: 1, M1: 0, M2: 0, M3: 0,\n\t\tM4: 0, M5: 1, M6: 0, M7: 0,\n\t\tM8: 0, M9: 0, M10: 1, M11: 0,\n\t\tM12: 0, M13: 0, M14: 0, M15: 1,\n\t}\n}", "func (s *Surface) Transform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"transform\", a, b, c, d, e, f)\n}", "func (in *TransformInput) DeepCopy() *TransformInput {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TransformInput)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func New(mspID string, certPEM []byte) (ci *CertIdentity, err error) {\n\tcert, err := Certificate(certPEM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &CertIdentity{mspID, cert}, nil\n}", "func (app *Configurable) Transform(parameters map[string]string) interfaces.AppFunction {\n\ttransformType, ok := parameters[TransformType]\n\tif !ok {\n\t\tapp.lc.Errorf(\"Could not find '%s' parameter for Transform\", TransformType)\n\t\treturn nil\n\t}\n\n\ttransform := transforms.Conversion{}\n\n\tswitch strings.ToLower(transformType) {\n\tcase TransformXml:\n\t\treturn transform.TransformToXML\n\tcase TransformJson:\n\t\treturn transform.TransformToJSON\n\tdefault:\n\t\tapp.lc.Errorf(\n\t\t\t\"Invalid transform type '%s'. Must be '%s' or '%s'\",\n\t\t\ttransformType,\n\t\t\tTransformXml,\n\t\t\tTransformJson)\n\t\treturn nil\n\t}\n}", "func NewIdentity(conn sshd.Connection) *Identity {\n\treturn &Identity{\n\t\tConnection: conn,\n\t\tid: sanitize.Name(conn.Name()),\n\t\tcreated: time.Now(),\n\t}\n}", "func newTask() task {\n\treturn task{}\n}", "func (t *Transform) Copy() *Transform {\n\tt.access.RLock()\n\tcpy := &Transform{\n\t\tparent: t.parent,\n\t\tpos: t.pos,\n\t\trot: t.rot,\n\t\tscale: t.scale,\n\t\tshear: t.shear,\n\t}\n\tif t.built != nil {\n\t\tbuiltCpy := *t.built\n\t\tcpy.built = &builtCpy\n\t}\n\tif t.localToWorld != nil {\n\t\tltwCpy := *t.localToWorld\n\t\tcpy.localToWorld = &ltwCpy\n\t}\n\tif t.worldToLocal != nil {\n\t\twtlCpy := *t.worldToLocal\n\t\tcpy.worldToLocal = &wtlCpy\n\t}\n\tif t.quat != nil {\n\t\tquatCpy := *t.quat\n\t\tcpy.quat = &quatCpy\n\t}\n\tt.access.RUnlock()\n\treturn cpy\n}", "func NewTransformations(tr ...*Transformation) (trs *Transformations) {\n\tif len(tr) != 3 {\n\t\ttrs = nil\n\t} else {\n\t\ttrc := make([]Transformation, len(tr))\n\n\t\t// Make a copy of the transformations.\n\t\tfor i := range tr {\n\t\t\tif tr[i] != nil {\n\t\t\t\ttrans := tr[i]\n\t\t\t\tfunction := trans.Function()\n\t\t\t\tparams := trans.Parameters()\n\t\t\t\tntr := NewTransformation(function, params...)\n\t\t\t\ttrc[i] = ntr\n\t\t\t} else {\n\t\t\t\ttrc[i] = Transformation{}\n\t\t\t}\n\t\t}\n\n\t\ttrs = &Transformations{Tmpl: trc[0], Mtch: trc[1], Rslt: trc[2]}\n\t}\n\n\treturn trs\n}", "func NewIdentity() *identity.X509Identity {\n\tcertificatePEM, err := ioutil.ReadFile(\"certificate.pem\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcertificate, err := identity.CertificateFromPEM(certificatePEM)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tid, err := identity.NewX509Identity(\"mspID\", certificate)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn id\n}", "func (c *Client) CreateMLTransform(ctx context.Context, params *CreateMLTransformInput, optFns ...func(*Options)) (*CreateMLTransformOutput, error) {\n\tif params == nil {\n\t\tparams = &CreateMLTransformInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"CreateMLTransform\", params, optFns, addOperationCreateMLTransformMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*CreateMLTransformOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (a *Application) newTransformer(patches []*resource.Resource) (transformers.Transformer, error) {\n\tvar r []transformers.Transformer\n\tt, err := transformers.NewPatchTransformer(patches)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr = append(r, t)\n\tr = append(r, transformers.NewNamespaceTransformer(string(a.kustomization.Namespace)))\n\tt, err = transformers.NewDefaultingNamePrefixTransformer(string(a.kustomization.NamePrefix))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr = append(r, t)\n\tt, err = transformers.NewDefaultingLabelsMapTransformer(a.kustomization.CommonLabels)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr = append(r, t)\n\tt, err = transformers.NewDefaultingAnnotationsMapTransformer(a.kustomization.CommonAnnotations)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr = append(r, t)\n\treturn transformers.NewMultiTransformer(r), nil\n}", "func (geom Geometry) Transform(ct CoordinateTransform) error {\n\treturn C.OGR_G_Transform(geom.cval, ct.cval).Err()\n}", "func (p *Profile) NewTransformer() *Transformer {\n\tvar ts []transform.Transformer\n\n\t// These transforms are applied in the order defined in\n\t// https://tools.ietf.org/html/rfc7564#section-7\n\n\t// RFC 8266 §2.1:\n\t//\n\t// Implementation experience has shown that applying the rules for the\n\t// Nickname profile is not an idempotent procedure for all code points.\n\t// Therefore, an implementation SHOULD apply the rules repeatedly until\n\t// the output string is stable; if the output string does not stabilize\n\t// after reapplying the rules three (3) additional times after the first\n\t// application, the implementation SHOULD terminate application of the\n\t// rules and reject the input string as invalid.\n\t//\n\t// There is no known string that will change indefinitely, so repeat 4 times\n\t// and rely on the Span method to keep things relatively performant.\n\tr := 1\n\tif p.options.repeat {\n\t\tr = 4\n\t}\n\tfor ; r > 0; r-- {\n\t\tif p.options.foldWidth {\n\t\t\tts = append(ts, width.Fold)\n\t\t}\n\n\t\tfor _, f := range p.options.additional {\n\t\t\tts = append(ts, f())\n\t\t}\n\n\t\tif p.options.cases != nil {\n\t\t\tts = append(ts, p.options.cases)\n\t\t}\n\n\t\tts = append(ts, p.options.norm)\n\n\t\tif p.options.bidiRule {\n\t\t\tts = append(ts, bidirule.New())\n\t\t}\n\n\t\tts = append(ts, &checker{p: p, allowed: p.Allowed()})\n\t}\n\n\t// TODO: Add the disallow empty rule with a dummy transformer?\n\n\treturn &Transformer{transform.Chain(ts...)}\n}", "func Transformer(name string, f interface{}) Option {\n\tv := reflect.ValueOf(f)\n\tif !function.IsType(v.Type(), function.Transformer) || v.IsNil() {\n\t\tpanic(fmt.Sprintf(\"invalid transformer function: %T\", f))\n\t}\n\tif name == \"\" {\n\t\tname = function.NameOf(v)\n\t\tif !identsRx.MatchString(name) {\n\t\t\tname = \"λ\" // Lambda-symbol as placeholder name\n\t\t}\n\t} else if !identsRx.MatchString(name) {\n\t\tpanic(fmt.Sprintf(\"invalid name: %q\", name))\n\t}\n\ttr := &transformer{name: name, fnc: reflect.ValueOf(f)}\n\tif ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 {\n\t\ttr.typ = ti\n\t}\n\treturn tr\n}", "func (a *Add) New(key, value string) transformer.Transformer {\n\treturn &Add{\n\t\tPath: key,\n\t\tValue: value,\n\n\t\tvariables: a.variables,\n\t}\n}", "func (s *CreateTransformJobInput) SetTransformInput(v *TransformInput) *CreateTransformJobInput {\n\ts.TransformInput = v\n\treturn s\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func (s *BaseSyslParserListener) EnterTransform(ctx *TransformContext) {}", "func NewIdentityQuaternion() Quaternion {\n\treturn NewQuaternion(0.0, 1.0, 0.0, 0.0)\n}", "func NewTransformer(feastClient feast.Client, config *transformer.StandardTransformerConfig, options *Options, logger *zap.Logger) (*Transformer, error) {\n\tdefaultValues := make(map[string]*types.Value)\n\t// populate default values\n\tfor _, ft := range config.TransformerConfig.Feast {\n\t\tfor _, f := range ft.Features {\n\t\t\tif len(f.DefaultValue) != 0 {\n\t\t\t\tfeastValType := types.ValueType_Enum(types.ValueType_Enum_value[f.ValueType])\n\t\t\t\tdefVal, err := getValue(f.DefaultValue, feastValType)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Warn(fmt.Sprintf(\"invalid default value for %s : %v, %v\", f.Name, f.DefaultValue, err))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdefaultValues[f.Name] = defVal\n\t\t\t}\n\t\t}\n\t}\n\n\tcompiledJsonPath := make(map[string]*jsonpath.Compiled)\n\tcompiledUdf := make(map[string]*vm.Program)\n\tfor _, ft := range config.TransformerConfig.Feast {\n\t\tfor _, configEntity := range ft.Entities {\n\t\t\tswitch configEntity.Extractor.(type) {\n\t\t\tcase *transformer.Entity_JsonPath:\n\t\t\t\tc, err := jsonpath.Compile(configEntity.GetJsonPath())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unable to compile jsonpath for entity %s: %s\", configEntity.Name, configEntity.GetJsonPath())\n\t\t\t\t}\n\t\t\t\tcompiledJsonPath[configEntity.GetJsonPath()] = c\n\t\t\tcase *transformer.Entity_Udf:\n\t\t\t\tc, err := expr.Compile(configEntity.GetUdf(), expr.Env(UdfEnv{}))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tcompiledUdf[configEntity.GetUdf()] = c\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn &Transformer{\n\t\tfeastClient: feastClient,\n\t\tconfig: config,\n\t\toptions: options,\n\t\tlogger: logger,\n\t\tdefaultValues: defaultValues,\n\t\tcompiledJsonPath: compiledJsonPath,\n\t\tcompiledUdf: compiledUdf,\n\t}, nil\n}", "func (s *DescribeTransformJobOutput) SetTransformInput(v *TransformInput) *DescribeTransformJobOutput {\n\ts.TransformInput = v\n\treturn s\n}", "func (me XAttrTypeTxsdAnimateTransformTypeTypeTranslate) TypeDefault() TxsdAnimateTransformTypeType {\n\treturn TxsdAnimateTransformTypeType(\"translate\")\n}", "func NewTranslator(name, namespace, secretsNamespace string, enforceHTTPs bool, hostNameSuffixMatch bool, idleTimeoutSeconds int) Translator {\n\treturn &defaultTranslator{\n\t\tname: name,\n\t\tnamespace: namespace,\n\t\tsecretsNamespace: secretsNamespace,\n\t\tenforceHTTPs: enforceHTTPs,\n\t\thostNameSuffixMatch: hostNameSuffixMatch,\n\t\tidleTimeoutSeconds: idleTimeoutSeconds,\n\t}\n}", "func NewPointAffine(x, y fr.Element) PointAffine {\n\treturn PointAffine{x, y}\n}", "func (in *Transformation) DeepCopy() *Transformation {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Transformation)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (t *Tuple) Transform(transformations ...Matrix) *Tuple {\n\n\tif len(transformations) < 1 {\n\t\treturn t\n\t}\n\n\tcurrent := transformations[0]\n\n\tfor i := 1; i < len(transformations); i++ {\n\t\tcurrent = transformations[i].MulMatrix(current)\n\t}\n\n\treturn current.MulTuple(t)\n\n}", "func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {\n\n\tif len(config.Path) == 0 || config.Path == \"\" {\n\t\tconfig.Path = \"/\"\n\t}\n\n\tif len(config.HeaderName) == 0 || config.HeaderName == \"\" {\n\t\tconfig.HeaderName = \"Authorization\"\n\t}\n\n\tif len(config.HeaderPrefix) == 0 || config.HeaderPrefix == \"\" {\n\t\tconfig.HeaderPrefix = \"\"\n\t}\n\n\tif len(config.ParamName) == 0 || config.ParamName == \"\" {\n\t\tconfig.ParamName = \"jwt\"\n\t}\n\n\treturn &JWTTransform{\n\t\tnext: next,\n\t\tname: name,\n\t\tconfig: config,\n\t}, nil\n}", "func (s *Stream) Transform(op api.UnOperation) *Stream {\n\toperator := unary.New(s.ctx)\n\toperator.SetOperation(op)\n\ts.ops = append(s.ops, operator)\n\treturn s\n}", "func (s *TransformJobDefinition) SetTransformInput(v *TransformInput) *TransformJobDefinition {\n\ts.TransformInput = v\n\treturn s\n}", "func Transform(ctx context.Context, input <-chan CrawlResult, worker TransformFunc, parallelism int) <-chan TransformResult {\n\tt := &transformer{\n\t\tinput: input,\n\t\toutput: make(chan TransformResult, 1000),\n\t\tworkerBody: worker,\n\t\tparallelism: parallelism,\n\t}\n\tgo t.runWorkersToCompletion(ctx)\n\treturn t.output\n}", "func NewDefaultTransactor(ds datastore.Datastorer) DefaultTransactor {\n\treturn DefaultTransactor{ds}\n}", "func NewDefaultTransactor(ds datastore.Datastorer) DefaultTransactor {\n\treturn DefaultTransactor{ds}\n}", "func (inv *ActionMailTemplateTranslationUpdateInvocation) NewInput() *ActionMailTemplateTranslationUpdateInput {\n\tinv.Input = &ActionMailTemplateTranslationUpdateInput{}\n\treturn inv.Input\n}", "func (s *TransformJob) SetTransformInput(v *TransformInput) *TransformJob {\n\ts.TransformInput = v\n\treturn s\n}", "func (a *Client) CreateInstanceTransformationByObjectName(params *CreateInstanceTransformationByObjectNameParams) (*CreateInstanceTransformationByObjectNameOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateInstanceTransformationByObjectNameParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createInstanceTransformationByObjectName\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/instances/transformations/{objectName}\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &CreateInstanceTransformationByObjectNameReader{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.(*CreateInstanceTransformationByObjectNameOK), nil\n\n}", "func (m *PowerTransformer) InverseTransform(X, Y mat.Matrix) (Xout, Yout *mat.Dense) {\n\tnSamples, nFeatures := X.Dims()\n\tXout = mat.NewDense(nSamples, nFeatures, nil)\n\tYout = base.ToDense(Y)\n\n\tvar inverseTransformFunc func(out, x []float64, lmbda float64)\n\tswitch m.Method {\n\tcase \"yeo-johnson\":\n\t\tinverseTransformFunc = yeoJohnsonInverseTransform\n\tcase \"box-cox\":\n\t\tinverseTransformFunc = boxCoxInverseTransform\n\tdefault:\n\t\tpanic(fmt.Errorf(\"'method' must be one of ('box-cox', 'yeo-johnson'), got %s instead\", m.Method))\n\t}\n\tX1 := base.ToDense(X)\n\tif m.Standardize {\n\t\tX1, _ = m.Scaler.InverseTransform(X1, nil)\n\t}\n\tbase.Parallelize(-1, nFeatures, func(th, start, end int) {\n\t\tcol := make([]float64, nSamples)\n\t\tout := make([]float64, nSamples)\n\t\tfor c := start; c < end; c++ {\n\t\t\tmat.Col(col, c, X1)\n\t\t\tinverseTransformFunc(out, col, m.Lambdas[c])\n\t\t\tXout.SetCol(c, out)\n\t\t}\n\t})\n\treturn\n}", "func (r *Repository) Transform(from, to int) Func {\n\treturn Transform(r.Code(from), r.Code(to))\n}", "func newExecute(name string) *Instruction {\n\treturn &Instruction{\n\t\tType: ExecuteInst,\n\t\tName: name,\n\t}\n}", "func (c *Identity) ToPlain(provider identityprovider.Interface) (*identityprovider.Identity, error) {\n\tpublicKey, err := hex.DecodeString(c.PublicKey)\n\tif err != nil {\n\t\treturn nil, errmsg.ErrIdentityDeserialization.Wrap(err)\n\t}\n\n\tidSignatures, err := c.Signatures.ToPlain()\n\tif err != nil {\n\t\treturn nil, errmsg.ErrIdentityDeserialization.Wrap(err)\n\t}\n\n\treturn &identityprovider.Identity{\n\t\tSignatures: idSignatures,\n\t\tPublicKey: publicKey,\n\t\tType: c.Type,\n\t\tID: c.ID,\n\t\tProvider: provider,\n\t}, nil\n}", "func NewDefault(metaTemplates []string) (TemplateEngine, error) {\n\tt := TextTemplate{\n\t\tbeginToken: DefaultBeginToken,\n\t\tendToken: DefaultEndToken,\n\t\tseparator: DefaultSeparator,\n\t\tmetaTemplates: metaTemplates,\n\t\tdict: map[string]interface{}{},\n\t}\n\n\tif err := t.buildTemplateTree(); err != nil {\n\t\treturn DummyTemplate{}, err\n\t}\n\n\treturn t, nil\n}", "func New(name string, key *uuidpb.UUID) *Identity {\n\tx := &Identity{\n\t\tName: name,\n\t\tKey: key,\n\t}\n\n\tif err := x.Validate(); err != nil {\n\t\tpanic(x)\n\t}\n\n\treturn x\n}", "func New(qtumClient *qtum.Qtum, proxies []ETHProxy, opts ...Option) (*Transformer, error) {\n\tif qtumClient == nil {\n\t\treturn nil, errors.New(\"qtumClient cannot be nil\")\n\t}\n\n\tt := &Transformer{\n\t\tqtumClient: qtumClient,\n\t\tlogger: log.NewNopLogger(),\n\t}\n\n\tvar err error\n\tfor _, p := range proxies {\n\t\tif err = t.Register(p); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tfor _, opt := range opts {\n\t\tif err := opt(t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn t, nil\n}", "func (inv *ActionExportCreateInvocation) NewInput() *ActionExportCreateInput {\n\tinv.Input = &ActionExportCreateInput{}\n\treturn inv.Input\n}" ]
[ "0.7560676", "0.7552853", "0.7524606", "0.72407454", "0.66244805", "0.6586805", "0.6541571", "0.64616334", "0.6403893", "0.6273406", "0.6072438", "0.6038543", "0.58727026", "0.5844496", "0.5673262", "0.5662089", "0.5576789", "0.55677426", "0.55498636", "0.55261695", "0.55217415", "0.55212605", "0.5409992", "0.53822106", "0.53605086", "0.53411514", "0.5327261", "0.5324441", "0.5253493", "0.52202594", "0.52019995", "0.5181892", "0.51816654", "0.51527184", "0.5149524", "0.51486516", "0.5129181", "0.512335", "0.51187956", "0.51043844", "0.5087263", "0.5066451", "0.50575227", "0.499973", "0.4998786", "0.49965027", "0.4963325", "0.49632058", "0.49623686", "0.49616775", "0.49351707", "0.4935086", "0.49254557", "0.49219653", "0.49055982", "0.48873395", "0.4873703", "0.48634785", "0.48609284", "0.48312458", "0.4828498", "0.4819921", "0.48143348", "0.48078057", "0.48075795", "0.48030314", "0.47984898", "0.4781533", "0.47758248", "0.47673917", "0.4754305", "0.4753689", "0.47376892", "0.47313783", "0.47275737", "0.4727564", "0.47265515", "0.4716263", "0.47157702", "0.4706355", "0.47000355", "0.46917036", "0.4684395", "0.46835032", "0.46827972", "0.46791705", "0.46789977", "0.4670661", "0.4670661", "0.46688148", "0.46549317", "0.4613056", "0.46125305", "0.4602827", "0.45982933", "0.45962858", "0.4588089", "0.4586528", "0.45846337", "0.4580744" ]
0.7824815
0
SetScale sets transform scale.
SetScale устанавливает масштаб трансформации.
func (t *Transform) SetScale(sx, sy float64) *Transform { t.Scale1.X = sx - 1 t.Scale1.Y = sy - 1 return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func (t *Transform) SetScale(v *Vector) ITransform {\n\tt.Scale = v\n\treturn t\n}", "func (this *Transformable) SetScale(scale Vector2f) {\n\tC.sfTransformable_setScale(this.cptr, scale.toC())\n}", "func (g *GameObject) SetScale(scale float64) {\r\n\tg.Hitbox.maxX *= scale / g.Scale\r\n\tg.Hitbox.maxY *= scale / g.Scale\r\n\tg.Scale = scale\r\n}", "func (self Transform) Scale(scaleX, scaleY float32) {\n\tC.sfTransform_scale(self.Cref, C.float(scaleX), C.float(scaleY))\n}", "func (t *Transform) Scale(sx, sy float64) {\n\tout := fmt.Sprintf(\"scale(%g,%g)\", sx, sy)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (s *UpdateTaskSetInput) SetScale(v *Scale) *UpdateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (s *CreateTaskSetInput) SetScale(v *Scale) *CreateTaskSetInput {\n\ts.Scale = v\n\treturn s\n}", "func (tr *trooper) setScale(scale float64) { tr.part.SetScale(scale, scale, scale) }", "func (this *RectangleShape) SetScale(scale Vector2f) {\n\tC.sfRectangleShape_setScale(this.cptr, scale.toC())\n}", "func (self Text) SetScale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setScale(self.Cref, v)\n}", "func (p *Part) SetScale(scale vector.Vector) {\n\tif scale.Len() != 3 && scale.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetScale: expects 3D-Float32 vector, got %dD-%v\", scale.Len(), scale.Kind())\n\t}\n\t// Create scaling matrix\n\tp.scaling = matrix.NewMatrix([][]float32{\n\t\t{scale.Get(0).(float32), 0.0, 0.0},\n\t\t{0.0, scale.Get(1).(float32), 0.0},\n\t\t{0.0, 0.0, scale.Get(2).(float32)},\n\t})\n}", "func (s *TaskSet) SetScale(v *Scale) *TaskSet {\n\ts.Scale = v\n\treturn s\n}", "func (a *ReplaySnapshotArgs) SetScale(scale float64) *ReplaySnapshotArgs {\n\ta.Scale = &scale\n\treturn a\n}", "func (z *Big) SetScale(scale int) *Big {\n\tz.exp = -scale\n\treturn z\n}", "func (sprite *Sprite) SetScaling(xScale, yScale float64) {\n\n\tsprite.shape.SetScaling(xScale, yScale)\n}", "func (s *Surface) Scale(x, y float64) {\n\ts.Ctx.Call(\"scale\", x, y)\n}", "func (canvas *Canvas) Scale(x, y float32) {\n\twriteCommand(canvas.contents, \"cm\", x, 0, 0, y, 0, 0)\n}", "func (this *Transformable) Scale(factor Vector2f) {\n\tC.sfTransformable_scale(this.cptr, factor.toC())\n}", "func (dw *DrawingWand) Scale(x, y float64) {\n\tC.MagickDrawScale(dw.dw, C.double(x), C.double(y))\n}", "func (t *Transform) SetScaleXY(x float64, y float64) ITransform {\n\treturn t.SetScale(NewVector(x, y))\n}", "func (tfs *tiflashScaler) Scale(tc *v1alpha1.TidbCluster, oldSet *apps.StatefulSet, newSet *apps.StatefulSet) error {\n\tscaling, _, _, _ := scaleOne(oldSet, newSet)\n\tif scaling > 0 {\n\t\treturn tfs.ScaleOut(tc, oldSet, newSet)\n\t} else if scaling < 0 {\n\t\treturn tfs.ScaleIn(tc, oldSet, newSet)\n\t}\n\t// we only sync auto scaler annotations when we are finishing syncing scaling\n\treturn tfs.SyncAutoScalerAnn(tc, oldSet)\n}", "func (t *Transform) Scale() lmath.Vec3 {\n\tt.access.RLock()\n\ts := t.scale\n\tt.access.RUnlock()\n\treturn s\n}", "func (ki *KernelInfo) Scale(scale float64, normalizeType KernelNormalizeType) {\n\tC.ScaleKernelInfo(ki.info, C.double(scale), C.GeometryFlags(normalizeType))\n\truntime.KeepAlive(ki)\n}", "func (c2d *C2DMatrix) Scale(xScale, yScale float64) {\n\tvar mat Matrix\n\n\tmat.m11 = xScale\n\tmat.m12 = 0\n\tmat.m13 = 0\n\n\tmat.m21 = 0\n\tmat.m22 = yScale\n\tmat.m23 = 0\n\n\tmat.m31 = 0\n\tmat.m32 = 0\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func (z *Big) SetMantScale(value int64, scale int) *Big {\n\tz.SetUint64(arith.Abs(value))\n\tz.exp = -scale // compiler should optimize out z.exp = 0 in SetUint64\n\tif value < 0 {\n\t\tz.form |= signbit\n\t}\n\treturn z\n}", "func (p *Point) Scale(v float64) {\n\tp.x *= v\n\tp.y *= v\n}", "func (p *Plane) Scale(scaleVec mgl32.Vec3) {\n\tp.model.Scale = scaleVec\n\tp.centroid = CalculateCentroid(p.vertexValues.Vertices, p.model.Scale)\n\tp.boundingBox = ScaleBoundingBox(p.boundingBox, scaleVec)\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * 1\n\tv.Y = v.Y * 1\n}", "func (k *kubectlContext) Scale(resource string, scale uint) error {\n\tout, err := k.do(\"scale\", fmt.Sprintf(\"--replicas=%d\", scale), resource)\n\tk.t.Log(string(out))\n\treturn err\n}", "func (w *windowImpl) Scale(dr image.Rectangle, src screen.Texture, sr image.Rectangle, op draw.Op, opts *screen.DrawOptions) {\n\tpanic(\"not implemented\") // TODO: Implement\n}", "func (m Matrix) Scale(scale vec32.Vector) Matrix {\n\treturn Mul(m, Matrix{\n\t\t{scale[0], 0, 0, 0},\n\t\t{0, scale[1], 0, 0},\n\t\t{0, 0, scale[2], 0},\n\t\t{0, 0, 0, 1},\n\t})\n}", "func (self *T) Scale(f float64) *T {\n\tself[0] *= f\n\tself[1] *= f\n\treturn self\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (c *canvasRenderer) Scale(amount sprec.Vec2) {\n\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\tc.currentLayer.Transform,\n\t\tsprec.ScaleMat4(amount.X, amount.Y, 1.0),\n\t)\n}", "func (v *Vertex) Scale(f float64) {\r\n\tv.X = v.X * f\r\n\tv.Y = v.Y * f\r\n}", "func (self *Tween) SetTimeScaleA(member int) {\n self.Object.Set(\"timeScale\", member)\n}", "func Scale(v *Vertex, f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func (p *Proc) Scale(x, y float64) {\n\tp.stk.scale(x, y)\n}", "func (v *Vertex) Scale(f float64) {\n\tv.X *= f\n\tv.Y *= f\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func (mw *MagickWand) Scale(cols, rows uint) error {\n\treturn mw.ScaleImage(cols, rows)\n}", "func (m *Matrix3) Scale(s float64) {\n\tfor i, x := range m {\n\t\tm[i] = x * s\n\t}\n}", "func (v *Vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (self *TileSprite) SetTileScaleA(member *Point) {\n self.Object.Set(\"tileScale\", member)\n}", "func Scale(v *Vertex, f float64) {\n\tv.x *= f\n\tv.y *= f\n}", "func (v *Vertex) scale(factor float64) {\n\tv.X = v.X * factor\n\tv.Y = v.Y * factor\n}", "func (v *vertex) Scale(f float64) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func (v *Vertex) Scale(f float64) {\n v.X = v.X * f\n v.Y = v.Y * f\n}", "func Scale(value float64) *SimpleElement { return newSEFloat(\"scale\", value) }", "func (v Vertex) Scale(f int) {\n\tv.x = v.x * f\n\tv.y = v.y * f\n}", "func (self *T) Scale(f float32) *T {\n\tself[0][0] *= f\n\tself[1][1] *= f\n\treturn self\n}", "func (v *Vector) ScaleTo(s float64) {\n\tv.X = s * v.X\n\tv.Y = s * v.Y\n\tv.Z = s * v.Z\n}", "func (ct *Ciphertext) SetScalingFactor(scale float64) {\n\tct.Scale = scale\n}", "func (z *Big) SetBigMantScale(value *big.Int, scale int) *Big {\n\t// Do this first in case value == z.unscaled. Don't want to clobber the sign.\n\tz.form = finite\n\tif value.Sign() < 0 {\n\t\tz.form |= signbit\n\t}\n\n\tz.unscaled.Abs(value)\n\tz.compact = c.Inflated\n\tz.precision = arith.BigLength(value)\n\n\tif z.unscaled.IsUint64() {\n\t\tif v := z.unscaled.Uint64(); v != c.Inflated {\n\t\t\tz.compact = v\n\t\t}\n\t}\n\n\tz.exp = -scale\n\treturn z\n}", "func (this *RectangleShape) Scale(factor Vector2f) {\n\tC.sfRectangleShape_scale(this.cptr, factor.toC())\n}", "func (b *IconButton) Scale(scale float32) *IconButton {\n\tb.size = b.th.TextSize.Scale(scale * 0.72)\n\treturn b\n}", "func (nt nodeTasks) setScale(node *Node, scale, buffer int) {\n\tst := nt[node]\n\tst.Lock()\n\tdefer st.RUnlock()\n\n\tcurrScale := len(st.buffers)\n\n\t// Increase the number of tasks for the given node.\n\t// a scale of 1 only adds a buffer with no scale.\n\tif scale > currScale {\n\t\tfor ; scale > currScale; currScale++ {\n\t\t\ttask := make(chan Record, buffer)\n\t\t\tst.buffers = append(st.buffers, task)\n\t\t\tgo func() {\n\t\t\t\tfor record := range task {\n\t\t\t\t\tnode.forward(record)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\n\tif scale < currScale {\n\t\tfor ; scale < currScale; currScale-- {\n\t\t\tclose(st.buffers[currScale-1])\n\t\t\tst.buffers = st.buffers[:currScale-1]\n\t\t}\n\t}\n}", "func (self Transform) ScaleWithCenter(scaleX, scaleY, centerX, centerY float32) {\n\tC.sfTransform_scaleWithCenter(self.Cref, C.float(scaleX), C.float(scaleY), C.float(centerX), C.float(centerY))\n}", "func (blk *Block) Scale(sx, sy float64) {\n\tops := contentstream.NewContentCreator().\n\t\tScale(sx, sy).\n\t\tOperations()\n\n\t*blk.contents = append(*ops, *blk.contents...)\n\tblk.contents.WrapIfNeeded()\n\n\tblk.width *= sx\n\tblk.height *= sy\n}", "func (v *Pixbuf) Scale(dst *Pixbuf, x, y, width, height int, offsetX, offsetY, scaleX, scaleY float64, interp InterpType) {\n\tC.gdk_pixbuf_scale(v.Native(), dst.Native(), C.int(x), C.int(y), C.int(width), C.int(height), C.double(offsetX), C.double(offsetY), C.double(scaleX), C.double(scaleY), C.GdkInterpType(interp))\n}", "func (c *ProcessClient) Scale(ctx context.Context, guid string, scale *resource.ProcessScale) (*resource.Process, error) {\n\tvar process resource.Process\n\t_, err := c.client.post(ctx, path.Format(\"/v3/processes/%s/actions/scale\", guid), scale, &process)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &process, nil\n}", "func (m *NOCWidget) SetTimescale(val string) {\n\tm.timescaleField = val\n}", "func Scale(A float64, x *Matrix) (*Matrix, error) {\n\tout, _ := New(x.RowCount, x.ColCount, nil)\n\n\tfor rowID := 0; rowID < x.RowCount; rowID++ {\n\t\tfor colID := 0; colID < x.ColCount; colID++ {\n\t\t\tout.Matrix[rowID][colID] = A * x.Matrix[rowID][colID]\n\t\t}\n\t}\n\n\treturn out, nil\n}", "func (in *Scale) DeepCopy() *Scale {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Scale)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (v *Vec4) Scale(s float32) {\n\tv.X *= s\n\tv.Y *= s\n\tv.Z *= s\n\tv.W *= s\n}", "func (v *Vertex) Scale(l float64) {\n\tv.x *= l\n\tv.y *= l\n}", "func (self Text) Scale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_scale(self.Cref, v)\n}", "func (p *P1D) Scale(factor float64) {\n\tp.bng.scaleW(factor)\n}", "func Scale(X *mat.Dense) *mat.Dense {\n\tXout, _ := NewStandardScaler().FitTransform(X, nil)\n\treturn Xout\n}", "func (b *IconButton) Scale(scale float32) *IconButton {\n\tb.size = b.Theme.TextSize.Scale(scale * 0.72)\n\treturn b\n}", "func (b *Base) Scale(w http.ResponseWriter, r *http.Request) {\n\tb.log.Printf(\"%s %s -> %s\", r.Method, r.URL.Path, r.RemoteAddr)\n\n\tsOptions, pOptions, kOptions, oOptions := render.SetDefaultScaleOptions()\n\n\tpv := render.PageVars{\n\t\tTitle: \"Practice Scales and Arpeggios\", // default scale initially displayed is A Major\n\t\tScalearp: \"Scale\",\n\t\tPitch: \"Major\",\n\t\tKey: \"A\",\n\t\tScaleImgPath: \"img/scale/major/a1.png\",\n\t\tGifPath: \"\",\n\t\tAudioPath: \"mp3/scale/major/a1.mp3\",\n\t\tAudioPath2: \"mp3/drone/a1.mp3\",\n\t\tLeftLabel: \"Listen to Major scale\",\n\t\tRightLabel: \"Listen to Drone\",\n\t\tScaleOptions: sOptions,\n\t\tPitchOptions: pOptions,\n\t\tKeyOptions: kOptions,\n\t\tOctaveOptions: oOptions,\n\t}\n\n\tif err := render.Render(w, \"scale.html\", pv); err != nil {\n\t\tb.log.Printf(\"%s %s -> %s : ERROR : %v\", r.Method, r.URL.Path, r.RemoteAddr, err)\n\t\treturn\n\t}\n}", "func (t *Tree) Scale(s float32) {\n\tif t.Leaf != nil {\n\t\tfor i, x := range t.Leaf.OutputDelta {\n\t\t\tt.Leaf.OutputDelta[i] = x * s\n\t\t}\n\t} else {\n\t\tt.Branch.FalseBranch.Scale(s)\n\t\tt.Branch.TrueBranch.Scale(s)\n\t}\n}", "func (c *Circle) Scale(f float64) {\n\tc.radius *= f\n}", "func Scale(s float64) Matrix {\n\treturn Matrix{s, 0, 0, s, 0, 0}\n}", "func (fpsc *FloorPlanScaleCreate) SetScaleInMeters(f float64) *FloorPlanScaleCreate {\n\tfpsc.mutation.SetScaleInMeters(f)\n\treturn fpsc\n}", "func (c Charset) Scale(factor int) {\n\tif factor <= 1 {\n\t\t// A factor of zero results in zero-sized glyphs and\n\t\t// is therefore not valid. A factor of 1 does not change\n\t\t// the glyphs, so we can ignore it.\n\t\treturn\n\t}\n\n\t// Multiply each glyph field by the given factor\n\t// to scale them up to the new size.\n\tfor i := range c {\n\t\tc[i].X *= factor\n\t\tc[i].Y *= factor\n\t\tc[i].Width *= factor\n\t\tc[i].Height *= factor\n\t\tc[i].Advance *= factor\n\t}\n}", "func (wv *Spectrum) Scale(s float32) {\n\twv.C[0] *= s\n\twv.C[1] *= s\n\twv.C[2] *= s\n\twv.C[3] *= s\n}", "func (p Point) Scale(s Length) Point {\n\treturn Point{p.X * s, p.Y * s}\n}", "func (p Point) Scale(s float64) Point {\n\treturn NewPoint(p.X*s, p.Y*s)\n}", "func Scale(zoom float64) float64 {\n\treturn 256 * math.Pow(2, zoom)\n}", "func (q *Quaternion) Scale(factor float64) {\n\tq.Q0 = factor * q.Q0\n\tq.Q1 = factor * q.Q1\n\tq.Q2 = factor * q.Q2\n\tq.Q3 = factor * q.Q3\n}", "func (this *Transformable) GetScale() (scale Vector2f) {\n\tscale.fromC(C.sfTransformable_getScale(this.cptr))\n\treturn\n}", "func Scale(p point, factor int) point {\n\treturn point{p.x * factor, p.y * factor, p.z * factor}\n}", "func (c *LinehaulCostComputation) Scale(factor float64) {\n\tc.BaseLinehaul = c.BaseLinehaul.MultiplyFloat64(factor)\n\tc.OriginLinehaulFactor = c.OriginLinehaulFactor.MultiplyFloat64(factor)\n\tc.DestinationLinehaulFactor = c.DestinationLinehaulFactor.MultiplyFloat64(factor)\n\tc.ShorthaulCharge = c.ShorthaulCharge.MultiplyFloat64(factor)\n\tc.LinehaulChargeTotal = c.LinehaulChargeTotal.MultiplyFloat64(factor)\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func (q Quat) Scale(scalar float64) Quat {\n\n\treturn Quat{q.W * scalar,\n\t\tq.X * scalar,\n\t\tq.Y * scalar,\n\t\tq.Z * scalar}\n}", "func (dev *pwm_context) Scale(value int) error {\n\tif dev.period == -1 {\n\t\tif err := dev.ReadPeriod(); err != nil {\n\t\t\treturn fmt.Errorf(\"pwm: error running Scale: %s\", err)\n\t\t}\n\t}\n\n\tduty := (float64(value) - dev.min) / dev.span\n\tfmt.Printf(\"pwm: Scaling pin[%d] from value: %d to duty: %f\\n\", dev.pin, value, duty)\n\treturn dev.WriteDuty(int(float64(dev.period) * duty))\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func (t *Transform) GetScale() *Vector {\n\treturn t.Scale\n}", "func ScaleFunc(v *Vertex, f float64) {\n\tv.X = v.X * f\n\tv.Y = v.Y * f\n}", "func (v Vec3) Scale(t float64) Vec3 {\n\treturn Vec3{X: v.X * t, Y: v.Y * t, Z: v.Z * t}\n}", "func (me TxsdAnimateTransformTypeType) IsScale() bool { return me.String() == \"scale\" }" ]
[ "0.82044643", "0.82026076", "0.8044438", "0.80010784", "0.738389", "0.73492926", "0.72787267", "0.7259887", "0.72031957", "0.71859896", "0.7162448", "0.71623427", "0.714276", "0.7092354", "0.7020097", "0.6801338", "0.65981305", "0.65689886", "0.65219027", "0.64675266", "0.64614767", "0.6361633", "0.6273564", "0.6270893", "0.61856204", "0.616847", "0.6126616", "0.61034936", "0.6048174", "0.60185546", "0.600596", "0.600518", "0.598788", "0.59684926", "0.59684926", "0.59684926", "0.59684926", "0.59684926", "0.59684926", "0.59684926", "0.59562904", "0.5951669", "0.595013", "0.5946237", "0.59423316", "0.5934794", "0.59291834", "0.59273636", "0.5926921", "0.5887774", "0.5864662", "0.5841725", "0.5841353", "0.58402926", "0.5838771", "0.5833896", "0.5830673", "0.5809072", "0.57709265", "0.5764065", "0.57638705", "0.5753886", "0.57504076", "0.5747996", "0.57240385", "0.5659796", "0.5653644", "0.56534797", "0.5647223", "0.56357026", "0.5633477", "0.563024", "0.5629556", "0.5629159", "0.5626737", "0.5616686", "0.56124014", "0.5609202", "0.56001467", "0.5598247", "0.558476", "0.5576161", "0.5557903", "0.55308497", "0.55218816", "0.5500874", "0.5479571", "0.5475519", "0.5474892", "0.5471038", "0.54131", "0.5396248", "0.5395988", "0.5392518", "0.5361842", "0.535773", "0.53545266", "0.5337189", "0.53371626", "0.533627" ]
0.8562481
0
SetRotation sets transform rotation.
SetRotation устанавливает поворот трансформации.
func (t *Transform) SetRotation(angle float64) *Transform { t.Rotation = angle return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Transform) SetRotation(r float64) ITransform {\n\tt.Rotation = r\n\treturn t\n}", "func (this *Transformable) SetRotation(rot float32) {\n\tC.sfTransformable_setRotation(this.cptr, C.float(rot))\n}", "func (p *Plane) SetRotation(rot mgl32.Mat4) {\n\tp.model.Rotation = rot\n}", "func (d *Device) SetRotation(rotation Rotation) error {\n\td.rotation = rotation\n\td.startWrite()\n\terr := d.setRotation(rotation)\n\td.endWrite()\n\treturn err\n}", "func (s *AppServerV3) SetRotation(r Rotation) {\n\ts.Spec.Rotation = r\n}", "func (s *DatabaseServerV3) SetRotation(r Rotation) {\n\ts.Spec.Rotation = r\n}", "func (t *Transform) SetRot(r lmath.Vec3) {\n\tt.access.Lock()\n\tif t.rot != r {\n\t\tt.built = nil\n\t\tt.quat = nil\n\t\tt.rot = r\n\t}\n\tt.access.Unlock()\n}", "func (self Text) SetRotation(angle float32) {\n\tC.sfText_setRotation(self.Cref, C.float(angle))\n}", "func (this *RectangleShape) SetRotation(rot float32) {\n\tC.sfRectangleShape_setRotation(this.cptr, C.float(rot))\n}", "func (p *Part) SetRotation(rotation vector.Vector) {\n\tif rotation.Len() != 3 && rotation.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetRotation: expects 3D-Float32 vector, got %dD-%v\", rotation.Len(), rotation.Kind())\n\t}\n\t// Make float64 values in Radians for math\n\txAngle := float64(rotation.Get(0).(float32)) * math.Pi / 180.0\n\tyAngle := float64(rotation.Get(1).(float32)) * math.Pi / 180.0\n\tzAngle := float64(rotation.Get(2).(float32)) * math.Pi / 180.0\n\t// Create a rotation matrix for each axis\n\txRotation := matrix.NewMatrix([][]float32{\n\t\t{1.0, 0.0, 0.0},\n\t\t{0.0, float32(math.Cos(xAngle)), float32(-math.Sin(xAngle))},\n\t\t{0.0, float32(math.Sin(xAngle)), float32(math.Cos(xAngle))},\n\t})\n\tyRotation := matrix.NewMatrix([][]float32{\n\t\t{float32(math.Cos(yAngle)), 0.0, float32(math.Sin(yAngle))},\n\t\t{0.0, 1.0, 0.0},\n\t\t{float32(-math.Sin(yAngle)), 0.0, float32(math.Cos(yAngle))},\n\t})\n\tzRotation := matrix.NewMatrix([][]float32{\n\t\t{float32(math.Cos(zAngle)), float32(-math.Sin(zAngle)), 0.0},\n\t\t{float32(math.Sin(zAngle)), float32(math.Cos(zAngle)), 0.0},\n\t\t{0.0, 0.0, 1.0},\n\t})\n\t// Combine the rotations\n\tp.rotation = zRotation.Mulm(yRotation.Mulm(xRotation))\n}", "func (w *Writer) SetRotate(rotate bool) *Writer {\n\t//fmt.Fprintf(os.Stderr, \"Writer.SetRotate: %v\\n\", rotate)\n\tw.rotate = rotate\n\treturn w\n}", "func (w *FileLogWriter) SetRotate(rotate bool) *FileLogWriter {\n\t//fmt.Fprintf(os.Stderr, \"FileLogWriter.SetRotate: %v\\n\", rotate)\n\tw.rotate = rotate\n\treturn w\n}", "func (t *Transform) Rotate(angle, cx, cy float64) {\n\tout := fmt.Sprintf(\"rotate(%g,%g,%g)\", angle, cx, cy)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (transform *Transform) Rotate(angle float32, axis mgl32.Vec3) {\n\ttransform.objMatrix = mgl32.HomogRotate3D(angle, axis)\n}", "func (s *CreateJobOutput) SetRotate(v string) *CreateJobOutput {\n\ts.Rotate = &v\n\treturn s\n}", "func (t *transform) Rotate(rotate mgl32.Vec3) {\n\tt.dataLock.Lock()\n\tdefer t.dataLock.Unlock()\n\n\tt.rotation = t.rotation.Add(rotate)\n\ttotal := t.rotation\n\trotX := mgl32.HomogRotate3DX(total.X())\n\trotY := mgl32.HomogRotate3DY(total.Y())\n\trotZ := mgl32.HomogRotate3DZ(total.Z())\n\trotMatrix := rotZ.Mul4(rotY).Mul4(rotX)\n\ttrans := t.translation\n\tt.modelView = mgl32.Ident4().Mul4(mgl32.Translate3D(trans.X(), trans.Y(), trans.Z())).Mul4(rotMatrix)\n}", "func (s *JobOutput) SetRotate(v string) *JobOutput {\n\ts.Rotate = &v\n\treturn s\n}", "func (lo *LogOption) SetRotate(rt RotateType) *LogOption {\n\tlo.RotateType = filelog.RotateType(rt)\n\treturn lo\n}", "func (self Transform) Rotate(angle float32) {\n\tC.sfTransform_rotate(self.Cref, C.float(angle))\n}", "func (hook *StackHook) SetRotationTime(rotationTime time.Duration) {\n\thook.lock.Lock()\n\tdefer hook.lock.Unlock()\n\thook.rotationTime = rotationTime\n\thook.lastRotate = time.Now()\n}", "func (this *Transformable) Rotate(angle float32) {\n\tC.sfTransformable_rotate(this.cptr, C.float(angle))\n}", "func (l *Logger) SetRotateInterval(duration time.Duration) (err error) {\n\tvar wasUnset bool\n\t// Ensure duration isn't set to zero\n\tif duration == 0 {\n\t\t// We do not like rotation intervals of zero, return\n\t\terr = ErrInvalidRotationInterval\n\t\treturn\n\t}\n\n\t// Acquire lock\n\tl.mu.Lock()\n\t// Defer the release of our lock\n\tdefer l.mu.Unlock()\n\n\t// Ensure the logger has not been closed\n\tif l.isClosed() {\n\t\t// Instance of logger has been closed, return\n\t\treturn errors.ErrIsClosed\n\t}\n\n\t// Set unset to true if rotate interval is currently zero\n\twasUnset = l.rotateInterval == 0\n\t// Set rotate interval to the provided duration\n\tl.rotateInterval = duration\n\n\tif wasUnset {\n\t\t// Rotate interval was previously unset, initialize rotation loop\n\t\tgo l.rotationLoop()\n\t}\n\n\treturn\n}", "func (t *Transform) GetRotation() float64 {\n\treturn t.Rotation\n}", "func (t *Transform) Rot() lmath.Vec3 {\n\tvar r lmath.Vec3\n\tt.access.RLock()\n\tif t.quat == nil {\n\t\tr = t.rot\n\t} else {\n\t\t// Convert quaternion rotation to euler rotation.\n\t\tr = (*t.quat).Hpr(lmath.CoordSysZUpRight).HprToXyz().Degrees()\n\t}\n\tt.access.RUnlock()\n\treturn r\n}", "func (device *Device) SetTiltAngle(degrees float64) error {\n\n\terrCode := C.freenect_set_tilt_degs(device.device, C.double(degrees))\n\n\tif errCode < 0 {\n\t\treturn fmt.Errorf(\"could not set tilt to \", degrees)\n\t}\n\n\treturn nil\n}", "func (l *Logger) SetRotateFn(fn RotateFn) {\n\t// Acquire lock\n\tl.mu.Lock()\n\t// Defer the release of our lock\n\tdefer l.mu.Unlock()\n\t// Set onRotation value as provided fn\n\tl.onRotate = fn\n}", "func (dw *DrawingWand) Rotate(degrees float64) {\n\tC.MagickDrawRotate(dw.dw, C.double(degrees))\n}", "func (c *canvasRenderer) Rotate(angle sprec.Angle) {\n\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\tc.currentLayer.Transform,\n\t\tsprec.RotationMat4(angle, 0.0, 0.0, 1.0),\n\t)\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func Rotation(value float64) *SimpleElement { return newSEFloat(\"rotation\", value) }", "func Rotation(r float64) Matrix {\n\ts, c := math.Sin(r), math.Cos(r)\n\treturn Matrix{c, s, -s, c, 0, 0}\n}", "func (w *Writer) Rotate() {\n\tw.rot <- true\n}", "func (d *Device) Rotation() drivers.Rotation {\n\treturn d.rotation\n}", "func (self Text) Rotation() float32 {\n\treturn float32(C.sfText_getRotation(self.Cref))\n}", "func (r *ImageRef) SetOrientation(orientation int) error {\n\tout, err := vipsCopyImage(r.image)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvipsSetMetaOrientation(out, orientation)\n\n\tr.setImage(out)\n\treturn nil\n}", "func (t *Transform) SetQuat(q lmath.Quat) {\n\tt.access.Lock()\n\tif t.quat == nil || (*t.quat) != q {\n\t\tt.built = nil\n\t\tt.quat = &q\n\t}\n\tt.access.Unlock()\n}", "func (c *Clac) Rot() error {\n\treturn c.rot(true)\n}", "func (w *Writer) SetRotateDaily(daily bool) *Writer {\n\t//fmt.Fprintf(os.Stderr, \"Writer.SetRotateDaily: %v\\n\", daily)\n\tw.daily = daily\n\treturn w\n}", "func (this *Transformable) GetRotation() float32 {\n\treturn float32(C.sfTransformable_getRotation(this.cptr))\n}", "func (c2d *C2DMatrix) Rotate(rot float64) {\n\tvar mat Matrix\n\n\tvar Sin float64 = math.Sin(rot)\n\tvar Cos float64 = math.Cos(rot)\n\n\tmat.m11 = Cos\n\tmat.m12 = Sin\n\tmat.m13 = 0\n\n\tmat.m21 = -Sin\n\tmat.m22 = Cos\n\tmat.m23 = 0\n\n\tmat.m31 = 0\n\tmat.m32 = 0\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func rotation(xs []string) (transform.Transformation, error) {\n\tif len(xs) != 2 {\n\t\treturn nil, ErrBadTransformation\n\t}\n\tp, err := Point(xs[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trads, err := Angle(xs[1])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn transform.Rotation(p, rads), nil\n}", "func (text *TEXT) Rotate(r ...float64) *TEXT {\n\ttext.rotate = r\n\treturn text\n}", "func (canvas *Canvas) Rotate(theta float32) {\n\ts, c := math.Sin(float64(theta)), math.Cos(float64(theta))\n\twriteCommand(canvas.contents, \"cm\", c, s, -s, c, 0, 0)\n}", "func (this *RectangleShape) Rotate(angle float32) {\n\tC.sfRectangleShape_rotate(this.cptr, C.float(angle))\n}", "func (l *Line) SetAngle(angle float64) float64 {\n\treturn l.Rotate(angle - l.angle)\n}", "func (e *Enigma) SetRotor(position, name string, ringPosition int, startPosition rune) error {\r\n\trotor, check := availableRotors[name]\r\n\tif !check {\r\n\t\treturn fmt.Errorf(\"no such rotor: %s\", name)\r\n\t}\r\n\r\n\tindex, check := rotorPositions[strings.ToUpper(position)]\r\n\tif !check {\r\n\t\treturn fmt.Errorf(\"no such position: %s\", position)\r\n\t}\r\n\r\n\tif ringPosition < 1 || ringPosition > 26 {\r\n\t\treturn fmt.Errorf(\"invalid ring position: %d\", ringPosition)\r\n\t}\r\n\r\n\tstart := unicode.ToUpper(startPosition)\r\n\tif start < 'A' || start > 'Z' {\r\n\t\treturn fmt.Errorf(\"invalid start position: %c\", start)\r\n\t}\r\n\r\n\trotor.setRingPosition(ringPosition)\r\n\r\n\trotor.setStartPosition(start)\r\n\r\n\te.rotors[index] = &rotor\r\n\r\n\treturn nil\r\n}", "func (s *Surface) Rotate(radians float64) {\n\ts.Ctx.Call(\"rotate\", 2*math.Pi-radians)\n}", "func (obj *Device) SetTransform(state TRANSFORMSTATETYPE, matrix MATRIX) Error {\n\tret, _, _ := syscall.Syscall(\n\t\tobj.vtbl.SetTransform,\n\t\t3,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(state),\n\t\tuintptr(unsafe.Pointer(&matrix[0])),\n\t)\n\treturn toErr(ret)\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func (w *RotateWriter) Rotate() (err error) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\treturn w.rotate()\n}", "func (self Text) Rotate(angle float32) {\n\tC.sfText_rotate(self.Cref, C.float(angle))\n}", "func (m Matrix) Rotate(angle float32, axis vec32.Vector) Matrix {\n\taxis = axis.Normalize()\n\tx, y, z := axis[0], axis[1], axis[2]\n\tsin, cos := float32(math.Sin(float64(angle))), float32(math.Cos(float64(angle)))\n\treturn Mul(m, Matrix{\n\t\t{cos + x*x*(1-cos), y*x*(1-cos) + z*sin, z*x*(1-cos) - y*sin, 0},\n\t\t{x*y*(1-cos) - z*sin, cos + y*y*(1-cos), z*y*(1-cos) + x*sin, 0},\n\t\t{x*z*(1-cos) + y*sin, y*z*(1-cos) - x*sin, cos + z*z*(1-cos), 0},\n\t\t{0, 0, 0, 1},\n\t})\n}", "func (me XsdGoPkgHasElem_Rotation) RotationDefault() Tangle180Type {\r\n\tvar x = new(Tangle180Type)\r\n\tx.Set(\"0.0\")\r\n\treturn *x\r\n}", "func (self *Graphics) SetPreviousRotationA(member int) {\n self.Object.Set(\"previousRotation\", member)\n}", "func (blk *Block) SetAngle(angleDeg float64) {\n\tblk.angle = angleDeg\n}", "func (w *FileLogWriter) SetRotateDaily(daily bool) *FileLogWriter {\n\t//fmt.Fprintf(os.Stderr, \"FileLogWriter.SetRotateDaily: %v\\n\", daily)\n\tw.daily = daily\n\treturn w\n}", "func Rotate(vec *mat.VecDense, angle float64, axis Axis) *mat.VecDense {\n\trot := RotationMatrix(angle, axis)\n\tvec.MulVec(rot, vec)\n\treturn vec\n}", "func (t *Transform) SetTranslation(tx, ty float64) *Transform {\n\tt.Translation.X = tx\n\tt.Translation.Y = ty\n\treturn t\n}", "func (me XsdGoPkgHasElems_Rotation) RotationDefault() Tangle180Type {\r\n\tvar x = new(Tangle180Type)\r\n\tx.Set(\"0.0\")\r\n\treturn *x\r\n}", "func (w *Writer) SetRotateSize(maxsize int) *Writer {\n\t//fmt.Fprintf(os.Stderr, \"Writer.SetRotateSize: %v\\n\", maxsize)\n\tw.maxsize = maxsize\n\treturn w\n}", "func RotationMatrix(angle float64, axis Axis) *mat.Dense {\n\tc := math.Cos(angle)\n\ts := math.Sin(angle)\n\n\tswitch axis {\n\tcase AxisX:\n\t\treturn mat.NewDense(3, 3, []float64{\n\t\t\t1, 0, 0,\n\t\t\t0, c, -s,\n\t\t\t0, s, c,\n\t\t})\n\tcase AxisY:\n\t\treturn mat.NewDense(3, 3, []float64{\n\t\t\tc, 0, s,\n\t\t\t0, 1, 0,\n\t\t\ts, 0, c,\n\t\t})\n\tcase AxisZ:\n\t\treturn mat.NewDense(3, 3, []float64{\n\t\t\tc, -s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1,\n\t\t})\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Unknown axis %v\", axis))\n\t}\n\n}", "func (player *Player) Rotation(f func(rotation float64)) {\n\tplayer.Exec(command.QueryTargetRequest(mctype.Target(player.name)), func(response *command.QueryTarget) {\n\t\tif len(*response.Details) == 1 {\n\t\t\tf((*response.Details)[0].YRotation)\n\t\t}\n\t})\n}", "func (s *DatabaseServerV3) GetRotation() Rotation {\n\treturn s.Spec.Rotation\n}", "func WithRotationTime(d time.Duration) Option {\n\treturn OptionFn(func(rl *RotateLogs) error {\n\t\trl.rotationTime = d\n\t\treturn nil\n\t})\n}", "func (h *Hook) SetRotateLog(typeName string) *Hook {\n\n\th.rotateType = typeName\n\treturn h\n}", "func (me *XsdGoPkgHasElem_Rotation) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElem_Rotation; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func (self *TileSprite) SetPreviousRotationA(member int) {\n self.Object.Set(\"previousRotation\", member)\n}", "func (xs *Sheet) SetLandscape(landscape int) {\n\txs.xb.lib.NewProc(\"xlSheetSetLandscapeW\").\n\t\tCall(xs.self, I(landscape))\n}", "func (s *AppServerV3) GetRotation() Rotation {\n\treturn s.Spec.Rotation\n}", "func (w *FileLogWriter) Rotate() {\n\tw.rot <- true\n}", "func QuatRotate(angle float32, axis Vec3) Quat {\n\t// angle = (float32(math.Pi) * angle) / 180.0\n\n\tc, s := float32(math.Cos(float64(angle/2))), float32(math.Sin(float64(angle/2)))\n\n\treturn Quat{c, axis.Mul(s)}\n}", "func (mw *MagickWand) Rotate(degree float64) error {\n\tbackground := gmagick.NewPixelWand()\n\tbackground.SetColor(\"#000000\")\n\treturn mw.RotateImage(background, degree)\n}", "func (l *Line) Rotate(angle float64) float64 {\n\tcenter := l.Center()\n\tpv := l.p.Subtract(center)\n\tqv := l.q.Subtract(center)\n\n\tpv = pv.Rotate(angle)\n\tqv = qv.Rotate(angle)\n\n\tl.p = center.Add(pv)\n\tl.q = center.Add(qv)\n\n\tl.angle += angle\n\tl.angle = AdjustAngle(l.angle)\n\n\treturn l.angle\n}", "func (o CryptoKeyOutput) RotationPeriod() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *CryptoKey) pulumi.StringPtrOutput { return v.RotationPeriod }).(pulumi.StringPtrOutput)\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func (v Vector) Rotate(degrees float64, axis Vector) (Vector, error) {\n\tvar ok bool\n\tif axis, ok = axis.Normalize(); !ok {\n\t\treturn Vector{}, fmt.Errorf(\"the zero vector cannot be used as an axis of rotation\")\n\t}\n\n\tangle := degrees / 180.0 * math.Pi\n\n\trotationMatrix := [][]float64{\n\t\t{\n\t\t\tmath.Cos(angle) + axis.X*axis.X*(1-math.Cos(angle)),\n\t\t\taxis.X*axis.Y*(1-math.Cos(angle)) - axis.Z*math.Sin(angle),\n\t\t\taxis.X*axis.Z*(1-math.Cos(angle)) + axis.Y*math.Sin(angle),\n\t\t}, {\n\t\t\taxis.Y*axis.X*(1-math.Cos(angle)) + axis.Z*math.Sin(angle),\n\t\t\tmath.Cos(angle) + axis.Y*axis.Y*(1-math.Cos(angle)),\n\t\t\taxis.Y*axis.Z*(1-math.Cos(angle)) - axis.X*math.Sin(angle),\n\t\t}, {\n\t\t\taxis.Z*axis.X*(1-math.Cos(angle)) - axis.Y*math.Sin(angle),\n\t\t\taxis.Z*axis.Y*(1-math.Cos(angle)) + axis.X*math.Sin(angle),\n\t\t\tmath.Cos(angle) + axis.Z*axis.Z*(1-math.Cos(angle)),\n\t\t},\n\t}\n\n\treturn Multiply(rotationMatrix, v), nil\n}", "func (ag *Agent) Rotate(v float32) {\n\tag.R += v\n}", "func (q Quat) AxisRotation() (Vec3f, float32) {\n\t// Based on: http://glmatrix.net/docs/module-quat.html\n\trad := q.Angle()\n\ts := math32.Sin(rad * 0.5)\n\tif s < Epsilon { // no rotation\n\t\treturn Vec3f{1, 0, 0}, rad\n\t}\n\treturn Vec3f{q.X / s, q.Y / s, q.Z / s}, rad\n}", "func RotationX(theta float64) *Gate {\n\t// R_x(theta) = cos(theta/2)I - i sin(theta/2)X\n\tt := theta/2\n\tcos := complex(math.Cos(t), 0)\n\tnisin := complex(0, -1 * math.Sin(t))\n\treturn newOneQubitGate([4]complex128{\n\t\tcos, nisin,\n\t\tnisin, cos})\n}", "func (l *Line) SetAngleRadians(angle float64) float64 {\n\treturn l.RotateRadians(angle - l.angle)\n}", "func (me TxsdAnimateTransformTypeType) IsRotate() bool { return me.String() == \"rotate\" }", "func (m *PrinterDefaults) SetOrientation(value *PrintOrientation)() {\n err := m.GetBackingStore().Set(\"orientation\", value)\n if err != nil {\n panic(err)\n }\n}", "func (me *XsdGoPkgHasElems_Rotation) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElems_Rotation; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func RotationZ(theta float64) *Gate {\n\t// R_z(theta) = cos(theta/2)I - i sin(theta/2)Z\n\tt := theta/2\n\tnexp := cmplx.Exp(complex(0, -1 * t))\n\texp := cmplx.Exp(complex(0, t))\n\treturn newOneQubitGate([4]complex128{\n\t\tnexp, 0,\n\t\t0, exp})\n}", "func (this *RectangleShape) GetRotation() float32 {\n\treturn float32(C.sfRectangleShape_getRotation(this.cptr))\n}", "func (rx *RotationX) SetMaterial(m material.Material) {\r\n\trx.Primitive.SetMaterial(m)\r\n}", "func (self Transform) RotateWithCenter(angle, centerX, centerY float32) {\n\tC.sfTransform_rotateWithCenter(self.Cref, C.float(angle), C.float(centerX), C.float(centerY))\n}", "func (r *RotatingFile) Rotate() error {\n\tnewFile, err := r.reopen()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer r.lock.Unlock()\n\tr.lock.Lock()\n\toldFile := r.file\n\tr.file = newFile\n\toldFile.Close()\n\treturn nil\n}", "func (self *TileSprite) SetAngleA(member int) {\n self.Object.Set(\"angle\", member)\n}", "func (r *GrayRotator) Rotate90() {\n\tsrc := r.Img\n\tsrcB := src.Bounds()\n\tsrcWidth := srcB.Dx()\n\tsrcHeight := srcB.Dy()\n\n\tdst := image.NewGray(image.Rect(0, 0, srcHeight, srcWidth))\n\n\tvar x, y, srcIdx, dstIdx int64\n\tmaxX, maxY := int64(srcWidth), int64(srcHeight)\n\tsrcStride, dstStride := int64(src.Stride), int64(dst.Stride)\n\tsrcPix := src.Pix\n\tdstPix := dst.Pix\n\tfor y = 0; y < maxY; y++ {\n\t\tfor x = 0; x < maxX; x++ {\n\t\t\tsrcIdx = y*srcStride + x\n\t\t\tdstIdx = x*dstStride + (maxY - 1 - y)\n\t\t\tdstPix[dstIdx] = srcPix[srcIdx]\n\t\t}\n\t}\n\n\tr.Img = dst\n}", "func (m Mat4) Rotation() Quat {\n\t// This is calculated by inversing the equations for\n\t// quat.OrientationX, quat.OrientationY and quat.OrientationZ.\n\n\tsqrX := (1.0 + m.M11 - m.M22 - m.M33) / 4.0\n\tsqrY := (1.0 - m.M11 + m.M22 - m.M33) / 4.0\n\tsqrZ := (1.0 - m.M11 - m.M22 + m.M33) / 4.0\n\n\tvar x, y, z, w float32\n\tif sqrZ > sqrX && sqrZ > sqrY { // Z is largest\n\t\tif Abs(sqrZ) < Epsilon {\n\t\t\treturn IdentityQuat()\n\t\t}\n\t\tz = Sqrt(sqrZ)\n\t\tx = (m.M31 + m.M13) / (4 * z)\n\t\ty = (m.M32 + m.M23) / (4 * z)\n\t\tw = (m.M21 - m.M12) / (4 * z)\n\t} else if sqrY > sqrX { // Y is largest\n\t\tif Abs(sqrY) < Epsilon {\n\t\t\treturn IdentityQuat()\n\t\t}\n\t\ty = Sqrt(sqrY)\n\t\tx = (m.M21 + m.M12) / (4 * y)\n\t\tz = (m.M32 + m.M23) / (4 * y)\n\t\tw = (m.M13 - m.M31) / (4 * y)\n\t} else { // X is largest\n\t\tif Abs(sqrX) < Epsilon {\n\t\t\treturn IdentityQuat()\n\t\t}\n\t\tx = Sqrt(sqrX)\n\t\ty = (m.M21 + m.M12) / (4 * x)\n\t\tz = (m.M31 + m.M13) / (4 * x)\n\t\tw = (m.M32 - m.M23) / (4 * x)\n\t}\n\treturn UnitQuat(NewQuat(w, x, y, z))\n}", "func (o *CanvasItem) X_EditGetRotation() gdnative.Real {\n\t//log.Println(\"Calling CanvasItem.X_EditGetRotation()\")\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(\"CanvasItem\", \"_edit_get_rotation\")\n\n\t// Call the parent method.\n\t// float\n\tretPtr := gdnative.NewEmptyReal()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewRealFromPointer(retPtr)\n\treturn ret\n}", "func (r *ImageRef) Rotate(angle Angle) error {\n\twidth := r.Width()\n\n\tif r.Pages() > 1 && (angle == Angle90 || angle == Angle270) {\n\t\tif angle == Angle270 {\n\t\t\tif err := r.Flip(DirectionHorizontal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := r.Grid(r.GetPageHeight(), r.Pages(), 1); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif angle == Angle270 {\n\t\t\tif err := r.Flip(DirectionHorizontal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tout, err := vipsRotate(r.image, angle)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.setImage(out)\n\n\tif r.Pages() > 1 && (angle == Angle90 || angle == Angle270) {\n\t\tif err := r.SetPageHeight(width); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (s *Scene) SetGravity(gravity dprec.Vec3) {\n\ts.gravity = gravity\n}", "func (self *Graphics) SetAngleA(member int) {\n self.Object.Set(\"angle\", member)\n}", "func (o *CanvasItem) X_EditUseRotation() gdnative.Bool {\n\t//log.Println(\"Calling CanvasItem.X_EditUseRotation()\")\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(\"CanvasItem\", \"_edit_use_rotation\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func (tr *RotateTransformation) Transform(ctx context.Context, im image.Image) (image.Image, error) {\n\treturn RotateImageWithOrientation(ctx, im, tr.orientation)\n}", "func Rotate(v *Vec, angle float64) *Vec {\n\tsin, cos := math.Sincos(angle)\n\treturn &Vec{\n\t\tv.X*cos - v.Y*sin,\n\t\tv.X*sin + v.Y*cos,\n\t}\n}", "func (r *RGBARotator) Rotate90() {\n\tsrc := r.Img\n\tsrcB := src.Bounds()\n\tsrcWidth := srcB.Dx()\n\tsrcHeight := srcB.Dy()\n\n\tdst := image.NewRGBA(image.Rect(0, 0, srcHeight, srcWidth))\n\n\tvar x, y, srcIdx, dstIdx int64\n\tmaxX, maxY := int64(srcWidth), int64(srcHeight)\n\tsrcStride, dstStride := int64(src.Stride), int64(dst.Stride)\n\tsrcPix := src.Pix\n\tdstPix := dst.Pix\n\tfor y = 0; y < maxY; y++ {\n\t\tfor x = 0; x < maxX; x++ {\n\t\t\tsrcIdx = y*srcStride + (x << 2)\n\t\t\tdstIdx = x*dstStride + ((maxY - 1 - y) << 2)\n\t\t\tcopy(dstPix[dstIdx:dstIdx+4], srcPix[srcIdx:srcIdx+4])\n\t\t}\n\t}\n\n\tr.Img = dst\n}", "func (w *FileLogWriter) SetRotateSize(maxsize int) *FileLogWriter {\n\t//fmt.Fprintf(os.Stderr, \"FileLogWriter.SetRotateSize: %v\\n\", maxsize)\n\tw.maxsize = maxsize\n\treturn w\n}" ]
[ "0.8625573", "0.8057875", "0.8017207", "0.77256304", "0.7505977", "0.74746484", "0.74095", "0.7240528", "0.7185497", "0.7154693", "0.6705631", "0.6337583", "0.6166817", "0.602419", "0.6017595", "0.59994197", "0.59966457", "0.5940456", "0.5913534", "0.5878609", "0.5819131", "0.57854635", "0.564823", "0.5597285", "0.5563502", "0.55405444", "0.55341613", "0.5525975", "0.5476779", "0.5465202", "0.5441467", "0.5418305", "0.54138577", "0.536219", "0.5341043", "0.52764624", "0.5269768", "0.52674115", "0.5250213", "0.52081776", "0.5192098", "0.5186578", "0.5147287", "0.51378703", "0.51311994", "0.5103847", "0.50917786", "0.5039657", "0.5031884", "0.50246054", "0.5022989", "0.4984123", "0.49702302", "0.49563965", "0.49358764", "0.49332753", "0.49222943", "0.49154803", "0.49138814", "0.48885223", "0.48870623", "0.48481017", "0.4844001", "0.48360625", "0.48265162", "0.48185006", "0.47697997", "0.47581697", "0.47430778", "0.47379458", "0.47343725", "0.47023755", "0.46957165", "0.46850333", "0.46818212", "0.4668588", "0.46669418", "0.46654946", "0.4664351", "0.46546188", "0.46545458", "0.4615579", "0.46117184", "0.46097", "0.45775238", "0.4563774", "0.45621932", "0.45612207", "0.45557225", "0.45023498", "0.4497925", "0.44932166", "0.44693863", "0.4463818", "0.4445872", "0.44326976", "0.44022414", "0.43917432", "0.43833047", "0.4367569" ]
0.85688853
1
SetTranslation sets transform translation.
SetTranslation устанавливает преобразование перевода.
func (t *Transform) SetTranslation(tx, ty float64) *Transform { t.Translation.X = tx t.Translation.Y = ty return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func (t *Transform) Translate(tx, ty float64) {\n\tout := fmt.Sprintf(\"translate(%g,%g)\", tx, ty)\n\n\tt.transforms = append(t.transforms, out)\n}", "func (ts *TextState) Translate(tx, ty float64) {\n\tts.Tm = transform.TranslationMatrix(tx, ty).Mult(ts.Tm)\n}", "func (obj *Device) SetTransform(state TRANSFORMSTATETYPE, matrix MATRIX) Error {\n\tret, _, _ := syscall.Syscall(\n\t\tobj.vtbl.SetTransform,\n\t\t3,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(state),\n\t\tuintptr(unsafe.Pointer(&matrix[0])),\n\t)\n\treturn toErr(ret)\n}", "func SetLanguage(language string) {\n\tif _, ok := supportedTranslations[language]; ok {\n\t\tgotext.SetLanguage(language)\n\t\treturn\n\t}\n\tgotext.SetLanguage(defaultLanguage)\n}", "func (t *transform) Translate(translate mgl32.Vec3) {\n\tt.dataLock.Lock()\n\tdefer t.dataLock.Unlock()\n\tt.translation = t.translation.Add(translate)\n\ttrans := t.translation\n\tt.modelView = t.modelView.Mul4(mgl32.Translate3D(trans.X(), trans.Y(), trans.Z()))\n}", "func (self Text) SetRotation(angle float32) {\n\tC.sfText_setRotation(self.Cref, C.float(angle))\n}", "func (st *SetTranslation) Set(db XODB) (*Set, error) {\n\treturn SetByCode(db, st.Setcode.String)\n}", "func (il *IL) Translation(source string, context ...string) string {\n\tfor _, locale := range il.locales {\n\t\tif sourceKey2Trans, ok := il.locale2SourceKey2Trans[locale]; ok {\n\t\t\tif trans, ok := sourceKey2Trans[sourceKey(source, context)]; ok {\n\t\t\t\treturn trans\n\t\t\t}\n\t\t}\n\t}\n\n\treturn source\n}", "func (self Transform) Translate(x, y float32) {\n\tC.sfTransform_translate(self.Cref, C.float(x), C.float(y))\n}", "func SetTranslationByID(db XODB, id NullInt64) (*SetTranslation, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, language, setCode, translation ` +\n\t\t`FROM set_translations ` +\n\t\t`WHERE id = ?`\n\n\t// run query\n\tXOLog(sqlstr, id)\n\tst := SetTranslation{\n\t\t_exists: true,\n\t}\n\n\terr = db.QueryRow(sqlstr, id).Scan(&st.ID, &st.Language, &st.Setcode, &st.Translation)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &st, nil\n}", "func (t *Translator) SetLocale(l string) error {\n\terr := t.AssertValidLocale(l)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = t.loadResource(l)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt.locale = l\n\n\treturn nil\n}", "func (canvas *Canvas) Translate(x, y Unit) {\n\twriteCommand(canvas.contents, \"cm\", 1, 0, 0, 1, x, y)\n}", "func Translation(t vec.Vec) Matrix {\n\treturn Matrix{1, 0, 0, 1, t.X, t.Y}\n}", "func (this *Transformable) SetRotation(rot float32) {\n\tC.sfTransformable_setRotation(this.cptr, C.float(rot))\n}", "func (e *HTMLApplet) Translate(v bool) *HTMLApplet {\n\tif v {\n\t\te.a[\"translate\"] = \"\"\n\t} else {\n\t\tdelete(e.a, \"translate\")\n\t}\n\treturn e\n}", "func (l *Localizer) SetLanguage(tag language.Tag) {\n\tif l.isUnd(tag) {\n\t\ttag = DefaultLanguage\n\t}\n\n\tl.LanguageTag = tag\n\tl.LoadTranslations()\n}", "func (st *SetTranslation) Update(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !st._exists {\n\t\treturn errors.New(\"update failed: does not exist\")\n\t}\n\n\t// if deleted, bail\n\tif st._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `UPDATE set_translations SET (` +\n\t\t`language, setCode, translation` +\n\t\t`) = ( ` +\n\t\t`?, ?, ?` +\n\t\t`) WHERE id = $4`\n\n\t// run query\n\tXOLog(sqlstr, st.Language, st.Setcode, st.Translation, st.ID)\n\t_, err = db.Exec(sqlstr, st.Language, st.Setcode, st.Translation, st.ID)\n\treturn err\n}", "func (t *transform) Set(modelView mgl32.Mat4) {\n\tt.dataLock.Lock()\n\tdefer t.dataLock.Unlock()\n\tt.modelView = modelView\n}", "func SetLocale(locale string) error {\n\tif matched, _ := regexp.MatchString(localeRegexp, locale); !matched {\n\t\treturn fmt.Errorf(\"Malformated locale string %s\", locale)\n\t}\n\tlocale = strings.Replace(locale, \"-\", \"_\", -1)\n\tparts := strings.Split(locale, \"_\")\n\tlang := parts[0]\n\tlog.Debugf(\"Setting locale %v\", locale)\n\tnewTrMap := make(map[string]string)\n\tmergeLocaleToMap(newTrMap, defaultLang)\n\tmergeLocaleToMap(newTrMap, defaultLocale)\n\tmergeLocaleToMap(newTrMap, lang)\n\tmergeLocaleToMap(newTrMap, locale)\n\tif len(newTrMap) == 0 {\n\t\treturn fmt.Errorf(\"Not found any translations, locale not set\")\n\t}\n\tlog.Tracef(\"Translations: %v\", newTrMap)\n\ttrMutex.Lock()\n\tdefer trMutex.Unlock()\n\ttrMap = newTrMap\n\treturn nil\n}", "func (trans *JSONTranslater) Translate(sl, tl language.Tag) error {\n\tvar err error\n\ttrans.Translation, err = convert(trans.Client, trans.Original, sl, tl)\n\treturn err\n}", "func (t *Transform) SetRot(r lmath.Vec3) {\n\tt.access.Lock()\n\tif t.rot != r {\n\t\tt.built = nil\n\t\tt.quat = nil\n\t\tt.rot = r\n\t}\n\tt.access.Unlock()\n}", "func (p *Page) Translate(x, y float64) {\n\tfmt.Fprintf(p.contents, \"1 0 0 1 %g %g cm \", x, y)\n}", "func SetLanguage(language string) {\r\n\tcurrentLanguage = language\r\n}", "func (trans *HTMLTranslater) Translate(sl, tl language.Tag) error {\n\tif trans.Client == nil {\n\t\treturn errors.New(\"translate client is nil\")\n\t}\n\n\tvar original = []string{\n\t\ttrans.Original,\n\t}\n\n\ttranslations, err := trans.Client.Translate(context.Background(), original, tl, &translate.Options{\n\t\tSource: sl,\n\t\tFormat: translate.HTML,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttrans.Translation = translations[0].Text\n\n\treturn nil\n}", "func (o *SmsPreviewRequest) SetTransliteration(v string) {\n\to.Transliteration = &v\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 translation(xs []string) (transform.Transformation, error) {\n\tif len(xs) != 1 {\n\t\treturn nil, ErrBadTransformation\n\t}\n\tv, err := Vector(xs[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn transform.Translation(v), nil\n}", "func SetViewTransform(viewID ViewID, view, proj [16]float32) {\n\tC.bgfx_set_view_transform(\n\t\tC.ushort(viewID),\n\t\tunsafe.Pointer(&view[0]),\n\t\tunsafe.Pointer(&proj[0]),\n\t)\n}", "func (v *IADsNameTranslate) Set(adsPath string, setType uint32) (err error) {\n\treturn ole.NewError(ole.E_NOTIMPL)\n}", "func (_ResolverContract *ResolverContractTransactor) SetText(opts *bind.TransactOpts, node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _ResolverContract.contract.Transact(opts, \"setText\", node, key, value)\n}", "func (self Text) SetScale(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setScale(self.Cref, v)\n}", "func (e *HTMLTableRow) Translate(v bool) *HTMLTableRow {\n\tif v {\n\t\te.a[\"translate\"] = \"\"\n\t} else {\n\t\tdelete(e.a, \"translate\")\n\t}\n\treturn e\n}", "func (r Rectangle) Translation() Transform {\n\treturn Identity().Translate(float32(r.X)+float32(r.Width)/2.0,\n\t\tfloat32(r.Y)+float32(r.Height)/2.0)\n}", "func (p *Proc) Translate(x, y float64) {\n\tp.stk.translate(x, y)\n}", "func (s *RegexMatchTuple) SetTextTransformation(v string) *RegexMatchTuple {\n\ts.TextTransformation = &v\n\treturn s\n}", "func SetDefaultLocale(newLocale string) error {\n\tif trans == nil {\n\t\treturn errors.New(\"translations are not initialized\")\n\t}\n\tif checkLocale(newLocale) {\n\t\ttrans.defaultLocale = newLocale\n\t\treturn nil\n\t}\n\treturn errors.New(\"locale is not found\")\n}", "func (t *Transform) SetParent(p Transformable) {\n\tt.access.Lock()\n\tif t.parent != p {\n\t\tt.built = nil\n\t\tt.parent = p\n\t}\n\tt.access.Unlock()\n}", "func (s *XssMatchTuple) SetTextTransformation(v string) *XssMatchTuple {\n\ts.TextTransformation = &v\n\treturn s\n}", "func SetLocale(o orm.Ormer, lang, code, message string) error {\n\tvar it Locale\n\terr := o.QueryTable(&it).\n\t\tFilter(\"lang\", lang).\n\t\tFilter(\"code\", code).\n\t\tOne(&it, \"id\")\n\n\tif err == nil {\n\t\t_, err = o.QueryTable(&it).Filter(\"id\", it.ID).Update(orm.Params{\n\t\t\t\"message\": message,\n\t\t\t\"updated_at\": time.Now(),\n\t\t})\n\t} else if err == orm.ErrNoRows {\n\t\tit.Lang = lang\n\t\tit.Code = code\n\t\tit.Message = message\n\t\t_, err = o.Insert(&it)\n\t}\n\treturn err\n}", "func (y *Handler) translation(ctx context.Context) (result.Translation, error) {\n\tif y.isDictionary {\n\t\trequest := &dictionary.Request{\n\t\t\tKey: y.config.Dictionary,\n\t\t\tText: y.text,\n\t\t\tTargetLanguageCode: y.toLanguage,\n\t\t\tSourceLanguageCode: y.fromLanguage,\n\t\t}\n\t\treturn dictionary.Translate(ctx, y.client, y.config, request)\n\t}\n\n\trequest := &translation.Request{\n\t\tFolderID: y.config.Translation.FolderID,\n\t\tTexts: []string{y.text},\n\t\tSourceLanguageCode: y.fromLanguage,\n\t\tTargetLanguageCode: y.toLanguage,\n\t}\n\treturn translation.Translate(ctx, y.client, y.config, request)\n}", "func SetLocale(locale string) {\n\tcurrentLocale = locale\n}", "func (st *SetTranslation) Save(db XODB) error {\n\tif st.Exists() {\n\t\treturn st.Update(db)\n\t}\n\n\treturn st.Insert(db)\n}", "func (r *Resolver) SetText(opts *bind.TransactOpts, name string, value string) (*types.Transaction, error) {\n\tnameHash, err := NameHash(r.domain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Contract.SetText(opts, nameHash, name, value)\n}", "func (s *ByteMatchTuple) SetTextTransformation(v string) *ByteMatchTuple {\n\ts.TextTransformation = &v\n\treturn s\n}", "func (dw *DrawingWand) Translate(x, y float64) {\n\tC.MagickDrawTranslate(dw.dw, C.double(x), C.double(y))\n}", "func (l *Localizer) SetLocale(al string) {\n\tl.SetLanguage(l.matchByString(al))\n}", "func (s *Surface) Translate(x, y float64) {\n\ts.Ctx.Call(\"translate\", math.Floor(x), math.Floor(y))\n}", "func (s *SqlInjectionMatchTuple) SetTextTransformation(v string) *SqlInjectionMatchTuple {\n\ts.TextTransformation = &v\n\treturn s\n}", "func SetLanguage(chatId string, lang string) error {\n\tchat, err := GetChatWithId(chatId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttag, _ := language.MatchStrings(i18n.Matcher, lang)\n\tif tag.String() == lang { // if the language is supported, update the chat\n\t\tchat.Language = tag.String()\n\t\treturn updateChat(chat)\n\t}\n\n\treturn fmt.Errorf(\"unsupported language\")\n}", "func (_ResolverContract *ResolverContractTransactorSession) SetText(node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _ResolverContract.Contract.SetText(&_ResolverContract.TransactOpts, node, key, value)\n}", "func (c2d *C2DMatrix) Translate(x, y float64) {\n\tvar mat Matrix\n\n\tmat.m11 = 1\n\tmat.m12 = 0\n\tmat.m13 = 0\n\n\tmat.m21 = 0\n\tmat.m22 = 1\n\tmat.m23 = 0\n\n\tmat.m31 = x\n\tmat.m32 = y\n\tmat.m33 = 1\n\n\t//and multiply\n\tc2d.MatrixMultiply(mat)\n}", "func (i *Internationalization) Translate(lang, key string) string {\n\tt, err := language.Parse(lang)\n\tif err != nil {\n\t\tt = i.fallback\n\t}\n\treturn i.translate(t, key)\n}", "func (t *Transform) SetScale(sx, sy float64) *Transform {\n\tt.Scale1.X = sx - 1\n\tt.Scale1.Y = sy - 1\n\treturn t\n}", "func (t *Transform) SetPos(p lmath.Vec3) {\n\tt.access.Lock()\n\tif t.pos != p {\n\t\tt.built = nil\n\t\tt.pos = p\n\t}\n\tt.access.Unlock()\n}", "func (s *SizeConstraint) SetTextTransformation(v string) *SizeConstraint {\n\ts.TextTransformation = &v\n\treturn s\n}", "func (s *Surface) Transform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"transform\", a, b, c, d, e, f)\n}", "func (me *TxsdAnimateTransformTypeType) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (t Translation) Translate(s, lang string) string {\n\tif val, ok := t.Phrases[s]; ok {\n\t\treturn val[t.Languages[lang]]\n\t}\n\n\treturn \"Phrase can't be translated\"\n}", "func (canvas *Canvas) Transform(a, b, c, d, e, f float32) {\n\twriteCommand(canvas.contents, \"cm\", a, b, c, d, e, f)\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 (_ResolverContract *ResolverContractSession) SetText(node [32]byte, key string, value string) (*types.Transaction, error) {\n\treturn _ResolverContract.Contract.SetText(&_ResolverContract.TransactOpts, node, key, value)\n}", "func (in *ActionMailTemplateTranslationUpdateInput) SetLanguage(value int64) *ActionMailTemplateTranslationUpdateInput {\n\tin.Language = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin.SetLanguageNil(false)\n\tin._selectedParameters[\"Language\"] = nil\n\treturn in\n}", "func (ts *TranslationService) Translate(key string, defaultLabel string, localeCode string, count int, translationArguments map[string]interface{}) string {\n\tts.reloadFilesIfNecessary()\n\tlabel, err := ts.translateWithLib(localeCode, key, count, translationArguments)\n\n\tif err != nil {\n\t\t//default to key (=untranslated) on error\n\t\tlabel = key\n\t}\n\n\t//Fallback if label was not translated\n\tif label == key && defaultLabel != \"\" {\n\t\treturn ts.parseDefaultLabel(defaultLabel, key, translationArguments)\n\t}\n\treturn label\n\n}", "func (t *Transform) SetRotation(r float64) ITransform {\n\tt.Rotation = r\n\treturn t\n}", "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func SetLanguage(language string) {\n\tif constants.GetAvailableSelectionID(language, constants.AvailableLangs, -1) < 0 {\n\t\tsetValue(\"common\", \"language\", getDefault(\"common\", \"language\"))\n\t} else {\n\t\tsetValue(\"common\", \"language\", language)\n\t}\n}", "func (p *Path) Translate(x, y float64) *Path {\n\treturn p.Transform(Identity.Translate(x, y))\n}", "func (g *Goi18n) SetLanguage(lang string, desc string) bool {\n\tif g.IsExist(lang) {\n\t\tg.langDescs[lang] = desc\n\t\tif err := g.Reload(lang); err != nil {\n\t\t\tfmt.Printf(\"Goi18n.SetLanguage: %v\\n\", err)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t} else {\n\t\treturn g.add(&locale{lang: lang, langDesc: desc})\n\t}\n}", "func (transform *Transform) SetPosition(newPos mgl32.Vec3) {\n\ttransform.objMatrix.SetRow(3, mgl32.Vec4{newPos.X(), newPos.Y(), newPos.Z()})\n}", "func (self *Geometry) Translate(tx float32, ty float32, tz float32) *Geometry {\n\tfor i := 0; i < len(self.verts); i++ {\n\t\tself.verts[i][0] += tx\n\t\tself.verts[i][1] += ty\n\t\tself.verts[i][2] += tz\n\t}\n\tself.Clear(false, true, true)\n\treturn self\n}", "func (p *Part) SetScale(scale vector.Vector) {\n\tif scale.Len() != 3 && scale.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetScale: expects 3D-Float32 vector, got %dD-%v\", scale.Len(), scale.Kind())\n\t}\n\t// Create scaling matrix\n\tp.scaling = matrix.NewMatrix([][]float32{\n\t\t{scale.Get(0).(float32), 0.0, 0.0},\n\t\t{0.0, scale.Get(1).(float32), 0.0},\n\t\t{0.0, 0.0, scale.Get(2).(float32)},\n\t})\n}", "func (self Text) SetUnicodeString(s string) {\n\t/* Go string are encoded in UTF-8, whereas SFML unicode\n\tstrings are encoded in UTF-32, so we have to make the\n\tconversion */\n\tbs := []byte(s)\n\tn := utf8.RuneCount(bs)\n\trunes := make([]rune, n+1)\n\tvar size int\n\ti := 0\n\tj := 0\n\tfor ; i < n; i += 1 {\n\t\trunes[i], size = utf8.DecodeRune(bs[j:])\n\t\tj += size\n\t}\n\trunes[i] = 0 /* don't forget the null terminator */\n\tC.sfText_setUnicodeString(self.Cref, (*C.sfUint32)(unsafe.Pointer(&runes[0])))\n}", "func (client *Client) SetLanguage(langs ...string) error {\n\tif len(langs) == 0 {\n\t\treturn fmt.Errorf(\"languages cannot be empty\")\n\t}\n\n\tclient.Languages = langs\n\n\tclient.flagForInit()\n\n\treturn nil\n}", "func (r *AWSAutoScalingPlansScalingPlan_ScalingInstruction) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (p *Plane) SetRotation(rot mgl32.Mat4) {\n\tp.model.Rotation = rot\n}", "func NewTransform() Transform {\n\tt := transform{\n\t\tmodelView: mgl32.Ident4(),\n\t\trotation: mgl32.Vec3{0, 0, 0},\n\t\ttranslation: mgl32.Vec3{0, 0, 0},\n\t}\n\treturn &t\n}", "func (_BaseContentSpace *BaseContentSpaceTransactor) SetDescription(opts *bind.TransactOpts, content_space_description string) (*types.Transaction, error) {\n\treturn _BaseContentSpace.contract.Transact(opts, \"setDescription\", content_space_description)\n}", "func (t *Transform) SetQuat(q lmath.Quat) {\n\tt.access.Lock()\n\tif t.quat == nil || (*t.quat) != q {\n\t\tt.built = nil\n\t\tt.quat = &q\n\t}\n\tt.access.Unlock()\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 (n *Mod) SetLang(lang Lang) *Mod {\n\tn.Target.Lang = lang\n\treturn n\n}", "func SetLang(newLang string) error {\n\tfound := false\n\tfor _, l := range availLangs {\n\t\tif newLang == l {\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !found {\n\t\treturn ErrNoLanguageFn(newLang)\n\t}\n\tlang = newLang\n\treturn nil\n}", "func (this *Transformable) SetScale(scale Vector2f) {\n\tC.sfTransformable_setScale(this.cptr, scale.toC())\n}", "func (m *MailboxSettings) SetLanguage(value LocaleInfoable)() {\n err := m.GetBackingStore().Set(\"language\", value)\n if err != nil {\n panic(err)\n }\n}", "func (context *context) SetLanguage(lang string) error {\n\tif context.model.ctx == nil {\n\t\treturn ErrInternalAppError\n\t}\n\tif !context.model.IsMultilingual() {\n\t\treturn ErrModelNotMultilingual\n\t}\n\n\tif lang == \"auto\" {\n\t\tcontext.params.SetLanguage(-1)\n\t} else if id := context.model.ctx.Whisper_lang_id(lang); id < 0 {\n\t\treturn ErrUnsupportedLanguage\n\t} else if err := context.params.SetLanguage(id); err != nil {\n\t\treturn err\n\t}\n\t// Return success\n\treturn nil\n}", "func (t *Text) SetText(text string) {\n\tt.Content = str.NString(text)\n\tt.Dirty()\n}", "func (self Text) SetOrigin(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setOrigin(self.Cref, v)\n}", "func (c *Client) TranslateText(ctx context.Context, params *params.TranslateTextParams) (*types.TranslateTextResponse, *types.ErrorResponse, error) {\n\tvar res types.TranslateTextResponse\n\n\tendpoint := c.EndpointBase + types.EndpointTranslateText\n\tparams.SetAuthnKey(c.AuthenticationKey)\n\trequester := NewRequester(endpoint, params)\n\n\terrRes, err := requester.Exec(&res)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif errRes != nil {\n\t\treturn nil, errRes, nil\n\t}\n\n\treturn &res, nil, nil\n}", "func (o *ServerName) SetTransformations(v []TransformationBase) {\n\to.Transformations = &v\n}", "func (t *Text) Set(k string, v string) {\n\tif err := ValidateTextKey(k); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := ValidateTextValue(v); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif t.m == nil {\n\t\tt.m = map[string]string{k: v}\n\t} else {\n\t\tt.m[k] = v\n\t}\n}", "func (p *PipelineBuild) Translate(lang string) {\n\tfor ks := range p.Stages {\n\t\tfor kj := range p.Stages[ks].PipelineBuildJobs {\n\t\t\tp.Stages[ks].PipelineBuildJobs[kj].Translate(lang)\n\t\t}\n\t}\n}", "func (tb *PrincipalVariationTable) Set(p *position.Position, mv position.Movekey) {\n\t(*tb)[p.GetPosKey()] = mv\n}", "func Transform(t transform.Transformer, filename string) error {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tw, err := Writer(filename, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer w.Close()\n\n\tif _, err := io.Copy(w, transform.NewReader(f, t)); err != nil {\n\t\treturn err\n\t}\n\treturn w.Commit()\n}", "func (ed *Editor) SetText(text string) {\n\tif ed.getTextarea() == nil {\n\t\tconsole.Log(\"editor.SetText() getTextarea() is nil\")\n\t\treturn\n\t}\n\ted.ta.SetValue(text)\n\ted.onChange(nil)\n}", "func (self Text) SetPosition(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setPosition(self.Cref, v)\n}", "func (m Matrix) Translate(v vec32.Vector) Matrix {\n\treturn Mul(m, Matrix{\n\t\t{1, 0, 0, 0},\n\t\t{0, 1, 0, 0},\n\t\t{0, 0, 1, 0},\n\t\t{v[0], v[1], v[2], 1},\n\t})\n}", "func Translate(sl string, tl string, q string) (AutoGenerated, error) {\n\tlink := getURL(tl)\n\ta, err := obtenerTraduccion(link, q, tl, sl)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn a, nil\n}", "func (w *TextWidget) SetText(text string) {\n\tw.text = text\n\tw.render()\n}" ]
[ "0.6251086", "0.59690094", "0.58699065", "0.5786746", "0.57243615", "0.5712761", "0.5690545", "0.5640491", "0.54449964", "0.5348975", "0.5331226", "0.5321163", "0.53097576", "0.5235144", "0.50976515", "0.5094021", "0.5056659", "0.5056363", "0.50562334", "0.50424784", "0.50373125", "0.503255", "0.50042295", "0.4964323", "0.4957486", "0.4952747", "0.49351826", "0.49292257", "0.490583", "0.48677427", "0.48645493", "0.48558372", "0.48511478", "0.4848541", "0.48162013", "0.4798986", "0.4797919", "0.47147384", "0.46988368", "0.46943843", "0.4686351", "0.46790242", "0.46444383", "0.46207196", "0.46186793", "0.46121415", "0.46086887", "0.45846558", "0.45810318", "0.45763937", "0.4556566", "0.45328304", "0.45140004", "0.45027536", "0.4497353", "0.4480298", "0.44660106", "0.44650295", "0.44611922", "0.44562247", "0.44486898", "0.4431777", "0.4423506", "0.44119817", "0.44101942", "0.4408876", "0.4389125", "0.43833837", "0.43829533", "0.4363078", "0.43584844", "0.43535367", "0.4343496", "0.43375129", "0.43343002", "0.4322469", "0.43193117", "0.4317133", "0.430837", "0.4284779", "0.42838457", "0.42715624", "0.42683533", "0.42617464", "0.42570996", "0.4235256", "0.4227029", "0.42247263", "0.4224662", "0.42161947", "0.42147076", "0.42124602", "0.42059824", "0.41940597", "0.41835296", "0.41810188", "0.41792262", "0.4178084", "0.41770452", "0.41658664" ]
0.822304
0
SetDepth sets transform depth.
SetDepth задает глубину трансформации.
func (t *Transform) SetDepth(depth float64) *Transform { t.Depth = depth return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *Dig) SetDepth(v int32) {\n\to.Depth = v\n}", "func (a *GetFlattenedDocumentArgs) SetDepth(depth int) *GetFlattenedDocumentArgs {\n\ta.Depth = &depth\n\treturn a\n}", "func (dev *Device) SetDepthMode(mode FrameMode) int {\n\treturn int(C.freenect_set_depth_mode(dev.ptr(), *mode.ptr()))\n}", "func (a *DescribeNodeArgs) SetDepth(depth int) *DescribeNodeArgs {\n\ta.Depth = &depth\n\treturn a\n}", "func (dev *Device) SetDepthBuffer(buf unsafe.Pointer) int {\n\treturn int(C.freenect_set_depth_buffer(dev.ptr(), buf))\n}", "func (a *GetDocumentArgs) SetDepth(depth int) *GetDocumentArgs {\n\ta.Depth = &depth\n\treturn a\n}", "func SetCallDepth(callDepth int) {\n\tstd.mu.Lock()\n\tdefer std.mu.Unlock()\n\tstd.callDepth = callDepth\n}", "func (a *RequestChildNodesArgs) SetDepth(depth int) *RequestChildNodesArgs {\n\ta.Depth = &depth\n\treturn a\n}", "func (buf *CommandBuffer) SetDepthBias(constantFactor, clamp, slopeFactor float32) {\n\tC.domVkCmdSetDepthBias(buf.fps[vkCmdSetDepthBias], buf.hnd, C.float(constantFactor), C.float(clamp), C.float(slopeFactor))\n}", "func SetDepthFunc(_func Enum) {\n\tc_func, _ := (C.GLenum)(_func), cgoAllocsUnknown\n\tC.glDepthFunc(c_func)\n}", "func (t *T) SetMaxDepth(d int) {\n\tt.maxDepth = d\n}", "func (l *Logger) SetCallDepth(d int) {\n\tl.calldepth = d\n}", "func (im *Image) SetChannelDepth(ch Channel, depth uint) error {\n\tif C.SetImageChannelDepth(im.image, C.ChannelType(ch), magickUint(depth)) == 0 {\n\t\treturn errors.New(\"error setting channel\")\n\t}\n\treturn nil\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func SetCallStackDepth(stackDepth int) {\n\tcallStackDepth = stackDepth\n}", "func (o *CatalogCategoryManagementV1GetTreeGetParams) SetDepth(depth *int64) {\n\to.Depth = depth\n}", "func ClearDepth(depth float64) {\n\tsyscall.Syscall(gpClearDepth, 1, uintptr(math.Float64bits(depth)), 0, 0)\n}", "func MakeDepth(width, height int) Texture {\n\ttex := Make(width, height, gl.DEPTH_COMPONENT, gl.DEPTH_COMPONENT,\n\t\tgl.UNSIGNED_BYTE, nil, gl.LINEAR, gl.LINEAR, gl.CLAMP_TO_BORDER,\n\t\tgl.CLAMP_TO_BORDER)\n\treturn tex\n}", "func WithDepth(depth int) Option {\n\treturn func(o *outputOpts) (*outputOpts, error) {\n\t\tif depth < 0 {\n\t\t\treturn nil, fmt.Errorf(\"invalid depth value %d, value must be >= 0\", depth)\n\t\t}\n\t\tc := o.copy()\n\t\tc.depth = depth\n\t\treturn c, nil\n\t}\n}", "func (s *SSL) SetVerifyDepth(depth int) {\n\tC.SSL_set_verify_depth(s.ssl, C.int(depth))\n}", "func (mParams *EncodingMatrixLiteral) Depth(actual bool) (depth int) {\n\tif actual {\n\t\tdepth = len(mParams.ScalingFactor)\n\t} else {\n\t\tfor i := range mParams.ScalingFactor {\n\t\t\tfor range mParams.ScalingFactor[i] {\n\t\t\t\tdepth++\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (device *Device) SetDepthCallback(callback DepthCallback) {\n\n\tif _, ok := devices[device.device]; !ok {\n\t\tdevices[device.device] = device\n\t}\n\n\tC.freenect_set_depth_callback(device.device, (*[0]byte)(C.depthCallback))\n\tdevice.depthCallback = callback\n}", "func DepthMask(flag bool) {\n\tsyscall.Syscall(gpDepthMask, 1, boolToUintptr(flag), 0, 0)\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func SetLevel(level Level) {\n\troot.SetLevel(level)\n}", "func (svc *batchService) UpdateDepth(id []byte, depth uint8, normalisedBalance *big.Int) error {\n\tb, err := svc.storer.Get(id)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get: %w\", err)\n\t}\n\terr = svc.storer.Put(b, normalisedBalance, depth)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"put: %w\", err)\n\t}\n\n\tsvc.logger.Debugf(\"batch service: updated depth of batch id %s from %d to %d\", hex.EncodeToString(b.ID), b.Depth, depth)\n\treturn nil\n}", "func (c *Camera) SetPerspective(angle, ratio, zNear, zFar float32) {\n\tglm.PerspectiveIn(angle, ratio, zNear, zFar, &c.Projection)\n}", "func (c *Camera) SetZoom(z float64) {\n\tif z == 0.0 {\n\t\treturn\n\t}\n\tc.zoom = z\n\tc.zoomInv = 1 / z\n\tc.sTop = c.lookAtY + float64(c.screenH/2)*c.zoomInv\n\tc.sBottom = c.lookAtY - float64(c.screenH/2)*c.zoomInv\n\tc.sLeft = c.lookAtX - float64(c.screenW/2)*c.zoomInv\n\tc.sRight = c.lookAtX + float64(c.screenW/2)*c.zoomInv\n}", "func DepthMask(flag bool) {\n\tgl.DepthMask(flag)\n}", "func (native *OpenGL) DepthMask(mask bool) {\n\tgl.DepthMask(mask)\n}", "func (gl *WebGL) ClearDepth(depth float64) {\n\tgl.context.Call(\"clearDepth\", float32(depth))\n}", "func (rl *RevelLogger) SetStackDepth(amount int) MultiLogger {\n\trl.Logger.SetStackDepth(amount) // Ignore the logger returned\n\treturn rl\n}", "func (rl *RevelLogger) SetStackDepth(amount int) MultiLogger {\n\trl.Logger.SetStackDepth(amount) // Ignore the logger returned\n\treturn rl\n}", "func (n *FnDeclNode) SetTree(t *Tree) {\n\tn.tree = t\n}", "func (o *Options) SetMaxDepth(v int) *Options {\n\topts := *o\n\topts.maxDepth = v\n\treturn &opts\n}", "func DepthMask(flag bool) {\n\tC.glDepthMask(glBool(flag))\n}", "func (f *Fuzzer) MaxDepth(d int) *Fuzzer {\n\tf.maxDepth = d\n\treturn f\n}", "func setDepth(p0 int, pool []huffmanTree, depth []byte, max_depth int) bool {\n\tvar stack [16]int\n\tvar level int = 0\n\tvar p int = p0\n\tassert(max_depth <= 15)\n\tstack[0] = -1\n\tfor {\n\t\tif pool[p].index_left_ >= 0 {\n\t\t\tlevel++\n\t\t\tif level > max_depth {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tstack[level] = int(pool[p].index_right_or_value_)\n\t\t\tp = int(pool[p].index_left_)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tdepth[pool[p].index_right_or_value_] = byte(level)\n\t\t}\n\n\t\tfor level >= 0 && stack[level] == -1 {\n\t\t\tlevel--\n\t\t}\n\t\tif level < 0 {\n\t\t\treturn true\n\t\t}\n\t\tp = stack[level]\n\t\tstack[level] = -1\n\t}\n}", "func ClearDepth(depth float64) {\n C.glowClearDepth(gpClearDepth, (C.GLdouble)(depth))\n}", "func DepthMask(flag Boolean) {\n\tcflag, _ := (C.GLboolean)(flag), cgoAllocsUnknown\n\tC.glDepthMask(cflag)\n}", "func (gl *WebGL) DepthFunc(function GLEnum) {\n\tgl.context.Call(\"depthFunc\", function)\n}", "func (c *Debugger) SetAsyncCallStackDepth(maxDepth int) (*gcdmessage.ChromeResponse, error) {\n\tparamRequest := make(map[string]interface{}, 1)\n\tparamRequest[\"maxDepth\"] = maxDepth\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"Debugger.setAsyncCallStackDepth\", Params: paramRequest})\n}", "func (w *WrapperChannel) UpdateMktDepth(reqID int64, position int64, operation int64, side int64, price float64, size int64) {\n\tlog.Fatal(\"WRAPPER FUNCTION NOT IMPLEMENTED\")\n}", "func (doDebugger Debugger) SetAsyncCallStackDepth(maxDepth int64) (err error) {\n\tb := debugger.SetAsyncCallStackDepth(maxDepth)\n\treturn b.Do(doDebugger.ctxWithExecutor)\n}", "func (c *Clac) Depth() error {\n\treturn c.Push(value.Int(len(c.Stack())))\n}", "func SetLevel(level Level) {\n\tgolevel = level\n}", "func Depth(index uint) (depth uint) {\n\tindex++\n\tfor (index & 1) == 0 {\n\t\tdepth++\n\t\tindex = rightShift(index)\n\t}\n\treturn\n}", "func (cc *ConstructionCreate) SetLevel(i int) *ConstructionCreate {\n\tcc.mutation.SetLevel(i)\n\treturn cc\n}", "func (n *Node) SetTreeSize(ctx context.Context, ts uint64) (err error) {\n\treturn n.SetXattrString(ctx, prefixes.TreesizeAttr, strconv.FormatUint(ts, 10))\n}", "func ClearDepthf(d float32) {\n\tsyscall.Syscall(gpClearDepthf, 1, uintptr(math.Float32bits(d)), 0, 0)\n}", "func SetLevel(lvs ...Level) {\n\tl.SetLevel(lvs...)\n}", "func (level *DepthOfMarketLevel) Set(price, volume float64, isBid bool) {\n\t(*level)[0] = price\n\tif isBid {\n\t\t(*level)[0] *= -1\n\t}\n\t(*level)[1] = volume\n}", "func (native *OpenGL) DepthFunc(xfunc uint32) {\n\tgl.DepthFunc(xfunc)\n}", "func (obj *Device) SetDepthStencilSurface(newZStencil *Surface) (err Error) {\n\tret, _, _ := syscall.Syscall(\n\t\tobj.vtbl.SetDepthStencilSurface,\n\t\t2,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(unsafe.Pointer(newZStencil)),\n\t\t0,\n\t)\n\treturn toErr(ret)\n}", "func DepthMask(flag bool) {\n\tC.glowDepthMask(gpDepthMask, (C.GLboolean)(boolToInt(flag)))\n}", "func DepthMask(flag bool) {\n\tC.glowDepthMask(gpDepthMask, (C.GLboolean)(boolToInt(flag)))\n}", "func (c *canvasRenderer) ResetTransform() {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = sprec.IdentityMat4()\n\t} else {\n\t\tc.currentLayer.Transform = c.currentLayer.previous.Transform\n\t}\n}", "func DepthFunc(fn Enum) {\n\tgl.DepthFunc(uint32(fn))\n}", "func (_Votes *VotesTransactor) SetLevel(opts *bind.TransactOpts, level uint8) (*types.Transaction, error) {\n\treturn _Votes.contract.Transact(opts, \"setLevel\", level)\n}", "func (n *RforkNode) SetTree(t *Tree) {\n\tn.tree = t\n}", "func (n *Node) SetTreeSize(ts uint64) (err error) {\n\treturn xattr.Set(n.InternalPath(), xattrs.TreesizeAttr, []byte(strconv.FormatUint(ts, 10)))\n}", "func ClearDepth(depth float64) {\n\tC.glowClearDepth(gpClearDepth, (C.GLdouble)(depth))\n}", "func ClearDepth(depth float64) {\n\tC.glowClearDepth(gpClearDepth, (C.GLdouble)(depth))\n}", "func DepthFunc(xfunc uint32) {\n\tsyscall.Syscall(gpDepthFunc, 1, uintptr(xfunc), 0, 0)\n}", "func (d *Detector) SetMode(x int) error {\n\terrno := C.fvad_set_mode(d.fvad, C.int(x))\n\tif errno != 0 {\n\t\treturn fmt.Errorf(\"invalid mode: %v\", x)\n\t}\n\treturn nil\n}", "func (kt KeyToken) MatchDepth(okt KeyToken) bool {\n\tif kt.Depth != okt.Depth {\n\t\treturn false\n\t}\n\treturn kt.Match(okt)\n}", "func (db *DB) UpdateMaxDepth(newDepth uint64) error {\n\tvar updatedParams core.Params\n\tupdatedParams.MaxDepth = newDepth\n\tif err := db.Instance.Table(\"params\").Assign(core.Params{MaxDepth: newDepth}).FirstOrCreate(&updatedParams).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (dev *Device) SetTiltDegs(angle float64) int {\n\treturn int(C.freenect_set_tilt_degs(dev.ptr(), C.double(angle)))\n}", "func SetLevel(l int) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tlevel = l\n}", "func (s *stencilOverdraw) storeNewDepthValues(ctx context.Context,\n\tcb CommandBuilder,\n\tgs *api.GlobalState,\n\tst *State,\n\ta arena.Arena,\n\tdevice VkDevice,\n\tqueue VkQueue,\n\tcmdBuffer VkCommandBuffer,\n\trenderInfo renderInfo,\n\talloc func(v ...interface{}) api.AllocResult,\n\taddCleanup func(func()),\n\tout transform.Writer,\n) error {\n\tif renderInfo.depthIdx == ^uint32(0) {\n\t\treturn nil\n\t}\n\trpInfo := st.RenderPasses().Get(renderInfo.renderPass)\n\tdaInfo := rpInfo.AttachmentDescriptions().Get(renderInfo.depthIdx)\n\n\tif daInfo.StoreOp() != VkAttachmentStoreOp_VK_ATTACHMENT_STORE_OP_STORE {\n\t\treturn nil\n\t}\n\n\tfbInfo := st.Framebuffers().Get(renderInfo.framebuffer)\n\n\toldImageView := fbInfo.ImageAttachments().Get(uint32(fbInfo.ImageAttachments().Len() - 1))\n\tnewImageView := fbInfo.ImageAttachments().Get(renderInfo.depthIdx)\n\n\toldImageDesc := imageDesc{\n\t\toldImageView.Image(),\n\t\toldImageView.SubresourceRange(),\n\t\trpInfo.AttachmentDescriptions().Get(uint32(fbInfo.ImageAttachments().Len() - 1)).FinalLayout(),\n\t\tVkImageAspectFlagBits_VK_IMAGE_ASPECT_DEPTH_BIT,\n\t}\n\tnewImageDesc := imageDesc{\n\t\tnewImageView.Image(),\n\t\tnewImageView.SubresourceRange(),\n\t\tdaInfo.FinalLayout(),\n\t\tVkImageAspectFlagBits_VK_IMAGE_ASPECT_DEPTH_BIT,\n\t}\n\treturn s.transferDepthValues(ctx, cb, gs, st, a,\n\t\tdevice, queue, cmdBuffer,\n\t\tfbInfo.Width(), fbInfo.Height(),\n\t\toldImageDesc, newImageDesc,\n\t\talloc, addCleanup, out)\n}", "func SetLevel(l int) {\n\tlevel = l\n}", "func SetLevel(l int) {\n\tlevel = l\n}", "func (o *Options) MaxDepth() int { return o.maxDepth }", "func FileDepth(d int) Option {\n\treturn func(opts *logOptions) {\n\t\topts.skipFrameCount = d\n\t}\n}", "func SetLevel(level Level) {\n\tdefaultLevel = int(level)\n}", "func (d *ModeDiff) setMode(mode rune) {\n\td.pos.setMode(mode)\n\td.neg.unsetMode(mode)\n}", "func (n *Node) Depth() int {\n\treturn n.depth\n}", "func DepthMask(flag bool) {\n C.glowDepthMask(gpDepthMask, (C.GLboolean)(boolToInt(flag)))\n}", "func (w *LevelWriter) SetLevel(s string) bool {\n\t// levels contains the first character of the levels in descending order\n\tconst levels = \"TDIWEF\"\n\tswitch strings.ToUpper(s) {\n\tcase \"TRACE\":\n\t\tw.level.Store(levels[0:])\n\t\treturn true\n\tcase \"DEBUG\":\n\t\tw.level.Store(levels[1:])\n\t\treturn true\n\tcase \"INFO\":\n\t\tw.level.Store(levels[2:])\n\t\treturn true\n\tcase \"WARN\":\n\t\tw.level.Store(levels[3:])\n\t\treturn true\n\tcase \"ERROR\":\n\t\tw.level.Store(levels[4:])\n\t\treturn true\n\tcase \"FATAL\":\n\t\tw.level.Store(levels[5:])\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func SetLevel(lv Level) {\n\tcurrentLevel = lv\n\tcfg.Level.SetLevel(lv)\n}", "func SetDebugLevel() {\n\tlogLevel = logrus.DebugLevel\n}", "func (rr *OPT) SetZ(z uint16) {\n\trr.Hdr.Ttl = rr.Hdr.Ttl&^0x7FFF | uint32(z&0x7FFF)\n}", "func (oupu *OrgUnitPositionUpdate) SetLevel(i int) *OrgUnitPositionUpdate {\n\toupu.mutation.ResetLevel()\n\toupu.mutation.SetLevel(i)\n\treturn oupu\n}", "func (f *Framebuffer) ClearDepth(depth float64) gfx.FramebufferStateValue {\n\treturn s.CSV{\n\t\tValue: depth,\n\t\tDefaultValue: 0, // TODO(slimsag): verify\n\t\tKey: csClearDepth,\n\t\tGLCall: f.ctx.glClearDepth,\n\t}\n}", "func SetLevel(level Level) {\n\tstd.mu.Lock()\n\tdefer std.mu.Unlock()\n\tstd.level = level\n}", "func (m Meta) SetLevel(lvl Level) {\n\tm.lvl.Store(int32(lvl))\n}", "func (c *ProjectsLogServicesIndexesListCall) Depth(depth int64) *ProjectsLogServicesIndexesListCall {\n\tc.params_.Set(\"depth\", fmt.Sprintf(\"%v\", depth))\n\treturn c\n}", "func (transform *Transform) SetPosition(newPos mgl32.Vec3) {\n\ttransform.objMatrix.SetRow(3, mgl32.Vec4{newPos.X(), newPos.Y(), newPos.Z()})\n}", "func (n *ForNode) SetTree(a *Tree) {\n\tn.tree = a\n}", "func (oupuo *OrgUnitPositionUpdateOne) SetLevel(i int) *OrgUnitPositionUpdateOne {\n\toupuo.mutation.ResetLevel()\n\toupuo.mutation.SetLevel(i)\n\treturn oupuo\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func SetMaxDepthDifference(maxDifference float64) {\n\tHeightMininum = maxDifference\n}", "func DepthFunc(func_ GLenum) {\n\tC.glDepthFunc(C.GLenum(func_))\n}", "func (o *TagModelStore) SetZoomLevel(v int32) {\n\to.ZoomLevel.Set(&v)\n}", "func (e *Env) SetTraceMode(b bool) { e.traceMode = b }", "func SetLogLevel(level zapcore.Level) {\n\tif level == TraceLevel {\n\t\tIsTraceLevel = true\n\t\tlevel = zapcore.DebugLevel\n\t}\n\tatom.SetLevel(level)\n}", "func (s *QueryLineageInput) SetMaxDepth(v int64) *QueryLineageInput {\n\ts.MaxDepth = &v\n\treturn s\n}", "func SetMode(flag int) (reset func()) {\n\tMustTestMode()\n\told := mode\n\treset = func() {\n\t\tmode = old\n\t}\n\tmode = flag\n\treturn\n}", "func (device *Device) StartDepthStream(resolution Resolution, format DepthFormat) error {\n\n\terrCode := C.freenect_set_depth_mode(device.device,\n\t\tC.freenect_find_depth_mode(C.freenect_resolution(resolution), C.freenect_depth_format(format)))\n\n\tif errCode != 0 {\n\t\treturn errors.New(\"could not find depth mode\")\n\t}\n\n\terrCode = C.freenect_start_depth(device.device)\n\n\tif errCode != 0 {\n\t\treturn errors.New(\"could not start depth stream\")\n\t}\n\n\treturn nil\n}", "func (r *Factory) SetLevel(name string, l Level) {\n\tr.Lock()\n\tdefer r.Unlock()\n\tr.setLevel(name, l)\n\tr.refreshLoggers()\n}" ]
[ "0.72426546", "0.66944337", "0.6489197", "0.64702225", "0.63566595", "0.63047695", "0.62911135", "0.6192278", "0.6161013", "0.60781723", "0.6054071", "0.5927159", "0.580917", "0.5697966", "0.56346196", "0.5625042", "0.54987735", "0.5410169", "0.53793144", "0.535777", "0.53403527", "0.52544856", "0.50957197", "0.50869507", "0.50756055", "0.50063527", "0.49944204", "0.4980019", "0.49795035", "0.49226826", "0.48766497", "0.48552296", "0.48552296", "0.4853564", "0.4844877", "0.4842187", "0.4832359", "0.48295847", "0.47158247", "0.47105035", "0.4701438", "0.46652982", "0.46467143", "0.46407813", "0.46324784", "0.46236888", "0.46201396", "0.4616436", "0.4608336", "0.46045387", "0.4601503", "0.4598649", "0.45736223", "0.45729613", "0.4568692", "0.4568692", "0.45578218", "0.45556626", "0.45394635", "0.45215696", "0.45199752", "0.4516093", "0.4516093", "0.45153263", "0.45105588", "0.45090422", "0.44964793", "0.44946858", "0.4490466", "0.4487136", "0.44851497", "0.44851497", "0.44742757", "0.44723693", "0.44700867", "0.4465641", "0.444332", "0.44367445", "0.4424385", "0.44198117", "0.4417476", "0.4406907", "0.43935296", "0.43926182", "0.4374365", "0.43719387", "0.43699282", "0.43594944", "0.43541738", "0.4347808", "0.4344097", "0.43359178", "0.4330127", "0.4314481", "0.4314044", "0.43092537", "0.42981994", "0.42969567", "0.4290699", "0.42859718" ]
0.8295805
0
SetOrigin sets transform origin.
SetOrigin устанавливает точку преобразования.
func (t *Transform) SetOrigin(origin string) *Transform { t.Origin = origin return t }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *Transformable) SetOrigin(orig Vector2f) {\n\tC.sfTransformable_setOrigin(this.cptr, orig.toC())\n}", "func SetOrigin(\n\tctx context.Context,\n\tcallOrigin string,\n) context.Context {\n\treturn setIncomingMD(ctx, map[string]string{callOriginHeaderName: callOrigin})\n}", "func (a *SetPermissionArgs) SetOrigin(origin string) *SetPermissionArgs {\n\ta.Origin = &origin\n\treturn a\n}", "func (p *ProvisionTokenV2) SetOrigin(origin string) {\n\tp.Metadata.SetOrigin(origin)\n}", "func (s *DatabaseServerV3) SetOrigin(origin string) {\n\ts.Metadata.SetOrigin(origin)\n}", "func (s *AppServerV3) SetOrigin(origin string) {\n\ts.Metadata.SetOrigin(origin)\n}", "func (s *GetDataSetOutput) SetOrigin(v string) *GetDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (s *ListDataSetsInput) SetOrigin(v string) *ListDataSetsInput {\n\ts.Origin = &v\n\treturn s\n}", "func (a *GrantPermissionsArgs) SetOrigin(origin string) *GrantPermissionsArgs {\n\ta.Origin = &origin\n\treturn a\n}", "func (s *UpdateDataSetOutput) SetOrigin(v string) *UpdateDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (s *CreateDataSetOutput) SetOrigin(v string) *CreateDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (mr *MockProcessOptionsMockRecorder) SetOrigin(value interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetOrigin\", reflect.TypeOf((*MockProcessOptions)(nil).SetOrigin), value)\n}", "func (s *DataSetEntry) SetOrigin(v string) *DataSetEntry {\n\ts.Origin = &v\n\treturn s\n}", "func (s *DisassociateApprovedOriginInput) SetOrigin(v string) *DisassociateApprovedOriginInput {\n\ts.Origin = &v\n\treturn s\n}", "func (m *Headers) SetOrigin(value *string)() {\n err := m.GetBackingStore().Set(\"origin\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *AssociateApprovedOriginInput) SetOrigin(v string) *AssociateApprovedOriginInput {\n\ts.Origin = &v\n\treturn s\n}", "func (self Text) SetOrigin(x, y float32) {\n\tv := C.sfVector2f{C.float(x), C.float(y)}\n\tC.sfText_setOrigin(self.Cref, v)\n}", "func (s *Surface) SetTransform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"setTransform\", a, b, c, d, e, f)\n}", "func (this *RectangleShape) SetOrigin(orig Vector2f) {\n\tC.sfRectangleShape_setOrigin(this.cptr, orig.toC())\n}", "func (o *Origin) SetOriginOM(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginMember) error {\n\tquery := \"update \\\"origin_members\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOM {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOM = nil\n\t}\n\treturn o.AddOriginOM(ctx, exec, insert, related...)\n}", "func (transform *Transform) SetPosition(newPos mgl32.Vec3) {\n\ttransform.objMatrix.SetRow(3, mgl32.Vec4{newPos.X(), newPos.Y(), newPos.Z()})\n}", "func (m *MockProcessOptions) SetOrigin(value topology.Host) ProcessOptions {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetOrigin\", value)\n\tret0, _ := ret[0].(ProcessOptions)\n\treturn ret0\n}", "func SetOrigin(ctx context.Context, cluster *kubernetes.Cluster, app models.AppRef, origin models.ApplicationOrigin) error {\n\tclient, err := cluster.ClientApp()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpatch, err := buildBodyPatch(origin)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error building body patch\")\n\t}\n\n\t_, err = client.Namespace(app.Namespace).Patch(ctx,\n\t\tapp.Name,\n\t\ttypes.JSONPatchType,\n\t\tpatch,\n\t\tmetav1.PatchOptions{})\n\n\treturn err\n}", "func (g *Group) SetTransform(m *algebra.Matrix) {\n\tif len(m.Get()) != 4 || len(m.Get()[0]) != 4 {\n\t\tpanic(algebra.ExpectedDimension(4))\n\t}\n\tg.transform = m\n}", "func Origin(value string) Option {\n\treturn setHeader(\"Origin\", value)\n}", "func (c *canvasRenderer) SetTransform(transform sprec.Mat4) {\n\tif c.currentLayer == c.topLayer {\n\t\tc.currentLayer.Transform = transform\n\t} else {\n\t\tc.currentLayer.Transform = sprec.Mat4Prod(\n\t\t\tc.currentLayer.previous.Transform,\n\t\t\ttransform,\n\t\t)\n\t}\n}", "func (t *Transform) SetPos(p lmath.Vec3) {\n\tt.access.Lock()\n\tif t.pos != p {\n\t\tt.built = nil\n\t\tt.pos = p\n\t}\n\tt.access.Unlock()\n}", "func (obj *Device) SetTransform(state TRANSFORMSTATETYPE, matrix MATRIX) Error {\n\tret, _, _ := syscall.Syscall(\n\t\tobj.vtbl.SetTransform,\n\t\t3,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(state),\n\t\tuintptr(unsafe.Pointer(&matrix[0])),\n\t)\n\treturn toErr(ret)\n}", "func (o *Origin) SetOriginOPR(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginProject) error {\n\tquery := \"update \\\"origin_projects\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOPR {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPR = nil\n\t}\n\treturn o.AddOriginOPR(ctx, exec, insert, related...)\n}", "func (this *Transformable) SetPosition(pos Vector2f) {\n\tC.sfTransformable_setPosition(this.cptr, pos.toC())\n}", "func (o *Origin) SetOriginOPK(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginPublicKey) error {\n\tquery := \"update \\\"origin_public_keys\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOPK {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPK = nil\n\t}\n\treturn o.AddOriginOPK(ctx, exec, insert, related...)\n}", "func (mr *MockProcessOptionsMockRecorder) Origin() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Origin\", reflect.TypeOf((*MockProcessOptions)(nil).Origin))\n}", "func (o *Origin) SetOriginOS(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginSecret) error {\n\tquery := \"update \\\"origin_secrets\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOS {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOS = nil\n\t}\n\treturn o.AddOriginOS(ctx, exec, insert, related...)\n}", "func NewOriginHeader() *OriginHeader {\n\treturn &OriginHeader{}\n}", "func WithOrigin(origin Point) HasCaptureOption {\n\treturn func(configuration *HasCaptureConfiguration) {\n\t\tconfiguration.FilterByOrigin = true\n\t\tconfiguration.Origin = origin\n\t}\n}", "func (t *Transform) SetQuat(q lmath.Quat) {\n\tt.access.Lock()\n\tif t.quat == nil || (*t.quat) != q {\n\t\tt.built = nil\n\t\tt.quat = &q\n\t}\n\tt.access.Unlock()\n}", "func (t *Transform) SetPosition(v *Vector) ITransform {\n\tt.Position = v\n\treturn t\n}", "func (pt *PointTransform) TransformCoord(c []float64) *image.Point {\n\treturn pt.TransformXY(c[0], c[1])\n}", "func (o *Origin) SetOriginOPA(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginPackage) error {\n\tquery := \"update \\\"origin_packages\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOPA {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPA = nil\n\t}\n\treturn o.AddOriginOPA(ctx, exec, insert, related...)\n}", "func (o *Origin) SetOriginOPUEK(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginPublicEncryptionKey) error {\n\tquery := \"update \\\"origin_public_encryption_keys\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOPUEK {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPUEK = nil\n\t}\n\treturn o.AddOriginOPUEK(ctx, exec, insert, related...)\n}", "func (o *Origin) SetOriginOI(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginInvitation) error {\n\tquery := \"update \\\"origin_invitations\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOI {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOI = nil\n\t}\n\treturn o.AddOriginOI(ctx, exec, insert, related...)\n}", "func (o *Origin) SetOriginOSK(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginSecretKey) error {\n\tquery := \"update \\\"origin_secret_keys\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOSK {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOSK = nil\n\t}\n\treturn o.AddOriginOSK(ctx, exec, insert, related...)\n}", "func (q *DistanceFeatureQuery) Origin(origin interface{}) *DistanceFeatureQuery {\n\tq.origin = origin\n\treturn q\n}", "func (o *Origin) SetOriginOC(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginChannel) error {\n\tquery := \"update \\\"origin_channels\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOC {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOC = nil\n\t}\n\treturn o.AddOriginOC(ctx, exec, insert, related...)\n}", "func (self Source) SetPosition(vector *Vector) {\n\tself.Set3f(AlPosition, vector[x], vector[y], vector[z])\n}", "func (object Object) Origin(value interface{}) Object {\n\treturn object.Property(as.PropertyOrigin, value)\n}", "func (o *Origin) SetOriginAPG(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*AuditPackageGroup) error {\n\tquery := \"update \\\"audit_package_group\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginAPG {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginAPG = nil\n\t}\n\treturn o.AddOriginAPG(ctx, exec, insert, related...)\n}", "func (o *Origin) SetOriginAP(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*AuditPackage) error {\n\tquery := \"update \\\"audit_package\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginAP {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginAP = nil\n\t}\n\treturn o.AddOriginAP(ctx, exec, insert, related...)\n}", "func SetCrtcTransform(c *xgb.Conn, Crtc Crtc, Transform render.Transform, FilterLen uint16, FilterName string, FilterParams []render.Fixed) SetCrtcTransformCookie {\n\tc.ExtLock.RLock()\n\tdefer c.ExtLock.RUnlock()\n\tif _, ok := c.Extensions[\"RANDR\"]; !ok {\n\t\tpanic(\"Cannot issue request 'SetCrtcTransform' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.\")\n\t}\n\tcookie := c.NewCookie(false, false)\n\tc.NewRequest(setCrtcTransformRequest(c, Crtc, Transform, FilterLen, FilterName, FilterParams), cookie)\n\treturn SetCrtcTransformCookie{cookie}\n}", "func (this *Transformable) GetOrigin() (origin Vector2f) {\n\torigin.fromC(C.sfTransformable_getOrigin(this.cptr))\n\treturn\n}", "func (o *Origin) SetOriginOPREK(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OriginPrivateEncryptionKey) error {\n\tquery := \"update \\\"origin_private_encryption_keys\\\" set \\\"origin\\\" = null where \\\"origin\\\" = $1\"\n\tvalues := []interface{}{o.Name}\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.ExecContext(ctx, 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.OriginOPREK {\n\t\t\tqueries.SetScanner(&rel.Origin, nil)\n\t\t\tif rel.R == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trel.R.OriginName = nil\n\t\t}\n\n\t\to.R.OriginOPREK = nil\n\t}\n\treturn o.AddOriginOPREK(ctx, exec, insert, related...)\n}", "func (t *transform) Set(modelView mgl32.Mat4) {\n\tt.dataLock.Lock()\n\tdefer t.dataLock.Unlock()\n\tt.modelView = modelView\n}", "func (a *Actor) SetPosition(x float64, y float64) {\n\ta.x = x\n\ta.y = y\n}", "func (c *Camera) SetPos(pos mgl32.Vec3) {\n\tc.pos = pos\n}", "func (t *Transform) SetRot(r lmath.Vec3) {\n\tt.access.Lock()\n\tif t.rot != r {\n\t\tt.built = nil\n\t\tt.quat = nil\n\t\tt.rot = r\n\t}\n\tt.access.Unlock()\n}", "func (s *DashConfiguration) SetOriginManifestType(v string) *DashConfiguration {\n\ts.OriginManifestType = &v\n\treturn s\n}", "func (a *Client) UpdateOrigin(params *UpdateOriginParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOriginOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateOriginParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"UpdateOrigin\",\n\t\tMethod: \"PATCH\",\n\t\tPathPattern: \"/cdn/v1/stacks/{stack_id}/origins/{origin_id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &UpdateOriginReader{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.(*UpdateOriginOK), nil\n\n}", "func (s *DashConfigurationForPut) SetOriginManifestType(v string) *DashConfigurationForPut {\n\ts.OriginManifestType = &v\n\treturn s\n}", "func (r *AWSCloudFrontDistribution_Origin) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (t *Transform) SetPositionXY(x float64, y float64) ITransform {\n\treturn t.SetPosition(NewVector(x, y))\n}", "func (sprite *Sprite) SetPosition(x, y float64) {\n\n\tsprite.shape.SetPosition(x, y)\n}", "func (p *PointsSgMutator) SetCoord(val []any) bool { //nolint:dupl false positive\n\tp.mutations = append(p.mutations, A.X{`=`, 1, val})\n\tp.Coord = val\n\treturn true\n}", "func (o RouteOutput) Origin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Route) pulumi.StringOutput { return v.Origin }).(pulumi.StringOutput)\n}", "func (s *DescribeTransformJobOutput) SetTransformInput(v *TransformInput) *DescribeTransformJobOutput {\n\ts.TransformInput = v\n\treturn s\n}", "func (s *CreateTransformJobInput) SetTransformInput(v *TransformInput) *CreateTransformJobInput {\n\ts.TransformInput = v\n\treturn s\n}", "func SetViewTransform(viewID ViewID, view, proj [16]float32) {\n\tC.bgfx_set_view_transform(\n\t\tC.ushort(viewID),\n\t\tunsafe.Pointer(&view[0]),\n\t\tunsafe.Pointer(&proj[0]),\n\t)\n}", "func SetCheckOriginFunc(fn func(*http.Request) bool) {\n\tcheckOrigin = fn\n}", "func (in *Origin) DeepCopy() *Origin {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Origin)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *SessionSpecification) SetOriginatingRequestId(v string) *SessionSpecification {\n\ts.OriginatingRequestId = &v\n\treturn s\n}", "func (b *BaseDevice) Origin() Point {\n\treturn b.origin\n}", "func (e *Enigma) SetRotor(position, name string, ringPosition int, startPosition rune) error {\r\n\trotor, check := availableRotors[name]\r\n\tif !check {\r\n\t\treturn fmt.Errorf(\"no such rotor: %s\", name)\r\n\t}\r\n\r\n\tindex, check := rotorPositions[strings.ToUpper(position)]\r\n\tif !check {\r\n\t\treturn fmt.Errorf(\"no such position: %s\", position)\r\n\t}\r\n\r\n\tif ringPosition < 1 || ringPosition > 26 {\r\n\t\treturn fmt.Errorf(\"invalid ring position: %d\", ringPosition)\r\n\t}\r\n\r\n\tstart := unicode.ToUpper(startPosition)\r\n\tif start < 'A' || start > 'Z' {\r\n\t\treturn fmt.Errorf(\"invalid start position: %c\", start)\r\n\t}\r\n\r\n\trotor.setRingPosition(ringPosition)\r\n\r\n\trotor.setStartPosition(start)\r\n\r\n\te.rotors[index] = &rotor\r\n\r\n\treturn nil\r\n}", "func (o LienOutput) Origin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Lien) pulumi.StringOutput { return v.Origin }).(pulumi.StringOutput)\n}", "func (s *TransformJob) SetTransformInput(v *TransformInput) *TransformJob {\n\ts.TransformInput = v\n\treturn s\n}", "func (s *Servo) SetPosition(position float64) {\n\tif s.Flags.is(Normalized) {\n\t\tposition *= 90\n\t}\n\tif s.Flags.is(Centered) {\n\t\tposition += 90\n\t}\n\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.position = clamp(position, 0, 180)\n\ts.target = s.position\n\ts.idle = false\n}", "func NewTransform2DAxisOrigin(xAxis Vector2, yAxis Vector2, origin Vector2) *Transform2D {\n\tvar dest C.godot_transform2d\n\targ1 := xAxis.getBase()\n\targ2 := yAxis.getBase()\n\targ3 := origin.getBase()\n\tC.go_godot_transform2d_new_axis_origin(GDNative.api, &dest, arg1, arg2, arg3)\n\treturn &Transform2D{base: &dest}\n}", "func (xf *Transform) SetScale(scale float32) {\n\txf.Scale = mgl32.Vec2{scale, scale}\n}", "func (t *Transform) SetScale(sx, sy float64) *Transform {\n\tt.Scale1.X = sx - 1\n\tt.Scale1.Y = sy - 1\n\treturn t\n}", "func (c *Catalog) Origin(originName string) (*Origin, error) {\n\torigin, ok := c.Origins[originName]\n\tif !ok {\n\t\treturn nil, ErrUnknownOrigin\n\t}\n\n\treturn origin, nil\n}", "func NewTransform() Transform {\n\tt := transform{\n\t\tmodelView: mgl32.Ident4(),\n\t\trotation: mgl32.Vec3{0, 0, 0},\n\t\ttranslation: mgl32.Vec3{0, 0, 0},\n\t}\n\treturn &t\n}", "func (p *Part) SetPosition(position vector.Vector) {\n\tif position.Len() != 3 && position.Kind() != reflect.Float32 {\n\t\tlog.Fatalf(\"Part.SetPosition: expects 3D-Float32 vector, got %dD-%v\", position.Len(), position.Kind())\n\t}\n\tp.position = position\n}", "func (s *TransformJobDefinition) SetTransformInput(v *TransformInput) *TransformJobDefinition {\n\ts.TransformInput = v\n\treturn s\n}", "func (s *Surface) Transform(a, b, c, d, e, f float64) {\n\ts.Ctx.Call(\"transform\", a, b, c, d, e, f)\n}", "func WithRequestOrigin(origin string) ConfigOption {\n\treturn func(s *WebAuthn) {\n\t\ts.requestOrigin = origin\n\t}\n}", "func (s *GetDataSetOutput) SetOriginDetails(v *OriginDetails) *GetDataSetOutput {\n\ts.OriginDetails = v\n\treturn s\n}", "func WithDataOrigin(dataOrigin string) WriterOption {\n\treturn func(ms *ManagedStream) {\n\t\tms.streamSettings.dataOrigin = dataOrigin\n\t}\n}", "func (w *WidgetImplement) SetPosition(x, y int) {\n\tw.x = x\n\tw.y = y\n}", "func (ps *ParticleSystem) SetPosition(x, y float64) {\n\tps.epiCenter.SetByComp(x, y)\n}", "func (o *Origin1) SetOrigins(v []Origin3) {\n\to.Origins = v\n}", "func (p *Point) SetPosition(pos vector.Vector) {\n\tp.position = pos\n}", "func (s *CreateDataSetOutput) SetOriginDetails(v *OriginDetails) *CreateDataSetOutput {\n\ts.OriginDetails = v\n\treturn s\n}", "func (o BucketCorsItemOutput) Origin() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v BucketCorsItem) []string { return v.Origin }).(pulumi.StringArrayOutput)\n}", "func (c *NestedTargetsBuilder) WithOrigin(origin string) *NestedTargetsBuilder {\n\tc.TargetsBuilder.WithOrigin(origin)\n\treturn c\n}", "func (m *Metric) Origin() *Origin {\n\treturn m.source.origin\n}", "func (s *UpdateDataSetOutput) SetOriginDetails(v *OriginDetails) *UpdateDataSetOutput {\n\ts.OriginDetails = v\n\treturn s\n}", "func (to *Session) UpdateOrigin(id int, origin tc.Origin, opts RequestOptions) (tc.OriginDetailResponse, toclientlib.ReqInf, error) {\n\tvar originResp tc.OriginDetailResponse\n\tvar remoteAddr net.Addr\n\treqInf := toclientlib.ReqInf{CacheHitStatus: toclientlib.CacheHitStatusMiss, RemoteAddr: remoteAddr}\n\n\terr := to.originIDs(&origin)\n\tif err != nil {\n\t\treturn originResp, reqInf, err\n\t}\n\tif opts.QueryParameters == nil {\n\t\topts.QueryParameters = url.Values{}\n\t}\n\topts.QueryParameters.Set(\"id\", strconv.Itoa(id))\n\treqInf, err = to.put(apiOrigins, opts, origin, &originResp)\n\treturn originResp, reqInf, err\n}", "func (obj Player) SetPos(xf, yf, zf float64) error {\n\ts := fmt.Sprintf(\"player.setPos(%s,%f,%f,%f)\",obj.name, xf, yf, zf)\n\treturn object(obj.obj).send(s)\n}", "func (b *Base) SetPosition(x, y, z float64) {\n\tb.messageChan <- &proto.Update{\n\t\tPosition: &proto.Position{\n\t\t\tX: x,\n\t\t\tY: y,\n\t\t\tZ: z,\n\t\t},\n\t}\n}", "func NewTransform() *Transform {\n\treturn &Transform{\n\t\tPosition: NewVector(0, 0),\n\t\tRotation: 0,\n\t\tScale: NewVector(1, 1),\n\t\tDim: NewVector(0, 0),\n\t}\n}", "func (p *ProvisionTokenV2) Origin() string {\n\treturn p.Metadata.Origin()\n}", "func (this *Transformable) SetRotation(rot float32) {\n\tC.sfTransformable_setRotation(this.cptr, C.float(rot))\n}" ]
[ "0.80196726", "0.7189707", "0.7154953", "0.7088292", "0.6934476", "0.68809646", "0.6803109", "0.67791086", "0.6698489", "0.6690764", "0.66876876", "0.66319853", "0.65280163", "0.6461048", "0.6432481", "0.6425079", "0.6382391", "0.6347609", "0.6234449", "0.6170806", "0.61677593", "0.6069137", "0.6047484", "0.59993756", "0.5946202", "0.5885523", "0.57690614", "0.57612103", "0.55365413", "0.5502958", "0.54714435", "0.5432496", "0.5366094", "0.53600794", "0.52932715", "0.52400774", "0.52257884", "0.52121055", "0.52008337", "0.5174318", "0.51693857", "0.5168657", "0.516274", "0.5146857", "0.51415586", "0.51405656", "0.5133817", "0.5115359", "0.51088846", "0.5107847", "0.5105198", "0.50924945", "0.50887036", "0.5076931", "0.5069258", "0.5023892", "0.50129604", "0.50024384", "0.49843898", "0.49557525", "0.49325117", "0.4909411", "0.4873028", "0.48461962", "0.4841269", "0.4834621", "0.4832632", "0.48286414", "0.48164052", "0.4809741", "0.47997472", "0.47674763", "0.47492605", "0.4746802", "0.47377187", "0.47250953", "0.47247848", "0.47144383", "0.47008312", "0.46850407", "0.46838987", "0.46744436", "0.46297452", "0.4629362", "0.4622521", "0.46136174", "0.46064547", "0.45800453", "0.4572818", "0.45553797", "0.45528683", "0.4548368", "0.45282578", "0.45271358", "0.45201424", "0.4512348", "0.44991764", "0.44920686", "0.44864988", "0.44753388" ]
0.79898334
1
ComputeOriginOffset returns the transform origin offset.
ComputeOriginOffset возвращает смещение точки преобразования.
func (t *Transform) ComputeOriginOffset(screenWidth, screenHeight float64) (offsetX, offsetY float64) { switch t.Origin { case TransformOriginTopLeft: offsetX, offsetY = 0, screenHeight case TransformOriginTopMiddle: offsetX, offsetY = screenWidth/2, screenHeight case TransformOriginTopRight: offsetX, offsetY = screenWidth, screenHeight case TransformOriginMiddleLeft: offsetX, offsetY = 0, screenHeight/2 case TransformOriginMiddle: offsetX, offsetY = screenWidth/2, screenHeight/2 case TransformOriginMiddleRight: offsetX, offsetY = screenWidth, screenHeight/2 case TransformOriginBottomLeft: offsetX, offsetY = 0, 0 case TransformOriginBottomMiddle: offsetX, offsetY = screenWidth/2, 0 case TransformOriginBottomRight: offsetX, offsetY = screenWidth, 0 case "": // TransformOriginBottomLeft offsetX, offsetY = 0, 0 default: utils.LogError(fmt.Errorf("unknown transform origin value: %s", t.Origin)) } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *Transformable) GetOrigin() (origin Vector2f) {\n\torigin.fromC(C.sfTransformable_getOrigin(this.cptr))\n\treturn\n}", "func (p point) distanceToOrigin() int {\n\treturn p.distanceToPoint(point{x: 0, y: 0})\n}", "func (tlc *TLCMessage) GetOrigin() string {\n\treturn tlc.Origin\n}", "func calcCoordinateStartingPoint(wm *WatermarkImage, oh OverheadImage, position int, offsetX int, offsetY int) image.Point {\n\n\treturn image.Point{0, 0}\n}", "func (r *RumorMessage) GetOrigin() string {\n\treturn r.Origin\n}", "func (b *BaseDevice) Origin() Point {\n\treturn b.origin\n}", "func (m *Metric) Origin() *Origin {\n\treturn m.source.origin\n}", "func (p Pos) Offset() int {\n\treturn p.Position().Offset\n}", "func (self Text) Origin() (x, y float32) {\n\tv := C.sfText_getOrigin(self.Cref)\n\treturn float32(v.x), float32(v.y)\n}", "func (this *RectangleShape) GetOrigin() (origin Vector2f) {\n\torigin.fromC(C.sfRectangleShape_getOrigin(this.cptr))\n\treturn\n}", "func (s UserSet) ComputeTZOffset() m.UserData {\n\tres := s.Collection().Call(\"ComputeTZOffset\")\n\tresTyped, _ := res.(m.UserData)\n\treturn resTyped\n}", "func (s *Structured) GetOffset() int {\n\treturn s.cloudEvent.Offset\n}", "func (c *Container) Offset() (float64, float64) {\n\treturn c.x, c.y\n}", "func (g *GetSupergroupMembersRequest) GetOffset() (value int32) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Offset\n}", "func (s *GetDataSetOutput) SetOrigin(v string) *GetDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (p Point) Offset() int {\n\treturn p.offset\n}", "func (c MethodsCollection) ComputeTZOffset() pComputeTZOffset {\n\treturn pComputeTZOffset{\n\t\tMethod: c.MustGet(\"ComputeTZOffset\"),\n\t}\n}", "func (s *Scheduler) Offset() time.Duration {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\n\treturn s.timeOffset\n}", "func (y City) Offset() int {\n\tif y.parent == nil {\n\t\treturn -1\n\t}\n\n\treturn y.parent.Offset()\n}", "func (r *RoleList) GetOffset() uint {\n\treturn r.Offset\n}", "func (s *CreateDataSetOutput) SetOrigin(v string) *CreateDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (r *Reader) Offset() Offset {\n\treturn NewOffset(r.fileSequence, r.position)\n}", "func (s *SearchChatMessagesRequest) GetOffset() (value int32) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Offset\n}", "func (o RouteOutput) Origin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Route) pulumi.StringOutput { return v.Origin }).(pulumi.StringOutput)\n}", "func (coord MapCoordinate) Offset() byte {\n\treturn byte(coord & 0x00FF)\n}", "func (s *UpdateDataSetOutput) SetOrigin(v string) *UpdateDataSetOutput {\n\ts.Origin = &v\n\treturn s\n}", "func (g *ChannelsGetLeftChannelsRequest) GetOffset() (value int) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Offset\n}", "func (e *Element) Offset() int64 {\n\treturn e.offset\n}", "func (s *DataSetEntry) SetOrigin(v string) *DataSetEntry {\n\ts.Origin = &v\n\treturn s\n}", "func (o AccessPointOutput) NetworkOrigin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AccessPoint) pulumi.StringOutput { return v.NetworkOrigin }).(pulumi.StringOutput)\n}", "func (p Pos) Offset() int64 {\n\tn := p.FrozenCount()\n\treturn int64(n) * LabelSize\n}", "func (w *Writer) Offset() uint64 {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\treturn w.offset\n}", "func (f *Font) getGlyphOriginForDirection(glyph fonts.GID, direction Direction) (x, y Position) {\n\tif direction.isHorizontal() {\n\t\treturn f.getGlyphHOriginWithFallback(glyph)\n\t}\n\treturn f.getGlyphVOriginWithFallback(glyph)\n}", "func (r *ImageRef) OffsetX() int {\n\treturn int(r.image.Xoffset)\n}", "func (c *Client) RemoteOffset() proto.RemoteOffset {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\treturn c.offset\n}", "func (t *Transform) Pos() lmath.Vec3 {\n\tt.access.RLock()\n\tp := t.pos\n\tt.access.RUnlock()\n\treturn p\n}", "func (profile *mobilityProfile) computeOffset(referenceTimestamp int64, lastRead int64) float64 {\n\t// y = mx + b\n\toffset := (profile.slope * float64(referenceTimestamp-lastRead)) + profile.yIntercept\n\n\t// check if offset needs to be capped at threshold ceiling\n\tif offset > profile.threshold {\n\t\toffset = profile.threshold\n\t}\n\treturn offset\n}", "func (s *SearchFileDownloadsRequest) GetOffset() (value string) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Offset\n}", "func (o EnterpriseProxyAccessOutput) OriginInfo() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EnterpriseProxyAccess) pulumi.StringOutput { return v.OriginInfo }).(pulumi.StringOutput)\n}", "func (a *chunkBasedAtlas) chunkOriginInWorldSpace(chunk int) maths.Vector {\n\t// Calculate the width\n\twidth := a.UpperBound.X - a.LowerBound.X\n\twidthInChunks := width / a.ChunkSize\n\n\t// Reverse the along the corridor and up the stairs\n\tv := maths.Vector{\n\t\tX: chunk % widthInChunks,\n\t\tY: chunk / widthInChunks,\n\t}\n\t// Multiply up to world scale\n\tv = v.Multiplied(a.ChunkSize)\n\t// Shift by the lower bound\n\treturn v.Added(a.LowerBound)\n}", "func (o LienOutput) Origin() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Lien) pulumi.StringOutput { return v.Origin }).(pulumi.StringOutput)\n}", "func (t *Transform) SetOrigin(origin string) *Transform {\n\tt.Origin = origin\n\treturn t\n}", "func (b *Base) GetOffset() int64 {\n\treturn b.Offset\n}", "func (m *Model) Offset() (float64, float64) {\n\treturn m.x, m.y\n}", "func (i Ivar) Offset() uintptr {\n\treturn ivar_getOffset(i)\n}", "func (pt *PointTransform) TransformCoord(c []float64) *image.Point {\n\treturn pt.TransformXY(c[0], c[1])\n}", "func (p *PdfiumImplementation) FPDFText_GetCharOrigin(request *requests.FPDFText_GetCharOrigin) (*responses.FPDFText_GetCharOrigin, error) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\ttextPageHandle, err := p.getTextPageHandle(request.TextPage)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tx := C.double(0)\n\ty := C.double(0)\n\tsuccess := C.FPDFText_GetCharOrigin(textPageHandle.handle, C.int(request.Index), &x, &y)\n\tif int(success) == 0 {\n\t\treturn nil, errors.New(\"could not get char origin\")\n\t}\n\n\treturn &responses.FPDFText_GetCharOrigin{\n\t\tIndex: request.Index,\n\t\tX: float64(x),\n\t\tY: float64(y),\n\t}, nil\n}", "func (r *Reader) Offset() Offset {\n\treturn r.offset\n}", "func (b *batch) GetOffset() *events.Offset {\n\treturn b.offset\n}", "func (p *YCbCr) COffset(x, y int) int {\n\treturn ((*image.YCbCr)(p)).COffset(x, y)\n}", "func (m *_TimeZoneDataType) GetOffset() int16 {\n\treturn m.Offset\n}", "func (o *StyleBox) GetOffset() gdnative.Vector2 {\n\t//log.Println(\"Calling StyleBox.GetOffset()\")\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(\"StyleBox\", \"get_offset\")\n\n\t// Call the parent method.\n\t// Vector2\n\tretPtr := gdnative.NewEmptyVector2()\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.NewVector2FromPointer(retPtr)\n\treturn ret\n}", "func (s *ListDataSetsInput) SetOrigin(v string) *ListDataSetsInput {\n\ts.Origin = &v\n\treturn s\n}", "func (d *Decoder) InputOffset() int {\n\treturn d.n\n}", "func (i ISCInstance) PortOffset() (offset int64, err error) {\n\tvar ss, web, hc int64\n\tif ss, err = getOffset(i.Name, \"SuperServer\", i.Ports.SuperServer, PortExternalSS); err != nil {\n\t\treturn -1, err\n\t}\n\n\tif web, err = getOffset(i.Name, \"Web\", i.Ports.Web, PortExternalWeb); err != nil {\n\t\treturn -1, err\n\t}\n\n\tif hc, err = getOffset(i.Name, \"HealthCheck\", i.Ports.Web, PortExternalWeb); err != nil {\n\t\treturn -1, err\n\t}\n\n\tif web != ss || web != hc {\n\t\treturn -1, fmt.Errorf(\"Port offsets do not match, instance: %s, SuperServer: %d, Web: %d, HealthCheck: %d\", i.Name, ss, web, hc)\n\t}\n\n\treturn ss, nil\n}", "func (q *BasicQuery) GetOffset() uint64 {\n\treturn q.Offset\n}", "func (s *AppServerV3) Origin() string {\n\treturn s.Metadata.Origin()\n}", "func (s UserSet) TZOffset() string {\n\tres, _ := s.RecordCollection.Get(models.NewFieldName(\"TZOffset\", \"tz_offset\")).(string)\n\treturn res\n}", "func (p *ProvisionTokenV2) Origin() string {\n\treturn p.Metadata.Origin()\n}", "func (d UserData) TZOffset() string {\n\tval := d.ModelData.Get(models.NewFieldName(\"TZOffset\", \"tz_offset\"))\n\tif !d.Has(models.NewFieldName(\"TZOffset\", \"tz_offset\")) {\n\t\treturn *new(string)\n\t}\n\treturn val.(string)\n}", "func (p *IPv4) Offset() uint16 {\n\treturn p.offset\n}", "func (s *DatabaseServerV3) Origin() string {\n\treturn s.Metadata.Origin()\n}", "func (e *exprHelper) OffsetLocation(exprID int64) common.Location {\n\treturn e.parserHelper.sourceInfo.GetStartLocation(exprID)\n}", "func Origin(app *unstructured.Unstructured) (models.ApplicationOrigin, error) {\n\tresult := models.ApplicationOrigin{}\n\n\torigin, found, err := unstructured.NestedMap(app.Object, \"spec\", \"origin\")\n\n\tif !found {\n\t\treturn result, nil\n\t}\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\t// Check, in order, for `path`, `container`, and `git` origins\n\t// Notes:\n\t// - Only one of path, container, or git may be present.\n\t// If more than one is present the first found is taken\n\t// (See above for the order)\n\t// - If a value is present it must not be empty.\n\t// IOW spec.origin.path == \"\", etc. are rejected.\n\n\tpath, found, err := unstructured.NestedString(origin, \"path\")\n\tif found {\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\tif path == \"\" {\n\t\t\treturn result, errors.New(\"bad path origin, empty string\")\n\t\t}\n\n\t\t// For path check the archive flag as well\n\t\tisarchive, found, err := unstructured.NestedBool(origin, \"archive\")\n\t\tif found {\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\n\t\t\tresult.Archive = isarchive\n\t\t}\n\n\t\tresult.Kind = models.OriginPath\n\t\tresult.Path = path\n\t\treturn result, nil\n\t}\n\n\tcontainer, found, err := unstructured.NestedString(origin, \"container\")\n\tif found {\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\tif container == \"\" {\n\t\t\treturn result, errors.New(\"bad container origin, empty string\")\n\t\t}\n\n\t\tresult.Kind = models.OriginContainer\n\t\tresult.Container = container\n\t\treturn result, nil\n\t}\n\n\trepository, found, err := unstructured.NestedString(origin, \"git\", \"repository\")\n\tif found {\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t\tif repository == \"\" {\n\t\t\treturn result, errors.New(\"bad git origin, url is empty string\")\n\t\t}\n\n\t\tresult.Git = &models.GitRef{}\n\n\t\t// For git check for the optional revision as well.\n\t\trevision, found, err := unstructured.NestedString(origin, \"git\", \"revision\")\n\t\tif found {\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tif revision == \"\" {\n\t\t\t\treturn result, errors.New(\"bad git origin, revision is empty string\")\n\t\t\t}\n\t\t\tresult.Git.Revision = revision\n\t\t}\n\n\t\t// For git check for the optional provider as well.\n\t\tprovider, found, err := unstructured.NestedString(origin, \"git\", \"provider\")\n\t\tif found {\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tif provider == \"\" {\n\t\t\t\treturn result, errors.New(\"bad git origin, provider is empty string\")\n\t\t\t}\n\t\t\tgitProvider, err := models.GitProviderFromString(provider)\n\t\t\tif err != nil {\n\t\t\t\treturn result, errors.New(\"bad git origin, illegal provider\")\n\t\t\t}\n\t\t\tresult.Git.Provider = gitProvider\n\t\t}\n\n\t\t// For git check for the optional branch as well.\n\t\tbranch, found, err := unstructured.NestedString(origin, \"git\", \"branch\")\n\t\tif found {\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tif branch == \"\" {\n\t\t\t\treturn result, errors.New(\"bad git origin, branch is empty string\")\n\t\t\t}\n\t\t\tresult.Git.Branch = branch\n\t\t}\n\n\t\tresult.Kind = models.OriginGit\n\t\tresult.Git.URL = repository\n\t\treturn result, nil\n\t}\n\n\t// Nothing found. Return as is, undefined origin. This can\n\t// happen for applications which were created, but not pushed\n\t// yet.\n\n\treturn result, nil\n}", "func (m *Headers) GetOrigin()(*string) {\n val, err := m.GetBackingStore().Get(\"origin\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (p Point) Offset(toward Point, by float32) Point {\n\treturn p.Add(p.DirTo(toward).Mul(by))\n}", "func (r *Scanner) Offset() uint64 {\n\treturn r.offset\n}", "func (*offsetPageInfoImpl) PreviousOffset(p graphql.ResolveParams) (int, error) {\n\tpage := p.Source.(offsetPageInfo)\n\tif page.offset > 0 {\n\t\tprevOffset := page.offset - page.limit\n\t\treturn clampInt(prevOffset, 0, math.MaxInt32), nil\n\t}\n\treturn 0, nil\n}", "func (p *Peer) TimeOffset() int64 {\n\tp.statsMtx.RLock()\n\ttimeOffset := p.timeOffset\n\tp.statsMtx.RUnlock()\n\n\treturn timeOffset\n}", "func (c *CPU) Offset() int {\n\treturn 1\n}", "func (cr *ClientResponse) Offset() uint64 {\n\treturn cr.offset\n}", "func (m NoMDEntries) GetMDEntryOriginator() (v string, err quickfix.MessageRejectError) {\n\tvar f field.MDEntryOriginatorField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (c FieldsCollection) TZOffset() *models.Field {\n\treturn c.MustGet(\"TZOffset\")\n}", "func (p Point2D) Offset(toward Point2D, by float32) Point2D {\n\treturn p.Add(p.DirTo(toward).Mul(by))\n}", "func (o TemplateAxisDisplayOptionsPtrOutput) AxisOffset() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TemplateAxisDisplayOptions) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.AxisOffset\n\t}).(pulumi.StringPtrOutput)\n}", "func (o BucketCorsItemOutput) Origin() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v BucketCorsItem) []string { return v.Origin }).(pulumi.StringArrayOutput)\n}", "func (o *WObj) GetTopLeft() (float64, float64) {\n\tpnt := o.Hitbox.Min()\n\treturn pnt.X, pnt.Y\n}", "func (p PageRequest) Offset() int64 {\n\treturn p.PerPage * (p.Page - 1)\n}", "func (o BucketCorsItemResponseOutput) Origin() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v BucketCorsItemResponse) []string { return v.Origin }).(pulumi.StringArrayOutput)\n}", "func (f *Font) subtractGlyphOriginForDirection(glyph fonts.GID, direction Direction,\n\tx, y Position) (Position, Position) {\n\toriginX, originY := f.getGlyphOriginForDirection(glyph, direction)\n\n\treturn x - originX, y - originY\n}", "func (r Ruler) Offset(p Point, dx float64, dy float64) Point {\n\treturn Point{p[0] + dx/r.kx, p[1] + dy/r.ky}\n}", "func (s *DisassociateApprovedOriginInput) SetOrigin(v string) *DisassociateApprovedOriginInput {\n\ts.Origin = &v\n\treturn s\n}", "func (o *InvestmentsTransactionsGetRequestOptions) GetOffset() int32 {\n\tif o == nil || o.Offset == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Offset\n}", "func NewTransform2DAxisOrigin(xAxis Vector2, yAxis Vector2, origin Vector2) *Transform2D {\n\tvar dest C.godot_transform2d\n\targ1 := xAxis.getBase()\n\targ2 := yAxis.getBase()\n\targ3 := origin.getBase()\n\tC.go_godot_transform2d_new_axis_origin(GDNative.api, &dest, arg1, arg2, arg3)\n\treturn &Transform2D{base: &dest}\n}", "func (l *LocalService) GetOrigin() string {\n\treturn \"local\"\n}", "func (r *Reader) AdjustedOffset(br *bufio.Reader) int64 {\n\treturn r.Request.Offset - int64(br.Buffered())\n}", "func (o EmailIdentityDkimSigningAttributesPtrOutput) SigningAttributesOrigin() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EmailIdentityDkimSigningAttributes) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SigningAttributesOrigin\n\t}).(pulumi.StringPtrOutput)\n}", "func (s *Scanner) Offset() int {\n\treturn s.offset\n}", "func (g Object) CalculatedPoint() Position {\n\tp := g.bridge().CalculatedPoint()\n\treturn Position{p.X, p.Y, p.Z}\n}", "func Offset() time.Duration {\n\treturn DefaultScheduler.Offset()\n}", "func getNodeOrigin(node graph.Node) kvs.ValueOrigin {\n\tflag := node.GetFlag(OriginFlagName)\n\tif flag != nil {\n\t\treturn flag.(*OriginFlag).origin\n\t}\n\treturn kvs.UnknownOrigin\n}", "func (lex *ExprLexer) Offset() int {\n\treturn lex.scan.Pos().Offset\n}", "func (p *Pagination) Offset() uint {\n\toffset := (p.Page - 1) * p.PerPage\n\t// a couple reasonable boundaries\n\toffset = minuint(offset, p.total)\n\toffset = maxuint(offset, 0)\n\treturn offset\n}", "func FetchOffset() int {\n\toffset := intFromEnvVar(\"FETCH_OFFSET\", -1)\n\tif offset < 0 {\n\t\tpanic(errors.New(\"FETCH_OFFSET could not be parsed or is a negative number\"))\n\t}\n\treturn offset\n}", "func (b Bounds3) Offset(p Point3) Vec3 {\n\to := p.SubtractP(b.pMin)\n\tif b.pMax.X > b.pMin.X {\n\t\to.X /= b.pMax.X - b.pMin.X\n\t}\n\tif b.pMax.Y > b.pMin.Y {\n\t\to.Y /= b.pMax.Y - b.pMin.Y\n\t}\n\tif b.pMax.Z > b.pMin.Z {\n\t\to.Z /= b.pMax.Z - b.pMin.Z\n\t}\n\treturn o\n}", "func CalcOffset() int {\n\tvar offset int\n\tweekday := time.Now().Weekday()\n\n\tswitch weekday {\n\tcase time.Sunday:\n\t\toffset = 7\n\tcase time.Monday:\n\t\toffset = 6\n\tcase time.Tuesday:\n\t\toffset = 5\n\tcase time.Wednesday:\n\t\toffset = 4\n\tcase time.Thursday:\n\t\toffset = 3\n\tcase time.Friday:\n\t\toffset = 2\n\tcase time.Saturday:\n\t\toffset = 1\n\t}\n\n\treturn offset\n}", "func (f *File) Offset(p Pos) int {\n\tx := p.index()\n\tif x < f.base || x > f.base+index(f.size) {\n\t\tpanic(\"illegal Pos value\")\n\t}\n\treturn int(x - f.base)\n}", "func (l *Line) Offset() int {\n\treturn l.offsets[0]\n}", "func (o OpenZfsVolumeOutput) OriginSnapshot() OpenZfsVolumeOriginSnapshotPtrOutput {\n\treturn o.ApplyT(func(v *OpenZfsVolume) OpenZfsVolumeOriginSnapshotPtrOutput { return v.OriginSnapshot }).(OpenZfsVolumeOriginSnapshotPtrOutput)\n}", "func ExamplePdfMaroto_GetCurrentOffset() {\n\tm := pdf.NewMaroto(consts.Portrait, consts.A4)\n\n\t// Offset here will be 0.\n\t_ = m.GetCurrentOffset()\n\n\t// Add Rows, Cols and Components until maroto add a new page.\n\n\t// Offset here will not be 0.\n\t_ = m.GetCurrentOffset()\n\n\t// Add Rows, Cols and Components to maroto add a new page.\n\n\t// Offset here will be 0.\n\t_ = m.GetCurrentOffset()\n\n\t// Do more things and save...\n}" ]
[ "0.5914239", "0.53744346", "0.5362208", "0.53457284", "0.5273407", "0.5206835", "0.51678556", "0.51544935", "0.513803", "0.5098593", "0.50667167", "0.49152374", "0.49146998", "0.49081457", "0.48933637", "0.48863855", "0.4874854", "0.48649567", "0.4814246", "0.481144", "0.47824776", "0.4759705", "0.47484967", "0.47476938", "0.47470304", "0.47442433", "0.4720422", "0.47183004", "0.46985132", "0.46885204", "0.46836895", "0.46673343", "0.4644397", "0.4603541", "0.45851442", "0.45821506", "0.45774463", "0.45689437", "0.45629278", "0.4562026", "0.4547541", "0.45374075", "0.452613", "0.45167017", "0.45148882", "0.44918212", "0.44826937", "0.44817704", "0.44768065", "0.44705784", "0.4466191", "0.44627956", "0.44575173", "0.44494864", "0.44480357", "0.4447075", "0.4446545", "0.44459823", "0.44439495", "0.44410762", "0.44243488", "0.44035512", "0.43849787", "0.43835297", "0.43800667", "0.43610594", "0.43525013", "0.43389487", "0.4337887", "0.4335689", "0.43313777", "0.4325086", "0.43238178", "0.43230948", "0.43230414", "0.43225977", "0.43221787", "0.43132752", "0.42988008", "0.4290477", "0.4288777", "0.42879087", "0.4280997", "0.42772257", "0.4275515", "0.42739266", "0.42650723", "0.42623237", "0.42558444", "0.42542452", "0.4248455", "0.42479074", "0.42461124", "0.42435443", "0.42428845", "0.42416456", "0.42380038", "0.42355382", "0.42344546", "0.42309955" ]
0.7910798
0
Deprecated: Use TopicSubmissionMessage.ProtoReflect.Descriptor instead.
Устаревший: используйте TopicSubmissionMessage.ProtoReflect.Descriptor вместо этого.
func (*TopicSubmissionMessage) Descriptor() ([]byte, []int) { return file_topic_submission_message_proto_rawDescGZIP(), []int{0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{2}\n}", "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_topic_proto_rawDescGZIP(), []int{0}\n}", "func (*TopicMessage) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{9}\n}", "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_topic_proto_rawDescGZIP(), []int{0}\n}", "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_topic_proto_rawDescGZIP(), []int{0}\n}", "func (*TopicGroup) Descriptor() ([]byte, []int) {\n\treturn file_topic_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 (*Topic_Parameters) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_topic_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_service_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 (TopicType) EnumDescriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_topic_proto_rawDescGZIP(), []int{0}\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 (*RecentMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{16}\n}", "func (*GenerateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgGCPlayerInfoSubmit) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{118}\n}", "func (*TopicSubscription) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{6}\n}", "func (*Topic_ResourceTrigger) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_r5_core_resources_topic_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*CreateMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{12}\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Messages) Descriptor() ([]byte, []int) {\n\treturn file_Forum_proto_rawDescGZIP(), []int{3}\n}", "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_message_proto_rawDescGZIP(), []int{2}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_Forum_proto_rawDescGZIP(), []int{2}\n}", "func (*TopicSubscriptionsChange) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{8}\n}", "func (*TopicList) Descriptor() ([]byte, []int) {\n\treturn file_topic_proto_rawDescGZIP(), []int{2}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*DeleteMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{13}\n}", "func (*GlobalTopic) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{5}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*TopicWise) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{4}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{1}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\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 (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_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 (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*DeleteConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{10}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*Message7865) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{15}\n}", "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "func (*GenerateMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_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 (*PublishRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_v1_task_task_proto_rawDescGZIP(), []int{4}\n}", "func (*Publisher_External) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*PublishMessageParameters) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{8}\n}", "func (*Message6107) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{11}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Message12821) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{5}\n}", "func (*Message5907) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{32}\n}", "func (*ExternalPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{53}\n}", "func (*Message5867) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{29}\n}", "func (*UpdateMessageTextRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{19}\n}", "func (*Embed_EmbedField) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*DownlinkQueueRequest) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{17}\n}", "func (*TopicSubscriptions) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{7}\n}", "func (*Message6126) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{8}\n}", "func (*Message5908) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{13}\n}", "func (*CreateConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{2}\n}", "func (*MessageWithComponents) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{61}\n}", "func (*Message12819) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_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 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 LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {\n\treturn legacyLoadMessageDesc(t, \"\")\n}", "func (*DeleteMessageTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_message_task_proto_rawDescGZIP(), []int{5}\n}", "func (*Message7919) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{21}\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 (*GroupRemoveRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{34}\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*Message6052) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{25}\n}", "func (*Message3850) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{14}\n}", "func (*Message6129) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{12}\n}", "func (*PublishDiagnosticsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{100}\n}", "func (*TriggerActionRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{15}\n}", "func convertKafkaToSubmission(msg *kafka.Message) (interface{}, error) {\n\tsubmission := &rpb.RedditSubmission{}\n\tif err := proto.Unmarshal(msg.Value, submission); err != nil {\n\t\treturn nil, fmt.Errorf(\"protobuf.Unmarshal: %v\", err)\n\t}\n\n\treturn submission, nil\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*MsgWithRequired) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{9}\n}", "func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{11}\n}", "func (*RecentMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{17}\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 (*GetChannelMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{9}\n}", "func (application *Application) sendServiceDescriptorMessage(topic string, message interface{}) {\n application.SendMessageToTopic(topic, message, application.DefaultSubscriptionClientOptions(), false)\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*Message12774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{0}\n}", "func (*Publisher) Descriptor() ([]byte, []int) {\n\treturn file_toit_model_pubsub_message_proto_rawDescGZIP(), []int{1}\n}", "func (*GetMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{11}\n}", "func (*Message4016) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{30}\n}", "func (*Message6054) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{23}\n}", "func (*SubscribeParameters) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{3}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{7}\n}" ]
[ "0.68175507", "0.67892355", "0.67468566", "0.6635227", "0.6584398", "0.6502781", "0.64011806", "0.6390371", "0.6389811", "0.63250625", "0.629232", "0.6287109", "0.6235323", "0.62342507", "0.61407334", "0.6138201", "0.612377", "0.6117275", "0.6095283", "0.60721815", "0.60713434", "0.60339755", "0.60202646", "0.6013821", "0.6009027", "0.59868175", "0.59863895", "0.597843", "0.5974462", "0.5971528", "0.5961411", "0.5956878", "0.5954177", "0.59517777", "0.595036", "0.59424174", "0.593105", "0.59276396", "0.59243923", "0.5916593", "0.5909192", "0.5908123", "0.590325", "0.5901293", "0.59000546", "0.5898736", "0.58929485", "0.5890234", "0.58833164", "0.5880771", "0.58774245", "0.58755124", "0.5869331", "0.58585966", "0.5855439", "0.5848317", "0.5845669", "0.5843919", "0.58430094", "0.5837941", "0.58377105", "0.5837121", "0.583552", "0.5832588", "0.5827303", "0.5823212", "0.5818079", "0.5815868", "0.5810909", "0.57997596", "0.5796568", "0.57901424", "0.57876796", "0.5778764", "0.57748157", "0.5772305", "0.5772102", "0.5769731", "0.5769384", "0.57672256", "0.57607925", "0.574708", "0.57381356", "0.5737602", "0.5737015", "0.5735064", "0.5731025", "0.57307893", "0.57243377", "0.5719194", "0.5719099", "0.5718977", "0.57161766", "0.5713471", "0.5712263", "0.5711936", "0.57116055", "0.5711239", "0.57064754", "0.57053554" ]
0.72706485
0
NewVvolBindingDeleteParams creates a new VvolBindingDeleteParams object, with the default timeout for this client. Default values are not hydrated, since defaults are normally applied by the API server side. To enforce default values in parameter, use SetDefaults or WithDefaults.
NewVvolBindingDeleteParams создает новый объект VvolBindingDeleteParams с default timeout для этого клиента. Default значения не гидратируются, поскольку обычно применяются по умолчанию сервером API. Чтобы принудительно применить значения по умолчанию в параметрах, используйте SetDefaults или WithDefaults.
func NewVvolBindingDeleteParams() *VvolBindingDeleteParams { return &VvolBindingDeleteParams{ timeout: cr.DefaultTimeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams {\n\to.SetDeleteAllReferences(deleteAllReferences)\n\treturn o\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s *VPCService) NewDeleteVPCOfferingParams(id string) *DeleteVPCOfferingParams {\n\tp := &DeleteVPCOfferingParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewVvolBindingDeleteParamsWithContext(ctx context.Context) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSubnetParams() *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeletePackageVersionParams() *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewVolumeDeleteParamsWithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParams() *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteTagParams() *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParams() *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) SetDefaults() {\n\tvar (\n\t\tdeleteAllReferencesDefault = bool(false)\n\t)\n\n\tval := VvolBindingDeleteParams{\n\t\tDeleteAllReferences: &deleteAllReferencesDefault,\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 *VvolBindingDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConnectionParams() *DeleteConnectionParams {\n\tvar ()\n\treturn &DeleteConnectionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteConditionParams() *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteDataSourceParams() *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewComponentDeleteParams() *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeletePackageVersionParamsWithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSubnetParamsWithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithTimeout(timeout time.Duration) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePoolProjectParams() *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (r *ProjectsBrokersV2ServiceInstancesServiceBindingsService) Delete(parent string, instanceId string, bindingId string) *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall {\n\tc := &ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.instanceId = instanceId\n\tc.bindingId = bindingId\n\treturn c\n}", "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func NewComponentDeleteParamsWithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (s *VPCService) NewDeleteVPCParams(id string) *DeleteVPCParams {\n\tp := &DeleteVPCParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewReposDeleteParams() *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSubnetsSubnetPoolParams() *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteConditionParamsWithTimeout(timeout time.Duration) *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithTimeout(timeout time.Duration) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewRevokeDeviceCertificateUsingDELETEParams() *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteDataSourceParamsWithTimeout(timeout time.Duration) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNamespaceParams() *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteKeyPairsParams() *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteVersionControlRequestParamsWithTimeout(timeout time.Duration) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewVolumeDeleteParamsWithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNetworkGroupPolicyParams() *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteTagParamsWithTimeout(timeout time.Duration) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteDeviceUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConnectionParamsWithTimeout(timeout time.Duration) *DeleteConnectionParams {\n\tvar ()\n\treturn &DeleteConnectionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (c *IPSecVPNClient) NewDeleteVPNTunnelRequest() *DeleteVPNTunnelRequest {\n\treq := &DeleteVPNTunnelRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteCwfNetworkIDParams() *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSubscribedEventParams() *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteScheduleParams() *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteVersionControlRequestParams() *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteSubnetsSubnetPoolParamsWithTimeout(timeout time.Duration) *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePoolProjectParamsWithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteDeviceUsingDELETEParams() *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSubscribedEventParamsWithTimeout(timeout time.Duration) *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteKeyPairsParamsWithTimeout(timeout time.Duration) *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeletePackageVersionParamsWithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNodeParams() *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNetworkGroupPolicyParamsWithTimeout(timeout time.Duration) *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterBindingDeleteArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(400, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func NewDeleteSubnetParamsWithHTTPClient(client *http.Client) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func NewReposDeleteParamsWithTimeout(timeout time.Duration) *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteBlueprintRequestUsingDELETE1ParamsWithTimeout(timeout time.Duration) *DeleteBlueprintRequestUsingDELETE1Params {\n\treturn &DeleteBlueprintRequestUsingDELETE1Params{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteAlertingProfileParams() *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteBlueprintsInWorkspaceParams() *DeleteBlueprintsInWorkspaceParams {\n\tvar ()\n\treturn &DeleteBlueprintsInWorkspaceParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNamespaceParamsWithTimeout(timeout time.Duration) *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteGerritListenerByIDUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteScriptDataParams() DeleteScriptDataParams {\n\n\treturn DeleteScriptDataParams{}\n}", "func NewDeleteScheduleParamsWithTimeout(timeout time.Duration) *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VolumeDeleteParams) WithContext(ctx context.Context) *VolumeDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewDeleteAttributeParams() *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewComponentDeleteParamsWithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewStreamsDeleteParams() *StreamsDeleteParams {\n\tvar ()\n\treturn &StreamsDeleteParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteGerritListenerByIDUsingDELETEParams() *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteRequestBody(p *inventory.DeletePayload) *DeleteRequestBody {\n\tbody := &DeleteRequestBody{}\n\tif p.Ids != nil {\n\t\tbody.Ids = make([]string, len(p.Ids))\n\t\tfor i, val := range p.Ids {\n\t\t\tbody.Ids[i] = val\n\t\t}\n\t}\n\treturn body\n}", "func NewEntryServiceDeleteParams() *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteRolesParams() *DeleteRolesParams {\n\tvar ()\n\treturn &DeleteRolesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteAlertingProfileParamsWithTimeout(timeout time.Duration) *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteKeyPairsParams) WithBody(body *models.OpenpitrixDeleteKeyPairsRequest) *DeleteKeyPairsParams {\n\to.SetBody(body)\n\treturn o\n}", "func (s *VPCService) NewDeletePrivateGatewayParams(id string) *DeletePrivateGatewayParams {\n\tp := &DeletePrivateGatewayParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewAPIDeleteUserParams() *APIDeleteUserParams {\n\tvar ()\n\treturn &APIDeleteUserParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteCwfNetworkIDParamsWithTimeout(timeout time.Duration) *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (c *UDBClient) NewDeleteUDBParamGroupRequest() *DeleteUDBParamGroupRequest {\n\treq := &DeleteUDBParamGroupRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "func (c *UDBClient) NewDeleteUDBParamGroupRequest() *DeleteUDBParamGroupRequest {\n\treq := &DeleteUDBParamGroupRequest{}\n\n\t// setup request with client config\n\tc.Client.SetupRequest(req)\n\n\t// setup retryable with default retry policy (retry for non-create action and common error)\n\treq.SetRetryable(true)\n\treturn req\n}", "func NewStorageVolumesDeleteRequestBody(p *spinregistry.StorageVolumesDeletePayload) *StorageVolumesDeleteRequestBody {\n\tbody := &StorageVolumesDeleteRequestBody{\n\t\tName: p.Name,\n\t}\n\treturn body\n}", "func NewOrderDeleteParams() *OrderDeleteParams {\n\treturn &OrderDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s *ProjectService) NewDeleteProjectInvitationParams(id string) *DeleteProjectInvitationParams {\n\tp := &DeleteProjectInvitationParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewEntryServiceDeleteParamsWithTimeout(timeout time.Duration) *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNodeParamsWithTimeout(timeout time.Duration) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ComponentDeleteParams) WithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}" ]
[ "0.8443394", "0.80488086", "0.79342115", "0.7605265", "0.73258764", "0.71807414", "0.66015834", "0.656757", "0.6386962", "0.6290172", "0.624446", "0.62381047", "0.61957663", "0.61885685", "0.61526823", "0.6124373", "0.6017747", "0.6001432", "0.5993086", "0.5975276", "0.59619576", "0.5920571", "0.5899723", "0.5898739", "0.58104837", "0.57858866", "0.5783528", "0.57319623", "0.5731894", "0.5720407", "0.5695943", "0.56915694", "0.5680454", "0.5637523", "0.5599144", "0.5588753", "0.55724853", "0.55671316", "0.5566718", "0.5563194", "0.5555212", "0.552324", "0.54914016", "0.54869205", "0.54819274", "0.5461057", "0.54590386", "0.5423771", "0.54173136", "0.538978", "0.5388258", "0.538207", "0.53719133", "0.53558433", "0.534948", "0.53306174", "0.53110605", "0.5307899", "0.52949464", "0.52758723", "0.5272912", "0.5257975", "0.5252578", "0.52364534", "0.5196358", "0.5189118", "0.5185938", "0.5178873", "0.51677734", "0.5148082", "0.51248294", "0.5117575", "0.5116993", "0.5113344", "0.51127607", "0.51057225", "0.5101026", "0.5095589", "0.5087535", "0.50841016", "0.50737536", "0.50684756", "0.50105596", "0.5009059", "0.5001125", "0.49856505", "0.49819764", "0.49745783", "0.4974002", "0.49526763", "0.49508944", "0.4950568", "0.4949228", "0.4949228", "0.4936675", "0.49267295", "0.49198043", "0.4919606", "0.49171132", "0.4900814" ]
0.89485335
0
NewVvolBindingDeleteParamsWithTimeout creates a new VvolBindingDeleteParams object with the ability to set a timeout on a request.
NewVvolBindingDeleteParamsWithTimeout создает новый объект VvolBindingDeleteParams с возможностью установки таймаута на запрос.
func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams { return &VvolBindingDeleteParams{ timeout: timeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewVolumeDeleteParamsWithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSubnetParamsWithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePackageVersionParamsWithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewComponentDeleteParamsWithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteTagParamsWithTimeout(timeout time.Duration) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteVersionControlRequestParamsWithTimeout(timeout time.Duration) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConnectionParamsWithTimeout(timeout time.Duration) *DeleteConnectionParams {\n\tvar ()\n\treturn &DeleteConnectionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConditionParamsWithTimeout(timeout time.Duration) *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithTimeout(timeout time.Duration) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithTimeout(timeout time.Duration) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteKeyPairsParamsWithTimeout(timeout time.Duration) *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteDataSourceParamsWithTimeout(timeout time.Duration) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNodeParamsWithTimeout(timeout time.Duration) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNamespaceParamsWithTimeout(timeout time.Duration) *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePoolProjectParamsWithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteAttributeParamsWithTimeout(timeout time.Duration) *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeleteSubnetsSubnetPoolParamsWithTimeout(timeout time.Duration) *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSubscribedEventParamsWithTimeout(timeout time.Duration) *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNetworkGroupPolicyParamsWithTimeout(timeout time.Duration) *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteScheduleParamsWithTimeout(timeout time.Duration) *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteBlueprintsInWorkspaceParamsWithTimeout(timeout time.Duration) *DeleteBlueprintsInWorkspaceParams {\n\tvar ()\n\treturn &DeleteBlueprintsInWorkspaceParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VolumeDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ComponentDeleteParams) WithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteDeviceUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePacketCapturesParamsWithTimeout(timeout time.Duration) *DeletePacketCapturesParams {\n\treturn &DeletePacketCapturesParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteCwfNetworkIDParamsWithTimeout(timeout time.Duration) *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewNvmeNamespaceDeleteParamsWithTimeout(timeout time.Duration) *NvmeNamespaceDeleteParams {\n\treturn &NvmeNamespaceDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteNtpServerParamsWithTimeout(timeout time.Duration) *DeleteNtpServerParams {\n\tvar ()\n\treturn &DeleteNtpServerParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteDebugRequestParamsWithTimeout(timeout time.Duration) *DeleteDebugRequestParams {\n\tvar ()\n\treturn &DeleteDebugRequestParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteVersionControlRequestParams) WithTimeout(timeout time.Duration) *DeleteVersionControlRequestParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteTagParams() *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewEntryServiceDeleteParamsWithTimeout(timeout time.Duration) *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteKeyPairsParams) WithTimeout(timeout time.Duration) *DeleteKeyPairsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewReposDeleteParamsWithTimeout(timeout time.Duration) *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteDebugRequestParams) WithTimeout(timeout time.Duration) *DeleteDebugRequestParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteGerritListenerByIDUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ComponentDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewStreamsDeleteParamsWithTimeout(timeout time.Duration) *StreamsDeleteParams {\n\tvar ()\n\treturn &StreamsDeleteParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewAPIDeleteUserParamsWithTimeout(timeout time.Duration) *APIDeleteUserParams {\n\tvar ()\n\treturn &APIDeleteUserParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteConditionParams) WithTimeout(timeout time.Duration) *DeleteConditionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteSubnetParams() *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteTagParams) WithTimeout(timeout time.Duration) *DeleteTagParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteRolesParamsWithTimeout(timeout time.Duration) *DeleteRolesParams {\n\tvar ()\n\treturn &DeleteRolesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteSubnetParams) WithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeletePoolProjectParams) WithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteConnectionParams() *DeleteConnectionParams {\n\tvar ()\n\treturn &DeleteConnectionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeletePackageVersionParams) WithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewServiceBindingBindingParamsWithTimeout(timeout time.Duration) *ServiceBindingBindingParams {\n\treturn &ServiceBindingBindingParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteLoadBalancerPoolParams) WithTimeout(timeout time.Duration) *DeleteLoadBalancerPoolParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDecryptParamsWithTimeout(timeout time.Duration) *DecryptParams {\n\tvar ()\n\treturn &DecryptParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteConditionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewRemoveGKECredentialParamsWithTimeout(timeout time.Duration) *RemoveGKECredentialParams {\n\tvar ()\n\treturn &RemoveGKECredentialParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLoadBalancerPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeleteClusterParamsWithTimeout(timeout time.Duration) *DeleteClusterParams {\n\tvar ()\n\treturn &DeleteClusterParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteDeviceUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (s *VPCService) NewDeleteVPCOfferingParams(id string) *DeleteVPCOfferingParams {\n\tp := &DeleteVPCOfferingParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewDeleteProtectedEntityParamsWithTimeout(timeout time.Duration) *DeleteProtectedEntityParams {\n\treturn &DeleteProtectedEntityParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteAlertingProfileParamsWithTimeout(timeout time.Duration) *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteVersionControlRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewOrderDeleteParamsWithTimeout(timeout time.Duration) *OrderDeleteParams {\n\treturn &OrderDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteConditionParams() *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeletePackageVersionParams() *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeletePrincipalIdentityParamsWithTimeout(timeout time.Duration) *DeletePrincipalIdentityParams {\n\tvar ()\n\treturn &DeletePrincipalIdentityParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewRemoveReceiverParamsWithTimeout(timeout time.Duration) *RemoveReceiverParams {\n\tvar ()\n\treturn &RemoveReceiverParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteUserAttributeParamsWithTimeout(timeout time.Duration) *DeleteUserAttributeParams {\n\tvar ()\n\treturn &DeleteUserAttributeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPcloudPlacementgroupsMembersDeleteParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersDeleteParams {\n\treturn &PcloudPlacementgroupsMembersDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewComponentDeleteParams() *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteKeyPairsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) WithTimeout(timeout time.Duration) *RevokeDeviceCertificateUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDebugRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewEmsDestinationDeleteParamsWithTimeout(timeout time.Duration) *EmsDestinationDeleteParams {\n\treturn &EmsDestinationDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewServiceInstanceDeprovisionParamsWithTimeout(timeout time.Duration) *ServiceInstanceDeprovisionParams {\n\treturn &ServiceInstanceDeprovisionParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *EntryServiceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteTagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *OrderDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeleteBlueprintRequestUsingDELETE1ParamsWithTimeout(timeout time.Duration) *DeleteBlueprintRequestUsingDELETE1Params {\n\treturn &DeleteBlueprintRequestUsingDELETE1Params{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSupportUserParamsWithTimeout(timeout time.Duration) *DeleteSupportUserParams {\n\tvar ()\n\treturn &DeleteSupportUserParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeletePoolProjectParams() *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteLifecycleSpacesParamsWithTimeout(timeout time.Duration) *DeleteLifecycleSpacesParams {\n\tvar ()\n\treturn &DeleteLifecycleSpacesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteAPI24ProtectionGroupSnapshotsParamsWithTimeout(timeout time.Duration) *DeleteAPI24ProtectionGroupSnapshotsParams {\n\tvar ()\n\treturn &DeleteAPI24ProtectionGroupSnapshotsParams{\n\n\t\ttimeout: timeout,\n\t}\n}" ]
[ "0.833041", "0.75770617", "0.75299597", "0.75071734", "0.7177665", "0.71717817", "0.7094056", "0.7027132", "0.69987446", "0.6997985", "0.6857217", "0.68130285", "0.6753555", "0.67476237", "0.67308384", "0.6725506", "0.6687974", "0.66241753", "0.65718096", "0.65705854", "0.65351385", "0.64943665", "0.6477535", "0.64680654", "0.64539886", "0.64370227", "0.63885933", "0.634305", "0.6337674", "0.6276346", "0.62429184", "0.6240647", "0.6212345", "0.6203376", "0.6147234", "0.6137001", "0.6133759", "0.6121305", "0.6115823", "0.6111048", "0.60869676", "0.6073598", "0.6048644", "0.6033159", "0.6008066", "0.6006792", "0.5999292", "0.5992947", "0.5988538", "0.5985604", "0.59681165", "0.59452266", "0.59340376", "0.5924503", "0.5913127", "0.5901739", "0.58993894", "0.5891964", "0.58875", "0.5872197", "0.58652073", "0.58635104", "0.5861905", "0.58604664", "0.5849651", "0.5845878", "0.5831884", "0.58314645", "0.5827535", "0.58218044", "0.5813774", "0.58116984", "0.58061904", "0.5795154", "0.5780861", "0.57730824", "0.5756823", "0.57557744", "0.5754876", "0.5735047", "0.57298833", "0.5729114", "0.57198614", "0.57150435", "0.56979764", "0.568907", "0.56878936", "0.5682498", "0.56766623", "0.567659", "0.56657696", "0.566385", "0.5649012", "0.5644881", "0.5644043", "0.564352", "0.56387323", "0.5623245", "0.5618066", "0.5607321" ]
0.89275056
0
NewVvolBindingDeleteParamsWithContext creates a new VvolBindingDeleteParams object with the ability to set a context for a request.
NewVvolBindingDeleteParamsWithContext создает новый объект VvolBindingDeleteParams с возможностью установки контекста запроса.
func NewVvolBindingDeleteParamsWithContext(ctx context.Context) *VvolBindingDeleteParams { return &VvolBindingDeleteParams{ Context: ctx, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVolumeDeleteParamsWithContext(ctx context.Context) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithContext(ctx context.Context) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteLoadBalancerPoolParamsWithContext(ctx context.Context) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSubnetParamsWithContext(ctx context.Context) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams {\n\to.SetDeleteAllReferences(deleteAllReferences)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func NewDeletePackageVersionParamsWithContext(ctx context.Context) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteTagParamsWithContext(ctx context.Context) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteAlertingProfileParamsWithContext(ctx context.Context) *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSiteSnippetParamsWithContext(ctx context.Context) *DeleteSiteSnippetParams {\n\tvar ()\n\treturn &DeleteSiteSnippetParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithContext(ctx context.Context) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSubnetsSubnetPoolParamsWithContext(ctx context.Context) *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteCwfNetworkIDParamsWithContext(ctx context.Context) *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParams() *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteNetworkGroupPolicyParamsWithContext(ctx context.Context) *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteSubscribedEventParamsWithContext(ctx context.Context) *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewReposDeleteParamsWithContext(ctx context.Context) *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteDeviceUsingDELETEParamsWithContext(ctx context.Context) *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteLoadBalancerPoolParams() *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s *VPCService) NewDeleteVPCOfferingParams(id string) *DeleteVPCOfferingParams {\n\tp := &DeleteVPCOfferingParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewComponentDeleteParamsWithContext(ctx context.Context) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteNamespaceParamsWithContext(ctx context.Context) *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *Krds) DeleteDBParameterGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.DeleteDBParameterGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (o *VolumeDeleteParams) WithContext(ctx context.Context) *VolumeDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewBundleProductOptionRepositoryV1DeleteByIDDeleteParamsWithContext(ctx context.Context) *BundleProductOptionRepositoryV1DeleteByIDDeleteParams {\n\tvar ()\n\treturn &BundleProductOptionRepositoryV1DeleteByIDDeleteParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeletePoolProjectParamsWithContext(ctx context.Context) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteDataSourceParamsWithContext(ctx context.Context) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteConditionParamsWithContext(ctx context.Context) *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *SageMaker) DeleteImageVersionWithContext(ctx aws.Context, input *DeleteImageVersionInput, opts ...request.Option) (*DeleteImageVersionOutput, error) {\n\treq, out := c.DeleteImageVersionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteKeyPairsParamsWithContext(ctx context.Context) *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *Connect) DeletePromptWithContext(ctx aws.Context, input *DeletePromptInput, opts ...request.Option) (*DeletePromptOutput, error) {\n\treq, out := c.DeletePromptRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteVersionControlRequestParamsWithContext(ctx context.Context) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\tContext: ctx,\n\t}\n}", "func (secretsManager *SecretsManagerV2) DeleteSecretWithContext(ctx context.Context, deleteSecretOptions *DeleteSecretOptions) (response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(deleteSecretOptions, \"deleteSecretOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(deleteSecretOptions, \"deleteSecretOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"id\": *deleteSecretOptions.ID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.DELETE)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = secretsManager.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(secretsManager.Service.Options.URL, `/api/v2/secrets/{id}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range deleteSecretOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"secrets_manager\", \"V2\", \"DeleteSecret\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresponse, err = secretsManager.Service.Request(request, nil)\n\n\treturn\n}", "func NewDeleteGerritListenerByIDUsingDELETEParamsWithContext(ctx context.Context) *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\tContext: ctx,\n\t}\n}", "func NewNvmeNamespaceDeleteParamsWithContext(ctx context.Context) *NvmeNamespaceDeleteParams {\n\treturn &NvmeNamespaceDeleteParams{\n\t\tContext: ctx,\n\t}\n}", "func (c *Budgets) DeleteBudgetWithContext(ctx aws.Context, input *DeleteBudgetInput, opts ...request.Option) (*DeleteBudgetOutput, error) {\n\treq, out := c.DeleteBudgetRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewEntryServiceDeleteParamsWithContext(ctx context.Context) *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithContext(ctx context.Context) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNodeParamsWithContext(ctx context.Context) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *Connect) DeleteVocabularyWithContext(ctx aws.Context, input *DeleteVocabularyInput, opts ...request.Option) (*DeleteVocabularyOutput, error) {\n\treq, out := c.DeleteVocabularyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteScheduleParamsWithContext(ctx context.Context) *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNtpServerParamsWithContext(ctx context.Context) *DeleteNtpServerParams {\n\tvar ()\n\treturn &DeleteNtpServerParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *SageMaker) DeleteEdgeDeploymentStageWithContext(ctx aws.Context, input *DeleteEdgeDeploymentStageInput, opts ...request.Option) (*DeleteEdgeDeploymentStageOutput, error) {\n\treq, out := c.DeleteEdgeDeploymentStageRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *LexModelsV2) DeleteBotVersionWithContext(ctx aws.Context, input *DeleteBotVersionInput, opts ...request.Option) (*DeleteBotVersionOutput, error) {\n\treq, out := c.DeleteBotVersionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *LexModelsV2) DeleteBotWithContext(ctx aws.Context, input *DeleteBotInput, opts ...request.Option) (*DeleteBotOutput, error) {\n\treq, out := c.DeleteBotRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (o *DeleteLoadBalancerPoolParams) WithContext(ctx context.Context) *DeleteLoadBalancerPoolParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (s *VPCService) NewDeleteVPCParams(id string) *DeleteVPCParams {\n\tp := &DeleteVPCParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func (c *Organizations) DeletePolicyWithContext(ctx aws.Context, input *DeletePolicyInput, opts ...request.Option) (*DeletePolicyOutput, error) {\n\treq, out := c.DeletePolicyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *Proton) DeleteEnvironmentTemplateVersionWithContext(ctx aws.Context, input *DeleteEnvironmentTemplateVersionInput, opts ...request.Option) (*DeleteEnvironmentTemplateVersionOutput, error) {\n\treq, out := c.DeleteEnvironmentTemplateVersionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteBlueprintRequestUsingDELETE1ParamsWithContext(ctx context.Context) *DeleteBlueprintRequestUsingDELETE1Params {\n\treturn &DeleteBlueprintRequestUsingDELETE1Params{\n\t\tContext: ctx,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewDeletePrincipalIdentityParamsWithContext(ctx context.Context) *DeletePrincipalIdentityParams {\n\tvar ()\n\treturn &DeletePrincipalIdentityParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPcloudPlacementgroupsMembersDeleteParamsWithContext(ctx context.Context) *PcloudPlacementgroupsMembersDeleteParams {\n\treturn &PcloudPlacementgroupsMembersDeleteParams{\n\t\tContext: ctx,\n\t}\n}", "func (c *SageMaker) DeleteEndpointWithContext(ctx aws.Context, input *DeleteEndpointInput, opts ...request.Option) (*DeleteEndpointOutput, error) {\n\treq, out := c.DeleteEndpointRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *Proton) DeleteServiceTemplateVersionWithContext(ctx aws.Context, input *DeleteServiceTemplateVersionInput, opts ...request.Option) (*DeleteServiceTemplateVersionOutput, error) {\n\treq, out := c.DeleteServiceTemplateVersionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (o *ReposDeleteParams) WithContext(ctx context.Context) *ReposDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewDeleteTagParams() *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSubnetParams() *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSupportUserParamsWithContext(ctx context.Context) *DeleteSupportUserParams {\n\tvar ()\n\treturn &DeleteSupportUserParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteProtectedEntityParamsWithContext(ctx context.Context) *DeleteProtectedEntityParams {\n\treturn &DeleteProtectedEntityParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteFreeIpaByEnvironmentV1ParamsWithContext(ctx context.Context) *DeleteFreeIpaByEnvironmentV1Params {\n\tvar (\n\t\tforcedDefault = bool(false)\n\t)\n\treturn &DeleteFreeIpaByEnvironmentV1Params{\n\t\tForced: &forcedDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteChartrepoRepoChartsNameVersionLabelsIDParamsWithContext(ctx context.Context) *DeleteChartrepoRepoChartsNameVersionLabelsIDParams {\n\tvar ()\n\treturn &DeleteChartrepoRepoChartsNameVersionLabelsIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *ManagedBlockchain) DeleteMemberWithContext(ctx aws.Context, input *DeleteMemberInput, opts ...request.Option) (*DeleteMemberOutput, error) {\n\treq, out := c.DeleteMemberRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteBlueprintsInWorkspaceParamsWithContext(ctx context.Context) *DeleteBlueprintsInWorkspaceParams {\n\tvar ()\n\treturn &DeleteBlueprintsInWorkspaceParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *Krds) DeleteDBInstanceWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.DeleteDBInstanceRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) WithContext(ctx context.Context) *DeleteGerritListenerByIDUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (c *DataExchange) DeleteRevisionWithContext(ctx aws.Context, input *DeleteRevisionInput, opts ...request.Option) (*DeleteRevisionOutput, error) {\n\treq, out := c.DeleteRevisionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *Proton) DeleteDeploymentWithContext(ctx aws.Context, input *DeleteDeploymentInput, opts ...request.Option) (*DeleteDeploymentOutput, error) {\n\treq, out := c.DeleteDeploymentRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteSiteDeployParamsWithContext(ctx context.Context) *DeleteSiteDeployParams {\n\tvar ()\n\treturn &DeleteSiteDeployParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteAttributeParamsWithContext(ctx context.Context) *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *SMS) DeleteAppValidationConfigurationWithContext(ctx aws.Context, input *DeleteAppValidationConfigurationInput, opts ...request.Option) (*DeleteAppValidationConfigurationOutput, error) {\n\treq, out := c.DeleteAppValidationConfigurationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *EFS) DeleteAccessPointWithContext(ctx aws.Context, input *DeleteAccessPointInput, opts ...request.Option) (*DeleteAccessPointOutput, error) {\n\treq, out := c.DeleteAccessPointRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (s *ProjectService) NewDeleteProjectInvitationParams(id string) *DeleteProjectInvitationParams {\n\tp := &DeleteProjectInvitationParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewServiceInstanceDeprovisionParamsWithContext(ctx context.Context) *ServiceInstanceDeprovisionParams {\n\treturn &ServiceInstanceDeprovisionParams{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteUsingDELETE1ParamsWithContext(ctx context.Context) *DeleteUsingDELETE1Params {\n\treturn &DeleteUsingDELETE1Params{\n\t\tContext: ctx,\n\t}\n}", "func NewDeleteDataSourceParams() *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (c *MediaTailor) DeleteVodSourceWithContext(ctx aws.Context, input *DeleteVodSourceInput, opts ...request.Option) (*DeleteVodSourceOutput, error) {\n\treq, out := c.DeleteVodSourceRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteClusterParamsWithContext(ctx context.Context) *DeleteClusterParams {\n\tvar ()\n\treturn &DeleteClusterParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterBindingDeleteArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(400, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func NewDeletePacketCapturesParamsWithContext(ctx context.Context) *DeletePacketCapturesParams {\n\treturn &DeletePacketCapturesParams{\n\t\tContext: ctx,\n\t}\n}", "func (c *MediaTailor) DeleteProgramWithContext(ctx aws.Context, input *DeleteProgramInput, opts ...request.Option) (*DeleteProgramOutput, error) {\n\treq, out := c.DeleteProgramRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewAPIDeleteUserParamsWithContext(ctx context.Context) *APIDeleteUserParams {\n\tvar ()\n\treturn &APIDeleteUserParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (c *SageMaker) DeleteHubWithContext(ctx aws.Context, input *DeleteHubInput, opts ...request.Option) (*DeleteHubOutput, error) {\n\treq, out := c.DeleteHubRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewDeleteAlertingProfileParams() *DeleteAlertingProfileParams {\n\tvar ()\n\treturn &DeleteAlertingProfileParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ComponentDeleteParams) WithContext(ctx context.Context) *ComponentDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (a *AgentApplications) AgentApplicationDeleteWithContext(\n\tctx context.Context,\n\tgUID common.EntityGUID,\n) (*AgentApplicationDeleteResult, error) {\n\n\tresp := AgentApplicationDeleteQueryResponse{}\n\tvars := map[string]interface{}{\n\t\t\"guid\": gUID,\n\t}\n\n\tif err := a.client.NerdGraphQueryWithContext(ctx, AgentApplicationDeleteMutation, vars, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &resp.AgentApplicationDeleteResult, nil\n}", "func NewDeleteGerritListenerByIDUsingDELETEParams() *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}" ]
[ "0.7681622", "0.74235815", "0.72549915", "0.64245224", "0.64204115", "0.6269961", "0.6203132", "0.6025189", "0.5897464", "0.58345693", "0.5770824", "0.56995344", "0.5696491", "0.5662892", "0.5658423", "0.56506205", "0.5478355", "0.5402012", "0.52876925", "0.5245509", "0.52265286", "0.52099", "0.51830506", "0.517366", "0.51692003", "0.5150724", "0.50877887", "0.5074468", "0.49866664", "0.49864656", "0.49839363", "0.49492243", "0.49415523", "0.4917708", "0.49026346", "0.48878482", "0.48812044", "0.48761833", "0.48604572", "0.48478448", "0.483371", "0.48116073", "0.47898918", "0.47713333", "0.47653925", "0.47573015", "0.47454938", "0.47359416", "0.47353134", "0.47332257", "0.4732282", "0.47276148", "0.47193727", "0.47078702", "0.47001445", "0.46989414", "0.46978793", "0.46884125", "0.46883407", "0.4671885", "0.46530566", "0.46422774", "0.46236676", "0.46154645", "0.45949158", "0.45919162", "0.45625895", "0.45496508", "0.45482358", "0.45429456", "0.4541815", "0.4531058", "0.45200184", "0.45087072", "0.45006028", "0.44920585", "0.44817433", "0.44759876", "0.44746917", "0.44725296", "0.44719264", "0.44547108", "0.44529408", "0.44512987", "0.44483542", "0.443887", "0.44350678", "0.4434614", "0.44330522", "0.44279858", "0.44226983", "0.4419553", "0.44194242", "0.44177222", "0.44144952", "0.44137713", "0.44114158", "0.440286", "0.44008464", "0.43984833" ]
0.883239
0
NewVvolBindingDeleteParamsWithHTTPClient creates a new VvolBindingDeleteParams object with the ability to set a custom HTTPClient for a request.
NewVvolBindingDeleteParamsWithHTTPClient создает новый объект VvolBindingDeleteParams с возможностью задания пользовательского HTTPClient для запроса.
func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams { return &VvolBindingDeleteParams{ HTTPClient: client, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewVolumeDeleteParamsWithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteTagParamsWithHTTPClient(client *http.Client) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeletePackageVersionParamsWithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VolumeDeleteParams) WithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewComponentDeleteParamsWithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteLoadBalancerPoolParamsWithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteDataSourceParamsWithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewDeleteConditionParamsWithHTTPClient(client *http.Client) *DeleteConditionParams {\n\tvar ()\n\treturn &DeleteConditionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteSubnetParamsWithHTTPClient(client *http.Client) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteVersionControlRequestParamsWithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteLoadBalancerPoolParams) WithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteNodeParamsWithHTTPClient(client *http.Client) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteSubscribedEventParamsWithHTTPClient(client *http.Client) *DeleteSubscribedEventParams {\n\tvar ()\n\treturn &DeleteSubscribedEventParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *ComponentDeleteParams) WithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ReposDeleteParams) WithHTTPClient(client *http.Client) *ReposDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteVersionControlRequestParams) WithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteKeyPairsParams) WithHTTPClient(client *http.Client) *DeleteKeyPairsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeletePoolProjectParamsWithHTTPClient(client *http.Client) *DeletePoolProjectParams {\n\tvar ()\n\treturn &DeletePoolProjectParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDebugRequestParams) WithHTTPClient(client *http.Client) *DeleteDebugRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteTagParams) WithHTTPClient(client *http.Client) *DeleteTagParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewReposDeleteParamsWithHTTPClient(client *http.Client) *ReposDeleteParams {\n\tvar ()\n\treturn &ReposDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteNamespaceParamsWithHTTPClient(client *http.Client) *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteAttributeParamsWithHTTPClient(client *http.Client) *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteConditionParams) WithHTTPClient(client *http.Client) *DeleteConditionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteNetworkGroupPolicyParamsWithHTTPClient(client *http.Client) *DeleteNetworkGroupPolicyParams {\n\tvar ()\n\treturn &DeleteNetworkGroupPolicyParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeletePoolProjectParams) WithHTTPClient(client *http.Client) *DeletePoolProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteKeyPairsParamsWithHTTPClient(client *http.Client) *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func NewEntryServiceDeleteParamsWithHTTPClient(client *http.Client) *EntryServiceDeleteParams {\n\tvar ()\n\treturn &EntryServiceDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteCwfNetworkIDParamsWithHTTPClient(client *http.Client) *DeleteCwfNetworkIDParams {\n\tvar ()\n\treturn &DeleteCwfNetworkIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteDeviceUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteDeviceUsingDELETEParams {\n\tvar ()\n\treturn &DeleteDeviceUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeletePackageVersionParams) WithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithHTTPClient(client *http.Client) *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteClusterParamsWithHTTPClient(client *http.Client) *DeleteClusterParams {\n\tvar ()\n\treturn &DeleteClusterParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VolumeDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtocolUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteGerritListenerByIDUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewAPIDeleteUserParamsWithHTTPClient(client *http.Client) *APIDeleteUserParams {\n\tvar ()\n\treturn &APIDeleteUserParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteBlueprintsInWorkspaceParamsWithHTTPClient(client *http.Client) *DeleteBlueprintsInWorkspaceParams {\n\tvar ()\n\treturn &DeleteBlueprintsInWorkspaceParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteDebugRequestParamsWithHTTPClient(client *http.Client) *DeleteDebugRequestParams {\n\tvar ()\n\treturn &DeleteDebugRequestParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) WithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubscribedEventParams) WithHTTPClient(client *http.Client) *DeleteSubscribedEventParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteScheduleParamsWithHTTPClient(client *http.Client) *DeleteScheduleParams {\n\tvar ()\n\treturn &DeleteScheduleParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteUserAttributeParamsWithHTTPClient(client *http.Client) *DeleteUserAttributeParams {\n\tvar ()\n\treturn &DeleteUserAttributeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDeviceUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteDeviceUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteSubnetsSubnetPoolParamsWithHTTPClient(client *http.Client) *DeleteSubnetsSubnetPoolParams {\n\tvar ()\n\treturn &DeleteSubnetsSubnetPoolParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDataSourceParams) WithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteNetworkGroupPolicyParams) WithHTTPClient(client *http.Client) *DeleteNetworkGroupPolicyParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteCwfNetworkIDParams) WithHTTPClient(client *http.Client) *DeleteCwfNetworkIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewOrderDeleteParamsWithHTTPClient(client *http.Client) *OrderDeleteParams {\n\treturn &OrderDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeletePacketCapturesParamsWithHTTPClient(client *http.Client) *DeletePacketCapturesParams {\n\treturn &DeletePacketCapturesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteNodeParams) WithHTTPClient(client *http.Client) *DeleteNodeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubnetParams) WithHTTPClient(client *http.Client) *DeleteSubnetParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *EntryServiceDeleteParams) WithHTTPClient(client *http.Client) *EntryServiceDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *OrderDeleteParams) WithHTTPClient(client *http.Client) *OrderDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteSupportUserParamsWithHTTPClient(client *http.Client) *DeleteSupportUserParams {\n\tvar ()\n\treturn &DeleteSupportUserParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteGerritListenerByIDUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteGerritListenerByIDUsingDELETEParams {\n\treturn &DeleteGerritListenerByIDUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewStreamsDeleteParamsWithHTTPClient(client *http.Client) *StreamsDeleteParams {\n\tvar ()\n\treturn &StreamsDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDeviceUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteAttributeParams) WithHTTPClient(client *http.Client) *DeleteAttributeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewNvmeNamespaceDeleteParamsWithHTTPClient(client *http.Client) *NvmeNamespaceDeleteParams {\n\treturn &NvmeNamespaceDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewRemoveGKECredentialParamsWithHTTPClient(client *http.Client) *RemoveGKECredentialParams {\n\tvar ()\n\treturn &RemoveGKECredentialParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteSiteSnippetParamsWithHTTPClient(client *http.Client) *DeleteSiteSnippetParams {\n\tvar ()\n\treturn &DeleteSiteSnippetParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeletePacketCapturesParams) WithHTTPClient(client *http.Client) *DeletePacketCapturesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteBlueprintRequestUsingDELETE1ParamsWithHTTPClient(client *http.Client) *DeleteBlueprintRequestUsingDELETE1Params {\n\treturn &DeleteBlueprintRequestUsingDELETE1Params{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteUsingDELETE1ParamsWithHTTPClient(client *http.Client) *DeleteUsingDELETE1Params {\n\treturn &DeleteUsingDELETE1Params{\n\t\tHTTPClient: client,\n\t}\n}", "func NewDeleteProtectedEntityParamsWithHTTPClient(client *http.Client) *DeleteProtectedEntityParams {\n\treturn &DeleteProtectedEntityParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *APIDeleteUserParams) WithHTTPClient(client *http.Client) *APIDeleteUserParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteNtpServerParamsWithHTTPClient(client *http.Client) *DeleteNtpServerParams {\n\tvar ()\n\treturn &DeleteNtpServerParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteUsingDELETE1Params) WithHTTPClient(client *http.Client) *DeleteUsingDELETE1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteAlertingProfileParams) WithHTTPClient(client *http.Client) *DeleteAlertingProfileParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintsInWorkspaceParams) WithHTTPClient(client *http.Client) *DeleteBlueprintsInWorkspaceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteRolesParamsWithHTTPClient(client *http.Client) *DeleteRolesParams {\n\tvar ()\n\treturn &DeleteRolesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteSubnetsSubnetPoolParams) WithHTTPClient(client *http.Client) *DeleteSubnetsSubnetPoolParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) WithHTTPClient(client *http.Client) *PcloudPlacementgroupsMembersDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteScheduleParams) WithHTTPClient(client *http.Client) *DeleteScheduleParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ComponentDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteClusterParams) WithHTTPClient(client *http.Client) *DeleteClusterParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteLoadBalancerPoolParams() *DeleteLoadBalancerPoolParams {\n\tvar ()\n\treturn &DeleteLoadBalancerPoolParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *ReposDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteV1WebhooksWebhookIDParams) WithHTTPClient(client *http.Client) *DeleteV1WebhooksWebhookIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}" ]
[ "0.8671437", "0.7384527", "0.7372792", "0.73189396", "0.7087894", "0.7058488", "0.6999345", "0.6938914", "0.69215393", "0.68205565", "0.68110675", "0.66864115", "0.66708326", "0.6662493", "0.6658155", "0.6491086", "0.647839", "0.6460584", "0.6460478", "0.6459379", "0.6436317", "0.63970274", "0.63960826", "0.63942814", "0.6389403", "0.63448125", "0.6336681", "0.6322259", "0.6316526", "0.6315967", "0.63104373", "0.6297815", "0.6293162", "0.62880415", "0.62824136", "0.6279546", "0.62461835", "0.62439364", "0.6092158", "0.6086753", "0.6066708", "0.6059862", "0.6046913", "0.60341376", "0.60134166", "0.6012363", "0.6008188", "0.6001543", "0.5980709", "0.5971419", "0.59650445", "0.5950939", "0.5920226", "0.5898683", "0.58887684", "0.5881838", "0.5873334", "0.5862811", "0.58543694", "0.5834226", "0.5830794", "0.5808356", "0.57878876", "0.5776445", "0.57745576", "0.57618535", "0.5760971", "0.5758706", "0.5749976", "0.5735061", "0.5731118", "0.5730668", "0.5714963", "0.5682656", "0.56826276", "0.56816417", "0.56755346", "0.5668115", "0.5667705", "0.56593746", "0.56554055", "0.56552356", "0.56537586", "0.56036776", "0.5600982", "0.5597073", "0.55906636", "0.55878353", "0.55858535", "0.556664", "0.55384696", "0.5536385", "0.55346876", "0.55235815", "0.55163616", "0.5515517", "0.5511289", "0.5508245", "0.5505844", "0.54983914" ]
0.85762304
1
WithDefaults hydrates default values in the vvol binding delete params (not the query body). All values with no default are reset to their zero value.
WithDefaults загружает значения по умолчанию в параметрах vvol binding delete (не в теле запроса). Все значения без значения по умолчанию сбрасываются к своему нулевому значению.
func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams { o.SetDefaults() return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetDefaults() {\n\tvar (\n\t\tdeleteAllReferencesDefault = bool(false)\n\t)\n\n\tval := VvolBindingDeleteParams{\n\t\tDeleteAllReferences: &deleteAllReferencesDefault,\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 *DeleteUsingDELETE1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ComponentDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *OrderDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *NvmeNamespaceDeleteParams) SetDefaults() {\n\tvar (\n\t\tallowDeleteWhileMappedDefault = bool(false)\n\t)\n\n\tval := NvmeNamespaceDeleteParams{\n\t\tAllowDeleteWhileMapped: &allowDeleteWhileMappedDefault,\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 *DeleteVersionControlRequestParams) SetDefaults() {\n\tvar (\n\t\tdisconnectedNodeAcknowledgedDefault = bool(false)\n\t)\n\n\tval := DeleteVersionControlRequestParams{\n\t\tDisconnectedNodeAcknowledged: &disconnectedNodeAcknowledgedDefault,\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 *DeleteBlueprintRequestUsingDELETE1Params) WithDefaults() *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteProtectedEntityParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteDataSourceParams) SetDefaults() {\n\tvar (\n\t\tencryptionModeDefault = string(\"CLEAR\")\n\n\t\tstorageTypeDefault = string(\"LOCAL\")\n\t)\n\n\tval := DeleteDataSourceParams{\n\t\tEncryptionMode: &encryptionModeDefault,\n\t\tStorageType: &storageTypeDefault,\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 *DeleteUsingDELETE1Params) WithDefaults() *DeleteUsingDELETE1Params {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteVersionControlRequestParams) WithDefaults() *DeleteVersionControlRequestParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeletePacketCapturesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceDeprovisionParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *EmsDestinationDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveDropRequestParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteReadonlyClusterParams) SetDefaults() {\n\tvar (\n\t\tisForceDeleteDefault = bool(false)\n\t)\n\n\tval := DeleteReadonlyClusterParams{\n\t\tIsForceDelete: &isForceDeleteDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (config *DeleteConfig) Default() {\r\n\tconfig.CaseName = \"*\" // default: delete from all cases\r\n\tconfig.Endpoint = \"\" // default detele single endpoint\r\n\tconfig.EndpointList = nil // Used if need to delete more than one endpoint\r\n}", "func (o *ComponentDeleteParams) WithDefaults() *ComponentDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteDataSourceParams) WithDefaults() *DeleteDataSourceParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeletePacketCapturesParams) WithDefaults() *DeletePacketCapturesParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteProtectedEntityParams) WithDefaults() *DeleteProtectedEntityParams {\n\to.SetDefaults()\n\treturn o\n}", "func (client IdentityClient) deleteTagDefault(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/tagDefaults/{tagDefaultId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteTagDefaultResponse\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 (o *PcloudPlacementgroupsMembersDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteDevicesDeviceidInterfacesInterfacenameParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceBindingBindingParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *UsersGroupsBulkDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *NvmeNamespaceDeleteParams) WithDefaults() *NvmeNamespaceDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *FreezeParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetIngredientVersionRevisionParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QueryFirewallFieldsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QuerySensorUpdateKernelsDistinctParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetGdprClientsIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetPropertyDescriptorParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteV1WebhooksWebhookIDParams) WithDefaults() *DeleteV1WebhooksWebhookIDParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *QueryChangesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetGCParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func DeleteOptionDefaults() DeleteOptions {\n\treturn DeleteOptions{\n\t\tWithDeleteNamespace(\"default\"),\n\t}\n}", "func (o *GetBundleByKeyParams) SetDefaults() {\n\tvar (\n\t\tauditDefault = string(\"NONE\")\n\n\t\tincludedDeletedDefault = bool(false)\n\t)\n\n\tval := GetBundleByKeyParams{\n\t\tAudit: &auditDefault,\n\t\tIncludedDeleted: &includedDeletedDefault,\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 *OrderDeleteParams) WithDefaults() *OrderDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *BudgetAddParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PcloudCloudinstancesVolumesGetallParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *TestEndpointParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) WithDefaults() *DeleteGerritListenerByIDUsingDELETEParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *GetGatewaysParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveUserGroupParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *StorageServiceOwnershipGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PetListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CapacityPoolGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteUserMetaTagsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ConfigurationBackupGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetRelationTuplesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ListHetznerSizesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SearchIngredientsParams) SetDefaults() {\n\tvar (\n\t\tallowDeletedDefault = bool(false)\n\n\t\tallowUnstableDefault = bool(false)\n\n\t\texactOnlyDefault = bool(false)\n\n\t\tlimitDefault = int64(50)\n\n\t\toffsetDefault = int64(0)\n\n\t\tqDefault = string(\"\")\n\t)\n\n\tval := SearchIngredientsParams{\n\t\tAllowDeleted: &allowDeletedDefault,\n\t\tAllowUnstable: &allowUnstableDefault,\n\t\tExactOnly: &exactOnlyDefault,\n\t\tLimit: &limitDefault,\n\t\tOffset: &offsetDefault,\n\t\tQ: &qDefault,\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 *ConfigGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteAPIRootDomainsDeleteSubdomiansTargetNameRootDomainNameParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (table *Table) DefaultDelete(c Context) (Result, error) {\n\tquery, args, err := table.WherePrimaryKey(false, false, c.Record)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tquery = fmt.Sprintf(\"DELETE FROM %s WHERE %s\", table.Name, query)\n\trst, err := c.DB.Exec(query, args...)\n\treturn NewResult(Context{StateDelete, c.DB, c.DataSet, table, c.Record, Field{}}, rst), err\n}", "func (o *PostDeviceUpsertParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetRouteByIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteAddressesDefault) WithPayload(payload *models.ErrorResponse) *DeleteAddressesDefault {\n\to.Payload = payload\n\treturn o\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *EditParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func DefaultParams() Params {\n\treturn NewParams(\n\t\tDefaultCreateWhoisPrice,\n\t\tDefaultUpdateWhoisPrice,\n\t\tDefaultDeleteWhoisPrice,\n\t)\n}", "func (o *VectorThumbnailParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceDeprovisionParams) WithDefaults() *ServiceInstanceDeprovisionParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *GetComponentByIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostAlertsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteConsulDefault) WithPayload(payload *models.Error) *DeleteConsulDefault {\n\to.Payload = payload\n\treturn o\n}", "func (o *GetDeploymentByIDV3UsingGETParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetProxiesHealthParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SyncStatusUsingGETParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SendJobCommandParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetDevicesUnknownParams) SetDefaults() {\n\tvar (\n\t\tminTrafficDefault = float64(102400)\n\t)\n\n\tval := GetDevicesUnknownParams{\n\t\tMinTraffic: &minTrafficDefault,\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 *DeleteV1SeverityMatrixImpactsImpactIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (xdc *XxxDemoCreate) defaults() {\n\tif _, ok := xdc.mutation.IsDel(); !ok {\n\t\tv := xxxdemo.DefaultIsDel\n\t\txdc.mutation.SetIsDel(v)\n\t}\n\tif _, ok := xdc.mutation.Memo(); !ok {\n\t\tv := xxxdemo.DefaultMemo\n\t\txdc.mutation.SetMemo(v)\n\t}\n\tif _, ok := xdc.mutation.Sort(); !ok {\n\t\tv := xxxdemo.DefaultSort\n\t\txdc.mutation.SetSort(v)\n\t}\n\tif _, ok := xdc.mutation.CreatedAt(); !ok {\n\t\tv := xxxdemo.DefaultCreatedAt()\n\t\txdc.mutation.SetCreatedAt(v)\n\t}\n\tif _, ok := xdc.mutation.UpdatedAt(); !ok {\n\t\tv := xxxdemo.DefaultUpdatedAt()\n\t\txdc.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := xdc.mutation.Status(); !ok {\n\t\tv := xxxdemo.DefaultStatus\n\t\txdc.mutation.SetStatus(v)\n\t}\n\tif _, ok := xdc.mutation.ID(); !ok {\n\t\tv := xxxdemo.DefaultID()\n\t\txdc.mutation.SetID(v)\n\t}\n}", "func (o *ToggleNetworkGeneratorsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DcimRacksListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveDropRequestParams) WithDefaults() *RemoveDropRequestParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *PetCreateParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceBrokerOpenstacksHostsGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) WithDefaults() *PostHostStorageSectorsDeleteMerklerootParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *GetDistrictForSchoolParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ListSSHKeysParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (kcu *K8sContainerUpdate) defaults() {\n\tif _, ok := kcu.mutation.UpdatedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultUpdatedAt()\n\t\tkcu.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := kcu.mutation.DeletedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultDeletedAt()\n\t\tkcu.mutation.SetDeletedAt(v)\n\t}\n}", "func (o *UpdateFlowParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PcloudSapGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PredictParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetCatalogXMLParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (client IdentityClient) DeleteTagDefault(ctx context.Context, request DeleteTagDefaultRequest) (response DeleteTagDefaultResponse, 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.deleteTagDefault, 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 = DeleteTagDefaultResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = DeleteTagDefaultResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(DeleteTagDefaultResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into DeleteTagDefaultResponse\")\n\t}\n\treturn\n}", "func (kcuo *K8sContainerUpdateOne) defaults() {\n\tif _, ok := kcuo.mutation.UpdatedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultUpdatedAt()\n\t\tkcuo.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := kcuo.mutation.DeletedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultDeletedAt()\n\t\tkcuo.mutation.SetDeletedAt(v)\n\t}\n}", "func (o *RTRExecuteActiveResponderCommandParams) SetDefaults() {\n\t// no default values defined for this parameter\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 DefaultParams() Params {\n\tacl := ACL(make([]ACLPair, 0))\n\tu := NewUpgrade(0, \"\")\n\treturn Params{\n\t\tACL: acl,\n\t\tDAOOwner: sdk.Address{},\n\t\tUpgrade: u,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams {\n\to.SetDeleteAllReferences(deleteAllReferences)\n\treturn o\n}", "func (o *V2DeregisterClusterParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CreateMigrationInvoiceParams) SetDefaults() {\n\t// no default values defined for this parameter\n}" ]
[ "0.8024694", "0.69307846", "0.6919275", "0.68561697", "0.68067634", "0.6789882", "0.6783438", "0.6654979", "0.65403056", "0.64354616", "0.6425076", "0.6423718", "0.63207895", "0.6310937", "0.62996227", "0.6297419", "0.6264217", "0.6254231", "0.624768", "0.6148051", "0.60388494", "0.6012384", "0.5956311", "0.59305555", "0.58641547", "0.58582264", "0.5846466", "0.58085257", "0.57567585", "0.5746949", "0.57467264", "0.57295346", "0.5717134", "0.57142735", "0.5706435", "0.5659719", "0.5657857", "0.5609161", "0.55923116", "0.5590901", "0.5586508", "0.55653846", "0.55530757", "0.55310476", "0.5485754", "0.5470397", "0.5431576", "0.5428443", "0.5426604", "0.5414084", "0.5412581", "0.5404402", "0.5403203", "0.5400778", "0.53993726", "0.5383455", "0.53698677", "0.53668857", "0.53653777", "0.53583443", "0.5357834", "0.5351725", "0.5351045", "0.5350642", "0.53472704", "0.5342387", "0.53358227", "0.53302574", "0.5329718", "0.53236544", "0.53046924", "0.5300839", "0.5299261", "0.5288364", "0.527947", "0.5258427", "0.5254454", "0.52418596", "0.5235531", "0.52354777", "0.5233771", "0.52337676", "0.523081", "0.52288467", "0.5227181", "0.5224047", "0.5222722", "0.5212543", "0.52108693", "0.52094275", "0.5207534", "0.51987344", "0.5193591", "0.5182554", "0.5178325", "0.5171396", "0.5171165", "0.5169184", "0.51648587", "0.5162138" ]
0.7161946
1
SetDefaults hydrates default values in the vvol binding delete params (not the query body). All values with no default are reset to their zero value.
SetDefaults загружает значения по умолчанию для параметров удаления vvol связывания (не в теле запроса). Все значения без значения по умолчанию сбрасываются к своему нулевому значению.
func (o *VvolBindingDeleteParams) SetDefaults() { var ( deleteAllReferencesDefault = bool(false) ) val := VvolBindingDeleteParams{ DeleteAllReferences: &deleteAllReferencesDefault, } val.timeout = o.timeout val.Context = o.Context val.HTTPClient = o.HTTPClient *o = val }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ComponentDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteUsingDELETE1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *OrderDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *NvmeNamespaceDeleteParams) SetDefaults() {\n\tvar (\n\t\tallowDeleteWhileMappedDefault = bool(false)\n\t)\n\n\tval := NvmeNamespaceDeleteParams{\n\t\tAllowDeleteWhileMapped: &allowDeleteWhileMappedDefault,\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 *DeleteVersionControlRequestParams) SetDefaults() {\n\tvar (\n\t\tdisconnectedNodeAcknowledgedDefault = bool(false)\n\t)\n\n\tval := DeleteVersionControlRequestParams{\n\t\tDisconnectedNodeAcknowledged: &disconnectedNodeAcknowledgedDefault,\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 *DeleteDataSourceParams) SetDefaults() {\n\tvar (\n\t\tencryptionModeDefault = string(\"CLEAR\")\n\n\t\tstorageTypeDefault = string(\"LOCAL\")\n\t)\n\n\tval := DeleteDataSourceParams{\n\t\tEncryptionMode: &encryptionModeDefault,\n\t\tStorageType: &storageTypeDefault,\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 *DeleteProtectedEntityParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeletePacketCapturesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceDeprovisionParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveDropRequestParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *EmsDestinationDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteReadonlyClusterParams) SetDefaults() {\n\tvar (\n\t\tisForceDeleteDefault = bool(false)\n\t)\n\n\tval := DeleteReadonlyClusterParams{\n\t\tIsForceDelete: &isForceDeleteDefault,\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 *UsersGroupsBulkDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *FreezeParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetPropertyDescriptorParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceBindingBindingParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetIngredientVersionRevisionParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *DeleteDevicesDeviceidInterfacesInterfacenameParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QueryFirewallFieldsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithDefaults() *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetDefaults()\n\treturn o\n}", "func (o *GetGCParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ConfigurationBackupGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (tb *TriggerBinding) SetDefaults(ctx context.Context) {}", "func (o *ListHetznerSizesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetGatewaysParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QuerySensorUpdateKernelsDistinctParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *EditParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteUserMetaTagsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *BudgetAddParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RemoveUserGroupParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetBundleByKeyParams) SetDefaults() {\n\tvar (\n\t\tauditDefault = string(\"NONE\")\n\n\t\tincludedDeletedDefault = bool(false)\n\t)\n\n\tval := GetBundleByKeyParams{\n\t\tAudit: &auditDefault,\n\t\tIncludedDeleted: &includedDeletedDefault,\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 *TestEndpointParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SetUniverseBackupFlagParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetGdprClientsIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ConfigGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *QueryChangesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CreateMigrationInvoiceParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetProxiesHealthParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ToggleNetworkGeneratorsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostAlertsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ConfigurationBackupModifyParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *UpdateFlowParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PutGatewaysIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *SendJobCommandParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *VectorThumbnailParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostDeviceUpsertParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RTRExecuteActiveResponderCommandParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *StorageServiceOwnershipGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostV1ServicesServiceLinksParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ListEtcdRestoreParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ListSSHKeysParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PredictParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteV1SeverityMatrixImpactsImpactIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetCatalogXMLParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PetListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostReplicationPoliciesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetRelationTuplesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DcimRacksListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceInstanceGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetBackupLocationsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetRouteByIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteAPIRootDomainsDeleteSubdomiansTargetNameRootDomainNameParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RegenerateDeployKeyParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetComponentByIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *UpdateComparisonReportParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *UpdateFolderParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CapacityPoolGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *BatchUpsertCatalogObjectsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteUsingDELETE1Params) WithDefaults() *DeleteUsingDELETE1Params {\n\to.SetDefaults()\n\treturn o\n}", "func (o *PostDevicesDeviceidBackupsBackupidApplyParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetFqdnCacheParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ExtrasSavedFiltersListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetOutagesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PetCreateParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ValidateParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *DeleteVersionControlRequestParams) WithDefaults() *DeleteVersionControlRequestParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *SearchIngredientsParams) SetDefaults() {\n\tvar (\n\t\tallowDeletedDefault = bool(false)\n\n\t\tallowUnstableDefault = bool(false)\n\n\t\texactOnlyDefault = bool(false)\n\n\t\tlimitDefault = int64(50)\n\n\t\toffsetDefault = int64(0)\n\n\t\tqDefault = string(\"\")\n\t)\n\n\tval := SearchIngredientsParams{\n\t\tAllowDeleted: &allowDeletedDefault,\n\t\tAllowUnstable: &allowUnstableDefault,\n\t\tExactOnly: &exactOnlyDefault,\n\t\tLimit: &limitDefault,\n\t\tOffset: &offsetDefault,\n\t\tQ: &qDefault,\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 *GetDistrictForSchoolParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *V2DeregisterClusterParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ServiceBrokerOpenstacksHostsGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetDevicesUnknownParams) SetDefaults() {\n\tvar (\n\t\tminTrafficDefault = float64(102400)\n\t)\n\n\tval := GetDevicesUnknownParams{\n\t\tMinTraffic: &minTrafficDefault,\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 *GetCurrentGenerationParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostV1CatalogsCatalogIDIngestParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *FetchIntegrationFormParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PcloudSapGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *WaitListParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PostContextsAddPhpParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *PutNmsUpdateParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (config *DeleteConfig) Default() {\r\n\tconfig.CaseName = \"*\" // default: delete from all cases\r\n\tconfig.Endpoint = \"\" // default detele single endpoint\r\n\tconfig.EndpointList = nil // Used if need to delete more than one endpoint\r\n}", "func (o *GetTasksGetPhpParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *RTRCheckAdminCommandStatusParams) SetDefaults() {\n\tvar (\n\t\tsequenceIDDefault = int64(0)\n\t)\n\n\tval := RTRCheckAdminCommandStatusParams{\n\t\tSequenceID: sequenceIDDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (kcu *K8sContainerUpdate) defaults() {\n\tif _, ok := kcu.mutation.UpdatedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultUpdatedAt()\n\t\tkcu.mutation.SetUpdatedAt(v)\n\t}\n\tif _, ok := kcu.mutation.DeletedAt(); !ok {\n\t\tv := k8scontainer.UpdateDefaultDeletedAt()\n\t\tkcu.mutation.SetDeletedAt(v)\n\t}\n}" ]
[ "0.75364006", "0.75100535", "0.7508836", "0.74438876", "0.7425384", "0.729681", "0.7260536", "0.72358084", "0.7212591", "0.71349096", "0.71285725", "0.7104628", "0.7054597", "0.7035304", "0.697078", "0.6863822", "0.67509896", "0.6714793", "0.67139083", "0.6703411", "0.66607034", "0.6623859", "0.66021234", "0.65921557", "0.6572527", "0.6521013", "0.65193015", "0.65039045", "0.6495045", "0.6491504", "0.6487894", "0.6468901", "0.6467066", "0.6460907", "0.6454707", "0.6442284", "0.64396435", "0.6420461", "0.64119095", "0.6401026", "0.63962585", "0.6381976", "0.63818043", "0.6372911", "0.63682705", "0.63598377", "0.6359107", "0.6352658", "0.63448656", "0.6317265", "0.6315751", "0.63139856", "0.63030815", "0.62954146", "0.6277245", "0.62736607", "0.6267421", "0.62609166", "0.62594646", "0.6257717", "0.6257233", "0.62449193", "0.6236483", "0.6234443", "0.6229176", "0.62250406", "0.6220144", "0.6212632", "0.6211171", "0.6210533", "0.62082314", "0.62040067", "0.6202852", "0.6193654", "0.6173255", "0.6158375", "0.6157157", "0.61546177", "0.61363393", "0.6135296", "0.6126472", "0.6119994", "0.61066306", "0.6103761", "0.60918474", "0.6078725", "0.60731566", "0.60723615", "0.60564595", "0.60529476", "0.60517085", "0.60488623", "0.6046046", "0.60314435", "0.6017388", "0.60170895", "0.60166365", "0.6009942", "0.60007155", "0.599688" ]
0.84096485
0
WithTimeout adds the timeout to the vvol binding delete params
WithTimeout добавляет таймаут в параметры удаления привязки vvol
func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams { o.SetTimeout(timeout) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *VolumeDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteProtocolUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (builder *TsDeleteRowCommandBuilder) WithTimeout(timeout time.Duration) *TsDeleteRowCommandBuilder {\n\ttimeoutMilliseconds := uint32(timeout / time.Millisecond)\n\tbuilder.timeout = timeout\n\tbuilder.protobuf.Timeout = &timeoutMilliseconds\n\treturn builder\n}", "func (o *DeletePackageVersionParams) WithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewVolumeDeleteParamsWithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDeviceUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePackageVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeletePackageVersionParamsWithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ComponentDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteVersionControlRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteTagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLoadBalancerPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDebugRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteVersionControlRequestParams) WithTimeout(timeout time.Duration) *DeleteVersionControlRequestParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteConditionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDataSourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteTagParams) WithTimeout(timeout time.Duration) *DeleteTagParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteKeyPairsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePoolProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteKeyPairsParams) WithTimeout(timeout time.Duration) *DeleteKeyPairsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDebugRequestParams) WithTimeout(timeout time.Duration) *DeleteDebugRequestParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteProtectedEntityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NodesDelTagByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EntryServiceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteFreeIpaByEnvironmentV1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ReposDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServiceInstanceDeprovisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ComponentDeleteParams) WithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *OrderDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithTimeout(timeout time.Duration) *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeletePoolProjectParams) WithTimeout(timeout time.Duration) *DeletePoolProjectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteUsingDELETE1Params) WithTimeout(timeout time.Duration) *DeleteUsingDELETE1Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubscribedEventParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePacketCapturesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCwfNetworkIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveGKECredentialParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteAttributeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NvmeNamespaceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePrincipalIdentityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePacketCapturesParams) WithTimeout(timeout time.Duration) *DeletePacketCapturesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteSubnetParams) WithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteAttributeParams) WithTimeout(timeout time.Duration) *DeleteAttributeParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteProtectedEntityParams) WithTimeout(timeout time.Duration) *DeleteProtectedEntityParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *EmsDestinationDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteConditionParams) WithTimeout(timeout time.Duration) *DeleteConditionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewComponentDeleteParamsWithTimeout(timeout time.Duration) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteSubnetParamsWithTimeout(timeout time.Duration) *DeleteSubnetParams {\n\tvar ()\n\treturn &DeleteSubnetParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(opts *VDRI) {\n\t\topts.client.Timeout = timeout\n\t}\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetsSubnetPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewLedgerVoucherAttachmentDeleteAttachmentParamsWithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\tvar (\n\t\tsendToInboxDefault = bool(false)\n\t\tsplitDefault = bool(false)\n\t)\n\treturn &LedgerVoucherAttachmentDeleteAttachmentParams{\n\t\tSendToInbox: &sendToInboxDefault,\n\t\tSplit: &splitDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) WithTimeout(timeout time.Duration) *RevokeDeviceCertificateUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteTagParamsWithTimeout(timeout time.Duration) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionsRemoveParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNtpServerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteScheduleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CompanyCompanyRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNetworkGroupPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewDeleteNodeParamsWithTimeout(timeout time.Duration) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNodeParams) WithTimeout(timeout time.Duration) *DeleteNodeParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PublicRemoveTrustedDeviceV4Params) WithTimeout(timeout time.Duration) *PublicRemoveTrustedDeviceV4Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDeviceUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteDeviceUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteBlueprintsInWorkspaceParams) WithTimeout(timeout time.Duration) *DeleteBlueprintsInWorkspaceParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteLoadBalancerPoolParams) WithTimeout(timeout time.Duration) *DeleteLoadBalancerPoolParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteDataSourceParams) WithTimeout(timeout time.Duration) *DeleteDataSourceParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *NodesDelTagByIDParams) WithTimeout(timeout time.Duration) *NodesDelTagByIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func DeleteVNet(vNetName string, rgroupName string) {\n\ta := wow.New(os.Stdout, spin.Get(spin.Dots), \"Deleting virtual network : \"+vNetName)\n\ta.Start()\n\ttime.Sleep(2 * time.Second)\n\ta.Text(\"This would take a few minutes...\").Spinner(spin.Get(spin.Dots))\n\tcmd := exec.Command(\"az\", \"network\", \"vnet\", \"delete\", \"--name\",\n\t\tvNetName, \"--resource-group\", rgroupName)\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprint(err) + \": \" + stderr.String())\n\t\treturn\n\t}\n\ta.PersistWith(spin.Spinner{}, \"....\")\n\tfmt.Println(\"Result: \" + out.String())\n}", "func (o *RemoveDropRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSiteDeployParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c *HTTPClient) Delete(q *Query, timeout time.Duration) error {\n if q == nil {\n return fmt.Errorf(\"kairosdb: nil query passed\")\n }\n payload, err := json.Marshal(q)\n if err != nil {\n return fmt.Errorf(\"error unmarshalling query:%v :: %v\", q, err)\n }\n\n glog.Infof(\"deleting datapoints payload: %v\", string(payload))\n reader := ioutil.NopCloser(bytes.NewReader(payload))\n err = c.backend.Call(\"POST\", c.url+\"/api/v1/datapoints/delete\", reader,\n timeout, http.StatusNoContent, nil)\n if err != nil {\n return fmt.Errorf(\"error deleting datapoints for query: %v :: %v\",\n string(payload), err)\n }\n\n glog.Infof(\"datapoints deleted successfully for query: %+v\", q)\n return nil\n}", "func NewDeleteDataSourceParamsWithTimeout(timeout time.Duration) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *DeleteAlertingProfileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServiceInstanceDeprovisionParams) WithTimeout(timeout time.Duration) *ServiceInstanceDeprovisionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteReadonlyClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNamespaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveAPIKeyPrivilegeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StreamsDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCwfNetworkIDParams) WithTimeout(timeout time.Duration) *DeleteCwfNetworkIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithTimeout(timeout time.Duration) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetTimeout(timeout)\n\treturn o\n}" ]
[ "0.7468831", "0.67573833", "0.6754353", "0.66252846", "0.6508116", "0.6367591", "0.6355736", "0.63485533", "0.6238335", "0.6232378", "0.62192976", "0.621058", "0.6202076", "0.6191659", "0.61659044", "0.616456", "0.6153679", "0.60536504", "0.5998588", "0.5980925", "0.597944", "0.59703755", "0.5935428", "0.5929296", "0.5912495", "0.59029806", "0.5894181", "0.58854914", "0.5881308", "0.5875906", "0.58734554", "0.58504975", "0.5826565", "0.58203435", "0.58185273", "0.58160657", "0.58130604", "0.5809414", "0.58068055", "0.58035344", "0.5780497", "0.5775577", "0.5745523", "0.5728427", "0.5727984", "0.57045275", "0.5693936", "0.5669721", "0.5658738", "0.56555134", "0.56368816", "0.5636105", "0.5631534", "0.56267315", "0.56246364", "0.5611716", "0.5607365", "0.55987734", "0.5592739", "0.558584", "0.55679536", "0.5566606", "0.55655193", "0.55597365", "0.5558777", "0.5558448", "0.5557868", "0.5555495", "0.5549898", "0.5549356", "0.55472034", "0.5538442", "0.55300516", "0.5516755", "0.55120164", "0.5509365", "0.55015504", "0.5500991", "0.54960126", "0.5490992", "0.548088", "0.54640263", "0.54582775", "0.54512477", "0.5445996", "0.5442495", "0.5414057", "0.53913385", "0.5389217", "0.5386954", "0.5382966", "0.53787875", "0.53709054", "0.5364477", "0.5360831", "0.5360458", "0.5357815", "0.53524077", "0.53519464", "0.53494716" ]
0.751193
0
SetTimeout adds the timeout to the vvol binding delete params
SetTimeout добавляет таймаут в параметры удаления vvol привязки
func (o *VvolBindingDeleteParams) SetTimeout(timeout time.Duration) { o.timeout = timeout }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VolumeDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteProtocolUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDebugRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePackageVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDeviceUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteVersionControlRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ComponentDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteUsingDELETE1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLoadBalancerPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePoolProjectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteTagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDataSourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteConditionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EntryServiceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteKeyPairsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCwfNetworkIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteFreeIpaByEnvironmentV1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NodesDelTagByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteProtectedEntityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServiceInstanceDeprovisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePacketCapturesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ReposDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNtpServerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveGKECredentialParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubscribedEventParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *OrderDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSubnetsSubnetPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteAttributeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NvmeNamespaceDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionsRemoveParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLTENetworkIDNetworkProbeTasksTaskIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNetworkGroupPolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePrincipalIdentityParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteScheduleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveDropRequestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EmsDestinationDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveAPIKeyPrivilegeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *MonitorDeleteMaintenancePeriodFromMonitorParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteDevicesDeviceidInterfacesInterfacenameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteGroupConfigurationAdminV1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteLifecycleSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSiteDeployParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteChartrepoRepoChartsNameVersionLabelsIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ReadStorageV1alpha1VolumeAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteReadonlyClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNamespaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *TokenDeleteOrgParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *FreezeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteaspecificEmergencyMappingContainerParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteBasketsByIDPaymentInstrumentsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetVrackServiceNameDedicatedCloudDedicatedCloudParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServiceBindingBindingParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CompanyCompanyRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSyslogPoliciesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSiteSnippetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteActionTemplateSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetIngredientVersionRevisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeletePackageVersionParams) WithTimeout(timeout time.Duration) *DeletePackageVersionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetBootVolumeAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNetworksNetworkIDTiersTierIDImagesImageNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteKubeClusterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchSepainstantIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveControlFromGroupParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteAlertingProfileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSystemObjectDefinitionsByIDAttributeGroupsByIDAttributeDefinitionsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteClusterClusterIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetNetworkAppliancePortParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveReceiverParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AdminDeleteProfanityFilterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateDrgAttachmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RTRExecuteActiveResponderCommandParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPurgeStatusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteSupportUserParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetNdmpSettingsVariableParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StreamsDeleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetGCParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ViewsGetByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchStorageVirtualDriveExtensionsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}" ]
[ "0.7573724", "0.7207692", "0.7046025", "0.7044389", "0.70108753", "0.7000114", "0.6995935", "0.6985808", "0.6983977", "0.69346863", "0.6927923", "0.68983376", "0.68788433", "0.6873153", "0.68369544", "0.68284047", "0.6817396", "0.6802894", "0.6794395", "0.67751145", "0.67681706", "0.67668825", "0.6759894", "0.6757143", "0.6750158", "0.6744437", "0.67424077", "0.67227346", "0.66763014", "0.66705173", "0.6668354", "0.6648364", "0.66477716", "0.6632924", "0.66299635", "0.6620888", "0.65999866", "0.6595887", "0.65710115", "0.6533902", "0.6533491", "0.652609", "0.65201336", "0.6509709", "0.6493237", "0.6487399", "0.64850545", "0.6464736", "0.6453436", "0.6449628", "0.6441235", "0.64181376", "0.64173007", "0.637364", "0.63710725", "0.6362126", "0.6329201", "0.6326512", "0.6324322", "0.6323399", "0.63233083", "0.6322812", "0.63121855", "0.6310189", "0.62969565", "0.6281542", "0.6281247", "0.62785923", "0.62761176", "0.6268588", "0.62662953", "0.62594545", "0.62567544", "0.6250593", "0.62477493", "0.6217439", "0.6214416", "0.6208767", "0.6207442", "0.62049836", "0.62047017", "0.618918", "0.61873525", "0.61871016", "0.61855537", "0.61811393", "0.61749965", "0.61657274", "0.61652994", "0.6163747", "0.61590475", "0.61527085", "0.61519593", "0.6148325", "0.61476624", "0.61459875", "0.6135266", "0.6133013", "0.6129995", "0.61268073" ]
0.81471366
0
SetContext adds the context to the vvol binding delete params
SetContext добавляет контекст в параметры удаления vvol-связи
func (o *VvolBindingDeleteParams) SetContext(ctx context.Context) { o.Context = ctx }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (t *TrudyPipe) DeleteContext(key string) {\n\tt.pipeMutex.Lock()\n\tdelete(t.KV, key)\n\tt.pipeMutex.Unlock()\n}", "func (o *VolumeDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteProtocolUsingDELETEParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall) Context(ctx context.Context) *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ComponentDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteProtocolUsingDELETEParams) WithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func DeleteContext(oldContext unsafe.Pointer) unsafe.Pointer {\n\tret, _, _ := syscall.Syscall(gpDeleteContext, 1, uintptr(oldContext), 0, 0)\n\treturn (unsafe.Pointer)(ret)\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ReposDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (r *ManagedServiceDeleteRequest) SendContext(ctx context.Context) (result *ManagedServiceDeleteResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\theader := helpers.CopyHeader(r.header)\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"DELETE\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &ManagedServiceDeleteResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\treader := bufio.NewReader(response.Body)\n\t_, err = reader.Peek(1)\n\tif err == io.EOF {\n\t\terr = nil\n\t\treturn\n\t}\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalErrorStatus(reader, result.status)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\treturn\n}", "func (o *VolumeDeleteParams) WithContext(ctx context.Context) *VolumeDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_obj *DataService) DeleteApplyWithContext(tarsCtx context.Context, wx_id string, club_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"deleteApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 3, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *NvmeNamespaceDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteVersionControlRequestParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *Apichannels) Channels_deleteChannelWithContext(tarsCtx context.Context, params *TLchannels_deleteChannel, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_deleteChannel\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (c *DynamicTargetingKeysDeleteCall) Context(ctx context.Context) *DynamicTargetingKeysDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteSubscribedEventParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *NodesDelTagByIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ServiceInstanceDeprovisionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (w *Webhook) DeleteContext(ctx context.Context) error {\n\treturn globalClient.DeleteWebhookContext(ctx, w.ID)\n}", "func (o *DeleteDeviceUsingDELETEParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeletePacketCapturesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteDataSourceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (req *DeleteRequest) Context(ctx context.Context) *DeleteRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "func (o *DeleteUsingDELETE1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RemoveGKECredentialParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *Client) DeleteVersionContext(ctx context.Context, projectIDOrKey interface{}, versionID int) (*Version, error) {\n\tu := fmt.Sprintf(\"/api/v2/projects/%v/versions/%v\", projectIDOrKey, versionID)\n\n\treq, err := c.NewRequest(\"DELETE\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tversion := new(Version)\n\tif err := c.Do(ctx, req, &version); err != nil {\n\t\treturn nil, err\n\t}\n\treturn version, nil\n}", "func (r *Readarr) DeleteImportListContext(ctx context.Context, importListID int64) error {\n\treq := starr.Request{URI: path.Join(bpImportList, fmt.Sprint(importListID))}\n\tif err := r.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *Apichannels) Channels_deleteChannelOneWayWithContext(tarsCtx context.Context, params *TLchannels_deleteChannel, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"channels_deleteChannel\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *RemoveReceiverParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *VariantsetsDeleteCall) Context(ctx context.Context) *VariantsetsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *RemoveDropRequestParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteDebugRequestParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *EntryServiceDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsDeleteDataCall) Context(ctx context.Context) *OrganizationsEnvironmentsApisRevisionsDebugsessionsDeleteDataCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteKeyPairsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (k *K8S) DeleteContext() map[string]string {\n\treturn k8sContext(k.ns)\n}", "func (o *DeleteUsingDELETE1Params) WithContext(ctx context.Context) *DeleteUsingDELETE1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *DataService) DeleteApplyOneWayWithContext(tarsCtx context.Context, wx_id string, club_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(club_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"deleteApply\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (o *DeleteProtectedEntityParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *PropertiesIosAppDataStreamsMeasurementProtocolSecretsDeleteCall) Context(ctx context.Context) *PropertiesIosAppDataStreamsMeasurementProtocolSecretsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *ServiceBindingBindingParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *DataService) DeleteActivityRecordWithContext(tarsCtx context.Context, activity_id string, wx_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(activity_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(wx_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"deleteActivityRecord\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _is.Read_int32(&(*affectRows), 3, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (s *Sonarr) DeleteImportListContext(ctx context.Context, importListID int64) error {\n\treq := starr.Request{URI: path.Join(bpImportList, fmt.Sprint(importListID))}\n\tif err := s.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (o *DeletePackageVersionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ActionsRemoveParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteKeyPairsParams) WithContext(ctx context.Context) *DeleteKeyPairsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteNodeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeletePackageVersionParams) WithContext(ctx context.Context) *DeletePackageVersionParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteProtectedEntityParams) WithContext(ctx context.Context) *DeleteProtectedEntityParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (c *PropertiesAndroidAppDataStreamsMeasurementProtocolSecretsDeleteCall) Context(ctx context.Context) *PropertiesAndroidAppDataStreamsMeasurementProtocolSecretsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (r *ClusterDeleteRequest) SendContext(ctx context.Context) (result *ClusterDeleteResponse, err error) {\n\tquery := helpers.CopyQuery(r.query)\n\tif r.deprovision != nil {\n\t\thelpers.AddValue(&query, \"deprovision\", *r.deprovision)\n\t}\n\theader := helpers.CopyHeader(r.header)\n\turi := &url.URL{\n\t\tPath: r.path,\n\t\tRawQuery: query.Encode(),\n\t}\n\trequest := &http.Request{\n\t\tMethod: \"DELETE\",\n\t\tURL: uri,\n\t\tHeader: header,\n\t}\n\tif ctx != nil {\n\t\trequest = request.WithContext(ctx)\n\t}\n\tresponse, err := r.transport.RoundTrip(request)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\tresult = &ClusterDeleteResponse{}\n\tresult.status = response.StatusCode\n\tresult.header = response.Header\n\tif result.status >= 400 {\n\t\tresult.err, err = errors.UnmarshalError(response.Body)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = result.err\n\t\treturn\n\t}\n\treturn\n}", "func SetDeleteSessionFlagInContext(ctx context.Context) {\n\t// create a header that the gateway will watch for\n\theader := metadata.Pairs(\"gateway-session-delete\", \"true\")\n\t// send the header back to the gateway\n\tgrpc.SendHeader(ctx, header)\n}", "func (o *GetaspecificPbxDeviceFirmwareBinaryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *OrganizationsSharedflowsRevisionsDeleteCall) Context(ctx context.Context) *OrganizationsSharedflowsRevisionsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteLoadBalancerPoolParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (client *WANPPPConnection1) DeletePortMappingCtx(\n\tctx context.Context,\n\tNewRemoteHost string,\n\tNewExternalPort uint16,\n\tNewProtocol string,\n) (err error) {\n\t// Request structure.\n\trequest := &struct {\n\t\tNewRemoteHost string\n\t\tNewExternalPort string\n\t\tNewProtocol string\n\t}{}\n\t// BEGIN Marshal arguments into request.\n\n\tif request.NewRemoteHost, err = soap.MarshalString(NewRemoteHost); err != nil {\n\t\treturn\n\t}\n\tif request.NewExternalPort, err = soap.MarshalUi2(NewExternalPort); err != nil {\n\t\treturn\n\t}\n\tif request.NewProtocol, err = soap.MarshalString(NewProtocol); err != nil {\n\t\treturn\n\t}\n\t// END Marshal arguments into request.\n\n\t// Response structure.\n\tresponse := interface{}(nil)\n\n\t// Perform the SOAP call.\n\tif err = client.SOAPClient.PerformActionCtx(ctx, URN_WANPPPConnection_1, \"DeletePortMapping\", request, response); err != nil {\n\t\treturn\n\t}\n\n\t// BEGIN Unmarshal arguments from response.\n\n\t// END Unmarshal arguments from response.\n\treturn\n}", "func (c *Client) DeleteTagContext(ctx context.Context, t string) error {\n\treq := &api.TagsDeleteRequest{\n\t\tTag: t,\n\t}\n\tresp := &api.TagsDeleteResponse{}\n\terr := c.postContext(ctx, \"tags/delete\", req, resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *CallsetsDeleteCall) Context(ctx context.Context) *CallsetsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithContext(ctx context.Context) *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *DeleteAPI24ProtectionGroupSnapshotsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteCwfNetworkIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func (o *StopGatewayBundleUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (l *Lidarr) DeleteAlbumContext(ctx context.Context, albumID int64, deleteFiles, addImportExclusion bool) error {\n\treq := starr.Request{URI: path.Join(bpAlbum, fmt.Sprint(albumID)), Query: make(url.Values)}\n\treq.Query.Set(\"deleteFiles\", fmt.Sprint(deleteFiles))\n\treq.Query.Set(\"addImportListExclusion\", fmt.Sprint(addImportExclusion))\n\n\tif err := l.DeleteAny(ctx, req); err != nil {\n\t\treturn fmt.Errorf(\"api.Delete(%s): %w\", &req, err)\n\t}\n\n\treturn nil\n}", "func (o *EmsDestinationDeleteParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (b *Bucket) DeleteContext(ctx context.Context, fileID interface{}) error {\n\t// If no deadline is set on the passed-in context, Timeout is set on the Client, and context is\n\t// not already a Timeout context, honor Timeout in new Timeout context for operation execution to\n\t// be shared by both delete operations.\n\tif _, deadlineSet := ctx.Deadline(); !deadlineSet && b.db.Client().Timeout() != nil && !csot.IsTimeoutContext(ctx) {\n\t\tnewCtx, cancelFunc := csot.MakeTimeoutContext(ctx, *b.db.Client().Timeout())\n\t\t// Redefine ctx to be the new timeout-derived context.\n\t\tctx = newCtx\n\t\t// Cancel the timeout-derived context at the end of Execute to avoid a context leak.\n\t\tdefer cancelFunc()\n\t}\n\n\t// Delete document in files collection and then chunks to minimize race conditions.\n\tres, err := b.filesColl.DeleteOne(ctx, bson.D{{\"_id\", fileID}})\n\tif err == nil && res.DeletedCount == 0 {\n\t\terr = ErrFileNotFound\n\t}\n\tif err != nil {\n\t\t_ = b.deleteChunks(ctx, fileID) // Can attempt to delete chunks even if no docs in files collection matched.\n\t\treturn err\n\t}\n\n\treturn b.deleteChunks(ctx, fileID)\n}", "func (material *Material) DeleteInContext(ctx *aero.Context) error {\n\treturn material.Delete()\n}", "func (c *OrganizationsApisRevisionsDeleteCall) Context(ctx context.Context) *OrganizationsApisRevisionsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteRestapiV10AccountAccountIDExtensionExtensionIDMessageStoreMessageIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *ProjectsPatchDeploymentsDeleteCall) Context(ctx context.Context) *ProjectsPatchDeploymentsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteTagParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *AppsModulesVersionsDeleteCall) Context(ctx context.Context) *AppsModulesVersionsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteVersionControlRequestParams) WithContext(ctx context.Context) *DeleteVersionControlRequestParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *AdminDeleteProfanityFilterParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteConditionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *Client) DeleteContext(keyname string) error {\n\n\tc.m.Lock()\n\tdefer c.m.Unlock()\n\n\tctx, ok := c.ctx[keyname]\n\tif !ok {\n\t\treturn errors.New(\"No such context\")\n\t}\n\n\tctx.client.Destroy()\n\n\tdelete(c.ctx, keyname)\n\n\treturn nil\n}", "func (o *DeleteNetworkGroupPolicyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PatchStorageVirtualDriveExtensionsMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *OrganizationsApiproductsAttributesDeleteCall) Context(ctx context.Context) *OrganizationsApiproductsAttributesDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *DeleteNtpServerParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeleteChartrepoRepoChartsNameVersionLabelsIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *DeletePoolProjectParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *DataService) DeleteActivityRecordOneWayWithContext(tarsCtx context.Context, activity_id string, wx_id string, affectRows *int32, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(activity_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_string(wx_id, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = _os.Write_int32((*affectRows), 3)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 1, \"deleteActivityRecord\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (c *PropertiesWebDataStreamsMeasurementProtocolSecretsDeleteCall) Context(ctx context.Context) *PropertiesWebDataStreamsMeasurementProtocolSecretsDeleteCall {\n\tc.ctx_ = ctx\n\treturn c\n}" ]
[ "0.66318446", "0.6619967", "0.61802596", "0.6071842", "0.6011937", "0.59528744", "0.57643175", "0.56513625", "0.56484604", "0.56130177", "0.5583455", "0.5573217", "0.5562416", "0.5535417", "0.5529479", "0.5527358", "0.55204093", "0.5519037", "0.55094343", "0.5493999", "0.54924464", "0.5465449", "0.5453682", "0.54522926", "0.54501975", "0.5446419", "0.5425906", "0.5425195", "0.54180413", "0.5413311", "0.5396725", "0.5395351", "0.5388578", "0.5385555", "0.5376396", "0.5351098", "0.53356975", "0.5335197", "0.53338104", "0.53298783", "0.5322833", "0.53042626", "0.5301756", "0.53012216", "0.5296832", "0.528788", "0.52835554", "0.527684", "0.5273054", "0.5272508", "0.52721876", "0.5267541", "0.52644914", "0.52533036", "0.5248373", "0.5246007", "0.52446085", "0.52371764", "0.5231704", "0.5221293", "0.5221091", "0.52174884", "0.5217239", "0.5216747", "0.5213936", "0.52133566", "0.52097595", "0.5207813", "0.51912105", "0.51857585", "0.5180597", "0.51734287", "0.51708394", "0.51604396", "0.5154539", "0.51477414", "0.51470846", "0.5145743", "0.5135102", "0.5134207", "0.5130057", "0.51281214", "0.5116972", "0.51149523", "0.51097685", "0.5107155", "0.5097996", "0.5095432", "0.5093356", "0.50932574", "0.50922567", "0.50896305", "0.5084938", "0.50820744", "0.5081215", "0.50805444", "0.5077397", "0.50676805", "0.50616527", "0.5058" ]
0.70238644
0
WithHTTPClient adds the HTTPClient to the vvol binding delete params
WithHTTPClient добавляет HTTPClient в параметры удаления vvol binding
func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams { o.SetHTTPClient(client) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *VolumeDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *VolumeDeleteParams) WithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteProtocolUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDebugRequestParams) WithHTTPClient(client *http.Client) *DeleteDebugRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVolumeDeleteParamsWithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteKeyPairsParams) WithHTTPClient(client *http.Client) *DeleteKeyPairsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteTagParams) WithHTTPClient(client *http.Client) *DeleteTagParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteDeviceUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteVersionControlRequestParams) WithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func DeleteClient(nbmaster string, httpClient *http.Client, jwt string) {\r\n fmt.Printf(\"\\nSending a DELETE request to delete client %s from policy %s...\\n\", testClientName, testPolicyName)\r\n\r\n uri := \"https://\" + nbmaster + \":\" + port + \"/netbackup/\" + policiesUri + testPolicyName + \"/clients/\" + testClientName\r\n\r\n request, _ := http.NewRequest(http.MethodDelete, uri, nil)\r\n request.Header.Add(\"Authorization\", jwt);\r\n\r\n response, err := httpClient.Do(request)\r\n\r\n if err != nil {\r\n fmt.Printf(\"The HTTP request failed with error: %s\\n\", err)\r\n panic(\"Unable to delete client.\\n\")\r\n } else {\r\n if response.StatusCode != 204 {\r\n printErrorResponse(response)\r\n } else {\r\n fmt.Printf(\"%s deleted successfully.\\n\", testClientName);\r\n }\r\n }\r\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ComponentDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteTagParamsWithHTTPClient(client *http.Client) *DeleteTagParams {\n\tvar ()\n\treturn &DeleteTagParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDebugRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CompanyCompanyRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteTagParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteKeyPairsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteVersionControlRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUsingDELETE1Params) WithHTTPClient(client *http.Client) *DeleteUsingDELETE1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeletePacketCapturesParams) WithHTTPClient(client *http.Client) *DeletePacketCapturesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteAttributeParams) WithHTTPClient(client *http.Client) *DeleteAttributeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *ComponentDeleteParams) WithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *NodesDelTagByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDataSourceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReposDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteGerritListenerByIDUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeletePacketCapturesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePoolProjectParams) WithHTTPClient(client *http.Client) *DeletePoolProjectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteConditionParams) WithHTTPClient(client *http.Client) *DeleteConditionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteLoadBalancerPoolParams) WithHTTPClient(client *http.Client) *DeleteLoadBalancerPoolParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) WithHTTPClient(client *http.Client) *DeleteBlueprintRequestUsingDELETE1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtectedEntityParams) WithHTTPClient(client *http.Client) *DeleteProtectedEntityParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteDataSourceParams) WithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteUsingDELETE1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteLoadBalancerPoolParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EntryServiceDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePackageVersionParams) WithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *NvmeNamespaceDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteFreeIpaByEnvironmentV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *OrderDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePoolProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteConditionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCwfNetworkIDParams) WithHTTPClient(client *http.Client) *DeleteCwfNetworkIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubscribedEventParams) WithHTTPClient(client *http.Client) *DeleteSubscribedEventParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeletePackageVersionParamsWithHTTPClient(client *http.Client) *DeletePackageVersionParams {\n\tvar ()\n\treturn &DeletePackageVersionParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteProtectedEntityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSubscribedEventParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EmsDestinationDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCwfNetworkIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveGKECredentialParams) WithHTTPClient(client *http.Client) *RemoveGKECredentialParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteAttributeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteDataSourceParamsWithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\treturn &DeleteDataSourceParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteNodeParams) WithHTTPClient(client *http.Client) *DeleteNodeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteNodeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePackageVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveDropRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewComponentDeleteParamsWithHTTPClient(client *http.Client) *ComponentDeleteParams {\n\treturn &ComponentDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteDeviceUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteDeviceUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintsInWorkspaceParams) WithHTTPClient(client *http.Client) *DeleteBlueprintsInWorkspaceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) WithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *TokenDeleteOrgParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ActionsRemoveParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReposDeleteParams) WithHTTPClient(client *http.Client) *ReposDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUserAttributeParams) WithHTTPClient(client *http.Client) *DeleteUserAttributeParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteNodeParamsWithHTTPClient(client *http.Client) *DeleteNodeParams {\n\tvar ()\n\treturn &DeleteNodeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *DeleteSubnetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePrincipalIdentityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNetworkGroupPolicyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServiceInstanceDeprovisionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveGKECredentialParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSiteDeployParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewDeleteAttributeParamsWithHTTPClient(client *http.Client) *DeleteAttributeParams {\n\tvar ()\n\treturn &DeleteAttributeParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *RemoveDropRequestParams) WithHTTPClient(client *http.Client) *RemoveDropRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *OrderDeleteParams) WithHTTPClient(client *http.Client) *OrderDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBasketsByIDPaymentInstrumentsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NodesDelTagByIDParams) WithHTTPClient(client *http.Client) *NodesDelTagByIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *APIDeleteUserParams) WithHTTPClient(client *http.Client) *APIDeleteUserParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *EntryServiceDeleteParams) WithHTTPClient(client *http.Client) *EntryServiceDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubnetParams) WithHTTPClient(client *http.Client) *DeleteSubnetParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSupportUserParams) WithHTTPClient(client *http.Client) *DeleteSupportUserParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithHTTPClient(client *http.Client) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewDeleteVersionControlRequestParamsWithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\treturn &DeleteVersionControlRequestParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *AdminDeleteProfanityFilterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.7519185", "0.6756765", "0.66501546", "0.6649163", "0.66412854", "0.65906143", "0.65437907", "0.6530756", "0.64375067", "0.64069736", "0.64000154", "0.6371847", "0.63688064", "0.6310587", "0.62990755", "0.6244727", "0.62355083", "0.61710334", "0.6162737", "0.6149288", "0.6124617", "0.6099622", "0.6095701", "0.60792255", "0.6073321", "0.60731953", "0.60722715", "0.607167", "0.6051747", "0.6039121", "0.60351044", "0.602792", "0.6015688", "0.6011999", "0.60102373", "0.60049194", "0.6002282", "0.5998462", "0.5997563", "0.59890014", "0.5980168", "0.59741044", "0.59740126", "0.59712255", "0.59516275", "0.5940537", "0.59201705", "0.5900349", "0.58977515", "0.5897701", "0.58871865", "0.58869845", "0.5886361", "0.5874923", "0.5874241", "0.5853086", "0.5848485", "0.58394015", "0.5837704", "0.5835981", "0.5816008", "0.5808681", "0.5793267", "0.5786067", "0.5774887", "0.5774071", "0.57693535", "0.57693464", "0.57652014", "0.57605183", "0.57596934", "0.5758972", "0.5738742", "0.573758", "0.57207066", "0.5714043", "0.5705986", "0.56940764", "0.56900084", "0.56825185", "0.5669456", "0.56672347", "0.56573594", "0.5655325", "0.56513137", "0.5647913", "0.5646679", "0.56392246", "0.56356466", "0.5608155", "0.5589216", "0.55823267", "0.5566009", "0.55597425", "0.55384594", "0.55297995", "0.55294704", "0.55235916", "0.5521578", "0.55038387" ]
0.7508446
1
SetHTTPClient adds the HTTPClient to the vvol binding delete params
SetHTTPClient добавляет HTTPClient в параметры удаления vvol привязки
func (o *VvolBindingDeleteParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VolumeDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtocolUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteGerritListenerByIDUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevokeDeviceCertificateUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDeviceUsingDELETEParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ComponentDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDebugRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteVersionControlRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteTagParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BundleProductOptionRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDataSourceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteKeyPairsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NodesDelTagByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteLoadBalancerPoolParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ReposDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePacketCapturesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePoolProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CompanyCompanyRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EntryServiceDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtectedEntityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUsingDELETE1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NvmeNamespaceDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteConditionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCwfNetworkIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SalesRuleCouponRepositoryV1DeleteByIDDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveDropRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteAttributeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePackageVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNodeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ActionsRemoveParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *OrderDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteFreeIpaByEnvironmentV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNetworkGroupPolicyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSubscribedEventParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EmsDestinationDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveGKECredentialParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeletePrincipalIdentityParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TokenDeleteOrgParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PublicRemoveTrustedDeviceV4Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteV1WebhooksWebhookIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteBlueprintsInWorkspaceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteCatalogsByIDSharedVariationAttributesByIDValuesByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ServiceInstanceDeprovisionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSiteDeployParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteMsgVpnRestDeliveryPointRestConsumerTLSTrustedCommonNameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSubnetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteBasketsByIDPaymentInstrumentsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNtpServerParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteChartrepoRepoChartsNameVersionLabelsIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteNamespaceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDevicesDeviceidInterfacesInterfacenameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AdminDeleteProfanityFilterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveAPIKeyPrivilegeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudPlacementgroupsMembersDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSiteSnippetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteActionTemplateSpacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *MonitorDeleteMaintenancePeriodFromMonitorParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteClusterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *APIDeleteUserParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteGroupConfigurationAdminV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteSystemObjectDefinitionsByIDAttributeGroupsByIDAttributeDefinitionsByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDebugRequestParams) WithHTTPClient(client *http.Client) *DeleteDebugRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSupportUserParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteLTENetworkIDNetworkProbeTasksTaskIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *VolumeDeleteParams) WithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteLifecycleSpacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteTagParams) WithHTTPClient(client *http.Client) *DeleteTagParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteRequestsRequestNameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveControlFromGroupParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUserAttributeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UsersGroupsBulkDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StreamsDeleteParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteReadonlyClusterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveReceiverParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteScheduleParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteRestapiV10AccountAccountIDExtensionExtensionIDMessageStoreMessageIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteAlertingProfileParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteVersionControlRequestParams) WithHTTPClient(client *http.Client) *DeleteVersionControlRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSubnetsSubnetPoolParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteClusterClusterIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteaspecificEmergencyMappingContainerParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteKubeClusterParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteKeyPairsParams) WithHTTPClient(client *http.Client) *DeleteKeyPairsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DeleteSyslogPoliciesMoidParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *MultiDeleteIssueAttachmentOfIssueParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func DeleteClient(nbmaster string, httpClient *http.Client, jwt string) {\r\n fmt.Printf(\"\\nSending a DELETE request to delete client %s from policy %s...\\n\", testClientName, testPolicyName)\r\n\r\n uri := \"https://\" + nbmaster + \":\" + port + \"/netbackup/\" + policiesUri + testPolicyName + \"/clients/\" + testClientName\r\n\r\n request, _ := http.NewRequest(http.MethodDelete, uri, nil)\r\n request.Header.Add(\"Authorization\", jwt);\r\n\r\n response, err := httpClient.Do(request)\r\n\r\n if err != nil {\r\n fmt.Printf(\"The HTTP request failed with error: %s\\n\", err)\r\n panic(\"Unable to delete client.\\n\")\r\n } else {\r\n if response.StatusCode != 204 {\r\n printErrorResponse(response)\r\n } else {\r\n fmt.Printf(\"%s deleted successfully.\\n\", testClientName);\r\n }\r\n }\r\n}", "func (o *DeleteAPI24ProtectionGroupSnapshotsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteDataSourceParams) WithHTTPClient(client *http.Client) *DeleteDataSourceParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *DecryptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteUserMetaTagsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DeleteV1PostMortemsReportsReportIDReasonsReasonIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StopGatewayBundleUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NetworkPruneParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.75474316", "0.74891007", "0.7454922", "0.73563224", "0.7226734", "0.719675", "0.71747655", "0.7127238", "0.7110341", "0.7092532", "0.70717365", "0.70638525", "0.70218146", "0.701651", "0.70134234", "0.70107466", "0.7001641", "0.6992659", "0.69905186", "0.69791144", "0.69666094", "0.6936348", "0.6934794", "0.6921718", "0.6883253", "0.6843424", "0.6826944", "0.6823938", "0.6820961", "0.681292", "0.6797056", "0.679551", "0.67817193", "0.6775884", "0.6767493", "0.6746643", "0.6740402", "0.67390674", "0.6736343", "0.6734648", "0.6732908", "0.66911703", "0.6689478", "0.66867274", "0.6676347", "0.6627396", "0.6619128", "0.6614608", "0.66074866", "0.6604125", "0.6573731", "0.657266", "0.65417963", "0.6533266", "0.6506494", "0.64928627", "0.6489005", "0.64884555", "0.64872116", "0.64795405", "0.64763904", "0.64732283", "0.6457858", "0.64534056", "0.6434753", "0.64323324", "0.6423375", "0.64133716", "0.6404281", "0.64030844", "0.6402742", "0.6391938", "0.63850725", "0.63717854", "0.6370852", "0.63635993", "0.6359136", "0.63415945", "0.6341302", "0.6332653", "0.63308567", "0.63296926", "0.63282895", "0.63199985", "0.6313481", "0.6299464", "0.6285556", "0.62852895", "0.6270187", "0.62681746", "0.6236154", "0.6230363", "0.6216558", "0.6195851", "0.6147913", "0.6147406", "0.61458576", "0.6129118", "0.61205155", "0.61129344" ]
0.81960213
0
WithDeleteAllReferences adds the deleteAllReferences to the vvol binding delete params
WithDeleteAllReferences добавляет deleteAllReferences в параметры удаления vvol привязки
func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams { o.SetDeleteAllReferences(deleteAllReferences) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetDeleteAllReferences(deleteAllReferences *bool) {\n\to.DeleteAllReferences = deleteAllReferences\n}", "func (o *VvolBindingDeleteParams) SetDefaults() {\n\tvar (\n\t\tdeleteAllReferencesDefault = bool(false)\n\t)\n\n\tval := VvolBindingDeleteParams{\n\t\tDeleteAllReferences: &deleteAllReferencesDefault,\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 FeatureCvtermDbxrefSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureCvtermDbxref slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(featureCvtermDbxrefBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureCvtermDbxrefPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"feature_cvterm_dbxref\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureCvtermDbxrefPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(featureCvtermDbxrefPrimaryKeyColumns), 1, len(featureCvtermDbxrefPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from featureCvtermDbxref slice\")\n\t}\n\n\tif len(featureCvtermDbxrefAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureCvtermDbxref slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (q featureCvtermDbxrefQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q featureCvtermDbxrefQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"chado: no featureCvtermDbxrefQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from feature_cvterm_dbxref\")\n\t}\n\n\treturn nil\n}", "func (o VoteSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(voteBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `vote` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, votePrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\tif len(voteAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o PeerSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(peerBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), peerPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `peers` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, peerPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to delete all from peer slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: failed to get rows affected by deleteall for peers\")\n\t}\n\n\tif len(peerAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BraceletPhotoSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no BraceletPhoto slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), braceletPhotoPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM `bracelet_photo` WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, braceletPhotoPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(braceletPhotoPrimaryKeyColumns), 1, len(braceletPhotoPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from braceletPhoto slice\")\n\t}\n\n\treturn nil\n}", "func (fkw *FakeClientWrapper) DeleteAllOf(ctx context.Context, obj runtime.Object, opts ...k8sCl.DeleteAllOfOption) error {\n\treturn fkw.client.DeleteAllOf(ctx, obj, opts...)\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o AddressSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Address slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(addressBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), addressPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `address` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, addressPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to delete all from address slice\")\n\t}\n\n\tif len(addressAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o PeerPropertySlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(peerPropertyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), peerPropertyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"peer_properties\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, peerPropertyPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from peerProperty slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for peer_properties\")\n\t}\n\n\tif len(peerPropertyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q braceletPhotoQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no braceletPhotoQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from bracelet_photo\")\n\t}\n\n\treturn nil\n}", "func (o VoteSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"vote\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, votePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o BraceletPhotoSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no BraceletPhoto slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (q assetRevisionQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o APIKeySlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no APIKey slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(apiKeyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), apiKeyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"api_keys\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, apiKeyPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from apiKey slice\")\n\t}\n\n\tif len(apiKeyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o VSPSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), vspPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"vsp\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, vspPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vsp slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vsp\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (d *Demo) DeleteAll(g *gom.Gom) {\n\ttoolkit.Println(\"===== Delete All =====\")\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tFilter: gom.EndWith(\"Name\", \"man\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().DeleteAll()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Filter(gom.EndWith(\"Name\", \"man\")).Cmd().DeleteAll()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n}", "func (o HoldenAtSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), holdenAtPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"HoldenAt\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, holdenAtPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from holdenAt slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for HoldenAt\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AssetRevisionSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no AssetRevision slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(assetRevisionBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), assetRevisionPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"asset_revision\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, assetRevisionPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(assetRevisionPrimaryKeyColumns), 1, len(assetRevisionPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(query, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to delete all from assetRevision slice\")\n\t}\n\n\tif len(assetRevisionAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q holdenAtQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no holdenAtQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from HoldenAt\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for HoldenAt\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AddressSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Address slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o AddressSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o DocSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(docBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), docPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `doc` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, docPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from doc slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for doc\")\n\t}\n\n\tif len(docAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o VoteSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o CMFBalanceChargeAdminSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cmfBalanceChargeAdminBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfBalanceChargeAdminPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `cmf_balance_charge_admin` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfBalanceChargeAdminPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from cmfBalanceChargeAdmin slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for cmf_balance_charge_admin\")\n\t}\n\n\tif len(cmfBalanceChargeAdminAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (m *MockVirtualMeshCertificateSigningRequestClient) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o BuildingSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"record: no Building slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(buildingBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), buildingPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"buildings\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, buildingPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to delete all from building slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by deleteall for buildings\")\n\t}\n\n\tif len(buildingAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (r *FakeClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error {\n\t// TODO (covariance) implement me!\n\tpanic(\"not implemented\")\n}", "func (q assetRevisionQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"public: no assetRevisionQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to delete all from asset_revision\")\n\t}\n\n\treturn nil\n}", "func (m *MockVirtualMeshCertificateSigningRequestWriter) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o FeatureRelationshipSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureRelationship slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(featureRelationshipBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureRelationshipPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"feature_relationship\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureRelationshipPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(featureRelationshipPrimaryKeyColumns), 1, len(featureRelationshipPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from featureRelationship slice\")\n\t}\n\n\tif len(featureRelationshipAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (g *Group) DeleteAll() {\n\tg.Equivalents = list.New()\n\tg.Fingerprints = make(map[string]*list.Element)\n\tg.FirstExpr = make(map[Operand]*list.Element)\n\tg.SelfFingerprint = \"\"\n}", "func (o AssetRevisionSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no AssetRevision slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AssetRevisionSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o ContentUnitDerivationSlice) DeleteAll(exec boil.Executor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), contentUnitDerivationPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"content_unit_derivations\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, contentUnitDerivationPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"mdbmodels: unable to delete all from contentUnitDerivation slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"mdbmodels: failed to get rows affected by deleteall for content_unit_derivations\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (q vspQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no vspQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vsp\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vsp\")\n\t}\n\n\treturn rowsAff, nil\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o ForeignLegalResourceSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), foreignLegalResourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"ForeignLegalResources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, foreignLegalResourcePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from foreignLegalResource slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for ForeignLegalResources\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (mr *MockVirtualMeshCertificateSigningRequestClientMockRecorder) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", reflect.TypeOf((*MockVirtualMeshCertificateSigningRequestClient)(nil).DeleteAllOfVirtualMeshCertificateSigningRequest), varargs...)\n}", "func (o BlockSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), blockPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"block\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, blockPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from block slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for block\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AuthorSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no Author slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authorPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"authors\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authorPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to delete all from author slice\")\n\t}\n\n\treturn nil\n}", "func (o FeatureRelationshipSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q buildingQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"record: no buildingQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to delete all from buildings\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by deleteall for buildings\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o ChannelSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(channelBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), channelPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"channels\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, channelPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from channel slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for channels\")\n\t}\n\n\tif len(channelAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o MempoolBinSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), mempoolBinPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"mempool_bin\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, mempoolBinPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from mempoolBin slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for mempool_bin\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o APIKeySlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no APIKey slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o RSSAnnouncementSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rssAnnouncementPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"rss_announcements\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, rssAnnouncementPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from rssAnnouncement slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for rss_announcements\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RecipeAdditiveSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(recipeAdditiveBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeAdditivePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"recipe_additive\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, recipeAdditivePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipeAdditive slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_additive\")\n\t}\n\n\tif len(recipeAdditiveAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q peerQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"model: no peerQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to delete all from peers\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: failed to get rows affected by deleteall for peers\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RentalSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Rental slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(rentalBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rentalPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `rental` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, rentalPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to delete all from rental slice\")\n\t}\n\n\tif len(rentalAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q featureRelationshipQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o CvtermsynonymSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Cvtermsynonym slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(cvtermsynonymBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cvtermsynonymPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"cvtermsynonym\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, cvtermsynonymPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(cvtermsynonymPrimaryKeyColumns), 1, len(cvtermsynonymPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from cvtermsynonym slice\")\n\t}\n\n\tif len(cvtermsynonymAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o KvstoreSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(kvstoreBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), kvstorePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"kvstore\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, kvstorePrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from kvstore slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for kvstore\")\n\t}\n\n\tif len(kvstoreAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AssetRevisionSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (s *service) DeleteAll(ctx context.Context, req *pb.Request, res *pb.Response) error {\n\tdone, err := s.repo.DeleteAll(\"\")\n\tif err != nil {\n\t\ttheerror := fmt.Sprintf(\"%v --from souscription_service\", err)\n\t\treturn errors.New(theerror)\n\t}\n\tres.Done = done\n\treturn nil\n}", "func (o PublisherSearchIdxSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(publisherSearchIdxBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), publisherSearchIdxPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"publisher_search_idx\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, publisherSearchIdxPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from publisherSearchIdx slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for publisher_search_idx\")\n\t}\n\n\tif len(publisherSearchIdxAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (mr *MockVirtualMeshCertificateSigningRequestWriterMockRecorder) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", reflect.TypeOf((*MockVirtualMeshCertificateSigningRequestWriter)(nil).DeleteAllOfVirtualMeshCertificateSigningRequest), varargs...)\n}", "func (q publisherSearchIdxQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no publisherSearchIdxQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from publisher_search_idx\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for publisher_search_idx\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o DMessageEmbedSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no DMessageEmbed slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), dMessageEmbedPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"d_message_embeds\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, dMessageEmbedPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(dMessageEmbedPrimaryKeyColumns), 1, len(dMessageEmbedPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from dMessageEmbed slice\")\n\t}\n\n\treturn nil\n}", "func (o AddressSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o RecipeLipidSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(recipeLipidBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeLipidPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"recipe_lipid\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, recipeLipidPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipeLipid slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_lipid\")\n\t}\n\n\tif len(recipeLipidAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q voteQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no voteQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vote\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q braceletPhotoQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q mempoolBinQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no mempoolBinQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from mempool_bin\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for mempool_bin\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o SegmentSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(segmentBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), segmentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"segment\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, segmentPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"boiler: unable to delete all from segment slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"boiler: failed to get rows affected by deleteall for segment\")\n\t}\n\n\tif len(segmentAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o FriendshipSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(friendshipBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), friendshipPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `friendship` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, friendshipPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from friendship slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for friendship\")\n\t}\n\n\tif len(friendshipAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o FeatureRelationshipSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureRelationship slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o PhenotypepropSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Phenotypeprop slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AuthorSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o CommentSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Comment slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(commentBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), commentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `comment` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, commentPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from comment slice\")\n\t}\n\n\tif len(commentAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q voteQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no voteQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote\")\n\t}\n\n\treturn nil\n}", "func (q peerPropertyQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no peerPropertyQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from peer_properties\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for peer_properties\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q addressQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o CurrencySlice) DeleteAll(exec boil.Executor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no Currency slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(currencyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), currencyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"currency\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, currencyPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from currency slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for currency\")\n\t}\n\n\tif len(currencyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o JetSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Jet slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (q foreignLegalResourceQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no foreignLegalResourceQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from ForeignLegalResources\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for ForeignLegalResources\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AuthSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Auth slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(authBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"auths\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from auth slice\")\n\t}\n\n\tif len(authAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (b *Builder) Delete(conds ...Cond) *Builder {\r\n\tb.cond = b.cond.And(conds...)\r\n\tb.optype = deleteType\r\n\treturn b\r\n}", "func (o AuthorSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q stockCvtermQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o VoteSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q voteQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o AuthorSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no Author slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o PhenotypepropSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Phenotypeprop slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(phenotypepropBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), phenotypepropPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"phenotypeprop\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, phenotypepropPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(phenotypepropPrimaryKeyColumns), 1, len(phenotypepropPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from phenotypeprop slice\")\n\t}\n\n\tif len(phenotypepropAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o RawVisitSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(rawVisitBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rawVisitPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"raw_visits\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, rawVisitPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from rawVisit slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for raw_visits\")\n\t}\n\n\tif len(rawVisitAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q recipeLipidQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no recipeLipidQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipe_lipid\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_lipid\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q apiKeyQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no apiKeyQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from api_keys\")\n\t}\n\n\treturn nil\n}", "func (o PaymentObjectSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(paymentObjectBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), paymentObjectPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `payment_objects` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, paymentObjectPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from paymentObject slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for payment_objects\")\n\t}\n\n\tif len(paymentObjectAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q apiKeyQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func DeleteAll(db *sqlx.DB) error {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := tx.Exec(deleteDoc); err != nil {\n\t\tif err := tx.Rollback(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn err\n\t}\n\n\treturn tx.Commit()\n}", "func (o SourceSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no Source slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), sourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"sources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, sourcePrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to delete all from source slice\")\n\t}\n\n\treturn nil\n}", "func (o AuthSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}" ]
[ "0.7380496", "0.6893267", "0.6104744", "0.604309", "0.58674455", "0.58534765", "0.5822575", "0.5779294", "0.5631722", "0.5625062", "0.5582434", "0.5573762", "0.5568083", "0.5548098", "0.55454016", "0.5544827", "0.5540688", "0.55064595", "0.54958194", "0.5486631", "0.54630715", "0.54456955", "0.543123", "0.5427109", "0.54192597", "0.5415218", "0.5412514", "0.5410719", "0.53949773", "0.53911966", "0.5384627", "0.53730714", "0.5372073", "0.53622913", "0.5362068", "0.53532857", "0.5351997", "0.53513104", "0.5338415", "0.5333983", "0.5332838", "0.53021896", "0.52997804", "0.5298733", "0.5296856", "0.5296471", "0.5293705", "0.5290165", "0.52885944", "0.52841526", "0.5281965", "0.52813613", "0.5280715", "0.5279059", "0.52729934", "0.5266435", "0.5264655", "0.5263149", "0.5252919", "0.5249838", "0.52486634", "0.52483773", "0.52451324", "0.5244675", "0.5243209", "0.524306", "0.5235687", "0.52353287", "0.5235217", "0.5232034", "0.5231531", "0.5227261", "0.5221335", "0.521504", "0.5209455", "0.5207776", "0.5207694", "0.5204492", "0.51984006", "0.5184591", "0.51834935", "0.5179698", "0.51788753", "0.51758915", "0.5167884", "0.51661557", "0.51661277", "0.51581264", "0.5157769", "0.51544553", "0.51517045", "0.5149557", "0.51366556", "0.51347935", "0.51256335", "0.5125593", "0.5125022", "0.5122161", "0.5121196", "0.5114483" ]
0.74422747
0
SetDeleteAllReferences adds the deleteAllReferences to the vvol binding delete params
SetDeleteAllReferences добавляет deleteAllReferences в параметры удаления vvol связывания
func (o *VvolBindingDeleteParams) SetDeleteAllReferences(deleteAllReferences *bool) { o.DeleteAllReferences = deleteAllReferences }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithDeleteAllReferences(deleteAllReferences *bool) *VvolBindingDeleteParams {\n\to.SetDeleteAllReferences(deleteAllReferences)\n\treturn o\n}", "func (o *VvolBindingDeleteParams) SetDefaults() {\n\tvar (\n\t\tdeleteAllReferencesDefault = bool(false)\n\t)\n\n\tval := VvolBindingDeleteParams{\n\t\tDeleteAllReferences: &deleteAllReferencesDefault,\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 FeatureCvtermDbxrefSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureCvtermDbxref slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(featureCvtermDbxrefBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureCvtermDbxrefPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"feature_cvterm_dbxref\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureCvtermDbxrefPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(featureCvtermDbxrefPrimaryKeyColumns), 1, len(featureCvtermDbxrefPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from featureCvtermDbxref slice\")\n\t}\n\n\tif len(featureCvtermDbxrefAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q featureCvtermDbxrefQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q featureCvtermDbxrefQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"chado: no featureCvtermDbxrefQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from feature_cvterm_dbxref\")\n\t}\n\n\treturn nil\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureCvtermDbxref slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o FeatureCvtermDbxrefSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o PeerPropertySlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(peerPropertyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), peerPropertyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"peer_properties\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, peerPropertyPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from peerProperty slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for peer_properties\")\n\t}\n\n\tif len(peerPropertyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q braceletPhotoQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no braceletPhotoQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from bracelet_photo\")\n\t}\n\n\treturn nil\n}", "func (q assetRevisionQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o PeerSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(peerBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), peerPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `peers` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, peerPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to delete all from peer slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: failed to get rows affected by deleteall for peers\")\n\t}\n\n\tif len(peerAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BraceletPhotoSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no BraceletPhoto slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), braceletPhotoPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM `bracelet_photo` WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, braceletPhotoPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(braceletPhotoPrimaryKeyColumns), 1, len(braceletPhotoPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from braceletPhoto slice\")\n\t}\n\n\treturn nil\n}", "func (o AddressSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Address slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(addressBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), addressPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `address` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, addressPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to delete all from address slice\")\n\t}\n\n\tif len(addressAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o VoteSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(voteBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `vote` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, votePrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\tif len(voteAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o CvtermsynonymSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Cvtermsynonym slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(cvtermsynonymBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cvtermsynonymPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"cvtermsynonym\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, cvtermsynonymPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(cvtermsynonymPrimaryKeyColumns), 1, len(cvtermsynonymPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from cvtermsynonym slice\")\n\t}\n\n\tif len(cvtermsynonymAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func (g *Group) DeleteAll() {\n\tg.Equivalents = list.New()\n\tg.Fingerprints = make(map[string]*list.Element)\n\tg.FirstExpr = make(map[Operand]*list.Element)\n\tg.SelfFingerprint = \"\"\n}", "func (o AddressSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (d *Demo) DeleteAll(g *gom.Gom) {\n\ttoolkit.Println(\"===== Delete All =====\")\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tFilter: gom.EndWith(\"Name\", \"man\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().DeleteAll()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Filter(gom.EndWith(\"Name\", \"man\")).Cmd().DeleteAll()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n}", "func (o AssetRevisionSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o BraceletPhotoSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no BraceletPhoto slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AssetRevisionSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no AssetRevision slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(assetRevisionBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), assetRevisionPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"asset_revision\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, assetRevisionPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(assetRevisionPrimaryKeyColumns), 1, len(assetRevisionPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, query)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(query, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to delete all from assetRevision slice\")\n\t}\n\n\tif len(assetRevisionAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o FeatureRelationshipSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q assetRevisionQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"public: no assetRevisionQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"public: unable to delete all from asset_revision\")\n\t}\n\n\treturn nil\n}", "func (q featureRelationshipQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q cvtermsynonymQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (fkw *FakeClientWrapper) DeleteAllOf(ctx context.Context, obj runtime.Object, opts ...k8sCl.DeleteAllOfOption) error {\n\treturn fkw.client.DeleteAllOf(ctx, obj, opts...)\n}", "func (q braceletPhotoQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q multiAddressesSetQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no multiAddressesSetQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from multi_addresses_sets\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for multi_addresses_sets\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o FeatureRelationshipSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureRelationship slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(featureRelationshipBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureRelationshipPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"feature_relationship\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureRelationshipPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(featureRelationshipPrimaryKeyColumns), 1, len(featureRelationshipPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from featureRelationship slice\")\n\t}\n\n\tif len(featureRelationshipAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o VoteSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"vote\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, votePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q peerPropertyQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no peerPropertyQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from peer_properties\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for peer_properties\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o ContentUnitDerivationSlice) DeleteAll(exec boil.Executor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), contentUnitDerivationPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"content_unit_derivations\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, contentUnitDerivationPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"mdbmodels: unable to delete all from contentUnitDerivation slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"mdbmodels: failed to get rows affected by deleteall for content_unit_derivations\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AddressSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Address slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AssetRevisionSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o CMFBalanceChargeAdminSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cmfBalanceChargeAdminBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfBalanceChargeAdminPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `cmf_balance_charge_admin` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfBalanceChargeAdminPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from cmfBalanceChargeAdmin slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for cmf_balance_charge_admin\")\n\t}\n\n\tif len(cmfBalanceChargeAdminAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o PhenotypepropSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Phenotypeprop slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(phenotypepropBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), phenotypepropPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"phenotypeprop\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, phenotypepropPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(phenotypepropPrimaryKeyColumns), 1, len(phenotypepropPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from phenotypeprop slice\")\n\t}\n\n\tif len(phenotypepropAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q mempoolBinQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no mempoolBinQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from mempool_bin\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for mempool_bin\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o MempoolBinSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), mempoolBinPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"mempool_bin\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, mempoolBinPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from mempoolBin slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for mempool_bin\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q peerQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"model: no peerQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to delete all from peers\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: failed to get rows affected by deleteall for peers\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AddressSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o AuthorSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"mdbmdbmodels: no Author slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authorPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"authors\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authorPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to delete all from author slice\")\n\t}\n\n\treturn nil\n}", "func (o APIKeySlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no APIKey slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(apiKeyBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), apiKeyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"api_keys\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, apiKeyPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from apiKey slice\")\n\t}\n\n\tif len(apiKeyAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (q addressQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (s *service) DeleteAll(ctx context.Context, req *pb.Request, res *pb.Response) error {\n\tdone, err := s.repo.DeleteAll(\"\")\n\tif err != nil {\n\t\ttheerror := fmt.Sprintf(\"%v --from souscription_service\", err)\n\t\treturn errors.New(theerror)\n\t}\n\tres.Done = done\n\treturn nil\n}", "func (q buildingQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"record: no buildingQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to delete all from buildings\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by deleteall for buildings\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q cvtermsynonymQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"chado: no cvtermsynonymQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from cvtermsynonym\")\n\t}\n\n\treturn nil\n}", "func (q holdenAtQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no holdenAtQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from HoldenAt\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for HoldenAt\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o VoteSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o DocSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(docBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), docPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `doc` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, docPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from doc slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for doc\")\n\t}\n\n\tif len(docAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (q stockCvtermQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o AssetRevisionSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"public: no AssetRevision slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o CvtermsynonymSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o PhenotypepropSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Phenotypeprop slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (o AuthorSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o MultiAddressesSetSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(multiAddressesSetBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), multiAddressesSetPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"multi_addresses_sets\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, multiAddressesSetPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from multiAddressesSet slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for multi_addresses_sets\")\n\t}\n\n\tif len(multiAddressesSetAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BuildingSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"record: no Building slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(buildingBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), buildingPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"buildings\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, buildingPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to delete all from building slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by deleteall for buildings\")\n\t}\n\n\tif len(buildingAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AuthorSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (m *MemBook) deleteAll() {\n\n\t// Reassign the Book data so it's take by the garbage collector.\n\tm.books = make(map[string]*models.Book)\n}", "func (o ForeignLegalResourceSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), foreignLegalResourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"ForeignLegalResources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, foreignLegalResourcePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from foreignLegalResource slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for ForeignLegalResources\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RentalSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"sqlboiler: no Rental slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(rentalBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rentalPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `rental` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, rentalPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to delete all from rental slice\")\n\t}\n\n\tif len(rentalAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o FeatureRelationshipSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no FeatureRelationship slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (q publisherSearchIdxQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no publisherSearchIdxQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from publisher_search_idx\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for publisher_search_idx\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o HoldenAtSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), holdenAtPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"HoldenAt\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, holdenAtPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from holdenAt slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for HoldenAt\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o VoteSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (r *FakeClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error {\n\t// TODO (covariance) implement me!\n\tpanic(\"not implemented\")\n}", "func (q voteQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o VSPSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), vspPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"vsp\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, vspPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vsp slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vsp\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (c *Command) DeleteAll() (int64, error) {\n\tclient := c.set.gom.GetClient()\n\n\tcollection := client.Database(c.set.gom.GetDatabase()).Collection(c.set.tableName)\n\n\tctx, cancelFunc := c.set.GetContext()\n\tdefer cancelFunc()\n\n\tres, err := collection.DeleteMany(ctx, c.set.filter)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.DeletedCount, nil\n}", "func (o CvtermsynonymSlice) DeleteAllG() error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Cvtermsynonym slice provided for delete all\")\n\t}\n\treturn o.DeleteAll(boil.GetDB())\n}", "func (a *apiServer) DeleteAll(ctx context.Context, request *emptypb.Empty) (response *emptypb.Empty, retErr error) {\n\tif _, err := a.DeletePipelines(ctx, &pps.DeletePipelinesRequest{All: true, Force: true}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := a.env.KubeClient.CoreV1().Secrets(a.namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{\n\t\tLabelSelector: \"secret-source=pachyderm-user\",\n\t}); err != nil {\n\t\treturn nil, errors.EnsureStack(err)\n\t}\n\treturn &emptypb.Empty{}, nil\n}", "func (o CommentSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Comment slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(commentBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), commentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `comment` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, commentPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from comment slice\")\n\t}\n\n\tif len(commentAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (m *MockVirtualMeshCertificateSigningRequestClient) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o PhenotypepropSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q recipeLipidQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no recipeLipidQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipe_lipid\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_lipid\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RecipeLipidSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(recipeLipidBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeLipidPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"recipe_lipid\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, recipeLipidPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipeLipid slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_lipid\")\n\t}\n\n\tif len(recipeLipidAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BraceletPhotoSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q foreignLegalResourceQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no foreignLegalResourceQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from ForeignLegalResources\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for ForeignLegalResources\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o *FeatureCvtermDbxrefSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tfeatureCvtermDbxrefs := FeatureCvtermDbxrefSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureCvtermDbxrefPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT \\\"feature_cvterm_dbxref\\\".* FROM \\\"feature_cvterm_dbxref\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureCvtermDbxrefPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(featureCvtermDbxrefPrimaryKeyColumns), 1, len(featureCvtermDbxrefPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&featureCvtermDbxrefs)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to reload all in FeatureCvtermDbxrefSlice\")\n\t}\n\n\t*o = featureCvtermDbxrefs\n\n\treturn nil\n}", "func (m *MockVirtualMeshCertificateSigningRequestWriter) DeleteAllOfVirtualMeshCertificateSigningRequest(ctx context.Context, opts ...client.DeleteAllOfOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"DeleteAllOfVirtualMeshCertificateSigningRequest\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o VoteSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o RecipeAdditiveSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(recipeAdditiveBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeAdditivePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"recipe_additive\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, recipeAdditivePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipeAdditive slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_additive\")\n\t}\n\n\tif len(recipeAdditiveAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o PublisherSearchIdxSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(publisherSearchIdxBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), publisherSearchIdxPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"publisher_search_idx\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, publisherSearchIdxPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from publisherSearchIdx slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for publisher_search_idx\")\n\t}\n\n\tif len(publisherSearchIdxAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o AuthSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Auth slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(authBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"auths\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from auth slice\")\n\t}\n\n\tif len(authAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o AuthSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q apiKeyQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o BraceletPhotoSlice) DeleteAllGP() {\n\tif err := o.DeleteAllG(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func DeleteAll(db *sqlx.DB) error {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := tx.Exec(deleteDoc); err != nil {\n\t\tif err := tx.Rollback(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn err\n\t}\n\n\treturn tx.Commit()\n}", "func (q voteQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no voteQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote\")\n\t}\n\n\treturn nil\n}", "func (q voteQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no voteQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vote\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o BlockSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), blockPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"block\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, blockPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from block slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for block\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o StockCvtermSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o FriendshipSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(friendshipBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), friendshipPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `friendship` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, friendshipPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from friendship slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for friendship\")\n\t}\n\n\tif len(friendshipAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o RSSAnnouncementSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rssAnnouncementPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"rss_announcements\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, rssAnnouncementPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from rssAnnouncement slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for rss_announcements\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q vspQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no vspQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vsp\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vsp\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q phenotypepropQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (q featureRelationshipQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"chado: no featureRelationshipQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from feature_relationship\")\n\t}\n\n\treturn nil\n}", "func (q recipeAdditiveQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no recipeAdditiveQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from recipe_additive\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for recipe_additive\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o SegmentSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(segmentBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), segmentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"segment\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, segmentPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"boiler: unable to delete all from segment slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"boiler: failed to get rows affected by deleteall for segment\")\n\t}\n\n\tif len(segmentAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}" ]
[ "0.70774865", "0.69914395", "0.6261222", "0.61479115", "0.6081627", "0.6005739", "0.5977111", "0.57168645", "0.56603426", "0.56408215", "0.5606522", "0.56003577", "0.5594191", "0.55833054", "0.55614084", "0.5522759", "0.55059785", "0.55058986", "0.5471875", "0.5471104", "0.5460233", "0.54585487", "0.54329056", "0.54320425", "0.5426304", "0.54170984", "0.5412243", "0.5409081", "0.5404681", "0.5403552", "0.54015166", "0.5397619", "0.5390557", "0.53854465", "0.5357829", "0.5345695", "0.5338313", "0.53376395", "0.5335536", "0.53289694", "0.53170943", "0.5315947", "0.5314089", "0.5312351", "0.5311932", "0.52979285", "0.5296225", "0.5296201", "0.5292483", "0.5287427", "0.52872235", "0.52829194", "0.52808905", "0.52769065", "0.526347", "0.5254746", "0.52503693", "0.5243819", "0.52324325", "0.5231488", "0.52314216", "0.52304894", "0.5216888", "0.52159715", "0.52133644", "0.5210891", "0.52102613", "0.5209858", "0.52091783", "0.5205611", "0.5200044", "0.51990175", "0.51941913", "0.519087", "0.5187823", "0.51872253", "0.51868623", "0.5186809", "0.518461", "0.5176878", "0.51761204", "0.5166142", "0.5163484", "0.51621294", "0.5160185", "0.51595616", "0.5158223", "0.5151658", "0.51453424", "0.51442873", "0.5141219", "0.5138828", "0.51356393", "0.51319164", "0.5131204", "0.51264614", "0.5123876", "0.5118587", "0.51166826", "0.51154023" ]
0.7569814
0
WithProtocolEndpointUUID adds the protocolEndpointUUID to the vvol binding delete params
WithProtocolEndpointUUID добавляет protocolEndpointUUID в параметры удаления привязки vvol
func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams { o.SetProtocolEndpointUUID(protocolEndpointUUID) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetProtocolEndpointUUID(protocolEndpointUUID string) {\n\to.ProtocolEndpointUUID = protocolEndpointUUID\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithProtocolID(protocolID string) *DeleteProtocolUsingDELETEParams {\n\to.SetProtocolID(protocolID)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func (o *DeleteProtocolUsingDELETEParams) WithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (ec *ExtensionClient) DeleteEndpoint(extensionID, serviceID, URL string) error {\n\n\turl := url.QueryEscape(URL)\n\trequest, err := extensionc.BuildDeleteEndpointPayload(extensionID, serviceID, url)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = ec.c.DeleteEndpoint()(context.Background(), request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (a *DefaultApiService) DeleteEndpoint(ctx _context.Context, id string) ApiDeleteEndpointRequest {\n\treturn ApiDeleteEndpointRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func DeleteEndpoint(serviceAccountProvider provider.ServiceAccountProvider, projectProvider provider.ProjectProvider, userInfoGetter provider.UserInfoGetter) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq, ok := request.(deleteReq)\n\t\tif !ok {\n\t\t\treturn nil, errors.NewBadRequest(\"invalid request\")\n\t\t}\n\t\terr := req.Validate()\n\t\tif err != nil {\n\t\t\treturn nil, errors.NewBadRequest(err.Error())\n\t\t}\n\t\tuserInfo, err := userInfoGetter(ctx, req.ProjectID)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\t\t// check if project exist\n\t\tif _, err := projectProvider.Get(userInfo, req.ProjectID, &provider.ProjectGetOptions{}); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\t// check if service account exist before deleting it\n\t\tif _, err := serviceAccountProvider.Get(userInfo, req.ServiceAccountID, nil); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\tif err := serviceAccountProvider.Delete(userInfo, req.ServiceAccountID); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\treturn nil, nil\n\t}\n}", "func DeleteEndpoint(w http.ResponseWriter, r *http.Request) {\r\n\tr.Header.Set(\"Content-Type\", \"application/json, charset=UTF-8\")\r\n\tvar dc DeleteConfig\r\n\r\n\tswitch r.Method {\r\n\tcase \"GET\":\r\n\t\tparams := mux.Vars(r)\r\n\t\tdc.Default()\r\n\t\tdc.Endpoint = params[\"endpoint_name\"]\r\n\t\tdc.EndpointList = append(dc.EndpointList, dc.Endpoint)\r\n\tcase \"POST\":\r\n\t\tbody, err := ioutil.ReadAll(r.Body)\r\n\t\tif err != nil {\r\n\t\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/endpoint, failed to read request\")\r\n\t\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Failed to read HTTP request\"))\r\n\t\t\treturn\r\n\t\t}\r\n\t\tdc.LoadParams(body)\r\n\t}\r\n\r\n\t// Verify Endpoint is provided in request body\r\n\tif len(dc.EndpointList) == 0 {\r\n\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/endpoint - endpoint is required\")\r\n\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Endpoint required\"))\r\n\t\treturn\r\n\t}\r\n\r\n\tvar query elastic.Query\r\n\r\n\t// Convert EndpointList to interface{} slice\r\n\tendpoints := make([]interface{}, len(dc.EndpointList))\r\n\tfor i, v := range dc.EndpointList {\r\n\t\tendpoints[i] = v\r\n\t}\r\n\r\n\tquery = elastic.NewBoolQuery().\r\n\t\tMust(elastic.NewWildcardQuery(\"CaseInfo.CaseName\", dc.CaseName),\r\n\t\t\telastic.NewTermsQuery(\"ComputerName.keyword\", endpoints...))\r\n\r\n\tdeleteEndpointByQuery(w, r, query, \"DeleteEndpoint\")\r\n\r\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETEExecute(r ApiDeleteBindingUsingDELETERequest) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DeprecatedBusManagementRouterApiService.DeleteBindingUsingDELETE\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v0/bindings/{routingKeyFilter}/{fifoName}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"routingKeyFilter\"+\"}\", _neturl.PathEscape(parameterToString(r.routingKeyFilter, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"fifoName\"+\"}\", _neturl.PathEscape(parameterToString(r.fifoName, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.xAPIKEY == nil {\n\t\treturn nil, reportError(\"xAPIKEY is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tlocalVarHeaderParams[\"X-API-KEY\"] = parameterToString(*r.xAPIKEY, \"\")\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorResponseWeb\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ErrorResponseWeb\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (a AppblueprintApi) AppBlueprintsUuidDelete(uuid string) (*APIResponse, error) {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/app_blueprints/{uuid}\"\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\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}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (m *peerMap) deleteEndpoint(ep *endpoint) {\n\tif ep == nil {\n\t\treturn\n\t}\n\tep.stopAndReset()\n\n\tepDisco := ep.disco.Load()\n\n\tpi := m.byNodeKey[ep.publicKey]\n\tif epDisco != nil {\n\t\tdelete(m.nodesOfDisco[epDisco.key], ep.publicKey)\n\t}\n\tdelete(m.byNodeKey, ep.publicKey)\n\tif pi == nil {\n\t\t// Kneejerk paranoia from earlier issue 2801.\n\t\t// Unexpected. But no logger plumbed here to log so.\n\t\treturn\n\t}\n\tfor ip := range pi.ipPorts {\n\t\tdelete(m.byIPPort, ip)\n\t}\n}", "func NewDeleteEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\tp := req.(*DeletePayload)\n\t\treturn nil, s.Delete(ctx, p)\n\t}\n}", "func (j *Jsonnet) DeleteParam(path []string) error {\n\t// TODO: make this work at the env level too\n\tparamsData, err := j.readParams(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdatedParams, err := params.DeleteFromObject(path, paramsData, j.Name(false), paramsComponentRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = j.writeParams(updatedParams); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (client *WebAppsClient) deletePrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *WebAppsBeginDeletePrivateEndpointConnectionOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}\"\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 privateEndpointConnectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointConnectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointConnectionName}\", url.PathEscape(privateEndpointConnectionName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.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 (o *DeleteProtocolUsingDELETEParams) SetProtocolID(protocolID string) {\n\to.ProtocolID = protocolID\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (client *NpmClient) EndpointDeleteReq(epinfo *netproto.Endpoint) (*netproto.Endpoint, error) {\n\treturn nil, nil\n}", "func (nb *NetBuilder) DeleteEndpoint(nw *Network, ep *Endpoint) error {\n\t// Generate network name here as endpoint name is dependent upon network name.\n\tnw.Name = nb.generateHNSNetworkName(nw)\n\t// Query the namespace identifier.\n\tnsType, namespaceIdentifier := nb.getNamespaceIdentifier(ep)\n\n\t// Find the HNS endpoint ID.\n\tendpointName := nb.generateHNSEndpointName(nw.Name, namespaceIdentifier)\n\thnsEndpoint, err := hcsshim.GetHNSEndpointByName(endpointName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Detach the HNS endpoint from the container's network namespace.\n\tlog.Infof(\"Detaching HNS endpoint %s from container %s netns.\", hnsEndpoint.Id, ep.ContainerID)\n\tif nsType == hcsNamespace {\n\t\t// Detach the HNS endpoint from the namespace, if we can.\n\t\t// HCN Namespace and HNS Endpoint have a 1-1 relationship, therefore,\n\t\t// even if detachment of endpoint from namespace fails, we can still proceed to delete it.\n\t\terr = hcn.RemoveNamespaceEndpoint(namespaceIdentifier, hnsEndpoint.Id)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to detach endpoint, ignoring: %v\", err)\n\t\t}\n\t} else {\n\t\terr = hcsshim.HotDetachEndpoint(ep.ContainerID, hnsEndpoint.Id)\n\t\tif err != nil && err != hcsshim.ErrComputeSystemDoesNotExist {\n\t\t\treturn err\n\t\t}\n\n\t\t// The rest of the delete logic applies to infrastructure container only.\n\t\tif nsType == nonInfraContainerNS {\n\t\t\t// For non-infra containers, the network must not be deleted.\n\t\t\tnw.UseExisting = true\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Delete the HNS endpoint.\n\tlog.Infof(\"Deleting HNS endpoint name: %s ID: %s\", endpointName, hnsEndpoint.Id)\n\t_, err = hnsEndpoint.Delete()\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to delete HNS endpoint: %v.\", err)\n\t}\n\n\treturn err\n}", "func decodeDeleteKeyPersonRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.DeleteKeyPersonRequest)\n\treturn endpoints.DeleteKeyPersonRequest{ID: req.Id}, nil\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (do *DeleteOptions) DevfileComponentDelete() error {\n\t// Parse devfile\n\tdevObj, err := devfileParser.Parse(do.devfilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcomponentName, err := getComponentName()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkc := kubernetes.KubernetesContext{\n\t\tNamespace: do.namespace,\n\t}\n\n\tlabels := map[string]string{\n\t\t\"component\": componentName,\n\t}\n\tdevfileHandler, err := adapters.NewPlatformAdapter(componentName, devObj, kc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tspinner := log.Spinner(fmt.Sprintf(\"Deleting devfile component %s\", componentName))\n\tdefer spinner.End(false)\n\n\terr = devfileHandler.Delete(labels)\n\tif err != nil {\n\t\treturn err\n\t}\n\tspinner.End(true)\n\tlog.Successf(\"Successfully deleted component\")\n\treturn nil\n}", "func MakeDeleteEndpoint(s service.DepartmentService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteRequest)\n\t\terror := s.Delete(ctx, req.Id)\n\t\treturn DeleteResponse{Error: error}, nil\n\t}\n}", "func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterBindingDeleteArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(400, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (r *RuntimeServer) DelThirdPartyEndpoint(ctx context.Context, re *pb.DelThirdPartyEndpointsReq) (*pb.Empty, error) {\n\tas := r.store.GetAppService(re.Sid)\n\tif as == nil {\n\t\treturn new(pb.Empty), nil\n\t}\n\tr.updateCh.In() <- discovery.Event{\n\t\tType: discovery.DeleteEvent,\n\t\tObj: &v1.RbdEndpoint{\n\t\t\tUUID: re.Uuid,\n\t\t\tSid: re.Sid,\n\t\t\tIP: re.Ip,\n\t\t\tPort: int(re.Port),\n\t\t},\n\t}\n\treturn new(pb.Empty), nil\n}", "func (a *SvmApiService) SvmPeerDelete(ctx _context.Context, peerUuid string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/svm/peers/{peer.uuid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer.uuid\"+\"}\", _neturl.QueryEscape(parameterToString(peerUuid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"application/hal+json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tvar v ErrorResponse\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func NewRevokeDeviceCertificateUsingDELETEParamsWithHTTPClient(client *http.Client) *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (s *EndpointServer) DeleteVertexaiEndpoint(ctx context.Context, request *vertexaipb.DeleteVertexaiEndpointRequest) (*emptypb.Empty, error) {\n\n\tcl, err := createConfigEndpoint(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptypb.Empty{}, cl.DeleteEndpoint(ctx, ProtoToEndpoint(request.GetResource()))\n\n}", "func (client *WebAppsClient) deletePrivateEndpointConnectionSlotCreateRequest(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, slot string, options *WebAppsBeginDeletePrivateEndpointConnectionSlotOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName}\"\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 privateEndpointConnectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointConnectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointConnectionName}\", url.PathEscape(privateEndpointConnectionName))\n\tif slot == \"\" {\n\t\treturn nil, errors.New(\"parameter slot cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{slot}\", url.PathEscape(slot))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.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 (d *ABFToInterfaceDescriptor) Delete(key string, emptyVal proto.Message, metadata api.Metadata) (err error) {\n\t// validate and get all required values\n\tisIPv6, abfIdx, ifIdx, priority, err := d.process(key)\n\tif err != nil {\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\n\t// detach interface to ABF policy\n\tif isIPv6 {\n\t\treturn d.abfHandler.AbfDetachInterfaceIPv6(abfIdx, ifIdx, priority)\n\t}\n\treturn d.abfHandler.AbfDetachInterfaceIPv4(abfIdx, ifIdx, priority)\n}", "func NewDeleteConnectorUsingDELETEMethodNotAllowed() *DeleteConnectorUsingDELETEMethodNotAllowed {\n\treturn &DeleteConnectorUsingDELETEMethodNotAllowed{}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitAttachedBit(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:attached-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocol(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupTransport(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:transport/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func deleteEndpoint(endpointId string) (string, error) {\n\tvar ret string\n\n\turi := fmt.Sprintf(\"%s/%s\", endpointURI, id)\n\turl, err := client.GetURL(uri)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\treq, err := client.BuildReq(nil, url, http.MethodDelete, true)\n\trawResp, err := client.HTTPClient().Do(req)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif _, err := client.ParseReq(rawResp); err != nil {\n\t\treturn ret, err\n\t}\n\n\t// Confirm the node was deleted.\n\tif rawResp.StatusCode != 204 {\n\t\treturn ret, errors.New(\"Endpoint was not able to be deleted\")\n\t}\n\tret = \"Endpoint deleted\\n\"\n\n\treturn ret, nil\n}", "func (vl *VlanBridge) RemoveEndpoint(endpoint *OfnetEndpoint) error {\n\tlog.Infof(\"Received DELETE endpoint: %+v\", endpoint)\n\n\t// Remove the endpoint from policy tables\n\terr := vl.policyAgent.DelEndpoint(endpoint)\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting endpoint to policy agent{%+v}. Err: %v\", endpoint, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalTransport(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:transport/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *EventProcessingMatchingApiService) DeleteUsingDELETE18(ctx _context.Context, matchingRuleId string) ApiDeleteUsingDELETE18Request {\n\treturn ApiDeleteUsingDELETE18Request{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmatchingRuleId: matchingRuleId,\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitOverloadBit(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:overload-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaVirtualLinksVirtualLinkConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, remoteRouterId string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:virtual-links/frinx-openconfig-network-instance:virtual-link/{remote-router-id}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"remote-router-id\"+\"}\", fmt.Sprintf(\"%v\", remoteRouterId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func Delete(c *drycc.Client, appID string, name string, port int, protocol string) error {\n\tu := fmt.Sprintf(\"/v2/apps/%s/gateways/\", appID)\n\n\treq := api.GatewayRemoveRequest{Name: name, Port: port, Protocol: protocol}\n\n\tbody, err := json.Marshal(req)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := c.Request(\"DELETE\", u, body)\n\tif err == nil {\n\t\tres.Body.Close()\n\t}\n\treturn err\n}", "func addIDToDeleteRequest(r *resource,\n\tinput *svcsdk.DeleteVpcEndpointsInput) error {\n\tif r.ko.Status.VPCEndpointID == nil {\n\t\treturn errors.New(\"unable to extract VPCEndpointID from resource\")\n\t}\n\tinput.VpcEndpointIds = []*string{r.ko.Status.VPCEndpointID}\n\treturn nil\n}", "func (d *InterfaceVrfDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error) {\n\tswIfIndex, vrf, inheritedVrf, ipv4, ipv6, err := d.getParametersFromKey(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !inheritedVrf && vrf > 0 && ipv4 {\n\t\terr = d.ifHandler.SetInterfaceVrf(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\tif !inheritedVrf && vrf > 0 && ipv6 {\n\t\terr = d.ifHandler.SetInterfaceVrfIPv6(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func makeDeleteBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a bookRequest\n\t\treq := request.(deleteBookRequest)\n\n\t\t// call actual service with data from the req\n\t\terr := svc.DeleteBook(req.BookId)\n\t\treturn deleteBookResponse{\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func (r *ProjectsBrokersV2ServiceInstancesServiceBindingsService) Delete(parent string, instanceId string, bindingId string) *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall {\n\tc := &ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.instanceId = instanceId\n\tc.bindingId = bindingId\n\treturn c\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitAttachedBitConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:attached-bit/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaVirtualLinksVirtualLink(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, remoteRouterId string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:virtual-links/frinx-openconfig-network-instance:virtual-link/{remote-router-id}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"remote-router-id\"+\"}\", fmt.Sprintf(\"%v\", remoteRouterId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (p *fullEndpoint) delete(expectedOldValue *Endpoint) {\n\tatomic.CompareAndSwapPointer(&p.endpoint, unsafe.Pointer(expectedOldValue), nil)\n}", "func NewRevokeDeviceCertificateUsingDELETEParams() *RevokeDeviceCertificateUsingDELETEParams {\n\tvar ()\n\treturn &RevokeDeviceCertificateUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (h *descriptorHandler) delete(key string, value proto.Message, metadata kvs.Metadata) error {\n\tif h.descriptor == nil {\n\t\treturn nil\n\t}\n\tif h.descriptor.Delete == nil {\n\t\treturn kvs.ErrUnimplementedDelete\n\t}\n\tdefer trackDescMethod(h.descriptor.Name, \"Delete\")()\n\terr := h.descriptor.Delete(key, value, metadata)\n\tif nsErr := checkNetNs(); nsErr != nil {\n\t\terr = nsErr\n\t}\n\treturn err\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupTransportConfig(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:transport/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalTransportConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:transport/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitOverloadBitConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:overload-bit/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalReferenceBandwidth(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:reference-bandwidth/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func DeleteHCNEndpoint(ctx context.Context, i *Endpoint, netns string) (string, error) {\n\tif netns == \"\" ||\n\t\t!i.isValid() {\n\t\treturn \"\", nil\n\t}\n\n\t// get endpoint\n\tvar ep *hcn.HostComputeEndpoint\n\tif i.ID != \"\" {\n\t\tvar err error\n\t\tep, err = hcn.GetEndpointByID(i.ID)\n\t\tif err != nil {\n\t\t\tif hcn.IsNotFoundError(err) {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to get HostComputeEndpoint %s\", i.ID)\n\t\t}\n\t} else {\n\t\tvar err error\n\t\tep, err = hcn.GetEndpointByName(i.Name)\n\t\tif err != nil {\n\t\t\tif hcn.IsNotFoundError(err) {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to get HostComputeEndpoint %s\", i.Name)\n\t\t}\n\t}\n\n\t// delete\n\treturn deleteHCNEndpoint(ep, netns)\n}", "func (d *Driver) DeleteEndpoint(r *sdk.DeleteEndpointRequest) error {\n\tlog.Debugf(\"Delete endpoint request: %+v\", &r)\n\t//TODO: null check cidr in case driver restarted and doesn't know the network to avoid panic\n\tlog.Debugf(\"Delete endpoint %s\", r.EndpointID)\n\n\tnid := r.NetworkID\n\teid := r.EndpointID\n\n\t// Get the network handler and make sure it exists\n\td.Lock()\n\tn, ok := d.networks[nid]\n\td.Unlock()\n\n\tif !ok {\n\t\treturn types.InternalMaskableErrorf(\"network %s does not exist\", nid)\n\t}\n\tif n == nil {\n\t\treturn driverapi.ErrNoNetwork(nid)\n\t}\n\n\t// Sanity Check\n\tn.Lock()\n\tif n.id != nid {\n\t\tn.Unlock()\n\t\treturn InvalidNetworkIDError(nid)\n\t}\n\tn.Unlock()\n\n\t// Check endpoint id and if an endpoint is actually there\n\tep, err := n.getEndpoint(eid)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ep == nil {\n\t\treturn EndpointNotFoundError(eid)\n\t}\n\n\t// Remove it\n\tn.Lock()\n\tdelete(n.endpoints, eid)\n\tn.Unlock()\n\n\t// On failure make sure to set back ep in n.endpoints, but only\n\t// if it hasn't been taken over already by some other thread.\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tn.Lock()\n\t\t\tif _, ok := n.endpoints[eid]; !ok {\n\t\t\t\tn.endpoints[eid] = ep\n\t\t\t}\n\t\t\tn.Unlock()\n\t\t}\n\t}()\n\n\t// Try removal of link. Discard error: it is a best effort.\n\t// Also make sure defer does not see this error either.\n\tif link, err := d.nlh.LinkByName(ep.srcName); err == nil {\n\t\td.nlh.LinkDel(link)\n\t}\n\n\treturn nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceInterfaceRefConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:interface-ref/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceLsaFilterConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:lsa-filter/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsSignalingProtocols(ctx context.Context, name string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:signaling-protocols/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceMplsIgpLdpSync(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceMplsIgpLdpSyncConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (self *PolicyAgent) DelEndpoint(endpoint *OfnetEndpoint) error {\n\n\t// find the dst group flow\n\tself.mutex.RLock()\n\tdstGrp := self.dstGrpFlow[endpoint.EndpointID]\n\tself.mutex.RUnlock()\n\tif dstGrp == nil {\n\t\treturn errors.New(\"Dst Group not found\")\n\t}\n\n\t// delete the Flow\n\terr := dstGrp.Delete()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting dst group for endpoint: %+v. Err: %v\", endpoint, err)\n\t}\n\n\t// delete the cache\n\tself.mutex.Lock()\n\tdelete(self.dstGrpFlow, endpoint.EndpointID)\n\tself.mutex.Unlock()\n\treturn nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalReferenceBandwidthConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:reference-bandwidth/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (s *InterconnectAttachmentServer) DeleteComputeBetaInterconnectAttachment(ctx context.Context, request *betapb.DeleteComputeBetaInterconnectAttachmentRequest) (*emptypb.Empty, error) {\n\n\tcl, err := createConfigInterconnectAttachment(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptypb.Empty{}, cl.DeleteInterconnectAttachment(ctx, ProtoToInterconnectAttachment(request.GetResource()))\n\n}", "func DeleteProductEndPoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "func NewDelSubDeviceWithCoreRequestWithoutParam() *DelSubDeviceWithCoreRequest {\n\n return &DelSubDeviceWithCoreRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}/products/{productKey}/edges/{edgeName}:delSubDevice\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "func deletePerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tparams := mux.Vars(r)\r\n\tuuid, err := primitive.ObjectIDFromHex(params[\"uuid\"])\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tcollection := models.ConnectDB()\r\n\tobjectToDelete, err := collection.DeleteOne(context.TODO(), bson.M{\"_id\": uuid})\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(objectToDelete.DeletedCount)\r\n\r\n}", "func DeleteEndpointInfo(ctx iris.Context) {\n\turi := ctx.Request().RequestURI\n\tfabricID := ctx.Params().Get(\"id\")\n\tif _, ok := capdata.FabricDataStore.Data[fabricID]; !ok {\n\t\terrMsg := fmt.Sprintf(\"Fabric data for uri %s not found\", uri)\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceNotFound, errMsg, []interface{}{\"Fabric\", fabricID})\n\t\tctx.StatusCode(http.StatusNotFound)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\tendpointData, ok := capdata.EndpointDataStore[uri]\n\tif !ok {\n\t\terrMsg := fmt.Sprintf(\"Endpoint data for uri %s not found\", uri)\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceNotFound, errMsg, []interface{}{\"Endpoint\", fabricID})\n\t\tctx.StatusCode(http.StatusNotFound)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\tif endpointData.Endpoint.Links != nil && len(endpointData.Endpoint.Links.AddressPools) > 0 {\n\t\terrMsg := fmt.Sprintf(\"Endpoint cannot be deleted as there are dependent upon AddressPool\")\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceCannotBeDeleted, errMsg, []interface{}{uri, \"Endpoint\"})\n\t\tctx.StatusCode(http.StatusNotAcceptable)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\t// Todo:Add the validation to verify the links\n\tdelete(capdata.EndpointDataStore, uri)\n\tctx.StatusCode(http.StatusNoContent)\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBit(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func NewDeleteProtocolUsingDELETEParamsWithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsLspsUnconstrainedPathPathSetupProtocol(ctx context.Context, name string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:lsps/frinx-openconfig-network-instance:unconstrained-path/frinx-openconfig-network-instance:path-setup-protocol/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobal(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2GlobalMplsIgpLdpSyncConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (client *WebAppsClient) deleteHostNameBindingSlotCreateRequest(ctx context.Context, resourceGroupName string, name string, slot string, hostName string, options *WebAppsDeleteHostNameBindingSlotOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}\"\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 slot == \"\" {\n\t\treturn nil, errors.New(\"parameter slot cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{slot}\", url.PathEscape(slot))\n\tif hostName == \"\" {\n\t\treturn nil, errors.New(\"parameter hostName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{hostName}\", url.PathEscape(hostName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.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 (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2Global(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2GlobalMplsIgpLdpSync(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (mm *Manager) OnBcsEndpointDelete(obj interface{}) {\n\tbcsendpoint, ok := obj.(*v2.BcsEndpoint)\n\tif !ok {\n\t\tmesosCritical.WithLabelValues(typeBcsEndpoint, eventDelete).Inc()\n\t\tblog.Errorf(\"[Critical]MesosManager BcsEndpoint event handler get unknown type obj %v OnDelete\", obj)\n\t\treturn\n\t}\n\tkey := fmt.Sprintf(\"%s/%s\", bcsendpoint.GetNamespace(), bcsendpoint.GetName())\n\tblog.V(5).Infof(\"BcsEndpoint %s delete, ready to refresh\", key)\n\tmesosEvent.WithLabelValues(typeBcsEndpoint, eventDelete, statusSuccess).Inc()\n\tmm.deleteAppService(key)\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2GlobalConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsLspsUnconstrainedPathPathSetupProtocolLdp(ctx context.Context, name string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:lsps/frinx-openconfig-network-instance:unconstrained-path/frinx-openconfig-network-instance:path-setup-protocol/frinx-openconfig-network-instance:ldp/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (v *EventPipelineParameterDelete) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonF8e2f9b1DecodeGithubComOvhCdsSdk16(l, v)\n}", "func makeDeleteTagHandler(m *http.ServeMux, endpoints endpoint.Endpoints, options []http1.ServerOption) {\n\tm.Handle(\"/delete-tag\", http1.NewServer(endpoints.DeleteTagEndpoint, decodeDeleteTagRequest, encodeDeleteTagResponse, options...))\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (s *DefaultClient) Del(endpoint string) (resp *http.Response, err error) {\n\t_, resp, err = s.http(http.MethodDelete, endpoint, nil)\n\treturn\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceInterfaceRef(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:interface-ref/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (es *Endpoints) DelByUUID(uuid string) {\n\tes.Lock()\n\tdefer es.Unlock()\n\tif i, ok := es.mapUUID[uuid]; ok {\n\t\tdelete(es.mapUUID, uuid)\n\n\t\tswitch {\n\t\tcase i == 0:\n\t\t\tif len(es.endpoints) == 1 {\n\t\t\t\tes.endpoints = make([]*Endpoint, 0)\n\t\t\t} else {\n\t\t\t\tes.endpoints = es.endpoints[i+1:]\n\t\t\t}\n\t\tcase i == len(es.endpoints)-1:\n\t\t\tes.endpoints = es.endpoints[:i]\n\t\tdefault:\n\t\t\tes.endpoints = append(es.endpoints[:i], es.endpoints[i+1:]...)\n\t\t}\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsSignalingProtocolsLdpInterfaceAttributes(ctx context.Context, name string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:signaling-protocols/frinx-openconfig-network-instance:ldp/frinx-openconfig-network-instance:interface-attributes/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupLoggingOptions(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:logging-options/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func EndpointDeleteMessage(e notifications.RegenNotificationInfo) AgentNotifyMessage {\n\tnotification := EndpointNotification{\n\t\tEndpointRegenNotification: EndpointRegenNotification{\n\t\t\tID: e.GetID(),\n\t\t\tLabels: e.GetOpLabels(),\n\t\t},\n\t\tPodName: e.GetK8sPodName(),\n\t\tNamespace: e.GetK8sNamespace(),\n\t}\n\n\treturn AgentNotifyMessage{\n\t\tType: AgentNotifyEndpointDeleted,\n\t\tNotification: notification,\n\t}\n}" ]
[ "0.78896624", "0.6120699", "0.5892373", "0.58651924", "0.56486714", "0.5636188", "0.5624453", "0.5530282", "0.55268186", "0.5493304", "0.5451638", "0.5444671", "0.54328173", "0.5395458", "0.53122944", "0.52827656", "0.52808744", "0.5268355", "0.52518433", "0.52463406", "0.5246078", "0.5229603", "0.51847214", "0.5176718", "0.5162673", "0.5144695", "0.51015204", "0.5101025", "0.5100676", "0.50845134", "0.50822383", "0.50775546", "0.5021456", "0.5009743", "0.5000824", "0.49872282", "0.49811193", "0.49757522", "0.4971316", "0.49628067", "0.4955001", "0.49432155", "0.493378", "0.4923893", "0.49228188", "0.4921432", "0.4913517", "0.49090612", "0.4897652", "0.48954105", "0.48851725", "0.48791513", "0.4874207", "0.48632395", "0.48559514", "0.4855919", "0.48557594", "0.48555908", "0.48549524", "0.48519373", "0.48503777", "0.48469213", "0.4841938", "0.48203993", "0.48117194", "0.48094672", "0.47893602", "0.47779867", "0.47765037", "0.47703898", "0.4766567", "0.47537977", "0.47489718", "0.47413784", "0.4735514", "0.47266427", "0.47260794", "0.4722918", "0.47228804", "0.47218972", "0.4721447", "0.47208732", "0.47195557", "0.47174346", "0.4714273", "0.47127092", "0.47071847", "0.47063372", "0.47006196", "0.46915543", "0.46904343", "0.4680746", "0.4676892", "0.46702808", "0.46649012", "0.46641713", "0.4663929", "0.46617413", "0.46607366", "0.46596915" ]
0.79024434
0
SetProtocolEndpointUUID adds the protocolEndpointUuid to the vvol binding delete params
SetProtocolEndpointUUID добавляет protocolEndpointUuid в параметры удаления связывания vvol
func (o *VvolBindingDeleteParams) SetProtocolEndpointUUID(protocolEndpointUUID string) { o.ProtocolEndpointUUID = protocolEndpointUUID }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func (ec *ExtensionClient) DeleteEndpoint(extensionID, serviceID, URL string) error {\n\n\turl := url.QueryEscape(URL)\n\trequest, err := extensionc.BuildDeleteEndpointPayload(extensionID, serviceID, url)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = ec.c.DeleteEndpoint()(context.Background(), request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *DeleteProtocolUsingDELETEParams) WithProtocolID(protocolID string) *DeleteProtocolUsingDELETEParams {\n\to.SetProtocolID(protocolID)\n\treturn o\n}", "func (a *DefaultApiService) DeleteEndpoint(ctx _context.Context, id string) ApiDeleteEndpointRequest {\n\treturn ApiDeleteEndpointRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "func (m *peerMap) deleteEndpoint(ep *endpoint) {\n\tif ep == nil {\n\t\treturn\n\t}\n\tep.stopAndReset()\n\n\tepDisco := ep.disco.Load()\n\n\tpi := m.byNodeKey[ep.publicKey]\n\tif epDisco != nil {\n\t\tdelete(m.nodesOfDisco[epDisco.key], ep.publicKey)\n\t}\n\tdelete(m.byNodeKey, ep.publicKey)\n\tif pi == nil {\n\t\t// Kneejerk paranoia from earlier issue 2801.\n\t\t// Unexpected. But no logger plumbed here to log so.\n\t\treturn\n\t}\n\tfor ip := range pi.ipPorts {\n\t\tdelete(m.byIPPort, ip)\n\t}\n}", "func DeleteEndpoint(serviceAccountProvider provider.ServiceAccountProvider, projectProvider provider.ProjectProvider, userInfoGetter provider.UserInfoGetter) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq, ok := request.(deleteReq)\n\t\tif !ok {\n\t\t\treturn nil, errors.NewBadRequest(\"invalid request\")\n\t\t}\n\t\terr := req.Validate()\n\t\tif err != nil {\n\t\t\treturn nil, errors.NewBadRequest(err.Error())\n\t\t}\n\t\tuserInfo, err := userInfoGetter(ctx, req.ProjectID)\n\t\tif err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\t\t// check if project exist\n\t\tif _, err := projectProvider.Get(userInfo, req.ProjectID, &provider.ProjectGetOptions{}); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\t// check if service account exist before deleting it\n\t\tif _, err := serviceAccountProvider.Get(userInfo, req.ServiceAccountID, nil); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\tif err := serviceAccountProvider.Delete(userInfo, req.ServiceAccountID); err != nil {\n\t\t\treturn nil, common.KubernetesErrorToHTTPError(err)\n\t\t}\n\n\t\treturn nil, nil\n\t}\n}", "func DeleteEndpoint(w http.ResponseWriter, r *http.Request) {\r\n\tr.Header.Set(\"Content-Type\", \"application/json, charset=UTF-8\")\r\n\tvar dc DeleteConfig\r\n\r\n\tswitch r.Method {\r\n\tcase \"GET\":\r\n\t\tparams := mux.Vars(r)\r\n\t\tdc.Default()\r\n\t\tdc.Endpoint = params[\"endpoint_name\"]\r\n\t\tdc.EndpointList = append(dc.EndpointList, dc.Endpoint)\r\n\tcase \"POST\":\r\n\t\tbody, err := ioutil.ReadAll(r.Body)\r\n\t\tif err != nil {\r\n\t\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/endpoint, failed to read request\")\r\n\t\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Failed to read HTTP request\"))\r\n\t\t\treturn\r\n\t\t}\r\n\t\tdc.LoadParams(body)\r\n\t}\r\n\r\n\t// Verify Endpoint is provided in request body\r\n\tif len(dc.EndpointList) == 0 {\r\n\t\tapi.LogDebug(api.DEBUG, \"[+] POST /delete/endpoint - endpoint is required\")\r\n\t\tfmt.Fprintln(w, api.HttpFailureMessage(\"Endpoint required\"))\r\n\t\treturn\r\n\t}\r\n\r\n\tvar query elastic.Query\r\n\r\n\t// Convert EndpointList to interface{} slice\r\n\tendpoints := make([]interface{}, len(dc.EndpointList))\r\n\tfor i, v := range dc.EndpointList {\r\n\t\tendpoints[i] = v\r\n\t}\r\n\r\n\tquery = elastic.NewBoolQuery().\r\n\t\tMust(elastic.NewWildcardQuery(\"CaseInfo.CaseName\", dc.CaseName),\r\n\t\t\telastic.NewTermsQuery(\"ComputerName.keyword\", endpoints...))\r\n\r\n\tdeleteEndpointByQuery(w, r, query, \"DeleteEndpoint\")\r\n\r\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func NewDeleteProtocolUsingDELETEParams() *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *DeleteProtocolUsingDELETEParams) SetProtocolID(protocolID string) {\n\to.ProtocolID = protocolID\n}", "func NewDeleteEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\tp := req.(*DeletePayload)\n\t\treturn nil, s.Delete(ctx, p)\n\t}\n}", "func (o *DeleteProtocolUsingDELETEParams) WithContext(ctx context.Context) *DeleteProtocolUsingDELETEParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (nb *NetBuilder) DeleteEndpoint(nw *Network, ep *Endpoint) error {\n\t// Generate network name here as endpoint name is dependent upon network name.\n\tnw.Name = nb.generateHNSNetworkName(nw)\n\t// Query the namespace identifier.\n\tnsType, namespaceIdentifier := nb.getNamespaceIdentifier(ep)\n\n\t// Find the HNS endpoint ID.\n\tendpointName := nb.generateHNSEndpointName(nw.Name, namespaceIdentifier)\n\thnsEndpoint, err := hcsshim.GetHNSEndpointByName(endpointName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Detach the HNS endpoint from the container's network namespace.\n\tlog.Infof(\"Detaching HNS endpoint %s from container %s netns.\", hnsEndpoint.Id, ep.ContainerID)\n\tif nsType == hcsNamespace {\n\t\t// Detach the HNS endpoint from the namespace, if we can.\n\t\t// HCN Namespace and HNS Endpoint have a 1-1 relationship, therefore,\n\t\t// even if detachment of endpoint from namespace fails, we can still proceed to delete it.\n\t\terr = hcn.RemoveNamespaceEndpoint(namespaceIdentifier, hnsEndpoint.Id)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to detach endpoint, ignoring: %v\", err)\n\t\t}\n\t} else {\n\t\terr = hcsshim.HotDetachEndpoint(ep.ContainerID, hnsEndpoint.Id)\n\t\tif err != nil && err != hcsshim.ErrComputeSystemDoesNotExist {\n\t\t\treturn err\n\t\t}\n\n\t\t// The rest of the delete logic applies to infrastructure container only.\n\t\tif nsType == nonInfraContainerNS {\n\t\t\t// For non-infra containers, the network must not be deleted.\n\t\t\tnw.UseExisting = true\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Delete the HNS endpoint.\n\tlog.Infof(\"Deleting HNS endpoint name: %s ID: %s\", endpointName, hnsEndpoint.Id)\n\t_, err = hnsEndpoint.Delete()\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to delete HNS endpoint: %v.\", err)\n\t}\n\n\treturn err\n}", "func (client *NpmClient) EndpointDeleteReq(epinfo *netproto.Endpoint) (*netproto.Endpoint, error) {\n\treturn nil, nil\n}", "func (a AppblueprintApi) AppBlueprintsUuidDelete(uuid string) (*APIResponse, error) {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/app_blueprints/{uuid}\"\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\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}", "func deleteEndpoint(endpointId string) (string, error) {\n\tvar ret string\n\n\turi := fmt.Sprintf(\"%s/%s\", endpointURI, id)\n\turl, err := client.GetURL(uri)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\treq, err := client.BuildReq(nil, url, http.MethodDelete, true)\n\trawResp, err := client.HTTPClient().Do(req)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif _, err := client.ParseReq(rawResp); err != nil {\n\t\treturn ret, err\n\t}\n\n\t// Confirm the node was deleted.\n\tif rawResp.StatusCode != 204 {\n\t\treturn ret, errors.New(\"Endpoint was not able to be deleted\")\n\t}\n\tret = \"Endpoint deleted\\n\"\n\n\treturn ret, nil\n}", "func (o *DeleteProtocolUsingDELETEParams) WithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func MakeDeleteEndpoint(s service.DepartmentService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteRequest)\n\t\terror := s.Delete(ctx, req.Id)\n\t\treturn DeleteResponse{Error: error}, nil\n\t}\n}", "func NewDeleteProtocolUsingDELETEParamsWithHTTPClient(client *http.Client) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func (d *Driver) DeleteEndpoint(r *sdk.DeleteEndpointRequest) error {\n\tlog.Debugf(\"Delete endpoint request: %+v\", &r)\n\t//TODO: null check cidr in case driver restarted and doesn't know the network to avoid panic\n\tlog.Debugf(\"Delete endpoint %s\", r.EndpointID)\n\n\tnid := r.NetworkID\n\teid := r.EndpointID\n\n\t// Get the network handler and make sure it exists\n\td.Lock()\n\tn, ok := d.networks[nid]\n\td.Unlock()\n\n\tif !ok {\n\t\treturn types.InternalMaskableErrorf(\"network %s does not exist\", nid)\n\t}\n\tif n == nil {\n\t\treturn driverapi.ErrNoNetwork(nid)\n\t}\n\n\t// Sanity Check\n\tn.Lock()\n\tif n.id != nid {\n\t\tn.Unlock()\n\t\treturn InvalidNetworkIDError(nid)\n\t}\n\tn.Unlock()\n\n\t// Check endpoint id and if an endpoint is actually there\n\tep, err := n.getEndpoint(eid)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ep == nil {\n\t\treturn EndpointNotFoundError(eid)\n\t}\n\n\t// Remove it\n\tn.Lock()\n\tdelete(n.endpoints, eid)\n\tn.Unlock()\n\n\t// On failure make sure to set back ep in n.endpoints, but only\n\t// if it hasn't been taken over already by some other thread.\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tn.Lock()\n\t\t\tif _, ok := n.endpoints[eid]; !ok {\n\t\t\t\tn.endpoints[eid] = ep\n\t\t\t}\n\t\t\tn.Unlock()\n\t\t}\n\t}()\n\n\t// Try removal of link. Discard error: it is a best effort.\n\t// Also make sure defer does not see this error either.\n\tif link, err := d.nlh.LinkByName(ep.srcName); err == nil {\n\t\td.nlh.LinkDel(link)\n\t}\n\n\treturn nil\n}", "func (vl *VlanBridge) RemoveEndpoint(endpoint *OfnetEndpoint) error {\n\tlog.Infof(\"Received DELETE endpoint: %+v\", endpoint)\n\n\t// Remove the endpoint from policy tables\n\terr := vl.policyAgent.DelEndpoint(endpoint)\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting endpoint to policy agent{%+v}. Err: %v\", endpoint, err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r *RuntimeServer) DelThirdPartyEndpoint(ctx context.Context, re *pb.DelThirdPartyEndpointsReq) (*pb.Empty, error) {\n\tas := r.store.GetAppService(re.Sid)\n\tif as == nil {\n\t\treturn new(pb.Empty), nil\n\t}\n\tr.updateCh.In() <- discovery.Event{\n\t\tType: discovery.DeleteEvent,\n\t\tObj: &v1.RbdEndpoint{\n\t\t\tUUID: re.Uuid,\n\t\t\tSid: re.Sid,\n\t\t\tIP: re.Ip,\n\t\t\tPort: int(re.Port),\n\t\t},\n\t}\n\treturn new(pb.Empty), nil\n}", "func (client *WebAppsClient) deletePrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, options *WebAppsBeginDeletePrivateEndpointConnectionOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}\"\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 privateEndpointConnectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointConnectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointConnectionName}\", url.PathEscape(privateEndpointConnectionName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.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 NewDeleteProtocolUsingDELETEParamsWithTimeout(timeout time.Duration) *DeleteProtocolUsingDELETEParams {\n\tvar ()\n\treturn &DeleteProtocolUsingDELETEParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETEExecute(r ApiDeleteBindingUsingDELETERequest) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DeprecatedBusManagementRouterApiService.DeleteBindingUsingDELETE\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v0/bindings/{routingKeyFilter}/{fifoName}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"routingKeyFilter\"+\"}\", _neturl.PathEscape(parameterToString(r.routingKeyFilter, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"fifoName\"+\"}\", _neturl.PathEscape(parameterToString(r.fifoName, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.xAPIKEY == nil {\n\t\treturn nil, reportError(\"xAPIKEY is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tlocalVarHeaderParams[\"X-API-KEY\"] = parameterToString(*r.xAPIKEY, \"\")\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorResponseWeb\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ErrorResponseWeb\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (manager *Manager) OnDeleteEndpoint(endpoint *k8sTypes.CiliumEndpoint) {\n\tid := types.NamespacedName{\n\t\tName: endpoint.GetName(),\n\t\tNamespace: endpoint.GetNamespace(),\n\t}\n\n\tmanager.pendingEndpointEventsLock.Lock()\n\tdelete(manager.pendingEndpointEvents, id)\n\tmanager.pendingEndpointEventsLock.Unlock()\n\n\tmanager.endpointEventsQueue.Add(id)\n}", "func (s *EndpointServer) DeleteVertexaiEndpoint(ctx context.Context, request *vertexaipb.DeleteVertexaiEndpointRequest) (*emptypb.Empty, error) {\n\n\tcl, err := createConfigEndpoint(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptypb.Empty{}, cl.DeleteEndpoint(ctx, ProtoToEndpoint(request.GetResource()))\n\n}", "func (p *fullEndpoint) delete(expectedOldValue *Endpoint) {\n\tatomic.CompareAndSwapPointer(&p.endpoint, unsafe.Pointer(expectedOldValue), nil)\n}", "func DeleteProductEndPoint(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "func (self *PolicyAgent) DelEndpoint(endpoint *OfnetEndpoint) error {\n\n\t// find the dst group flow\n\tself.mutex.RLock()\n\tdstGrp := self.dstGrpFlow[endpoint.EndpointID]\n\tself.mutex.RUnlock()\n\tif dstGrp == nil {\n\t\treturn errors.New(\"Dst Group not found\")\n\t}\n\n\t// delete the Flow\n\terr := dstGrp.Delete()\n\tif err != nil {\n\t\tlog.Errorf(\"Error deleting dst group for endpoint: %+v. Err: %v\", endpoint, err)\n\t}\n\n\t// delete the cache\n\tself.mutex.Lock()\n\tdelete(self.dstGrpFlow, endpoint.EndpointID)\n\tself.mutex.Unlock()\n\treturn nil\n}", "func (a *SvmApiService) SvmPeerDelete(ctx _context.Context, peerUuid string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/svm/peers/{peer.uuid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer.uuid\"+\"}\", _neturl.QueryEscape(parameterToString(peerUuid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"application/hal+json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tvar v ErrorResponse\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (service *Service) DeleteEndpoint(ID portainer.EndpointID) error {\n\treturn service.connection.UpdateTx(func(tx portainer.Transaction) error {\n\t\treturn service.Tx(tx).DeleteEndpoint(ID)\n\t})\n}", "func (j *Jsonnet) DeleteParam(path []string) error {\n\t// TODO: make this work at the env level too\n\tparamsData, err := j.readParams(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdatedParams, err := params.DeleteFromObject(path, paramsData, j.Name(false), paramsComponentRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = j.writeParams(updatedParams); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func DeleteHCNEndpoint(ctx context.Context, i *Endpoint, netns string) (string, error) {\n\tif netns == \"\" ||\n\t\t!i.isValid() {\n\t\treturn \"\", nil\n\t}\n\n\t// get endpoint\n\tvar ep *hcn.HostComputeEndpoint\n\tif i.ID != \"\" {\n\t\tvar err error\n\t\tep, err = hcn.GetEndpointByID(i.ID)\n\t\tif err != nil {\n\t\t\tif hcn.IsNotFoundError(err) {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to get HostComputeEndpoint %s\", i.ID)\n\t\t}\n\t} else {\n\t\tvar err error\n\t\tep, err = hcn.GetEndpointByName(i.Name)\n\t\tif err != nil {\n\t\t\tif hcn.IsNotFoundError(err) {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t\treturn \"\", errors.Wrapf(err, \"failed to get HostComputeEndpoint %s\", i.Name)\n\t\t}\n\t}\n\n\t// delete\n\treturn deleteHCNEndpoint(ep, netns)\n}", "func Delete(c *drycc.Client, appID string, name string, port int, protocol string) error {\n\tu := fmt.Sprintf(\"/v2/apps/%s/gateways/\", appID)\n\n\treq := api.GatewayRemoveRequest{Name: name, Port: port, Protocol: protocol}\n\n\tbody, err := json.Marshal(req)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := c.Request(\"DELETE\", u, body)\n\tif err == nil {\n\t\tres.Body.Close()\n\t}\n\treturn err\n}", "func (sp *SessionProxy) DelEndpoint(sid string) { sp.GetSession().DelEndpoint(sid) }", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupTransport(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:transport/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func delEndpoint(domain string, addr string) error {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tservice, ok := registryMap[domain]\n\tif ok == false {\n\t\treturn ErrServiceNotFound\n\t}\n\tfor k, item := range service.Items {\n\t\tif item.Endpoint == addr {\n\t\t\tendpoints := append(service.Items[:k], service.Items[k+1:]...)\n\t\t\tservice.Items = endpoints\n\t\t\tbreak\n\t\t}\n\t}\n\tregistryMap[domain] = service\n\treturn nil\n}", "func (s *DefaultClient) Del(endpoint string) (resp *http.Response, err error) {\n\t_, resp, err = s.http(http.MethodDelete, endpoint, nil)\n\treturn\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func deleteHCNEndpoint(ep *hcn.HostComputeEndpoint, netns string) (string, error) {\n\tdefer func() { _ = recover() }()\n\tif ep == nil {\n\t\treturn \"\", nil\n\t}\n\n\t// remove endpoint from namespace\n\tif netns == \"\" {\n\t\tnetns = ep.HostComputeNamespace\n\t}\n\t_ = hcn.RemoveNamespaceEndpoint(netns, ep.Id)\n\n\t// delete endpoint\n\tif err := ep.Delete(); err != nil {\n\t\tif !hcn.IsNotFoundError(err) {\n\t\t\treturn ep.HostComputeNetwork, err\n\t\t}\n\t}\n\treturn ep.HostComputeNetwork, nil\n}", "func (do *DeleteOptions) DevfileComponentDelete() error {\n\t// Parse devfile\n\tdevObj, err := devfileParser.Parse(do.devfilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcomponentName, err := getComponentName()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkc := kubernetes.KubernetesContext{\n\t\tNamespace: do.namespace,\n\t}\n\n\tlabels := map[string]string{\n\t\t\"component\": componentName,\n\t}\n\tdevfileHandler, err := adapters.NewPlatformAdapter(componentName, devObj, kc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tspinner := log.Spinner(fmt.Sprintf(\"Deleting devfile component %s\", componentName))\n\tdefer spinner.End(false)\n\n\terr = devfileHandler.Delete(labels)\n\tif err != nil {\n\t\treturn err\n\t}\n\tspinner.End(true)\n\tlog.Successf(\"Successfully deleted component\")\n\treturn nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocol(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func NewDeleteConnectorUsingDELETEMethodNotAllowed() *DeleteConnectorUsingDELETEMethodNotAllowed {\n\treturn &DeleteConnectorUsingDELETEMethodNotAllowed{}\n}", "func (client *WebAppsClient) deletePrivateEndpointConnectionSlotCreateRequest(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, slot string, options *WebAppsBeginDeletePrivateEndpointConnectionSlotOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName}\"\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 privateEndpointConnectionName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointConnectionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointConnectionName}\", url.PathEscape(privateEndpointConnectionName))\n\tif slot == \"\" {\n\t\treturn nil, errors.New(\"parameter slot cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{slot}\", url.PathEscape(slot))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.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 (s *NotificationEndpointService) DeleteNotificationEndpoint(ctx context.Context, id platform.ID) ([]influxdb.SecretField, platform.ID, error) {\n\tif !id.Valid() {\n\t\treturn nil, 0, fmt.Errorf(\"invalid ID: please provide a valid ID\")\n\t}\n\terr := s.Client.\n\t\tDelete(prefixNotificationEndpoints, id.String()).\n\t\tDo(ctx)\n\treturn nil, 0, err\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolBgpPeerGroupsPeerGroupTransportConfig(ctx context.Context, name string, identifier string, protocolName string, peerGroupName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:bgp/frinx-openconfig-network-instance:peer-groups/frinx-openconfig-network-instance:peer-group/{peer-group-name}/frinx-openconfig-network-instance:transport/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"peer-group-name\"+\"}\", fmt.Sprintf(\"%v\", peerGroupName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func makeDeleteTagHandler(m *http.ServeMux, endpoints endpoint.Endpoints, options []http1.ServerOption) {\n\tm.Handle(\"/delete-tag\", http1.NewServer(endpoints.DeleteTagEndpoint, decodeDeleteTagRequest, encodeDeleteTagResponse, options...))\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func makeDeleteBookEndpoint(svc BookService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t// convert request into a bookRequest\n\t\treq := request.(deleteBookRequest)\n\n\t\t// call actual service with data from the req\n\t\terr := svc.DeleteBook(req.BookId)\n\t\treturn deleteBookResponse{\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func DeleteEndpointInfo(ctx iris.Context) {\n\turi := ctx.Request().RequestURI\n\tfabricID := ctx.Params().Get(\"id\")\n\tif _, ok := capdata.FabricDataStore.Data[fabricID]; !ok {\n\t\terrMsg := fmt.Sprintf(\"Fabric data for uri %s not found\", uri)\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceNotFound, errMsg, []interface{}{\"Fabric\", fabricID})\n\t\tctx.StatusCode(http.StatusNotFound)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\tendpointData, ok := capdata.EndpointDataStore[uri]\n\tif !ok {\n\t\terrMsg := fmt.Sprintf(\"Endpoint data for uri %s not found\", uri)\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceNotFound, errMsg, []interface{}{\"Endpoint\", fabricID})\n\t\tctx.StatusCode(http.StatusNotFound)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\tif endpointData.Endpoint.Links != nil && len(endpointData.Endpoint.Links.AddressPools) > 0 {\n\t\terrMsg := fmt.Sprintf(\"Endpoint cannot be deleted as there are dependent upon AddressPool\")\n\t\tlog.Error(errMsg)\n\t\tresp := updateErrorResponse(response.ResourceCannotBeDeleted, errMsg, []interface{}{uri, \"Endpoint\"})\n\t\tctx.StatusCode(http.StatusNotAcceptable)\n\t\tctx.JSON(resp)\n\t\treturn\n\t}\n\t// Todo:Add the validation to verify the links\n\tdelete(capdata.EndpointDataStore, uri)\n\tctx.StatusCode(http.StatusNoContent)\n}", "func decodeDeleteKeyPersonRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.DeleteKeyPersonRequest)\n\treturn endpoints.DeleteKeyPersonRequest{ID: req.Id}, nil\n}", "func addIDToDeleteRequest(r *resource,\n\tinput *svcsdk.DeleteVpcEndpointsInput) error {\n\tif r.ko.Status.VPCEndpointID == nil {\n\t\treturn errors.New(\"unable to extract VPCEndpointID from resource\")\n\t}\n\tinput.VpcEndpointIds = []*string{r.ko.Status.VPCEndpointID}\n\treturn nil\n}", "func (mm *Manager) OnBcsEndpointDelete(obj interface{}) {\n\tbcsendpoint, ok := obj.(*v2.BcsEndpoint)\n\tif !ok {\n\t\tmesosCritical.WithLabelValues(typeBcsEndpoint, eventDelete).Inc()\n\t\tblog.Errorf(\"[Critical]MesosManager BcsEndpoint event handler get unknown type obj %v OnDelete\", obj)\n\t\treturn\n\t}\n\tkey := fmt.Sprintf(\"%s/%s\", bcsendpoint.GetNamespace(), bcsendpoint.GetName())\n\tblog.V(5).Infof(\"BcsEndpoint %s delete, ready to refresh\", key)\n\tmesosEvent.WithLabelValues(typeBcsEndpoint, eventDelete, statusSuccess).Inc()\n\tmm.deleteAppService(key)\n}", "func ExampleWebAppsClient_BeginDeletePrivateEndpointConnectionSlot() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armappservice.NewWebAppsClient(\"34adfa4f-cedf-4dc0-ba29-b6d1a69ab345\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := client.BeginDeletePrivateEndpointConnectionSlot(ctx,\n\t\t\"rg\",\n\t\t\"testSite\",\n\t\t\"connection\",\n\t\t\"stage\",\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\tres, err := poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n\t// TODO: use response item\n\t_ = res\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalTransport(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:transport/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func MakeDeleteProductEndpoint(s service.ProductsService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteProductRequest)\n\t\tdeleteResp, err := s.DeleteProduct(ctx, req.Id)\n\t\treturn DeleteProductResponse{\n\t\t\tDeleteResp: deleteResp,\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitAttachedBit(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:attached-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitOverloadBit(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:overload-bit/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func MakeDeleteProfileEndpoint(s Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(deleteProfileRequest)\n\t\te := s.DeleteProfile(ctx, req.ProfileID)\n\t\treturn deleteProfileResponse{Err: e}, nil\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsLspsUnconstrainedPathPathSetupProtocol(ctx context.Context, name string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:lsps/frinx-openconfig-network-instance:unconstrained-path/frinx-openconfig-network-instance:path-setup-protocol/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (o *StoragePhysicalDisk) SetProtocol(v string) {\n\to.Protocol = &v\n}", "func (h *descriptorHandler) delete(key string, value proto.Message, metadata kvs.Metadata) error {\n\tif h.descriptor == nil {\n\t\treturn nil\n\t}\n\tif h.descriptor.Delete == nil {\n\t\treturn kvs.ErrUnimplementedDelete\n\t}\n\tdefer trackDescMethod(h.descriptor.Name, \"Delete\")()\n\terr := h.descriptor.Delete(key, value, metadata)\n\tif nsErr := checkNetNs(); nsErr != nil {\n\t\terr = nsErr\n\t}\n\treturn err\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaVirtualLinksVirtualLinkConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, remoteRouterId string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:virtual-links/frinx-openconfig-network-instance:virtual-link/{remote-router-id}/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"remote-router-id\"+\"}\", fmt.Sprintf(\"%v\", remoteRouterId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsLspsUnconstrainedPathPathSetupProtocolLdp(ctx context.Context, name string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:lsps/frinx-openconfig-network-instance:unconstrained-path/frinx-openconfig-network-instance:path-setup-protocol/frinx-openconfig-network-instance:ldp/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (es *Endpoints) DelByUUID(uuid string) {\n\tes.Lock()\n\tdefer es.Unlock()\n\tif i, ok := es.mapUUID[uuid]; ok {\n\t\tdelete(es.mapUUID, uuid)\n\n\t\tswitch {\n\t\tcase i == 0:\n\t\t\tif len(es.endpoints) == 1 {\n\t\t\t\tes.endpoints = make([]*Endpoint, 0)\n\t\t\t} else {\n\t\t\t\tes.endpoints = es.endpoints[i+1:]\n\t\t\t}\n\t\tcase i == len(es.endpoints)-1:\n\t\t\tes.endpoints = es.endpoints[:i]\n\t\tdefault:\n\t\t\tes.endpoints = append(es.endpoints[:i], es.endpoints[i+1:]...)\n\t\t}\n\t}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalTransportConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:transport/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterBindingDeleteArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(400, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (srv *Server) RegisterDelete(ep *Endpoint) (err error) {\n\tif ep == nil || ep.Call == nil {\n\t\treturn nil\n\t}\n\n\tep.Method = RequestMethodDelete\n\tep.RequestType = RequestTypeQuery\n\n\t// Check if the same route already registered.\n\tfor _, rute := range srv.routeDeletes {\n\t\t_, ok := rute.parse(ep.Path)\n\t\tif ok {\n\t\t\treturn ErrEndpointAmbiguous\n\t\t}\n\t}\n\n\trute, err := newRoute(ep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrv.routeDeletes = append(srv.routeDeletes, rute)\n\n\treturn nil\n}", "func (proxier *Proxier) deleteEndpointConnections(connectionMap map[util.EndpointServicePair]bool) {\n\tfor epSvcPair := range connectionMap {\n\t\tif svcInfo, ok := proxier.serviceMap[epSvcPair.ServicePortName]; ok && svcInfo.Protocol == strings.ToLower(string(api.ProtocolUDP)) {\n\t\t\tendpointIP := util.IPPart(epSvcPair.Endpoint)\n\t\t\terr := util.ClearUDPConntrackForPeers(proxier.exec, svcInfo.ClusterIP.String(), endpointIP)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"Failed to delete %s endpoint connections, error: %v\", epSvcPair.ServicePortName.String(), err)\n\t\t\t}\n\t\t}\n\t}\n}", "func (r *ProjectsBrokersV2ServiceInstancesServiceBindingsService) Delete(parent string, instanceId string, bindingId string) *ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall {\n\tc := &ProjectsBrokersV2ServiceInstancesServiceBindingsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\tc.instanceId = instanceId\n\tc.bindingId = bindingId\n\treturn c\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitOverloadBitConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:overload-bit/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceMplsSignalingProtocols(ctx context.Context, name string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:signaling-protocols/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func DeletePlayerEndPoint(writer http.ResponseWriter, request *http.Request) {\n\tdefer request.Body.Close()\n\tlogRequestInfo(request)\n\n\tvar player models.Player\n\n\tif err := json.NewDecoder(request.Body).Decode(&player); err != nil {\n\t\trespondWithError(writer, http.StatusInternalServerError, err.Error())\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\tif err := playerDAO.Delete(player); err != nil {\n\t\trespondWithError(writer, http.StatusInternalServerError, err.Error())\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\n\trespondWithJSON(writer, http.StatusOK, map[string]string{\"result\": \"success\"})\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalLspBitAttachedBitConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:lsp-bit/frinx-openconfig-network-instance:attached-bit/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func EndpointDeleteMessage(e notifications.RegenNotificationInfo) AgentNotifyMessage {\n\tnotification := EndpointNotification{\n\t\tEndpointRegenNotification: EndpointRegenNotification{\n\t\t\tID: e.GetID(),\n\t\t\tLabels: e.GetOpLabels(),\n\t\t},\n\t\tPodName: e.GetK8sPodName(),\n\t\tNamespace: e.GetK8sNamespace(),\n\t}\n\n\treturn AgentNotifyMessage{\n\t\tType: AgentNotifyEndpointDeleted,\n\t\tNotification: notification,\n\t}\n}", "func (*DeleteEndpointRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{11}\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceMplsIgpLdpSync(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func MakeDeleteNodeEndpoint(s registry.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteNodeRequest)\n\t\terr := s.DeleteNode(ctx, req.Token, req.Id)\n\t\treturn DeleteNodeResponse{Err: err}, nil\n\t}\n}", "func deletePerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tparams := mux.Vars(r)\r\n\tuuid, err := primitive.ObjectIDFromHex(params[\"uuid\"])\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tcollection := models.ConnectDB()\r\n\tobjectToDelete, err := collection.DeleteOne(context.TODO(), bson.M{\"_id\": uuid})\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(objectToDelete.DeletedCount)\r\n\r\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceMplsIgpLdpSyncConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (p *PatternServeMux) Del(pat string, h http.Handler) {\n\tp.Add(\"DELETE\", pat, h)\n}", "func (c *Client) Delete(ctx context.Context, p *DeletePayload) (err error) {\n\t_, err = c.DeleteEndpoint(ctx, p)\n\treturn\n}", "func (v *EventPipelineParameterDelete) UnmarshalEasyJSON(l *jlexer.Lexer) {\n\teasyjsonF8e2f9b1DecodeGithubComOvhCdsSdk16(l, v)\n}", "func (a *DefaultApiService) DeleteEndpointExecute(r ApiDeleteEndpointRequest) (*_nethttp.Response, GenericOpenAPIError) {\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\texecutionError GenericOpenAPIError\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DefaultApiService.DeleteEndpoint\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/endpoints/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(r.id, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\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 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 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 localVarHTTPResponse, executionError\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ErrorNotFound\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, executionError\n}", "func (d *ABFToInterfaceDescriptor) Delete(key string, emptyVal proto.Message, metadata api.Metadata) (err error) {\n\t// validate and get all required values\n\tisIPv6, abfIdx, ifIdx, priority, err := d.process(key)\n\tif err != nil {\n\t\td.log.Error(err)\n\t\treturn err\n\t}\n\n\t// detach interface to ABF policy\n\tif isIPv6 {\n\t\treturn d.abfHandler.AbfDetachInterfaceIPv6(abfIdx, ifIdx, priority)\n\t}\n\treturn d.abfHandler.AbfDetachInterfaceIPv4(abfIdx, ifIdx, priority)\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceInterfaceRefConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:interface-ref/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaVirtualLinksVirtualLink(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, remoteRouterId string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:virtual-links/frinx-openconfig-network-instance:virtual-link/{remote-router-id}/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"remote-router-id\"+\"}\", fmt.Sprintf(\"%v\", remoteRouterId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolIsisGlobalReferenceBandwidth(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:isis/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:reference-bandwidth/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func ExampleRDS_DeleteDBClusterEndpoint_shared00() {\n\tsvc := rds.New(session.New())\n\tinput := &rds.DeleteDBClusterEndpointInput{\n\t\tDBClusterEndpointIdentifier: aws.String(\"mycustomendpoint\"),\n\t}\n\n\tresult, err := svc.DeleteDBClusterEndpoint(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase rds.ErrCodeInvalidDBClusterEndpointStateFault:\n\t\t\t\tfmt.Println(rds.ErrCodeInvalidDBClusterEndpointStateFault, aerr.Error())\n\t\t\tcase rds.ErrCodeDBClusterEndpointNotFoundFault:\n\t\t\t\tfmt.Println(rds.ErrCodeDBClusterEndpointNotFoundFault, aerr.Error())\n\t\t\tcase rds.ErrCodeInvalidDBClusterStateFault:\n\t\t\t\tfmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2GlobalMplsIgpLdpSyncConfig(ctx context.Context, name string, identifier string, protocolName string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:global/frinx-openconfig-network-instance:mpls/frinx-openconfig-network-instance:igp-ldp-sync/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func MakeDeleteEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteRequest)\n\t\terror := s.Delete(ctx, req.Id)\n\t\treturn DeleteResponse{Error: error}, nil\n\t}\n}", "func (a *SvmApiService) SvmPeerPermissionDelete(ctx _context.Context, clusterUuid string, svmUuid string) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/svm/peer-permissions/{cluster.uuid}/{svm.uuid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"cluster.uuid\"+\"}\", _neturl.QueryEscape(parameterToString(clusterUuid, \"\")), -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"svm.uuid\"+\"}\", _neturl.QueryEscape(parameterToString(svmUuid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"application/hal+json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tvar v ErrorResponse\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (a *FrinxOpenconfigNetworkInstanceApiService) DeleteFrinxOpenconfigNetworkInstanceNetworkInstancesNetworkInstanceProtocolsProtocolOspfv2AreasAreaInterfacesInterfaceLsaFilterConfig(ctx context.Context, name string, identifier string, protocolName string, areaIdentifier string, id string, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-openconfig-network-instance:network-instances/frinx-openconfig-network-instance:network-instance/{name}/frinx-openconfig-network-instance:protocols/frinx-openconfig-network-instance:protocol/{identifier}/{protocol-name}/frinx-openconfig-network-instance:ospfv2/frinx-openconfig-network-instance:areas/frinx-openconfig-network-instance:area/{area-identifier}/frinx-openconfig-network-instance:interfaces/frinx-openconfig-network-instance:interface/{id}/frinx-openconfig-network-instance:lsa-filter/frinx-openconfig-network-instance:config/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"identifier\"+\"}\", fmt.Sprintf(\"%v\", identifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"protocol-name\"+\"}\", fmt.Sprintf(\"%v\", protocolName), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"area-identifier\"+\"}\", fmt.Sprintf(\"%v\", areaIdentifier), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func (o *StoragePhysicalDiskAllOf) SetProtocol(v string) {\n\to.Protocol = &v\n}", "func (d *InterfaceVrfDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error) {\n\tswIfIndex, vrf, inheritedVrf, ipv4, ipv6, err := d.getParametersFromKey(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !inheritedVrf && vrf > 0 && ipv4 {\n\t\terr = d.ifHandler.SetInterfaceVrf(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\tif !inheritedVrf && vrf > 0 && ipv6 {\n\t\terr = d.ifHandler.SetInterfaceVrfIPv6(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (client PatternClient) DeletePatternResponder(resp *http.Response) (result OperationStatus, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}" ]
[ "0.7659155", "0.570262", "0.5665805", "0.5574231", "0.5487855", "0.5458138", "0.54484373", "0.53901285", "0.53780055", "0.5294667", "0.525582", "0.52462846", "0.5224845", "0.51934177", "0.51763844", "0.5141262", "0.51157594", "0.50997233", "0.50864244", "0.5083183", "0.5074168", "0.50425315", "0.50207734", "0.5019197", "0.49907386", "0.49783346", "0.49025732", "0.4901423", "0.4880698", "0.48686674", "0.48633406", "0.48553225", "0.48549277", "0.4838389", "0.48282278", "0.48248425", "0.48178375", "0.48143038", "0.47825012", "0.47782", "0.47685513", "0.47555846", "0.475199", "0.4737166", "0.4736255", "0.47239432", "0.47058982", "0.46993423", "0.46952316", "0.46903276", "0.4684593", "0.4682517", "0.46742675", "0.46615297", "0.46572226", "0.4645298", "0.46447167", "0.4633049", "0.4624563", "0.46199504", "0.4618318", "0.46034646", "0.45989957", "0.4597142", "0.45820674", "0.4580892", "0.45792988", "0.45774424", "0.45762387", "0.45734647", "0.4572499", "0.45715922", "0.45692363", "0.45659238", "0.4555449", "0.45550865", "0.45513573", "0.45482436", "0.45472884", "0.45465866", "0.45455536", "0.4545486", "0.4533648", "0.45299247", "0.4514827", "0.4513684", "0.4513491", "0.4501826", "0.45017937", "0.44947034", "0.4491033", "0.44896305", "0.44893298", "0.44768938", "0.44745764", "0.44701675", "0.44681287", "0.4464367", "0.4455591", "0.44536605" ]
0.8175953
0
WithVvolUUID adds the vvolUUID to the vvol binding delete params
WithVvolUUID добавляет vvolUUID в параметры удаления привязки vvol
func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams { o.SetVvolUUID(vvolUUID) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) SetVvolUUID(vvolUUID string) {\n\to.VvolUUID = vvolUUID\n}", "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func DeleteVol(uuid string) int32 {\n\n\t_, conn, err := utils.DialVolMgr(VolMgrHosts)\n\tif err != nil {\n\t\tlogger.Error(\"DeleteVol failed,Dial to VolMgrHosts fail :%v\", err)\n\t\treturn -1\n\t}\n\tdefer conn.Close()\n\tvc := vp.NewVolMgrClient(conn)\n\n\tpDeleteVolReq := &vp.DeleteVolReq{\n\t\tUUID: uuid,\n\t}\n\tctx, _ := context.WithTimeout(context.Background(), VOLUME_TIMEOUT_SECONDS*time.Second)\n\tpDeleteVolAck, err := vc.DeleteVol(ctx, pDeleteVolReq)\n\tif err != nil {\n\t\treturn -1\n\t}\n\n\tif pDeleteVolAck.Ret != 0 {\n\t\tlogger.Error(\"DeleteVol failed :%v\", pDeleteVolAck.Ret)\n\t\treturn -1\n\t}\n\n\treturn 0\n}", "func (l *Libvirt) StorageVolDelete(Vol StorageVol, Flags StorageVolDeleteFlags) (err error) {\n\tvar buf []byte\n\n\targs := StorageVolDeleteArgs {\n\t\tVol: Vol,\n\t\tFlags: Flags,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(94, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func deleteVolume(vol string) {\n\tclient.RemoveVolume(vol)\n}", "func (o *VvolBindingDeleteParams) WithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (p *FCProvisioner) Delete(volume *v1.PersistentVolume, config map[string]string, nodeList []*v1.Node) (err error) {\n\tdefer func() {\n\t\tif res := recover(); res != nil && err == nil {\n\t\t\terr = errors.New(\"error while deleting volume \" + fmt.Sprint(res))\n\t\t}\n\t}()\n\tprovisioned, err := p.provisioned(volume)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error determining if this provisioner was the one to provision volume %q: %v\", volume.Name, err)\n\t}\n\tif !provisioned {\n\t\tstrerr := fmt.Sprintf(\"this provisioner id %s didn't provision volume %q and so can't delete it; id %s did & can\", createdBy, volume.Name, volume.Annotations[annCreatedBy])\n\t\treturn &controller.IgnoredError{Reason: strerr}\n\t}\n\n\tglog.Info(\"volume deletion request received: \", volume.GetName())\n\n\tif volume.Annotations[\"volumeId\"] == \"\" {\n\t\terr = errors.New(\"volumeid is empty\")\n\t\treturn err\n\t}\n\tvolId, err := strconv.ParseInt(volume.Annotations[\"volumeId\"], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = p.volDestroy(volId, volume.Annotations[\"volume_name\"], nodeList)\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn err\n\n\t}\n\tglog.Info(\"Volume deleted: \", volume.GetName())\n\treturn nil\n}", "func (e *ExternalInterface) DeleteVolume(ctx context.Context, req *systemsproto.VolumeRequest, pc *PluginContact, taskID string) {\n\tvar resp response.RPC\n\tvar targetURI = \"/redfish/v1/Systems/\" + req.SystemID + \"/Storage/\" + req.StorageInstance + \"/Volumes\" + req.VolumeID\n\n\ttaskInfo := &common.TaskUpdateInfo{Context: ctx, TaskID: taskID, TargetURI: targetURI,\n\t\tUpdateTask: pc.UpdateTask, TaskRequest: string(req.RequestBody)}\n\tvar volume smodel.Volume\n\terr := JSONUnmarshalFunc(req.RequestBody, &volume)\n\tif err != nil {\n\t\terrorMessage := \"Error while unmarshaling the create volume request: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errorMessage)\n\t\tcommon.GeneralError(http.StatusBadRequest, response.MalformedJSON, errorMessage, []interface{}{}, taskInfo)\n\t\treturn\n\t}\n\n\t// spliting the uuid and system id\n\trequestData := strings.SplitN(req.SystemID, \".\", 2)\n\tif len(requestData) != 2 || requestData[1] == \"\" {\n\t\terrorMessage := \"error: SystemUUID not found\"\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errorMessage, []interface{}{\"System\", req.SystemID}, taskInfo)\n\t\treturn\n\t}\n\tuuid := requestData[0]\n\ttarget, gerr := e.DB.GetTarget(uuid)\n\tif gerr != nil {\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, gerr.Error(), []interface{}{\"System\", uuid}, taskInfo)\n\t\treturn\n\t}\n\t// Validating the storage instance\n\tif StringTrimSpace(req.VolumeID) == \"\" {\n\t\terrorMessage := \"error: Volume id is not found\"\n\t\tcommon.GeneralError(http.StatusBadRequest, response.ResourceNotFound, errorMessage, []interface{}{\"Volume\", req.VolumeID}, taskInfo)\n\t\treturn\n\t}\n\n\t// Validating the request JSON properties for case sensitive\n\tinvalidProperties, err := RequestParamsCaseValidatorFunc(req.RequestBody, volume)\n\tif err != nil {\n\t\terrMsg := \"error while validating request parameters for volume creation: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errMsg, nil, taskInfo)\n\t\treturn\n\t} else if invalidProperties != \"\" {\n\t\terrorMessage := \"error: one or more properties given in the request body are not valid, ensure properties are listed in uppercamelcase \"\n\t\tl.LogWithFields(ctx).Error(errorMessage)\n\t\tcommon.GeneralError(http.StatusBadRequest, response.PropertyUnknown, errorMessage, []interface{}{invalidProperties}, taskInfo)\n\t\treturn\n\t}\n\n\tkey := fmt.Sprintf(\"/redfish/v1/Systems/%s/Storage/%s/Volumes/%s\", req.SystemID, req.StorageInstance, req.VolumeID)\n\t_, dbErr := e.DB.GetResource(ctx, \"Volumes\", key)\n\tif dbErr != nil {\n\t\tl.LogWithFields(ctx).Error(\"error getting volumes details : \" + dbErr.Error())\n\t\terrorMessage := dbErr.Error()\n\t\tif errors.DBKeyNotFound == dbErr.ErrNo() {\n\t\t\tvar getDeviceInfoRequest = scommon.ResourceInfoRequest{\n\t\t\t\tURL: key,\n\t\t\t\tUUID: uuid,\n\t\t\t\tSystemID: requestData[1],\n\t\t\t\tContactClient: e.ContactClient,\n\t\t\t\tDevicePassword: e.DevicePassword,\n\t\t\t\tGetPluginStatus: e.GetPluginStatus,\n\t\t\t}\n\t\t\tvar err error\n\t\t\tif _, err = scommon.GetResourceInfoFromDevice(ctx, getDeviceInfoRequest, true); err != nil {\n\t\t\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errorMessage, []interface{}{\"Volumes\", key}, taskInfo)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t} else {\n\t\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\t\treturn\n\t\t}\n\t}\n\n\tdecryptedPasswordByte, err := e.DevicePassword(target.Password)\n\tif err != nil {\n\t\terrorMessage := \"error while trying to decrypt device password: \" + err.Error()\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\treturn\n\t}\n\ttarget.Password = decryptedPasswordByte\n\t// Get the Plugin info\n\tplugin, gerr := e.DB.GetPluginData(target.PluginID)\n\tif gerr != nil {\n\t\terrorMessage := \"error while trying to get plugin details\"\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\treturn\n\t}\n\n\tvar contactRequest scommon.PluginContactRequest\n\tcontactRequest.ContactClient = e.ContactClient\n\tcontactRequest.Plugin = plugin\n\tcontactRequest.GetPluginStatus = e.GetPluginStatus\n\tif StringsEqualFold(plugin.PreferredAuthType, \"XAuthToken\") {\n\t\tvar err error\n\t\tcontactRequest.HTTPMethodType = http.MethodPost\n\t\tcontactRequest.DeviceInfo = map[string]interface{}{\n\t\t\t\"UserName\": plugin.Username,\n\t\t\t\"Password\": string(plugin.Password),\n\t\t}\n\t\tcontactRequest.OID = \"/ODIM/v1/Sessions\"\n\t\t_, token, _, getResponse, err := scommon.ContactPlugin(ctx, contactRequest, \"error while creating session with the plugin: \")\n\n\t\tif err != nil {\n\t\t\tcommon.GeneralError(getResponse.StatusCode, getResponse.StatusMessage, err.Error(), nil, taskInfo)\n\t\t\treturn\n\t\t}\n\t\tcontactRequest.Token = token\n\t} else {\n\t\tcontactRequest.BasicAuth = map[string]string{\n\t\t\t\"UserName\": plugin.Username,\n\t\t\t\"Password\": string(plugin.Password),\n\t\t}\n\n\t}\n\n\tif string(req.RequestBody) == \"null\" {\n\t\ttarget.PostBody = []byte{}\n\t} else {\n\t\ttarget.PostBody = req.RequestBody\n\n\t}\n\tcontactRequest.HTTPMethodType = http.MethodDelete\n\tcontactRequest.DeviceInfo = target\n\tcontactRequest.OID = fmt.Sprintf(\"/ODIM/v1/Systems/%s/Storage/%s/Volumes/%s\", requestData[1], req.StorageInstance, req.VolumeID)\n\n\tbody, location, pluginIP, getResponse, err := scommon.ContactPlugin(ctx, contactRequest, \"error while deleting a volume: \")\n\tif err != nil {\n\t\tresp.StatusCode = getResponse.StatusCode\n\t\tjson.Unmarshal(body, &resp.Body)\n\t\terrMsg := \"error while deleting volume: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\t\tcommon.Completed, common.Warning, 100, http.MethodPost)\n\t\tpc.UpdateTask(ctx, task)\n\t\treturn\n\t}\n\tif getResponse.StatusCode == http.StatusAccepted {\n\t\terr = pc.SavePluginTaskInfo(ctx, pluginIP, plugin.IP, taskID, location)\n\t\tif err != nil {\n\t\t\tl.LogWithFields(ctx).Error(err)\n\t\t}\n\t\treturn\n\t}\n\n\t// handling the status ok response from plugin\n\tif getResponse.StatusCode == http.StatusOK && body != nil {\n\t\tresp.StatusCode = getResponse.StatusCode\n\t\tjson.Unmarshal(body, &resp.Body)\n\t\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\t\tcommon.Completed, common.OK, 100, http.MethodDelete)\n\t\tpc.UpdateTask(ctx, task)\n\t\treturn\n\t}\n\n\t// delete a volume in db\n\tif derr := e.DB.DeleteVolume(ctx, key); derr != nil {\n\t\terrMsg := \"error while trying to delete volume: \" + derr.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\tif errors.DBKeyNotFound == derr.ErrNo() {\n\t\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errMsg, []interface{}{\"Volumes\", key}, taskInfo)\n\t\t\treturn\n\t\t}\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errMsg, nil, taskInfo)\n\t\treturn\n\t}\n\n\t// adding volume collection uri and deleted volume uri to the AddSystemResetInfo\n\t// for avoiding storing or retrieving them from DB before a BMC reset.\n\tcollectionKey := fmt.Sprintf(\"/redfish/v1/Systems/%s/Storage/%s/Volumes\", req.SystemID, req.StorageInstance)\n\te.DB.AddSystemResetInfo(ctx, key, \"On\")\n\te.DB.AddSystemResetInfo(ctx, collectionKey, \"On\")\n\n\tresp.StatusCode = http.StatusNoContent\n\tresp.StatusMessage = response.Success\n\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\tcommon.Completed, common.OK, 100, http.MethodDelete)\n\tpc.UpdateTask(ctx, task)\n}", "func DelVol(fcVolName string) (string, error) {\n\tvar (\n\t\tcmdOut []byte\n\t\terr error\n\t)\n\n\tstrs := strings.SplitAfterN(fcVolName, \"/dev/\", 2)\n\tif len(strs) == 2 && strs[0] == \"/dev/\" {\n\t\tfcVolName = strs[1]\n\t}\n\tlog.Debug(\"fcVolName=\", fcVolName)\n\n\tcmd := \"fcagent\"\n\targs := []string{\n\t\t\"delvol\",\n\t\tfcVolName,\n\t\t\"-donotdelebs\"}\n\n\tlog.Debug(cmd, args)\n\n\tif cmdOut, err = exec.Command(cmd, args...).Output(); err != nil {\n\t\tlog.Debug(err)\n\t}\n\n\treturn string(cmdOut), err\n}", "func NewVvolBindingDeleteParams() *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func cephRBDVolumeDelete(clusterName string, poolName string, volumeName string,\n\tvolumeType string, userName string) error {\n\t_, err := shared.RunCommand(\n\t\t\"rbd\",\n\t\t\"--id\", userName,\n\t\t\"--cluster\", clusterName,\n\t\t\"--pool\", poolName,\n\t\t\"rm\",\n\t\tfmt.Sprintf(\"%s_%s\", volumeType, volumeName))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *VvolBindingDeleteParams) WithContext(ctx context.Context) *VvolBindingDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (client *Client) DeleteTagWithUuidWithOptions(request *DeleteTagWithUuidRequest, runtime *util.RuntimeOptions) (_result *DeleteTagWithUuidResponse, _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.TagName)) {\n\t\tquery[\"TagName\"] = request.TagName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.UuidList)) {\n\t\tquery[\"UuidList\"] = request.UuidList\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteTagWithUuid\"),\n\t\tVersion: tea.String(\"2018-12-03\"),\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 = &DeleteTagWithUuidResponse{}\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 (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (s *Stack) DeleteVolumeAttachment(serverID, vaID string) error {\n\tif s == nil {\n\t\treturn scerr.InvalidInstanceError()\n\t}\n\tif serverID == \"\" {\n\t\treturn scerr.InvalidParameterError(\"serverID\", \"cannot be empty string\")\n\t}\n\tif vaID == \"\" {\n\t\treturn scerr.InvalidParameterError(\"vaID\", \"cannot be empty string\")\n\t}\n\n\tdefer concurrency.NewTracer(nil, \"('\"+serverID+\"', '\"+vaID+\"')\", true).WithStopwatch().GoingIn().OnExitTrace()()\n\n\tr := volumeattach.Delete(s.ComputeClient, serverID, vaID)\n\terr := r.ExtractErr()\n\tif err != nil {\n\t\treturn scerr.Wrap(err, fmt.Sprintf(\"error deleting volume attachment '%s': %s\", vaID, ProviderErrorToString(err)))\n\t}\n\treturn nil\n}", "func (client *Client) DeleteVodSpecificConfigWithOptions(request *DeleteVodSpecificConfigRequest, runtime *util.RuntimeOptions) (_result *DeleteVodSpecificConfigResponse, _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.ConfigId)) {\n\t\tquery[\"ConfigId\"] = request.ConfigId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.DomainName)) {\n\t\tquery[\"DomainName\"] = request.DomainName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Env)) {\n\t\tquery[\"Env\"] = request.Env\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.SecurityToken)) {\n\t\tquery[\"SecurityToken\"] = request.SecurityToken\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteVodSpecificConfig\"),\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 = &DeleteVodSpecificConfigResponse{}\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 (s stack) DeleteVolume(ctx context.Context, ref string) fail.Error {\n\tif valid.IsNil(s) {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\treturn fail.NotImplementedError(\"implement me\")\n}", "func (o *VvolBindingDeleteParams) WithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewVvolBindingDeleteParamsWithTimeout(timeout time.Duration) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (a *DeprecatedBusManagementRouterApiService) DeleteBindingUsingDELETE(ctx _context.Context, routingKeyFilter string, fifoName string) ApiDeleteBindingUsingDELETERequest {\n\treturn ApiDeleteBindingUsingDELETERequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\troutingKeyFilter: routingKeyFilter,\n\t\tfifoName: fifoName,\n\t}\n}", "func BdevLvolDelete(ctx context.Context, client *Client, args BdevLvolDeleteArgs) (bool, error) {\n\tvar response bool\n\terr := client.Invoke(ctx, \"bdev_lvol_delete\", args, &response)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn response, err\n}", "func (cl *Client) VolumeDelete(ctx context.Context, vda *csp.VolumeDeleteArgs) error {\n\tsvc, vid, _ := VolumeIdentifierParse(vda.VolumeIdentifier)\n\tswitch svc {\n\tcase ServiceGCE:\n\t\treturn cl.gceVolumeDelete(ctx, vda, vid)\n\t}\n\treturn fmt.Errorf(\"invalid volume identifier\")\n}", "func (rc *regClient) TagDelete(ctx context.Context, ref types.Ref) error {\n\tvar tempManifest manifest.Manifest\n\tif ref.Tag == \"\" {\n\t\treturn ErrMissingTag\n\t}\n\n\t// attempt to delete the tag directly, available in OCI distribution-spec, and Hub API\n\treq := httpReq{\n\t\thost: ref.Registry,\n\t\tnoMirrors: true,\n\t\tapis: map[string]httpReqAPI{\n\t\t\t\"\": {\n\t\t\t\tmethod: \"DELETE\",\n\t\t\t\trepository: ref.Repository,\n\t\t\t\tpath: \"manifests/\" + ref.Tag,\n\t\t\t\tignoreErr: true, // do not trigger backoffs if this fails\n\t\t\t},\n\t\t\t\"hub\": {\n\t\t\t\tmethod: \"DELETE\",\n\t\t\t\tpath: \"repositories/\" + ref.Repository + \"/tags/\" + ref.Tag + \"/\",\n\t\t\t},\n\t\t},\n\t}\n\n\tresp, err := rc.httpDo(ctx, req)\n\tif resp != nil {\n\t\tdefer resp.Close()\n\t}\n\t// TODO: Hub may return a different status\n\tif err == nil && resp != nil && resp.HTTPResponse().StatusCode == 202 {\n\t\treturn nil\n\t}\n\t// ignore errors, fallback to creating a temporary manifest to replace the tag and deleting that manifest\n\n\t// lookup the current manifest media type\n\tcurManifest, err := rc.ManifestHead(ctx, ref)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create empty image config with single label\n\t// Note, this should be MediaType specific, but it appears that docker uses OCI for the config\n\tnow := time.Now()\n\tconf := ociv1.Image{\n\t\tCreated: &now,\n\t\tConfig: ociv1.ImageConfig{\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"delete-tag\": ref.Tag,\n\t\t\t\t\"delete-date\": now.String(),\n\t\t\t},\n\t\t},\n\t\tOS: \"linux\",\n\t\tArchitecture: \"amd64\",\n\t\tRootFS: ociv1.RootFS{\n\t\t\tType: \"layers\",\n\t\t\tDiffIDs: []digest.Digest{},\n\t\t},\n\t}\n\tconfB, err := json.Marshal(conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdigester := digest.Canonical.Digester()\n\tconfBuf := bytes.NewBuffer(confB)\n\t_, err = confBuf.WriteTo(digester.Hash())\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfDigest := digester.Digest()\n\n\t// create manifest with config, matching the original tag manifest type\n\tswitch curManifest.GetMediaType() {\n\tcase MediaTypeOCI1Manifest, MediaTypeOCI1ManifestList:\n\t\ttempManifest, err = manifest.FromOrig(ociv1.Manifest{\n\t\t\tVersioned: ociv1Specs.Versioned{\n\t\t\t\tSchemaVersion: 1,\n\t\t\t},\n\t\t\tConfig: ociv1.Descriptor{\n\t\t\t\tMediaType: MediaTypeOCI1ImageConfig,\n\t\t\t\tDigest: confDigest,\n\t\t\t\tSize: int64(len(confB)),\n\t\t\t},\n\t\t\tLayers: []ociv1.Descriptor{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault: // default to the docker v2 schema\n\t\ttempManifest, err = manifest.FromOrig(dockerSchema2.Manifest{\n\t\t\tVersioned: dockerManifest.Versioned{\n\t\t\t\tSchemaVersion: 2,\n\t\t\t\tMediaType: MediaTypeDocker2Manifest,\n\t\t\t},\n\t\t\tConfig: dockerDistribution.Descriptor{\n\t\t\t\tMediaType: MediaTypeDocker2ImageConfig,\n\t\t\t\tDigest: confDigest,\n\t\t\t\tSize: int64(len(confB)),\n\t\t\t},\n\t\t\tLayers: []dockerDistribution.Descriptor{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\trc.log.WithFields(logrus.Fields{\n\t\t\"ref\": ref.Reference,\n\t}).Debug(\"Sending dummy manifest to replace tag\")\n\n\t// push config\n\t_, _, err = rc.BlobPut(ctx, ref, confDigest, ioutil.NopCloser(bytes.NewReader(confB)), MediaTypeDocker2ImageConfig, int64(len(confB)))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed sending dummy config to delete %s: %w\", ref.CommonName(), err)\n\t}\n\n\t// push manifest to tag\n\terr = rc.ManifestPut(ctx, ref, tempManifest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed sending dummy manifest to delete %s: %w\", ref.CommonName(), err)\n\t}\n\n\tref.Digest = tempManifest.GetDigest().String()\n\n\t// delete manifest by digest\n\trc.log.WithFields(logrus.Fields{\n\t\t\"ref\": ref.Reference,\n\t\t\"digest\": ref.Digest,\n\t}).Debug(\"Deleting dummy manifest\")\n\terr = rc.ManifestDelete(ctx, ref)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed deleting dummy manifest for %s: %w\", ref.CommonName(), err)\n\t}\n\n\treturn nil\n}", "func (util *PortworxVolumeUtil) DeleteVolume(d *portworxVolumeDeleter) error {\n\tdriver, err := util.getPortworxDriver(d.plugin.host, false /*localOnly*/)\n\tif err != nil || driver == nil {\n\t\tglog.Errorf(\"Failed to get portworx driver. Err: %v\", err)\n\t\treturn err\n\t}\n\n\terr = driver.Delete(d.volumeID)\n\tif err != nil {\n\t\tglog.Errorf(\"Error deleting Portworx Volume (%v): %v\", d.volName, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewVvolBindingDeleteParamsWithHTTPClient(client *http.Client) *VvolBindingDeleteParams {\n\treturn &VvolBindingDeleteParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (d *InterfaceVrfDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error) {\n\tswIfIndex, vrf, inheritedVrf, ipv4, ipv6, err := d.getParametersFromKey(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !inheritedVrf && vrf > 0 && ipv4 {\n\t\terr = d.ifHandler.SetInterfaceVrf(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\tif !inheritedVrf && vrf > 0 && ipv6 {\n\t\terr = d.ifHandler.SetInterfaceVrfIPv6(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func DeleteVNet(vNetName string, rgroupName string) {\n\ta := wow.New(os.Stdout, spin.Get(spin.Dots), \"Deleting virtual network : \"+vNetName)\n\ta.Start()\n\ttime.Sleep(2 * time.Second)\n\ta.Text(\"This would take a few minutes...\").Spinner(spin.Get(spin.Dots))\n\tcmd := exec.Command(\"az\", \"network\", \"vnet\", \"delete\", \"--name\",\n\t\tvNetName, \"--resource-group\", rgroupName)\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprint(err) + \": \" + stderr.String())\n\t\treturn\n\t}\n\ta.PersistWith(spin.Spinner{}, \"....\")\n\tfmt.Println(\"Result: \" + out.String())\n}", "func DeleteVM(c config.Cpi, extInput bosh.MethodArguments) error {\n\tvar cid string\n\tif reflect.TypeOf(extInput[0]) != reflect.TypeOf(cid) {\n\t\treturn errors.New(\"Received unexpected type for vm cid\")\n\t}\n\n\tcid = extInput[0].(string)\n\tnode, err := rackhdapi.GetNodeByVMCID(c, cid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif node.PersistentDisk.IsAttached {\n\t\terr = rackhdapi.MakeDiskRequest(c, node, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tworkflowName, err := workflows.PublishDeprovisionNodeWorkflow(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = workflows.RunDeprovisionNodeWorkflow(c, node.ID, workflowName, cid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, tag := range node.Tags {\n\t\tif strings.HasPrefix(tag, DiskCIDTagPrefix) {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\terr = rackhdapi.ReleaseNode(c, node.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *restClient) DeleteVolume(ctx context.Context, req *netapppb.DeleteVolumeRequest, opts ...gax.CallOption) (*DeleteVolumeOperation, error) {\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v\", req.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\tif req.GetForce() {\n\t\tparams.Add(\"force\", fmt.Sprintf(\"%v\", req.GetForce()))\n\t}\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"name\", url.QueryEscape(req.GetName()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &longrunningpb.Operation{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"DELETE\", baseUrl.String(), nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\toverride := fmt.Sprintf(\"/v1/%s\", resp.GetName())\n\treturn &DeleteVolumeOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, resp),\n\t\tpollPath: override,\n\t}, nil\n}", "func DeleteVolume(base, volID string) error {\n\tklog.V(4).Infof(\"starting to delete hostpath volume: %s\", volID)\n\n\tpath := filepath.Join(base, volID)\n\tif err := os.RemoveAll(path); err != nil && !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\tklog.V(4).Infof(\"deleted hostpath volume: %s\", volID)\n\treturn nil\n}", "func (c *MockVirtualNetworksClient) Delete(ctx context.Context, resourceGroupName, vnetName string) error {\n\t// Ignore resourceGroupName for simplicity.\n\tif _, ok := c.VNets[vnetName]; !ok {\n\t\treturn fmt.Errorf(\"%s does not exist\", vnetName)\n\t}\n\tdelete(c.VNets, vnetName)\n\treturn nil\n}", "func (p *cinderProvisioner) Delete(pv *v1.PersistentVolume) error {\n\tann, ok := pv.Annotations[provisionerIDAnn]\n\tif !ok {\n\t\treturn errors.New(\"identity annotation not found on PV\")\n\t}\n\tif ann != p.identity {\n\t\treturn &controller.IgnoredError{\n\t\t\tReason: \"identity annotation on PV does not match ours\",\n\t\t}\n\t}\n\t// TODO when beta is removed, have to check kube version and pick v1/beta\n\t// accordingly: maybe the controller lib should offer a function for that\n\n\tvolumeID, ok := pv.Annotations[cinderVolumeID]\n\tif !ok {\n\t\treturn errors.New(cinderVolumeID + \" annotation not found on PV\")\n\t}\n\n\tctx := deleteCtx{p, pv}\n\tmapper, err := newVolumeMapperFromPV(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmapper.AuthTeardown(ctx)\n\n\terr = disconnectCinderVolume(p, volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = unreserveCinderVolume(p, volumeID)\n\tif err != nil {\n\t\t// TODO: Create placeholder PV?\n\t\tglog.Errorf(\"Failed to unreserve volume: %v\", err)\n\t\treturn err\n\t}\n\n\terr = deleteCinderVolume(p, volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglog.V(2).Infof(\"Successfully deleted cinder volume %s\", volumeID)\n\treturn nil\n}", "func (s *VPCService) NewDeleteVPCOfferingParams(id string) *DeleteVPCOfferingParams {\n\tp := &DeleteVPCOfferingParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func (a AppblueprintApi) AppBlueprintsUuidDelete(uuid string) (*APIResponse, error) {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/app_blueprints/{uuid}\"\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\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}", "func (o *VvolBindingDeleteParams) WithDefaults() *VvolBindingDeleteParams {\n\to.SetDefaults()\n\treturn o\n}", "func VisualisationDeleteParams(dbOwner, dbFolder, dbName, visName string) (err error) {\n\tvar commandTag pgx.CommandTag\n\tdbQuery := `\n\t\tWITH u AS (\n\t\t\tSELECT user_id\n\t\t\tFROM users\n\t\t\tWHERE lower(user_name) = lower($1)\n\t\t), d AS (\n\t\t\tSELECT db.db_id\n\t\t\tFROM sqlite_databases AS db, u\n\t\t\tWHERE db.user_id = u.user_id\n\t\t\t\tAND folder = $2\n\t\t\t\tAND db_name = $3\n\t\t)\n\t\tDELETE FROM vis_params WHERE user_id = (SELECT user_id FROM u) AND db_id = (SELECT db_id FROM d) AND name = $4`\n\tcommandTag, err = pdb.Exec(dbQuery, dbOwner, dbFolder, dbName, visName)\n\tif err != nil {\n\t\tlog.Printf(\"Deleting visualisation '%s' for database '%s%s%s' failed: %v\\n\", visName, dbOwner, dbFolder, dbName, err)\n\t\treturn err\n\t}\n\tif numRows := commandTag.RowsAffected(); numRows != 1 {\n\t\tlog.Printf(\"Wrong number of rows (%v) affected while deleting visualisation '%s' for database '%s%s%s'\\n\", numRows, visName, dbOwner, dbFolder, dbName)\n\t}\n\treturn\n}", "func (client *Client) DeleteVodSpecificConfig(request *DeleteVodSpecificConfigRequest) (_result *DeleteVodSpecificConfigResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &DeleteVodSpecificConfigResponse{}\n\t_body, _err := client.DeleteVodSpecificConfigWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (cl *Client) gceVolumeDelete(ctx context.Context, vda *csp.VolumeDeleteArgs, vid string) error {\n\tcomputeService, err := cl.getComputeService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\top, err := computeService.Disks().Delete(cl.projectID, cl.attrs[AttrZone].Value, vid).Context(ctx).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = cl.waitForOperation(ctx, op)\n\treturn err\n}", "func (o *VolumeDeleteParams) WithForce(force *bool) *VolumeDeleteParams {\n\to.SetForce(force)\n\treturn o\n}", "func DelVinho(c *gin.Context) {\n\tlog.Println(\"Iniciando rota DeleteVinho\")\n\n\tvar Vinho string\n\tVinho = c.Param(\"vinho\")\n\n\t// Realizando atualização da quantidade\n\terr := DeleteVinho(Vinho, adega)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\t// Retorna vinho\n\tlog.Println(\"Vinho apagado\")\n\tc.JSON(200, gin.H{\"message\": \"Vinho apagado com sucesso.\"})\n}", "func (j *Jsonnet) DeleteParam(path []string) error {\n\t// TODO: make this work at the env level too\n\tparamsData, err := j.readParams(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdatedParams, err := params.DeleteFromObject(path, paramsData, j.Name(false), paramsComponentRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = j.writeParams(updatedParams); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewVolumeDeleteParams() *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (c *CmdVolumeDeleteOptions) RunVolumeDelete(cmd *cobra.Command) error {\n\tfmt.Println(\"Executing volume delete...\")\n\n\tresp := mapiserver.DeleteVolume(c.volName)\n\tif resp != nil {\n\t\treturn fmt.Errorf(\"Error: %v\", resp)\n\t}\n\n\tfmt.Printf(\"Volume deletion initiated:%v\\n\", c.volName)\n\n\treturn nil\n}", "func (oo *OmciCC) SendDeleteVtfd(ctx context.Context, timeout int, highPrio bool,\n\trxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) {\n\ttid := oo.GetNextTid(highPrio)\n\tlogger.Debugw(ctx, \"send VTFD-Delete-msg:\", log.Fields{\"device-id\": oo.deviceID,\n\t\t\"SequNo\": strconv.FormatInt(int64(tid), 16),\n\t\t\"InstId\": strconv.FormatInt(int64(aInstID), 16)})\n\n\tmeParams := me.ParamData{EntityID: aInstID}\n\tmeInstance, omciErr := me.NewVlanTaggingFilterData(meParams)\n\tif omciErr.GetError() == nil {\n\t\tomciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType,\n\t\t\toframe.TransactionID(tid))\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot encode VTFD for delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\t//TODO!!: refactoring improvement requested, here as an example for [VOL-3457]:\n\t\t\t// return (dual format) error code that can be used at caller for immediate error treatment\n\t\t\t// (relevant to all used sendXX() methods and their error conditions)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot serialize VTFD delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\n\t\tomciRxCallbackPair := CallbackPair{\n\t\t\tCbKey: tid,\n\t\t\tCbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true},\n\t\t}\n\t\terr = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot send VTFD delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\t\tlogger.Debug(ctx, \"send VTFD-Delete-msg done\")\n\t\treturn meInstance, nil\n\t}\n\tlogger.Errorw(ctx, \"Cannot generate VTFD Instance for delete\", log.Fields{\n\t\t\"Err\": omciErr.GetError(), \"device-id\": oo.deviceID})\n\treturn nil, omciErr.GetError()\n}", "func (s *StackEbrc) DeleteVolume(ref string) error {\n\tlogrus.Debugf(\"ebrc.Client.DeleteVolume(%s) called\", ref)\n\tdefer logrus.Debugf(\"ebrc.Client.DeleteVolume(%s) done\", ref)\n\n\tthed, err := s.findDiskByID(ref)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdeltask, err := thed.Delete()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = deltask.WaitTaskCompletion()\n\treturn err\n}", "func (_BaseLibrary *BaseLibraryTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseLibrary.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (cs *controller) DeleteVolume(\n\tctx context.Context,\n\treq *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\n\tlogrus.Infof(\"received request to delete volume {%s}\", req.VolumeId)\n\n\tif req.VolumeId == \"\" {\n\t\treturn nil, status.Error(\n\t\t\tcodes.InvalidArgument,\n\t\t\t\"failed to handle delete volume request: missing volume id\",\n\t\t)\n\t}\n\n\terr := cs.validateRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\t// this call is made just to fetch pvc namespace\n\tpv, err := utils.FetchPVDetails(req.VolumeId)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\tpvcNamespace := pv.Spec.ClaimRef.Namespace\n\n\t// send delete request to maya apiserver\n\terr = utils.DeleteVolume(req.VolumeId, pvcNamespace)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\t// TODO\n\t// Use a lock to remove\n\t//\n\t// remove entry from the in-memory\n\t// maintained list\n\tdelete(utils.Volumes, req.VolumeId)\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (s *Storage) DeleteVolume(vname string, rSnapshots bool) RestError {\n\tvar err error\n\taddr := fmt.Sprintf(\"api/v3/pools/%s/volumes/%s\", s.pool, vname)\n\n\tdata := DeleteVolume{\n\t\tRecursivelyChildren: false,\n\t\tRecursivelyDependents: false,\n\t\tForceUmount: false,\n\t}\n\tif rSnapshots == true {\n\t\tdata.RecursivelyChildren = true\n\t}\n\n\tstat, body, err := s.rp.Send(\"DELETE\", addr, data, DeleteVolumeRCode)\n\n\ts.l.Tracef(\"Status %d\", stat)\n\ts.l.Tracef(\"Body %s\", body[:len(body)])\n\ts.l.Tracef(\"Err %+v\", err)\n\n\tif stat == DeleteVolumeRCode {\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Internal failure during volume %s deletion.\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestRequestMalfunction, msg)\n\t}\n\n\terrData, er := s.getError(body)\n\n\tif er != nil {\n\t\tmsg := fmt.Sprintf(\"Unable to extract err message %+v\", er)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestRequestMalfunction, msg)\n\t}\n\n\tif (*errData).Errno == 1 {\n\t\tmsg := fmt.Sprintf(\"Volume %s doesn't exist\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestResourceDNE, \"\")\n\t}\n\n\tif (*errData).Errno == 1000 {\n\n\t\tmsg := fmt.Sprintf(\"Volume %s is busy\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestResourceBusy, msg)\n\t}\n\n\tmsg := fmt.Sprintf(\"Unidentified failure during volume %s deletion.\", vname)\n\ts.l.Warn(msg)\n\treturn GetError(RestFailureUnknown, msg)\n}", "func (d *DefaultDriver) DeleteVolume(volumeID string) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"DeleteVolume()\",\n\t}\n}", "func (o *VvolBindingDeleteParams) SetProtocolEndpointUUID(protocolEndpointUUID string) {\n\to.ProtocolEndpointUUID = protocolEndpointUUID\n}", "func (_Container *ContainerTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _Container.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (d *DefaultDriver) ValidateDeleteVolume(vol *Volume) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"ValidateDeleteVolume()\",\n\t}\n}", "func (cl *Client) gceVolumeTagsDelete(ctx context.Context, vta *csp.VolumeTagArgs, vid string) (*csp.Volume, error) {\n\tif _, err := cl.getComputeService(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\tlabelsToDelete := gceLabelsFromModel(vta.Tags)\n\treturn cl.intSetLabels(ctx, vid, labelsToDelete, true)\n}", "func (_BaseAccessWallet *BaseAccessWalletTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (client IdentityClient) deleteTag(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/tagNamespaces/{tagNamespaceId}/tags/{tagName}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteTagResponse\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 (driver *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\t//klog.V(4).Infof(\"DeleteVolume: called with args: %#v\", req)\n\n\tvolID := req.GetVolumeId()\n\tif len(volID) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID not provided\")\n\t}\n\n\tklog.V(4).Infof(\"DeleteVolume: volumeId (%#v)\", volID)\n\n\tirodsVolume := PopIRODSVolume(volID)\n\tif irodsVolume == nil {\n\t\t// orphant\n\t\tklog.V(4).Infof(\"DeleteVolume: cannot find a volume with id (%v)\", volID)\n\t\t// ignore this error\n\t\treturn &csi.DeleteVolumeResponse{}, nil\n\t}\n\n\tif !irodsVolume.RetainData {\n\t\tklog.V(5).Infof(\"Deleting a volume dir %s\", irodsVolume.Path)\n\t\terr := IRODSRmdir(irodsVolume.ConnectionInfo, irodsVolume.Path)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"Could not delete a volume dir %s : %v\", irodsVolume.Path, err)\n\t\t}\n\t}\n\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (client *Client) DeleteVideoWithOptions(request *DeleteVideoRequest, runtime *util.RuntimeOptions) (_result *DeleteVideoResponse, _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(\"DeleteVideo\"),\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 = &DeleteVideoResponse{}\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 (c *Dg) DeleteDeviceVsys(g interface{}, d string, vsys []string) error {\n var name string\n\n switch v := g.(type) {\n case string:\n name = v\n case Entry:\n name = v.Name\n default:\n return fmt.Errorf(\"Unknown type sent to remove devices: %s\", v)\n }\n\n c.con.LogAction(\"(delete) device vsys from device group: %s\", name)\n\n path := make([]string, 0, 9)\n path = append(path, c.xpath([]string{name})...)\n path = append(path, \"devices\", util.AsEntryXpath([]string{d}))\n if len(vsys) > 0 {\n path = append(path, \"vsys\", util.AsEntryXpath(vsys))\n }\n\n _, err := c.con.Delete(path, nil, nil)\n return err\n}", "func deleteVxlanIntf(inParams *XfmrParams, ifName *string) error {\n var err error\n subOpMap := make(map[db.DBNum]map[string]map[string]db.Value)\n resMap := make(map[string]map[string]db.Value)\n\n _, err = inParams.d.GetEntry(&db.TableSpec{Name:\"VXLAN_TUNNEL\"}, db.Key{Comp: []string{*ifName}})\n if err != nil {\n \treturn tlerr.NotFound(\"Resource Not Found\")\n }\n \n _, err = inParams.d.GetEntry(&db.TableSpec{Name:\"EVPN_NVO\"}, db.Key{Comp: []string{\"nvo1\"}})\n if err == nil {\n\t evpnNvoMap := make(map[string]db.Value)\n\t evpnDbV := db.Value{Field:map[string]string{}}\n\t evpnDbV.Field[\"source_vtep\"] = *ifName\n\t evpnNvoMap[\"nvo1\"] = evpnDbV\n\t resMap[\"EVPN_NVO\"] = evpnNvoMap\n }\n \n vxlanIntfMap := make(map[string]db.Value)\n vxlanIntfMap[*ifName] = db.Value{Field:map[string]string{}}\n resMap[\"VXLAN_TUNNEL\"] = vxlanIntfMap\n \n subOpMap[db.ConfigDB] = resMap\n inParams.subOpDataMap[DELETE] = &subOpMap\n return nil\n}", "func NewVolumeDeleteParamsWithHTTPClient(client *http.Client) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\t\tHTTPClient: client,\n\t}\n}", "func DeleteVolume(req systemsproto.VolumeRequest) (*systemsproto.SystemsResponse, error) {\n\tconn, err := services.ODIMService.Client(services.Systems)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client connection: %v\", err)\n\t}\n\tdefer conn.Close()\n\tasService := systemsproto.NewSystemsClient(conn)\n\tresp, err := asService.DeleteVolume(context.TODO(), &req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error: RPC error: %v\", err)\n\t}\n\treturn resp, nil\n}", "func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\tif len(req.GetVolumeId()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID missing in request\")\n\t}\n\n\tif err := d.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid delete volume req: %v\", req)\n\t}\n\n\tvolumeID := req.VolumeId\n\tresourceGroupName, accountName, containerName, err := getContainerInfo(volumeID)\n\tif err != nil {\n\t\tklog.Errorf(\"getContainerInfo(%s) in DeleteVolume failed with error: %v\", volumeID, err)\n\t\treturn &csi.DeleteVolumeResponse{}, nil\n\t}\n\n\tif resourceGroupName == \"\" {\n\t\tresourceGroupName = d.cloud.ResourceGroup\n\t}\n\n\taccountKey, err := d.cloud.GetStorageAccesskey(accountName, resourceGroupName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"no key for storage account(%s) under resource group(%s), err %v\", accountName, resourceGroupName, err)\n\t}\n\n\tklog.V(2).Infof(\"deleting container(%s) rg(%s) account(%s) volumeID(%s)\", containerName, resourceGroupName, accountName, volumeID)\n\tclient, err := azstorage.NewBasicClientOnSovereignCloud(accountName, accountKey, d.cloud.Environment)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tblobClient := client.GetBlobService()\n\tcontainer := blobClient.GetContainerReference(containerName)\n\t// todo: check what value to add into DeleteContainerOptions\n\terr = wait.ExponentialBackoff(d.cloud.RequestBackoff(), func() (bool, error) {\n\t\t_, err := container.DeleteIfExists(nil)\n\t\tif err != nil && !strings.Contains(err.Error(), \"ContainerBeingDeleted\") {\n\t\t\treturn false, fmt.Errorf(\"failed to delete container(%s) on account(%s), error: %v\", containerName, accountName, err)\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tklog.V(2).Infof(\"container(%s) under rg(%s) account(%s) volumeID(%s) is deleted successfully\", containerName, resourceGroupName, accountName, volumeID)\n\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (c *WebAuthn) RemoveVirtualAuthenticatorWithParams(v *WebAuthnRemoveVirtualAuthenticatorParams) (*gcdmessage.ChromeResponse, error) {\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"WebAuthn.removeVirtualAuthenticator\", Params: v})\n}", "func (p *Processor) DeleteTag(account keppel.Account, repo keppel.Repository, tagName string, actx keppel.AuditContext) error {\n\tdigestStr, err := p.db.SelectStr(\n\t\t`DELETE FROM tags WHERE repo_id = $1 AND name = $2 RETURNING digest`,\n\t\trepo.ID, tagName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif digestStr == \"\" {\n\t\treturn sql.ErrNoRows\n\t}\n\n\ttagDigest, err := digest.Parse(digestStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif userInfo := actx.UserIdentity.UserInfo(); userInfo != nil {\n\t\tp.auditor.Record(audittools.EventParameters{\n\t\t\tTime: p.timeNow(),\n\t\t\tRequest: actx.Request,\n\t\t\tUser: userInfo,\n\t\t\tReasonCode: http.StatusOK,\n\t\t\tAction: cadf.DeleteAction,\n\t\t\tTarget: auditTag{\n\t\t\t\tAccount: account,\n\t\t\t\tRepository: repo,\n\t\t\t\tDigest: tagDigest,\n\t\t\t\tTagName: tagName,\n\t\t\t},\n\t\t})\n\t}\n\n\treturn nil\n}", "func (client *Client) DeleteVolume(name string) (*Response, *ResponseStatus, error) {\n\treturn client.FormattedRequest(\"/delete/volumes/\\\"%s\\\"\", name)\n}", "func (_Editable *EditableTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _Editable.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func DeleteVault(c *gin.Context) {\n\tdbmap := c.MustGet(\"DBmap\").(*gorp.DbMap)\n\tid := c.Params.ByName(\"id\")\n\n\tvar vault Vault\n\terr := dbmap.SelectOne(&vault, \"SELECT * FROM vault WHERE id=?\", id)\n\n\tif err == nil {\n\t\t_, err = dbmap.Delete(&vault)\n\n\t\tif err == nil {\n\t\t\tc.JSON(200, gin.H{\"id #\" + id: \"deleted\"})\n\t\t} else {\n\t\t\tcheckErr(err, \"Delete failed\")\n\t\t}\n\n\t} else {\n\t\tc.JSON(404, gin.H{\"error\": \"vault not found\"})\n\t}\n\n\t// curl -i -X DELETE http://localhost:8080/api/v1/vaults/1\n}", "func (o *DeleteSubnetParams) WithIfMatch(ifMatch *string) *DeleteSubnetParams {\n\to.SetIfMatch(ifMatch)\n\treturn o\n}", "func Remove(ctx context.Context, nameOrID string, force *bool) error {\n\tconn, err := bindings.GetClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tparams := url.Values{}\n\tif force != nil {\n\t\tparams.Set(\"force\", strconv.FormatBool(*force))\n\t}\n\tresponse, err := conn.DoRequest(nil, http.MethodPost, \"/volumes/%s/prune\", params, nameOrID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn response.Process(nil)\n}", "func addIDToDeleteRequest(r *resource,\n\tinput *svcsdk.DeleteVpcEndpointsInput) error {\n\tif r.ko.Status.VPCEndpointID == nil {\n\t\treturn errors.New(\"unable to extract VPCEndpointID from resource\")\n\t}\n\tinput.VpcEndpointIds = []*string{r.ko.Status.VPCEndpointID}\n\treturn nil\n}", "func DeleteVolume(volumeID string) (err error) {\n\terr = volbuilder.NewKubeclient().WithNamespace(OpenEBSNamespace).Delete(volumeID)\n\tif err == nil {\n\t\tklog.Infof(\"deprovisioned volume %s\", volumeID)\n\t}\n\n\treturn\n}", "func (u *apiUtil) DeletePV(pvName string) error {\n\tstartTime := time.Now()\n\tmetrics.APIServerRequestsTotal.WithLabelValues(metrics.APIServerRequestDelete).Inc()\n\terr := u.client.CoreV1().PersistentVolumes().Delete(context.TODO(), pvName, metav1.DeleteOptions{})\n\tmetrics.APIServerRequestsDurationSeconds.WithLabelValues(metrics.APIServerRequestDelete).Observe(time.Since(startTime).Seconds())\n\tif err != nil {\n\t\tmetrics.APIServerRequestsFailedTotal.WithLabelValues(metrics.APIServerRequestDelete).Inc()\n\t}\n\treturn err\n}", "func (o *LedgerVoucherAttachmentDeleteAttachmentParams) WithVersion(version *int32) *LedgerVoucherAttachmentDeleteAttachmentParams {\n\to.SetVersion(version)\n\treturn o\n}", "func (client *KeyVaultClient) deleteSecretCreateRequest(ctx context.Context, vaultBaseURL string, secretName string, options *KeyVaultClientDeleteSecretOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/secrets/{secret-name}\"\n\tif secretName == \"\" {\n\t\treturn nil, errors.New(\"parameter secretName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{secret-name}\", url.PathEscape(secretName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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 (es *Endpoints) DelByUUID(uuid string) {\n\tes.Lock()\n\tdefer es.Unlock()\n\tif i, ok := es.mapUUID[uuid]; ok {\n\t\tdelete(es.mapUUID, uuid)\n\n\t\tswitch {\n\t\tcase i == 0:\n\t\t\tif len(es.endpoints) == 1 {\n\t\t\t\tes.endpoints = make([]*Endpoint, 0)\n\t\t\t} else {\n\t\t\t\tes.endpoints = es.endpoints[i+1:]\n\t\t\t}\n\t\tcase i == len(es.endpoints)-1:\n\t\t\tes.endpoints = es.endpoints[:i]\n\t\tdefault:\n\t\t\tes.endpoints = append(es.endpoints[:i], es.endpoints[i+1:]...)\n\t\t}\n\t}\n}", "func DeleteVolume(ip, name string) (string, error) {\n\tlog.Printf(\"Destroying volume [%s]\\n\", name)\n\tvar out string\n\tvar err error\n\n\tfor attempt := 0; attempt < maxRemoveVolAttempt; attempt++ {\n\t\tout, err = ssh.InvokeCommand(ip, dockercli.RemoveVolume+name)\n\t\tif err != nil && strings.Contains(out, pluginInitError) {\n\t\t\tmisc.SleepForSec(waitTime)\n\t\t\tlog.Printf(\"Volume cannot be deleted yet as plugin initialization still in progress. Retrying...\")\n\t\t\tcontinue\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn out, err\n}", "func removeDeleteme(){\n lvm_count := exec.Command(\"/bin/bash\", \"-c\", \"lvs | grep deleteme | wc -l\")\n if lvm_count > 1 {\n fmt.Println(\"Multiple deleteme logical volumes detected. Please remove the deleteme volumes manually.\")\n os.Exit(1)\n } else if lvm_count == 0 {\n fmt.Println(\"No deleteme logical volumes detected.\")\n } else {\n exec.Command(\"/bin/bash\", \"-c\", \"umount /delete\")\n exec.Command(\"/bin/bash\", \"-c\", \"rmdir /deleteme\")\n exec.Command(\"/bin/bash\", \"-c\", \"lvchange -an /dev/mapper/$(lvs | grep deleteme | awk ' { print $2 }')-deleteme00\")\n exec.Command(\"/bin/bash\", \"-c\", \"lvremove -f /dev/mapper/$(lvs | grep deleteme | awk ' { print $2 }')-deleteme00\")\n exec.Command(\"/bin/bash\", \"-c\", \"cp /etc/fstab /home/rack/fstab.bak\")\n exec.Command(\"/bin/bash\", \"-c\", \"sed -i '/\\/deleteme/d' /etc/fstab\")\n fmt.Println(\"The deleteme volume has been successfully removed.\")\n }\n}", "func (controller AppsController) RemoveVersion(c *gin.Context) {\n\t//app_id := c.Params.ByName(\"app_id\")\n\t//versionstring := c.Params.ByName(\"versionstring\")\n\n}", "func deleteLokiPv(ctx context.Context, k8sClient client.Client, namespace string, pv *corev1.PersistentVolume, log logr.Logger) error {\n\tlog.Info(\"Loki2vali: Delete Loki PV\", \"lokiNamespace\", namespace)\n\tif err := kubernetesutils.DeleteObject(ctx, k8sClient, pv); err != nil {\n\t\treturn err\n\t}\n\tlog.Info(\"Loki2vali: Successfully deleted the Loki PV\", \"lokiNamespace\", namespace)\n\treturn nil\n}", "func deletePerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tparams := mux.Vars(r)\r\n\tuuid, err := primitive.ObjectIDFromHex(params[\"uuid\"])\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tcollection := models.ConnectDB()\r\n\tobjectToDelete, err := collection.DeleteOne(context.TODO(), bson.M{\"_id\": uuid})\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(objectToDelete.DeletedCount)\r\n\r\n}", "func (d *Dao) DeleteRepoTag(c context.Context, repoName, tagName string) (err error) {\n\tvar req *http.Request\n\n\thost := d.c.BiliHub.Host + _repositoryURI + \"/%s/tags/%s\"\n\turl := fmt.Sprintf(host, repoName, tagName)\n\n\tif req, err = d.newRequest(http.MethodDelete, url, nil); err != nil {\n\t\treturn\n\t}\n\n\treq.SetBasicAuth(d.c.BiliHub.Username, d.c.BiliHub.Password)\n\n\tif err = d.httpClient.Do(c, req, nil); err != nil {\n\t\tlog.Error(\"d.DeleteRepoTag url(%s) err(%v)\", url, err)\n\t\terr = ecode.MerlinHubRequestErr\n\t}\n\n\treturn\n}", "func (cl *Client) VolumeTagsDelete(ctx context.Context, vta *csp.VolumeTagArgs) (*csp.Volume, error) {\n\tif len(vta.Tags) == 0 {\n\t\treturn nil, fmt.Errorf(\"no tags specified\")\n\t}\n\tsvc, vid, _ := VolumeIdentifierParse(vta.VolumeIdentifier)\n\tswitch svc {\n\tcase ServiceGCE:\n\t\treturn cl.gceVolumeTagsDelete(ctx, vta, vid)\n\t}\n\treturn nil, fmt.Errorf(\"invalid volume identifier\")\n}", "func (t *Tags) Delete(tag string, resourceType string, resourceId string) error {\n\tpath := fmt.Sprintf(\"%s%s/\", t.getKvResourceTagsPath(resourceType, resourceId), tag)\n\n\t_, err := t.client.KV().DeleteTree(path, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *MockBlockStorageClient) DeleteVolume(ctx context.Context, id string) error {\n\treturn nil\n}", "func (c *MockBlockStorageClient) DeleteVolume(ctx context.Context, id string) error {\n\treturn nil\n}", "func (srv *VolumeService) Delete(ref string) error {\n\tvol, err := srv.Get(ref)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Volume '%s' does not exists\", ref)\n\t}\n\treturn srv.provider.DeleteVolume(vol.ID)\n}", "func (iface *Interface) DeleteVrrpVirtualAddress(subifname string, vrid uint8, addr net.IP) {\n\tiface.lock.Lock()\n\tdefer iface.lock.Unlock()\n\n\tsubiface, ret := iface.Subinterfaces[subifname]\n\tif ret {\n\t\tsubiface.DeleteVrrpVirtualAddress(vrid, addr)\n\t}\n}", "func DeleteVehicle(ctx context.Context, client *mongo.Client, reg string) (*mongo.DeleteResult, error) {\n\tcol := client.Database(\"parkai\").Collection(\"vehicles\")\n\tfilter := bson.M{\"registration\": reg}\n\n\treturn col.DeleteOne(ctx, filter)\n}", "func deleteVolunteer(c *gin.Context) {\n\temail := c.Params.ByName(\"email\")\n\tvar vol Volunteer\n\tif err := db.Where(\"email = ?\", email).Find(&vol).Error; err != nil {\n\t\tcreateNotFoundResponse(c)\n\t\treturn\n\t}\n\n\t//Checks if data belongs to the user\n\tif !volunteerAuth(c, &vol) {\n\t\treturn\n\t}\n\t//Deletes from database\n\tdb.Delete(&vol)\n\n\t//Deletes from authentification map\n\tdelete(authMap, vol.Email)\n\tc.JSON(200, gin.H{\"Message\": email + \" deleted\"})\n}", "func (client *LicenseStatusClient) Delete(uuid string, options ...session.ApiOptionsParams) error {\n\tif len(options) == 0 {\n\t\treturn client.aviSession.Delete(client.getAPIPath(uuid))\n\t} else {\n\t\treturn client.aviSession.DeleteObject(client.getAPIPath(uuid), options...)\n\t}\n}", "func (s *Stack) DeleteVolume(id string) (err error) {\n\tif s == nil {\n\t\treturn scerr.InvalidInstanceError()\n\t}\n\tif id == \"\" {\n\t\treturn scerr.InvalidParameterError(\"id\", \"cannot be empty string\")\n\t}\n\n\tdefer concurrency.NewTracer(nil, \"(\"+id+\")\", true).WithStopwatch().GoingIn().OnExitTrace()()\n\n\tvar (\n\t\ttimeout = temporal.GetBigDelay()\n\t)\n\n\tretryErr := retry.WhileUnsuccessfulDelay5Seconds(\n\t\tfunc() error {\n\t\t\tr := volumesv2.Delete(s.VolumeClient, id, nil)\n\t\t\terr := r.ExtractErr()\n\t\t\tif err != nil {\n\t\t\t\tswitch err.(type) {\n\t\t\t\tcase gc.ErrDefault400:\n\t\t\t\t\treturn scerr.Errorf(fmt.Sprintf(\"volume not in state 'available'\"), err)\n\t\t\t\tdefault:\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\ttimeout,\n\t)\n\tif retryErr != nil {\n\t\tif _, ok := retryErr.(retry.ErrTimeout); ok {\n\t\t\treturn retryErr\n\t\t}\n\t\treturn retryErr\n\t}\n\treturn nil\n}", "func NewVolumeDeleteParamsWithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\tvar (\n\t\tforceDefault = bool(false)\n\t)\n\treturn &VolumeDeleteParams{\n\t\tForce: &forceDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (r *SoftwareVolumeResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+SoftwareVolumeEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (_BaseContentType *BaseContentTypeTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseContentType.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (c *CmdVolumeDeleteOptions) ValidateVolumeDelete(cmd *cobra.Command) error {\n\tif c.volName == \"\" {\n\t\treturn errors.New(\"--volname is missing. Please specify an unique name\")\n\t}\n\treturn nil\n}", "func (o *VolumeDeleteParams) WithTimeout(timeout time.Duration) *VolumeDeleteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *VolumeDeleteParams) WithContext(ctx context.Context) *VolumeDeleteParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (op *OnPrem) DeleteVolume(ctx *lepton.Context, name string) error {\n\tquery := map[string]string{\n\t\t\"label\": name,\n\t\t\"id\": name,\n\t}\n\n\tbuildDir := ctx.Config().VolumesDir\n\tvolumes, err := GetVolumes(buildDir, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(volumes) == 1 {\n\t\tvolumePath := path.Join(volumes[0].Path)\n\t\terr := os.Remove(volumePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (g *Generator) RemoveConfigVolume(volume string) {\n\tdelete(g.image.Config.Volumes, volume)\n}", "func (client *AlertConfigClient) Delete(uuid string) error {\n\treturn client.aviSession.Delete(client.getAPIPath(uuid))\n}" ]
[ "0.6342966", "0.57557654", "0.56391346", "0.5401194", "0.5321719", "0.5308691", "0.52751863", "0.52710754", "0.5231506", "0.5231353", "0.5230582", "0.5166526", "0.5165278", "0.51168615", "0.5112844", "0.50630164", "0.5059387", "0.5027256", "0.50054806", "0.5002026", "0.49879515", "0.49459344", "0.49028182", "0.48981813", "0.48800045", "0.4866075", "0.48563588", "0.4854246", "0.48478875", "0.48382157", "0.48143637", "0.48078486", "0.48041368", "0.47824925", "0.477085", "0.47667286", "0.47452685", "0.4727903", "0.4717716", "0.47128832", "0.47082072", "0.46889746", "0.46745986", "0.46693483", "0.46676683", "0.46526793", "0.46440834", "0.46425608", "0.46406412", "0.46369886", "0.463677", "0.46357295", "0.46329418", "0.46021968", "0.46009797", "0.45999482", "0.4590022", "0.45832458", "0.45808268", "0.457146", "0.4563621", "0.45437402", "0.45396322", "0.45258516", "0.45256928", "0.45181662", "0.45110893", "0.45021272", "0.4498598", "0.4490919", "0.4490229", "0.4476006", "0.44751593", "0.44697618", "0.44623157", "0.44580463", "0.44531626", "0.4448117", "0.44438422", "0.4443529", "0.44411027", "0.44379652", "0.44308466", "0.44230515", "0.44230515", "0.44219127", "0.44205725", "0.44204798", "0.44195694", "0.44078928", "0.43990275", "0.4393404", "0.43902975", "0.43827036", "0.43818557", "0.43817735", "0.4377765", "0.43774962", "0.4372293", "0.43632212" ]
0.70726687
0
SetVvolUUID adds the vvolUuid to the vvol binding delete params
SetVvolUUID добавляет vvolUuid в параметры удаления привязки vvol
func (o *VvolBindingDeleteParams) SetVvolUUID(vvolUUID string) { o.VvolUUID = vvolUUID }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *VvolBindingDeleteParams) WithVvolUUID(vvolUUID string) *VvolBindingDeleteParams {\n\to.SetVvolUUID(vvolUUID)\n\treturn o\n}", "func DeleteVol(uuid string) int32 {\n\n\t_, conn, err := utils.DialVolMgr(VolMgrHosts)\n\tif err != nil {\n\t\tlogger.Error(\"DeleteVol failed,Dial to VolMgrHosts fail :%v\", err)\n\t\treturn -1\n\t}\n\tdefer conn.Close()\n\tvc := vp.NewVolMgrClient(conn)\n\n\tpDeleteVolReq := &vp.DeleteVolReq{\n\t\tUUID: uuid,\n\t}\n\tctx, _ := context.WithTimeout(context.Background(), VOLUME_TIMEOUT_SECONDS*time.Second)\n\tpDeleteVolAck, err := vc.DeleteVol(ctx, pDeleteVolReq)\n\tif err != nil {\n\t\treturn -1\n\t}\n\n\tif pDeleteVolAck.Ret != 0 {\n\t\tlogger.Error(\"DeleteVol failed :%v\", pDeleteVolAck.Ret)\n\t\treturn -1\n\t}\n\n\treturn 0\n}", "func (o *VvolBindingDeleteParams) WithProtocolEndpointUUID(protocolEndpointUUID string) *VvolBindingDeleteParams {\n\to.SetProtocolEndpointUUID(protocolEndpointUUID)\n\treturn o\n}", "func deleteVolume(vol string) {\n\tclient.RemoveVolume(vol)\n}", "func (e *ExternalInterface) DeleteVolume(ctx context.Context, req *systemsproto.VolumeRequest, pc *PluginContact, taskID string) {\n\tvar resp response.RPC\n\tvar targetURI = \"/redfish/v1/Systems/\" + req.SystemID + \"/Storage/\" + req.StorageInstance + \"/Volumes\" + req.VolumeID\n\n\ttaskInfo := &common.TaskUpdateInfo{Context: ctx, TaskID: taskID, TargetURI: targetURI,\n\t\tUpdateTask: pc.UpdateTask, TaskRequest: string(req.RequestBody)}\n\tvar volume smodel.Volume\n\terr := JSONUnmarshalFunc(req.RequestBody, &volume)\n\tif err != nil {\n\t\terrorMessage := \"Error while unmarshaling the create volume request: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errorMessage)\n\t\tcommon.GeneralError(http.StatusBadRequest, response.MalformedJSON, errorMessage, []interface{}{}, taskInfo)\n\t\treturn\n\t}\n\n\t// spliting the uuid and system id\n\trequestData := strings.SplitN(req.SystemID, \".\", 2)\n\tif len(requestData) != 2 || requestData[1] == \"\" {\n\t\terrorMessage := \"error: SystemUUID not found\"\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errorMessage, []interface{}{\"System\", req.SystemID}, taskInfo)\n\t\treturn\n\t}\n\tuuid := requestData[0]\n\ttarget, gerr := e.DB.GetTarget(uuid)\n\tif gerr != nil {\n\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, gerr.Error(), []interface{}{\"System\", uuid}, taskInfo)\n\t\treturn\n\t}\n\t// Validating the storage instance\n\tif StringTrimSpace(req.VolumeID) == \"\" {\n\t\terrorMessage := \"error: Volume id is not found\"\n\t\tcommon.GeneralError(http.StatusBadRequest, response.ResourceNotFound, errorMessage, []interface{}{\"Volume\", req.VolumeID}, taskInfo)\n\t\treturn\n\t}\n\n\t// Validating the request JSON properties for case sensitive\n\tinvalidProperties, err := RequestParamsCaseValidatorFunc(req.RequestBody, volume)\n\tif err != nil {\n\t\terrMsg := \"error while validating request parameters for volume creation: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errMsg, nil, taskInfo)\n\t\treturn\n\t} else if invalidProperties != \"\" {\n\t\terrorMessage := \"error: one or more properties given in the request body are not valid, ensure properties are listed in uppercamelcase \"\n\t\tl.LogWithFields(ctx).Error(errorMessage)\n\t\tcommon.GeneralError(http.StatusBadRequest, response.PropertyUnknown, errorMessage, []interface{}{invalidProperties}, taskInfo)\n\t\treturn\n\t}\n\n\tkey := fmt.Sprintf(\"/redfish/v1/Systems/%s/Storage/%s/Volumes/%s\", req.SystemID, req.StorageInstance, req.VolumeID)\n\t_, dbErr := e.DB.GetResource(ctx, \"Volumes\", key)\n\tif dbErr != nil {\n\t\tl.LogWithFields(ctx).Error(\"error getting volumes details : \" + dbErr.Error())\n\t\terrorMessage := dbErr.Error()\n\t\tif errors.DBKeyNotFound == dbErr.ErrNo() {\n\t\t\tvar getDeviceInfoRequest = scommon.ResourceInfoRequest{\n\t\t\t\tURL: key,\n\t\t\t\tUUID: uuid,\n\t\t\t\tSystemID: requestData[1],\n\t\t\t\tContactClient: e.ContactClient,\n\t\t\t\tDevicePassword: e.DevicePassword,\n\t\t\t\tGetPluginStatus: e.GetPluginStatus,\n\t\t\t}\n\t\t\tvar err error\n\t\t\tif _, err = scommon.GetResourceInfoFromDevice(ctx, getDeviceInfoRequest, true); err != nil {\n\t\t\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errorMessage, []interface{}{\"Volumes\", key}, taskInfo)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t} else {\n\t\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\t\treturn\n\t\t}\n\t}\n\n\tdecryptedPasswordByte, err := e.DevicePassword(target.Password)\n\tif err != nil {\n\t\terrorMessage := \"error while trying to decrypt device password: \" + err.Error()\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\treturn\n\t}\n\ttarget.Password = decryptedPasswordByte\n\t// Get the Plugin info\n\tplugin, gerr := e.DB.GetPluginData(target.PluginID)\n\tif gerr != nil {\n\t\terrorMessage := \"error while trying to get plugin details\"\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errorMessage, nil, taskInfo)\n\t\treturn\n\t}\n\n\tvar contactRequest scommon.PluginContactRequest\n\tcontactRequest.ContactClient = e.ContactClient\n\tcontactRequest.Plugin = plugin\n\tcontactRequest.GetPluginStatus = e.GetPluginStatus\n\tif StringsEqualFold(plugin.PreferredAuthType, \"XAuthToken\") {\n\t\tvar err error\n\t\tcontactRequest.HTTPMethodType = http.MethodPost\n\t\tcontactRequest.DeviceInfo = map[string]interface{}{\n\t\t\t\"UserName\": plugin.Username,\n\t\t\t\"Password\": string(plugin.Password),\n\t\t}\n\t\tcontactRequest.OID = \"/ODIM/v1/Sessions\"\n\t\t_, token, _, getResponse, err := scommon.ContactPlugin(ctx, contactRequest, \"error while creating session with the plugin: \")\n\n\t\tif err != nil {\n\t\t\tcommon.GeneralError(getResponse.StatusCode, getResponse.StatusMessage, err.Error(), nil, taskInfo)\n\t\t\treturn\n\t\t}\n\t\tcontactRequest.Token = token\n\t} else {\n\t\tcontactRequest.BasicAuth = map[string]string{\n\t\t\t\"UserName\": plugin.Username,\n\t\t\t\"Password\": string(plugin.Password),\n\t\t}\n\n\t}\n\n\tif string(req.RequestBody) == \"null\" {\n\t\ttarget.PostBody = []byte{}\n\t} else {\n\t\ttarget.PostBody = req.RequestBody\n\n\t}\n\tcontactRequest.HTTPMethodType = http.MethodDelete\n\tcontactRequest.DeviceInfo = target\n\tcontactRequest.OID = fmt.Sprintf(\"/ODIM/v1/Systems/%s/Storage/%s/Volumes/%s\", requestData[1], req.StorageInstance, req.VolumeID)\n\n\tbody, location, pluginIP, getResponse, err := scommon.ContactPlugin(ctx, contactRequest, \"error while deleting a volume: \")\n\tif err != nil {\n\t\tresp.StatusCode = getResponse.StatusCode\n\t\tjson.Unmarshal(body, &resp.Body)\n\t\terrMsg := \"error while deleting volume: \" + err.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\t\tcommon.Completed, common.Warning, 100, http.MethodPost)\n\t\tpc.UpdateTask(ctx, task)\n\t\treturn\n\t}\n\tif getResponse.StatusCode == http.StatusAccepted {\n\t\terr = pc.SavePluginTaskInfo(ctx, pluginIP, plugin.IP, taskID, location)\n\t\tif err != nil {\n\t\t\tl.LogWithFields(ctx).Error(err)\n\t\t}\n\t\treturn\n\t}\n\n\t// handling the status ok response from plugin\n\tif getResponse.StatusCode == http.StatusOK && body != nil {\n\t\tresp.StatusCode = getResponse.StatusCode\n\t\tjson.Unmarshal(body, &resp.Body)\n\t\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\t\tcommon.Completed, common.OK, 100, http.MethodDelete)\n\t\tpc.UpdateTask(ctx, task)\n\t\treturn\n\t}\n\n\t// delete a volume in db\n\tif derr := e.DB.DeleteVolume(ctx, key); derr != nil {\n\t\terrMsg := \"error while trying to delete volume: \" + derr.Error()\n\t\tl.LogWithFields(ctx).Error(errMsg)\n\t\tif errors.DBKeyNotFound == derr.ErrNo() {\n\t\t\tcommon.GeneralError(http.StatusNotFound, response.ResourceNotFound, errMsg, []interface{}{\"Volumes\", key}, taskInfo)\n\t\t\treturn\n\t\t}\n\t\tcommon.GeneralError(http.StatusInternalServerError, response.InternalError, errMsg, nil, taskInfo)\n\t\treturn\n\t}\n\n\t// adding volume collection uri and deleted volume uri to the AddSystemResetInfo\n\t// for avoiding storing or retrieving them from DB before a BMC reset.\n\tcollectionKey := fmt.Sprintf(\"/redfish/v1/Systems/%s/Storage/%s/Volumes\", req.SystemID, req.StorageInstance)\n\te.DB.AddSystemResetInfo(ctx, key, \"On\")\n\te.DB.AddSystemResetInfo(ctx, collectionKey, \"On\")\n\n\tresp.StatusCode = http.StatusNoContent\n\tresp.StatusMessage = response.Success\n\ttask := fillTaskData(taskID, targetURI, string(req.RequestBody), resp,\n\t\tcommon.Completed, common.OK, 100, http.MethodDelete)\n\tpc.UpdateTask(ctx, task)\n}", "func (o *NvmeNamespaceDeleteParams) SetUUID(uuid string) {\n\to.UUID = uuid\n}", "func (o *BucketsCollectionGetParams) SetVolumeUUID(volumeUUID *string) {\n\to.VolumeUUID = volumeUUID\n}", "func (l *Libvirt) StorageVolDelete(Vol StorageVol, Flags StorageVolDeleteFlags) (err error) {\n\tvar buf []byte\n\n\targs := StorageVolDeleteArgs {\n\t\tVol: Vol,\n\t\tFlags: Flags,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(94, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (o *QtreeCollectionGetParams) SetVolumeUUID(volumeUUID *string) {\n\to.VolumeUUID = volumeUUID\n}", "func (s *VcenterClient) SetVcenterUUID(v string) *VcenterClient {\n\ts.VcenterUUID = &v\n\treturn s\n}", "func (o *GetVersioningPolicyParams) SetUUID(uuid string) {\n\to.UUID = uuid\n}", "func (o *FileInfoCreateParams) SetVolumeUUID(volumeUUID string) {\n\to.VolumeUUID = volumeUUID\n}", "func DelVol(fcVolName string) (string, error) {\n\tvar (\n\t\tcmdOut []byte\n\t\terr error\n\t)\n\n\tstrs := strings.SplitAfterN(fcVolName, \"/dev/\", 2)\n\tif len(strs) == 2 && strs[0] == \"/dev/\" {\n\t\tfcVolName = strs[1]\n\t}\n\tlog.Debug(\"fcVolName=\", fcVolName)\n\n\tcmd := \"fcagent\"\n\targs := []string{\n\t\t\"delvol\",\n\t\tfcVolName,\n\t\t\"-donotdelebs\"}\n\n\tlog.Debug(cmd, args)\n\n\tif cmdOut, err = exec.Command(cmd, args...).Output(); err != nil {\n\t\tlog.Debug(err)\n\t}\n\n\treturn string(cmdOut), err\n}", "func (p *FCProvisioner) Delete(volume *v1.PersistentVolume, config map[string]string, nodeList []*v1.Node) (err error) {\n\tdefer func() {\n\t\tif res := recover(); res != nil && err == nil {\n\t\t\terr = errors.New(\"error while deleting volume \" + fmt.Sprint(res))\n\t\t}\n\t}()\n\tprovisioned, err := p.provisioned(volume)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error determining if this provisioner was the one to provision volume %q: %v\", volume.Name, err)\n\t}\n\tif !provisioned {\n\t\tstrerr := fmt.Sprintf(\"this provisioner id %s didn't provision volume %q and so can't delete it; id %s did & can\", createdBy, volume.Name, volume.Annotations[annCreatedBy])\n\t\treturn &controller.IgnoredError{Reason: strerr}\n\t}\n\n\tglog.Info(\"volume deletion request received: \", volume.GetName())\n\n\tif volume.Annotations[\"volumeId\"] == \"\" {\n\t\terr = errors.New(\"volumeid is empty\")\n\t\treturn err\n\t}\n\tvolId, err := strconv.ParseInt(volume.Annotations[\"volumeId\"], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = p.volDestroy(volId, volume.Annotations[\"volume_name\"], nodeList)\n\tif err != nil {\n\t\tglog.Error(err)\n\t\treturn err\n\n\t}\n\tglog.Info(\"Volume deleted: \", volume.GetName())\n\treturn nil\n}", "func (user *User) SetUUID(uuid string) {\n\tuser.GctlUUID = uuid\n}", "func (o *FileInfoCollectionGetParams) SetVolumeUUID(volumeUUID string) {\n\to.VolumeUUID = volumeUUID\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) SetUUID(uuid string) {\n\to.UUID = uuid\n}", "func cephRBDVolumeDelete(clusterName string, poolName string, volumeName string,\n\tvolumeType string, userName string) error {\n\t_, err := shared.RunCommand(\n\t\t\"rbd\",\n\t\t\"--id\", userName,\n\t\t\"--cluster\", clusterName,\n\t\t\"--pool\", poolName,\n\t\t\"rm\",\n\t\tfmt.Sprintf(\"%s_%s\", volumeType, volumeName))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *VvolBindingDeleteParams) SetProtocolEndpointUUID(protocolEndpointUUID string) {\n\to.ProtocolEndpointUUID = protocolEndpointUUID\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) SetVolumeUUID(volumeUUID string) {\n\to.VolumeUUID = volumeUUID\n}", "func DeleteVolume(base, volID string) error {\n\tklog.V(4).Infof(\"starting to delete hostpath volume: %s\", volID)\n\n\tpath := filepath.Join(base, volID)\n\tif err := os.RemoveAll(path); err != nil && !os.IsNotExist(err) {\n\t\treturn err\n\t}\n\tklog.V(4).Infof(\"deleted hostpath volume: %s\", volID)\n\treturn nil\n}", "func (s stack) DeleteVolume(ctx context.Context, ref string) fail.Error {\n\tif valid.IsNil(s) {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\treturn fail.NotImplementedError(\"implement me\")\n}", "func (dev VMVolumeDevice) UUID() string {\n\treturn utils.NewUUID5(blockVolumeNsUUID, dev.HostPath)\n}", "func DeleteVM(c config.Cpi, extInput bosh.MethodArguments) error {\n\tvar cid string\n\tif reflect.TypeOf(extInput[0]) != reflect.TypeOf(cid) {\n\t\treturn errors.New(\"Received unexpected type for vm cid\")\n\t}\n\n\tcid = extInput[0].(string)\n\tnode, err := rackhdapi.GetNodeByVMCID(c, cid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif node.PersistentDisk.IsAttached {\n\t\terr = rackhdapi.MakeDiskRequest(c, node, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tworkflowName, err := workflows.PublishDeprovisionNodeWorkflow(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = workflows.RunDeprovisionNodeWorkflow(c, node.ID, workflowName, cid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, tag := range node.Tags {\n\t\tif strings.HasPrefix(tag, DiskCIDTagPrefix) {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\terr = rackhdapi.ReleaseNode(c, node.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *BucketsCollectionGetParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func (client *Client) DeleteTagWithUuidWithOptions(request *DeleteTagWithUuidRequest, runtime *util.RuntimeOptions) (_result *DeleteTagWithUuidResponse, _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.TagName)) {\n\t\tquery[\"TagName\"] = request.TagName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.UuidList)) {\n\t\tquery[\"UuidList\"] = request.UuidList\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteTagWithUuid\"),\n\t\tVersion: tea.String(\"2018-12-03\"),\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 = &DeleteTagWithUuidResponse{}\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 (util *PortworxVolumeUtil) DeleteVolume(d *portworxVolumeDeleter) error {\n\tdriver, err := util.getPortworxDriver(d.plugin.host, false /*localOnly*/)\n\tif err != nil || driver == nil {\n\t\tglog.Errorf(\"Failed to get portworx driver. Err: %v\", err)\n\t\treturn err\n\t}\n\n\terr = driver.Delete(d.volumeID)\n\tif err != nil {\n\t\tglog.Errorf(\"Error deleting Portworx Volume (%v): %v\", d.volName, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *UpdateWidgetParams) SetUUID(uuid strfmt.UUID) {\n\to.UUID = uuid\n}", "func (o *NvmeNamespaceDeleteParams) WithUUID(uuid string) *NvmeNamespaceDeleteParams {\n\to.SetUUID(uuid)\n\treturn o\n}", "func (a AppblueprintApi) AppBlueprintsUuidDelete(uuid string) (*APIResponse, error) {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/app_blueprints/{uuid}\"\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\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}", "func (o *PortsetCollectionGetParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func DeleteVNet(vNetName string, rgroupName string) {\n\ta := wow.New(os.Stdout, spin.Get(spin.Dots), \"Deleting virtual network : \"+vNetName)\n\ta.Start()\n\ttime.Sleep(2 * time.Second)\n\ta.Text(\"This would take a few minutes...\").Spinner(spin.Get(spin.Dots))\n\tcmd := exec.Command(\"az\", \"network\", \"vnet\", \"delete\", \"--name\",\n\t\tvNetName, \"--resource-group\", rgroupName)\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\tfmt.Println(fmt.Sprint(err) + \": \" + stderr.String())\n\t\treturn\n\t}\n\ta.PersistWith(spin.Spinner{}, \"....\")\n\tfmt.Println(\"Result: \" + out.String())\n}", "func (o *SecurityCertificateCollectionGetParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) WithUUID(uuid string) *GetContainersUUIDVolumesVolumeUUIDParams {\n\to.SetUUID(uuid)\n\treturn o\n}", "func BdevLvolDelete(ctx context.Context, client *Client, args BdevLvolDeleteArgs) (bool, error) {\n\tvar response bool\n\terr := client.Invoke(ctx, \"bdev_lvol_delete\", args, &response)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn response, err\n}", "func (o *ApplicationComponentSnapshotCollectionGetParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func (s *Stack) DeleteVolumeAttachment(serverID, vaID string) error {\n\tif s == nil {\n\t\treturn scerr.InvalidInstanceError()\n\t}\n\tif serverID == \"\" {\n\t\treturn scerr.InvalidParameterError(\"serverID\", \"cannot be empty string\")\n\t}\n\tif vaID == \"\" {\n\t\treturn scerr.InvalidParameterError(\"vaID\", \"cannot be empty string\")\n\t}\n\n\tdefer concurrency.NewTracer(nil, \"('\"+serverID+\"', '\"+vaID+\"')\", true).WithStopwatch().GoingIn().OnExitTrace()()\n\n\tr := volumeattach.Delete(s.ComputeClient, serverID, vaID)\n\terr := r.ExtractErr()\n\tif err != nil {\n\t\treturn scerr.Wrap(err, fmt.Sprintf(\"error deleting volume attachment '%s': %s\", vaID, ProviderErrorToString(err)))\n\t}\n\treturn nil\n}", "func (cl *Client) VolumeDelete(ctx context.Context, vda *csp.VolumeDeleteArgs) error {\n\tsvc, vid, _ := VolumeIdentifierParse(vda.VolumeIdentifier)\n\tswitch svc {\n\tcase ServiceGCE:\n\t\treturn cl.gceVolumeDelete(ctx, vda, vid)\n\t}\n\treturn fmt.Errorf(\"invalid volume identifier\")\n}", "func (o *BucketsCollectionGetParams) SetSvmUUID(svmUUID string) {\n\to.SvmUUID = svmUUID\n}", "func (calendar *OutlookCalendar) SetUUID(id string) {\n\tcalendar.uuid = id\n}", "func (rc *regClient) TagDelete(ctx context.Context, ref types.Ref) error {\n\tvar tempManifest manifest.Manifest\n\tif ref.Tag == \"\" {\n\t\treturn ErrMissingTag\n\t}\n\n\t// attempt to delete the tag directly, available in OCI distribution-spec, and Hub API\n\treq := httpReq{\n\t\thost: ref.Registry,\n\t\tnoMirrors: true,\n\t\tapis: map[string]httpReqAPI{\n\t\t\t\"\": {\n\t\t\t\tmethod: \"DELETE\",\n\t\t\t\trepository: ref.Repository,\n\t\t\t\tpath: \"manifests/\" + ref.Tag,\n\t\t\t\tignoreErr: true, // do not trigger backoffs if this fails\n\t\t\t},\n\t\t\t\"hub\": {\n\t\t\t\tmethod: \"DELETE\",\n\t\t\t\tpath: \"repositories/\" + ref.Repository + \"/tags/\" + ref.Tag + \"/\",\n\t\t\t},\n\t\t},\n\t}\n\n\tresp, err := rc.httpDo(ctx, req)\n\tif resp != nil {\n\t\tdefer resp.Close()\n\t}\n\t// TODO: Hub may return a different status\n\tif err == nil && resp != nil && resp.HTTPResponse().StatusCode == 202 {\n\t\treturn nil\n\t}\n\t// ignore errors, fallback to creating a temporary manifest to replace the tag and deleting that manifest\n\n\t// lookup the current manifest media type\n\tcurManifest, err := rc.ManifestHead(ctx, ref)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create empty image config with single label\n\t// Note, this should be MediaType specific, but it appears that docker uses OCI for the config\n\tnow := time.Now()\n\tconf := ociv1.Image{\n\t\tCreated: &now,\n\t\tConfig: ociv1.ImageConfig{\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"delete-tag\": ref.Tag,\n\t\t\t\t\"delete-date\": now.String(),\n\t\t\t},\n\t\t},\n\t\tOS: \"linux\",\n\t\tArchitecture: \"amd64\",\n\t\tRootFS: ociv1.RootFS{\n\t\t\tType: \"layers\",\n\t\t\tDiffIDs: []digest.Digest{},\n\t\t},\n\t}\n\tconfB, err := json.Marshal(conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdigester := digest.Canonical.Digester()\n\tconfBuf := bytes.NewBuffer(confB)\n\t_, err = confBuf.WriteTo(digester.Hash())\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfDigest := digester.Digest()\n\n\t// create manifest with config, matching the original tag manifest type\n\tswitch curManifest.GetMediaType() {\n\tcase MediaTypeOCI1Manifest, MediaTypeOCI1ManifestList:\n\t\ttempManifest, err = manifest.FromOrig(ociv1.Manifest{\n\t\t\tVersioned: ociv1Specs.Versioned{\n\t\t\t\tSchemaVersion: 1,\n\t\t\t},\n\t\t\tConfig: ociv1.Descriptor{\n\t\t\t\tMediaType: MediaTypeOCI1ImageConfig,\n\t\t\t\tDigest: confDigest,\n\t\t\t\tSize: int64(len(confB)),\n\t\t\t},\n\t\t\tLayers: []ociv1.Descriptor{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault: // default to the docker v2 schema\n\t\ttempManifest, err = manifest.FromOrig(dockerSchema2.Manifest{\n\t\t\tVersioned: dockerManifest.Versioned{\n\t\t\t\tSchemaVersion: 2,\n\t\t\t\tMediaType: MediaTypeDocker2Manifest,\n\t\t\t},\n\t\t\tConfig: dockerDistribution.Descriptor{\n\t\t\t\tMediaType: MediaTypeDocker2ImageConfig,\n\t\t\t\tDigest: confDigest,\n\t\t\t\tSize: int64(len(confB)),\n\t\t\t},\n\t\t\tLayers: []dockerDistribution.Descriptor{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\trc.log.WithFields(logrus.Fields{\n\t\t\"ref\": ref.Reference,\n\t}).Debug(\"Sending dummy manifest to replace tag\")\n\n\t// push config\n\t_, _, err = rc.BlobPut(ctx, ref, confDigest, ioutil.NopCloser(bytes.NewReader(confB)), MediaTypeDocker2ImageConfig, int64(len(confB)))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed sending dummy config to delete %s: %w\", ref.CommonName(), err)\n\t}\n\n\t// push manifest to tag\n\terr = rc.ManifestPut(ctx, ref, tempManifest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed sending dummy manifest to delete %s: %w\", ref.CommonName(), err)\n\t}\n\n\tref.Digest = tempManifest.GetDigest().String()\n\n\t// delete manifest by digest\n\trc.log.WithFields(logrus.Fields{\n\t\t\"ref\": ref.Reference,\n\t\t\"digest\": ref.Digest,\n\t}).Debug(\"Deleting dummy manifest\")\n\terr = rc.ManifestDelete(ctx, ref)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed deleting dummy manifest for %s: %w\", ref.CommonName(), err)\n\t}\n\n\treturn nil\n}", "func DeleteVolume(req systemsproto.VolumeRequest) (*systemsproto.SystemsResponse, error) {\n\tconn, err := services.ODIMService.Client(services.Systems)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client connection: %v\", err)\n\t}\n\tdefer conn.Close()\n\tasService := systemsproto.NewSystemsClient(conn)\n\tresp, err := asService.DeleteVolume(context.TODO(), &req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error: RPC error: %v\", err)\n\t}\n\treturn resp, nil\n}", "func (s *Storage) DeleteVolume(vname string, rSnapshots bool) RestError {\n\tvar err error\n\taddr := fmt.Sprintf(\"api/v3/pools/%s/volumes/%s\", s.pool, vname)\n\n\tdata := DeleteVolume{\n\t\tRecursivelyChildren: false,\n\t\tRecursivelyDependents: false,\n\t\tForceUmount: false,\n\t}\n\tif rSnapshots == true {\n\t\tdata.RecursivelyChildren = true\n\t}\n\n\tstat, body, err := s.rp.Send(\"DELETE\", addr, data, DeleteVolumeRCode)\n\n\ts.l.Tracef(\"Status %d\", stat)\n\ts.l.Tracef(\"Body %s\", body[:len(body)])\n\ts.l.Tracef(\"Err %+v\", err)\n\n\tif stat == DeleteVolumeRCode {\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Internal failure during volume %s deletion.\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestRequestMalfunction, msg)\n\t}\n\n\terrData, er := s.getError(body)\n\n\tif er != nil {\n\t\tmsg := fmt.Sprintf(\"Unable to extract err message %+v\", er)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestRequestMalfunction, msg)\n\t}\n\n\tif (*errData).Errno == 1 {\n\t\tmsg := fmt.Sprintf(\"Volume %s doesn't exist\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestResourceDNE, \"\")\n\t}\n\n\tif (*errData).Errno == 1000 {\n\n\t\tmsg := fmt.Sprintf(\"Volume %s is busy\", vname)\n\t\ts.l.Warn(msg)\n\t\treturn GetError(RestResourceBusy, msg)\n\t}\n\n\tmsg := fmt.Sprintf(\"Unidentified failure during volume %s deletion.\", vname)\n\ts.l.Warn(msg)\n\treturn GetError(RestFailureUnknown, msg)\n}", "func (c *restClient) DeleteVolume(ctx context.Context, req *netapppb.DeleteVolumeRequest, opts ...gax.CallOption) (*DeleteVolumeOperation, error) {\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v\", req.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\tif req.GetForce() {\n\t\tparams.Add(\"force\", fmt.Sprintf(\"%v\", req.GetForce()))\n\t}\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"name\", url.QueryEscape(req.GetName()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &longrunningpb.Operation{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"DELETE\", baseUrl.String(), nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\toverride := fmt.Sprintf(\"/v1/%s\", resp.GetName())\n\treturn &DeleteVolumeOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, resp),\n\t\tpollPath: override,\n\t}, nil\n}", "func (c *Dg) DeleteDeviceVsys(g interface{}, d string, vsys []string) error {\n var name string\n\n switch v := g.(type) {\n case string:\n name = v\n case Entry:\n name = v.Name\n default:\n return fmt.Errorf(\"Unknown type sent to remove devices: %s\", v)\n }\n\n c.con.LogAction(\"(delete) device vsys from device group: %s\", name)\n\n path := make([]string, 0, 9)\n path = append(path, c.xpath([]string{name})...)\n path = append(path, \"devices\", util.AsEntryXpath([]string{d}))\n if len(vsys) > 0 {\n path = append(path, \"vsys\", util.AsEntryXpath(vsys))\n }\n\n _, err := c.con.Delete(path, nil, nil)\n return err\n}", "func (a *Client) DeleteVMSnapshotsUUID(params *DeleteVMSnapshotsUUIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteVMSnapshotsUUIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteVMSnapshotsUUIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteVMSnapshotsUUID\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/vm_snapshots/{uuid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteVMSnapshotsUUIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteVMSnapshotsUUIDOK), nil\n\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) WithContext(ctx context.Context) *GetContainersUUIDVolumesVolumeUUIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func removeDeleteme(){\n lvm_count := exec.Command(\"/bin/bash\", \"-c\", \"lvs | grep deleteme | wc -l\")\n if lvm_count > 1 {\n fmt.Println(\"Multiple deleteme logical volumes detected. Please remove the deleteme volumes manually.\")\n os.Exit(1)\n } else if lvm_count == 0 {\n fmt.Println(\"No deleteme logical volumes detected.\")\n } else {\n exec.Command(\"/bin/bash\", \"-c\", \"umount /delete\")\n exec.Command(\"/bin/bash\", \"-c\", \"rmdir /deleteme\")\n exec.Command(\"/bin/bash\", \"-c\", \"lvchange -an /dev/mapper/$(lvs | grep deleteme | awk ' { print $2 }')-deleteme00\")\n exec.Command(\"/bin/bash\", \"-c\", \"lvremove -f /dev/mapper/$(lvs | grep deleteme | awk ' { print $2 }')-deleteme00\")\n exec.Command(\"/bin/bash\", \"-c\", \"cp /etc/fstab /home/rack/fstab.bak\")\n exec.Command(\"/bin/bash\", \"-c\", \"sed -i '/\\/deleteme/d' /etc/fstab\")\n fmt.Println(\"The deleteme volume has been successfully removed.\")\n }\n}", "func generateVolumeID(volName string) string {\n\t//uuid := uuid.New()\n\t//return fmt.Sprintf(\"volid-%s\", uuid.String())\n\treturn volName\n}", "func (p *cinderProvisioner) Delete(pv *v1.PersistentVolume) error {\n\tann, ok := pv.Annotations[provisionerIDAnn]\n\tif !ok {\n\t\treturn errors.New(\"identity annotation not found on PV\")\n\t}\n\tif ann != p.identity {\n\t\treturn &controller.IgnoredError{\n\t\t\tReason: \"identity annotation on PV does not match ours\",\n\t\t}\n\t}\n\t// TODO when beta is removed, have to check kube version and pick v1/beta\n\t// accordingly: maybe the controller lib should offer a function for that\n\n\tvolumeID, ok := pv.Annotations[cinderVolumeID]\n\tif !ok {\n\t\treturn errors.New(cinderVolumeID + \" annotation not found on PV\")\n\t}\n\n\tctx := deleteCtx{p, pv}\n\tmapper, err := newVolumeMapperFromPV(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmapper.AuthTeardown(ctx)\n\n\terr = disconnectCinderVolume(p, volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = unreserveCinderVolume(p, volumeID)\n\tif err != nil {\n\t\t// TODO: Create placeholder PV?\n\t\tglog.Errorf(\"Failed to unreserve volume: %v\", err)\n\t\treturn err\n\t}\n\n\terr = deleteCinderVolume(p, volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglog.V(2).Infof(\"Successfully deleted cinder volume %s\", volumeID)\n\treturn nil\n}", "func (cs *controller) DeleteVolume(\n\tctx context.Context,\n\treq *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\n\tlogrus.Infof(\"received request to delete volume {%s}\", req.VolumeId)\n\n\tif req.VolumeId == \"\" {\n\t\treturn nil, status.Error(\n\t\t\tcodes.InvalidArgument,\n\t\t\t\"failed to handle delete volume request: missing volume id\",\n\t\t)\n\t}\n\n\terr := cs.validateRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\t// this call is made just to fetch pvc namespace\n\tpv, err := utils.FetchPVDetails(req.VolumeId)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\tpvcNamespace := pv.Spec.ClaimRef.Namespace\n\n\t// send delete request to maya apiserver\n\terr = utils.DeleteVolume(req.VolumeId, pvcNamespace)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr,\n\t\t\t\"failed to handle delete volume request for {%s}\",\n\t\t\treq.VolumeId,\n\t\t)\n\t}\n\n\t// TODO\n\t// Use a lock to remove\n\t//\n\t// remove entry from the in-memory\n\t// maintained list\n\tdelete(utils.Volumes, req.VolumeId)\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (c *MockVirtualNetworksClient) Delete(ctx context.Context, resourceGroupName, vnetName string) error {\n\t// Ignore resourceGroupName for simplicity.\n\tif _, ok := c.VNets[vnetName]; !ok {\n\t\treturn fmt.Errorf(\"%s does not exist\", vnetName)\n\t}\n\tdelete(c.VNets, vnetName)\n\treturn nil\n}", "func (c *CmdVolumeDeleteOptions) RunVolumeDelete(cmd *cobra.Command) error {\n\tfmt.Println(\"Executing volume delete...\")\n\n\tresp := mapiserver.DeleteVolume(c.volName)\n\tif resp != nil {\n\t\treturn fmt.Errorf(\"Error: %v\", resp)\n\t}\n\n\tfmt.Printf(\"Volume deletion initiated:%v\\n\", c.volName)\n\n\treturn nil\n}", "func (d *InterfaceVrfDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error) {\n\tswIfIndex, vrf, inheritedVrf, ipv4, ipv6, err := d.getParametersFromKey(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !inheritedVrf && vrf > 0 && ipv4 {\n\t\terr = d.ifHandler.SetInterfaceVrf(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\tif !inheritedVrf && vrf > 0 && ipv6 {\n\t\terr = d.ifHandler.SetInterfaceVrfIPv6(swIfIndex, uint32(0))\n\t\tif err != nil {\n\t\t\td.log.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (o IopingSpecVolumeVolumeSourceFlockerOutput) DatasetUUID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceFlocker) *string { return v.DatasetUUID }).(pulumi.StringPtrOutput)\n}", "func (a *Client) GetContainersUUIDVolumesVolumeUUID(params *GetContainersUUIDVolumesVolumeUUIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetContainersUUIDVolumesVolumeUUIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetContainersUUIDVolumesVolumeUUIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetContainersUUIDVolumesVolumeUUID\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/containers/{uuid}/volumes/{volume_uuid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetContainersUUIDVolumesVolumeUUIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetContainersUUIDVolumesVolumeUUIDOK), nil\n\n}", "func deletePerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\r\n\tparams := mux.Vars(r)\r\n\tuuid, err := primitive.ObjectIDFromHex(params[\"uuid\"])\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tcollection := models.ConnectDB()\r\n\tobjectToDelete, err := collection.DeleteOne(context.TODO(), bson.M{\"_id\": uuid})\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(objectToDelete.DeletedCount)\r\n\r\n}", "func (s *StackEbrc) DeleteVolume(ref string) error {\n\tlogrus.Debugf(\"ebrc.Client.DeleteVolume(%s) called\", ref)\n\tdefer logrus.Debugf(\"ebrc.Client.DeleteVolume(%s) done\", ref)\n\n\tthed, err := s.findDiskByID(ref)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdeltask, err := thed.Delete()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = deltask.WaitTaskCompletion()\n\treturn err\n}", "func (u *apiUtil) DeletePV(pvName string) error {\n\tstartTime := time.Now()\n\tmetrics.APIServerRequestsTotal.WithLabelValues(metrics.APIServerRequestDelete).Inc()\n\terr := u.client.CoreV1().PersistentVolumes().Delete(context.TODO(), pvName, metav1.DeleteOptions{})\n\tmetrics.APIServerRequestsDurationSeconds.WithLabelValues(metrics.APIServerRequestDelete).Observe(time.Since(startTime).Seconds())\n\tif err != nil {\n\t\tmetrics.APIServerRequestsFailedTotal.WithLabelValues(metrics.APIServerRequestDelete).Inc()\n\t}\n\treturn err\n}", "func (d *DefaultDriver) DeleteVolume(volumeID string) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"DeleteVolume()\",\n\t}\n}", "func (driver *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\t//klog.V(4).Infof(\"DeleteVolume: called with args: %#v\", req)\n\n\tvolID := req.GetVolumeId()\n\tif len(volID) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID not provided\")\n\t}\n\n\tklog.V(4).Infof(\"DeleteVolume: volumeId (%#v)\", volID)\n\n\tirodsVolume := PopIRODSVolume(volID)\n\tif irodsVolume == nil {\n\t\t// orphant\n\t\tklog.V(4).Infof(\"DeleteVolume: cannot find a volume with id (%v)\", volID)\n\t\t// ignore this error\n\t\treturn &csi.DeleteVolumeResponse{}, nil\n\t}\n\n\tif !irodsVolume.RetainData {\n\t\tklog.V(5).Infof(\"Deleting a volume dir %s\", irodsVolume.Path)\n\t\terr := IRODSRmdir(irodsVolume.ConnectionInfo, irodsVolume.Path)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"Could not delete a volume dir %s : %v\", irodsVolume.Path, err)\n\t\t}\n\t}\n\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (obj *ObjectBase) SetUuid(uuid string) {\n\tif obj.clientPtr != nil {\n\t\tpanic(fmt.Sprintf(\"Attempt to override uuid for %s\", obj.uuid))\n\t}\n\tobj.uuid = uuid\n}", "func (d *DefaultDriver) RandomizeVolumeName(params string) string {\n\tre := regexp.MustCompile(\"(\" + api.Name + \"=)([0-9A-Za-z_-]+)(,)?\")\n\treturn re.ReplaceAllString(params, \"${1}${2}_\"+uuid.New()+\"${3}\")\n}", "func (o *GetContainersUUIDVolumesVolumeUUIDParams) WithTimeout(timeout time.Duration) *GetContainersUUIDVolumesVolumeUUIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewGetContainersUUIDVolumesVolumeUUIDParams() *GetContainersUUIDVolumesVolumeUUIDParams {\n\tvar ()\n\treturn &GetContainersUUIDVolumesVolumeUUIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (client *LicenseStatusClient) Delete(uuid string, options ...session.ApiOptionsParams) error {\n\tif len(options) == 0 {\n\t\treturn client.aviSession.Delete(client.getAPIPath(uuid))\n\t} else {\n\t\treturn client.aviSession.DeleteObject(client.getAPIPath(uuid), options...)\n\t}\n}", "func (client *Client) DeleteVodSpecificConfigWithOptions(request *DeleteVodSpecificConfigRequest, runtime *util.RuntimeOptions) (_result *DeleteVodSpecificConfigResponse, _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.ConfigId)) {\n\t\tquery[\"ConfigId\"] = request.ConfigId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.DomainName)) {\n\t\tquery[\"DomainName\"] = request.DomainName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Env)) {\n\t\tquery[\"Env\"] = request.Env\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.SecurityToken)) {\n\t\tquery[\"SecurityToken\"] = request.SecurityToken\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteVodSpecificConfig\"),\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 = &DeleteVodSpecificConfigResponse{}\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 (client *Client) DeleteVolume(name string) (*Response, *ResponseStatus, error) {\n\treturn client.FormattedRequest(\"/delete/volumes/\\\"%s\\\"\", name)\n}", "func (o FioSpecVolumeVolumeSourceFlockerOutput) DatasetUUID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceFlocker) *string { return v.DatasetUUID }).(pulumi.StringPtrOutput)\n}", "func (o *GetAiProductRecommendationsByIDParams) SetUUID(uuid *string) {\n\to.UUID = uuid\n}", "func (client *Client) DeleteVodSpecificConfig(request *DeleteVodSpecificConfigRequest) (_result *DeleteVodSpecificConfigResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &DeleteVodSpecificConfigResponse{}\n\t_body, _err := client.DeleteVodSpecificConfigWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func DeleteVolume(volumeID string) (err error) {\n\terr = volbuilder.NewKubeclient().WithNamespace(OpenEBSNamespace).Delete(volumeID)\n\tif err == nil {\n\t\tklog.Infof(\"deprovisioned volume %s\", volumeID)\n\t}\n\n\treturn\n}", "func (client *AlertConfigClient) Delete(uuid string) error {\n\treturn client.aviSession.Delete(client.getAPIPath(uuid))\n}", "func DeleteVolume(ip, name string) (string, error) {\n\tlog.Printf(\"Destroying volume [%s]\\n\", name)\n\tvar out string\n\tvar err error\n\n\tfor attempt := 0; attempt < maxRemoveVolAttempt; attempt++ {\n\t\tout, err = ssh.InvokeCommand(ip, dockercli.RemoveVolume+name)\n\t\tif err != nil && strings.Contains(out, pluginInitError) {\n\t\t\tmisc.SleepForSec(waitTime)\n\t\t\tlog.Printf(\"Volume cannot be deleted yet as plugin initialization still in progress. Retrying...\")\n\t\t\tcontinue\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn out, err\n}", "func (es *Endpoints) DelByUUID(uuid string) {\n\tes.Lock()\n\tdefer es.Unlock()\n\tif i, ok := es.mapUUID[uuid]; ok {\n\t\tdelete(es.mapUUID, uuid)\n\n\t\tswitch {\n\t\tcase i == 0:\n\t\t\tif len(es.endpoints) == 1 {\n\t\t\t\tes.endpoints = make([]*Endpoint, 0)\n\t\t\t} else {\n\t\t\t\tes.endpoints = es.endpoints[i+1:]\n\t\t\t}\n\t\tcase i == len(es.endpoints)-1:\n\t\t\tes.endpoints = es.endpoints[:i]\n\t\tdefault:\n\t\t\tes.endpoints = append(es.endpoints[:i], es.endpoints[i+1:]...)\n\t\t}\n\t}\n}", "func (o *VvolBindingDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DeleteAllReferences != nil {\n\n\t\t// query param delete_all_references\n\t\tvar qrDeleteAllReferences bool\n\n\t\tif o.DeleteAllReferences != nil {\n\t\t\tqrDeleteAllReferences = *o.DeleteAllReferences\n\t\t}\n\t\tqDeleteAllReferences := swag.FormatBool(qrDeleteAllReferences)\n\t\tif qDeleteAllReferences != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"delete_all_references\", qDeleteAllReferences); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param protocol_endpoint.uuid\n\tif err := r.SetPathParam(\"protocol_endpoint.uuid\", o.ProtocolEndpointUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vvol.uuid\n\tif err := r.SetPathParam(\"vvol.uuid\", o.VvolUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (j *Jsonnet) DeleteParam(path []string) error {\n\t// TODO: make this work at the env level too\n\tparamsData, err := j.readParams(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tupdatedParams, err := params.DeleteFromObject(path, paramsData, j.Name(false), paramsComponentRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = j.writeParams(updatedParams); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (w *Writer) SetUUID(u uuid.UUID) {\n\tcopy(w.blk[uuidStart:uuidEnd], u[:])\n\tcopy(w.blk[uuidCopyStart:uuidCopyEnd], u[:])\n}", "func (a *Client) DeleteContainersUUID(params *DeleteContainersUUIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteContainersUUIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteContainersUUIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteContainersUUID\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/containers/{uuid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteContainersUUIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteContainersUUIDOK), nil\n\n}", "func (op *OnPrem) DeleteVolume(ctx *lepton.Context, name string) error {\n\tquery := map[string]string{\n\t\t\"label\": name,\n\t\t\"id\": name,\n\t}\n\n\tbuildDir := ctx.Config().VolumesDir\n\tvolumes, err := GetVolumes(buildDir, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(volumes) == 1 {\n\t\tvolumePath := path.Join(volumes[0].Path)\n\t\terr := os.Remove(volumePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *PostDockerRegistriesUUIDSearchListParams) SetUUID(uuid string) {\n\to.UUID = uuid\n}", "func (_BaseAccessWallet *BaseAccessWalletTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (o FioSpecVolumeVolumeSourceFlockerPtrOutput) DatasetUUID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceFlocker) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DatasetUUID\n\t}).(pulumi.StringPtrOutput)\n}", "func (p *Processor) DeleteTag(account keppel.Account, repo keppel.Repository, tagName string, actx keppel.AuditContext) error {\n\tdigestStr, err := p.db.SelectStr(\n\t\t`DELETE FROM tags WHERE repo_id = $1 AND name = $2 RETURNING digest`,\n\t\trepo.ID, tagName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif digestStr == \"\" {\n\t\treturn sql.ErrNoRows\n\t}\n\n\ttagDigest, err := digest.Parse(digestStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif userInfo := actx.UserIdentity.UserInfo(); userInfo != nil {\n\t\tp.auditor.Record(audittools.EventParameters{\n\t\t\tTime: p.timeNow(),\n\t\t\tRequest: actx.Request,\n\t\t\tUser: userInfo,\n\t\t\tReasonCode: http.StatusOK,\n\t\t\tAction: cadf.DeleteAction,\n\t\t\tTarget: auditTag{\n\t\t\t\tAccount: account,\n\t\t\t\tRepository: repo,\n\t\t\t\tDigest: tagDigest,\n\t\t\t\tTagName: tagName,\n\t\t\t},\n\t\t})\n\t}\n\n\treturn nil\n}", "func (c *MockBlockStorageClient) DeleteVolume(ctx context.Context, id string) error {\n\treturn nil\n}", "func (c *MockBlockStorageClient) DeleteVolume(ctx context.Context, id string) error {\n\treturn nil\n}", "func (e *EPub) SetUUID(uu string) error {\n\tu, err := uuid.FromString(uu)\n\tif err != nil {\n\t\treturn err\n\t}\n\te.uuid = \"urn:uuid:\" + u.String()\n\tlog.Printf(\"Setting uuid, theoretically %q\", e.uuid)\n\tfor i, m := range e.metadata {\n\t\tif m.kind == \"dc:identifier\" {\n\t\t\tlog.Printf(\"Set id to %q\", e.uuid)\n\t\t\te.metadata[i].value = e.uuid\n\t\t}\n\t}\n\treturn nil\n}", "func (o *PortsetCollectionGetParams) SetSvmUUID(svmUUID *string) {\n\to.SvmUUID = svmUUID\n}", "func SetFakeUUID(fake string) {\n\tfakeUUID = fake\n}", "func (client IdentityClient) deleteTag(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/tagNamespaces/{tagNamespaceId}/tags/{tagName}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteTagResponse\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 (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\tif len(req.GetVolumeId()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID missing in request\")\n\t}\n\n\tif err := d.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid delete volume req: %v\", req)\n\t}\n\n\tvolumeID := req.VolumeId\n\tresourceGroupName, accountName, containerName, err := getContainerInfo(volumeID)\n\tif err != nil {\n\t\tklog.Errorf(\"getContainerInfo(%s) in DeleteVolume failed with error: %v\", volumeID, err)\n\t\treturn &csi.DeleteVolumeResponse{}, nil\n\t}\n\n\tif resourceGroupName == \"\" {\n\t\tresourceGroupName = d.cloud.ResourceGroup\n\t}\n\n\taccountKey, err := d.cloud.GetStorageAccesskey(accountName, resourceGroupName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"no key for storage account(%s) under resource group(%s), err %v\", accountName, resourceGroupName, err)\n\t}\n\n\tklog.V(2).Infof(\"deleting container(%s) rg(%s) account(%s) volumeID(%s)\", containerName, resourceGroupName, accountName, volumeID)\n\tclient, err := azstorage.NewBasicClientOnSovereignCloud(accountName, accountKey, d.cloud.Environment)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tblobClient := client.GetBlobService()\n\tcontainer := blobClient.GetContainerReference(containerName)\n\t// todo: check what value to add into DeleteContainerOptions\n\terr = wait.ExponentialBackoff(d.cloud.RequestBackoff(), func() (bool, error) {\n\t\t_, err := container.DeleteIfExists(nil)\n\t\tif err != nil && !strings.Contains(err.Error(), \"ContainerBeingDeleted\") {\n\t\t\treturn false, fmt.Errorf(\"failed to delete container(%s) on account(%s), error: %v\", containerName, accountName, err)\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tklog.V(2).Infof(\"container(%s) under rg(%s) account(%s) volumeID(%s) is deleted successfully\", containerName, resourceGroupName, accountName, volumeID)\n\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func UUID(v string) predicate.Agent {\n\treturn predicate.Agent(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUUID), v))\n\t})\n}", "func (oo *OmciCC) SendDeleteVtfd(ctx context.Context, timeout int, highPrio bool,\n\trxChan chan Message, aInstID uint16) (*me.ManagedEntity, error) {\n\ttid := oo.GetNextTid(highPrio)\n\tlogger.Debugw(ctx, \"send VTFD-Delete-msg:\", log.Fields{\"device-id\": oo.deviceID,\n\t\t\"SequNo\": strconv.FormatInt(int64(tid), 16),\n\t\t\"InstId\": strconv.FormatInt(int64(aInstID), 16)})\n\n\tmeParams := me.ParamData{EntityID: aInstID}\n\tmeInstance, omciErr := me.NewVlanTaggingFilterData(meParams)\n\tif omciErr.GetError() == nil {\n\t\tomciLayer, msgLayer, err := oframe.EncodeFrame(meInstance, omci.DeleteRequestType,\n\t\t\toframe.TransactionID(tid))\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot encode VTFD for delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\t//TODO!!: refactoring improvement requested, here as an example for [VOL-3457]:\n\t\t\t// return (dual format) error code that can be used at caller for immediate error treatment\n\t\t\t// (relevant to all used sendXX() methods and their error conditions)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpkt, err := SerializeOmciLayer(ctx, omciLayer, msgLayer)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot serialize VTFD delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\n\t\tomciRxCallbackPair := CallbackPair{\n\t\t\tCbKey: tid,\n\t\t\tCbEntry: CallbackPairEntry{rxChan, oo.receiveOmciResponse, true},\n\t\t}\n\t\terr = oo.Send(ctx, pkt, timeout, CDefaultRetries, highPrio, omciRxCallbackPair)\n\t\tif err != nil {\n\t\t\tlogger.Errorw(ctx, \"Cannot send VTFD delete\", log.Fields{\n\t\t\t\t\"Err\": err, \"device-id\": oo.deviceID})\n\t\t\treturn nil, err\n\t\t}\n\t\tlogger.Debug(ctx, \"send VTFD-Delete-msg done\")\n\t\treturn meInstance, nil\n\t}\n\tlogger.Errorw(ctx, \"Cannot generate VTFD Instance for delete\", log.Fields{\n\t\t\"Err\": omciErr.GetError(), \"device-id\": oo.deviceID})\n\treturn nil, omciErr.GetError()\n}", "func (p *PersistentVolume) Delete(name string) error {\n\tvar b bytes.Buffer\n\tpath := strutil.Concat(\"/api/v1/persistentvolumes/\", name)\n\n\tresp, err := p.client.Delete(p.addr).\n\t\tPath(path).\n\t\tDo().\n\t\tBody(&b)\n\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to delete pv, name: %s, (%v)\", name, err)\n\t}\n\tif !resp.IsOK() {\n\t\tif resp.IsNotfound() {\n\t\t\treturn k8serror.ErrNotFound\n\t\t}\n\n\t\treturn errors.Errorf(\"failed to delete pv, name: %s, statuscode: %v, body: %v\",\n\t\t\tname, resp.StatusCode(), b.String())\n\t}\n\treturn nil\n}", "func (o IopingSpecVolumeVolumeSourceFlockerPtrOutput) DatasetUUID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceFlocker) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DatasetUUID\n\t}).(pulumi.StringPtrOutput)\n}", "func (upvc *UnsavedPostVideoCreate) SetUUID(s string) *UnsavedPostVideoCreate {\n\tupvc.mutation.SetUUID(s)\n\treturn upvc\n}", "func (d *Dao) DeleteRepoTag(c context.Context, repoName, tagName string) (err error) {\n\tvar req *http.Request\n\n\thost := d.c.BiliHub.Host + _repositoryURI + \"/%s/tags/%s\"\n\turl := fmt.Sprintf(host, repoName, tagName)\n\n\tif req, err = d.newRequest(http.MethodDelete, url, nil); err != nil {\n\t\treturn\n\t}\n\n\treq.SetBasicAuth(d.c.BiliHub.Username, d.c.BiliHub.Password)\n\n\tif err = d.httpClient.Do(c, req, nil); err != nil {\n\t\tlog.Error(\"d.DeleteRepoTag url(%s) err(%v)\", url, err)\n\t\terr = ecode.MerlinHubRequestErr\n\t}\n\n\treturn\n}", "func (o *QtreeCollectionGetParams) SetSvmUUID(svmUUID *string) {\n\to.SvmUUID = svmUUID\n}", "func DeleteVault(c *gin.Context) {\n\tdbmap := c.MustGet(\"DBmap\").(*gorp.DbMap)\n\tid := c.Params.ByName(\"id\")\n\n\tvar vault Vault\n\terr := dbmap.SelectOne(&vault, \"SELECT * FROM vault WHERE id=?\", id)\n\n\tif err == nil {\n\t\t_, err = dbmap.Delete(&vault)\n\n\t\tif err == nil {\n\t\t\tc.JSON(200, gin.H{\"id #\" + id: \"deleted\"})\n\t\t} else {\n\t\t\tcheckErr(err, \"Delete failed\")\n\t\t}\n\n\t} else {\n\t\tc.JSON(404, gin.H{\"error\": \"vault not found\"})\n\t}\n\n\t// curl -i -X DELETE http://localhost:8080/api/v1/vaults/1\n}", "func (s *Systems) DeleteVolume(ctx context.Context, req *systemsproto.VolumeRequest) (*systemsproto.SystemsResponse, error) {\n\tvar resp systemsproto.SystemsResponse\n\tsessionToken := req.SessionToken\n\tauthResp := s.IsAuthorizedRPC(sessionToken, []string{common.PrivilegeConfigureComponents}, []string{})\n\tif authResp.StatusCode != http.StatusOK {\n\t\tlog.Error(\"error while trying to authenticate session\")\n\t\tfillSystemProtoResponse(&resp, authResp)\n\t\treturn &resp, nil\n\t}\n\n\tdata := s.EI.DeleteVolume(req)\n\tfillSystemProtoResponse(&resp, data)\n\treturn &resp, nil\n}" ]
[ "0.6738907", "0.5607763", "0.53754246", "0.5191161", "0.5182265", "0.5169527", "0.5094504", "0.5089154", "0.50468004", "0.50332665", "0.5024225", "0.49893975", "0.4986372", "0.49672964", "0.4869989", "0.48687732", "0.48615307", "0.48320144", "0.47920194", "0.47809136", "0.47408715", "0.47321913", "0.47061163", "0.46920976", "0.4689291", "0.46650076", "0.46585023", "0.46327338", "0.462813", "0.46165472", "0.46143618", "0.46082217", "0.45581496", "0.4554866", "0.45445102", "0.45394814", "0.4535565", "0.45325282", "0.45267585", "0.45230505", "0.4508843", "0.44699398", "0.44681975", "0.4467712", "0.44654074", "0.44593325", "0.44538587", "0.44439238", "0.44421822", "0.4439007", "0.44307268", "0.44284594", "0.442497", "0.4423856", "0.44164398", "0.44124225", "0.44109768", "0.44089714", "0.4395983", "0.43940213", "0.43932435", "0.43922845", "0.43815994", "0.43806714", "0.43794233", "0.43705136", "0.43685287", "0.43563467", "0.43511784", "0.43418878", "0.43404475", "0.43364954", "0.43332985", "0.433188", "0.43308693", "0.43275973", "0.43124834", "0.43106756", "0.43030894", "0.42766714", "0.4269725", "0.42693302", "0.4266628", "0.4263774", "0.42630836", "0.42630836", "0.4259835", "0.4259233", "0.42549476", "0.42482895", "0.42419317", "0.42404357", "0.42397675", "0.42396793", "0.42395633", "0.4230643", "0.42260394", "0.42256835", "0.42220747", "0.42203623" ]
0.7143403
0
SessionKey returns the most recent sessionKey in MemStore.
SessionKey возвращает самый последний sessionKey в MemStore.
func (ms *MemStore) SessionKey() string { return ms.sessionKey }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *Account) SessionKey() *big.Int {\n\tif a.sessionKey == nil {\n\t\ta.sessionKey, _ = new(big.Int).SetString(a.SessionKeyStr, 16)\n\t}\n\n\treturn a.sessionKey\n}", "func (session *Session) GetSessionKey() string {\n\treturn session.id.String()\n}", "func SessionStoreKey() string {\n\treturn app.SessionStoreKey\n}", "func (st *MemSessionStore) SessionID() string {\n\treturn (*session.MemSessionStore)(st).SessionID(context.Background())\n}", "func (s *session) getKey() string {\n\treturn s.uuid\n}", "func (st *MemSessionStore) SessionID() string {\n\treturn st.sid\n}", "func (dh *DiffieHelman) SessionKey() ([sha256.Size]byte, error) {\n\tif dh.B == big.NewInt(0) {\n\t\tvar k [sha256.Size]byte\n\t\treturn k, errors.New(\"no second public key available\")\n\t}\n\n\tsessionKey := big.NewInt(0)\n\t// Having your secret set to -1 means your public key is just 0.\n\t// (This is not a mathematical fact; we've just used -1 as a beacon here.)\n\tif dh.a.Cmp(big.NewInt(-1)) != 0 {\n\t\tsessionKey = big.NewInt(0).Exp(dh.B, dh.a, dh.p)\n\t}\n\n\tsessionKeyBytes := sessionKey.Bytes()\n\n\treturn sha256.Sum256(sessionKeyBytes), nil\n}", "func SessionID() int64 { return time.Now().UnixNano() }", "func (st *MemSessionStore) Get(key interface{}) interface{} {\n\treturn (*session.MemSessionStore)(st).Get(context.Background(), key)\n}", "func (c *chat) key() int64 {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\t// generates new possible key value\n\tvar key = time.Now().UnixNano()\n\n\t// generated key become actual if the previous key is absent\n\tif c.prev == 0 {\n\t\tc.prev = key\n\t\t// returns actual key\n\t\treturn c.prev\n\t}\n\n\t// calculates minimum next possible key value\n\tc.prev = c.prev + c.latency\n\n\t// generated key become actual if generated key greater than the minimum possible key\n\tif key > c.prev {\n\t\tc.prev = key\n\t}\n\n\t// returns actual key\n\treturn c.prev\n}", "func (stateID StateID) Key() string {\n\treturn string(stateID.LastAppHash)\n}", "func (ms *MemStore) GetSessionKey(hash string) (\n\tjson, privKey string,\n\terr error,\n) {\n\tsk, ok := ms.sessionKeys[hash]\n\tif !ok {\n\t\treturn \"\", \"\", log.Error(session.ErrNoKeyEntry)\n\t}\n\treturn sk.json, sk.privKey, nil\n}", "func (cache *LRUCache) GetMostRecentKey() (string, bool) {\n\tif len(cache.hash) == 0 {\n\t\treturn \"\", false\n\t}\n\n\treturn cache.curr.key, true\n}", "func (s *Store) GetSessionID() []byte {\n\treturn s.sessionID\n}", "func (ms memstore) Get(key string) Sessiondata {\n\tvar (\n\t\tn, e time.Time\n\t)\n\tms.lock.RLock()\n\tif v, ok := ms.store[key]; ok {\n\t\tms.lock.RUnlock()\n\t\tn = time.Now()\n\t\te = v[expiresTS].(time.Time)\n\t\t// timeout\n\t\tif n.After(e) {\n\t\t\tms.lock.Lock()\n\t\t\tdelete(ms.store, key)\n\t\t\tms.lock.Unlock()\n\t\t\treturn nil\n\t\t}\n\t\treturn v\n\t}\n\tms.lock.RUnlock()\n\treturn nil\n}", "func (ms *MemStore) GetMessageKey(\n\tsessionKey string,\n\tsender bool,\n\tmsgIndex uint64,\n) (*[64]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\tif msgIndex >= uint64(len(s.send)) {\n\t\treturn nil, log.Error(\"memstore: message index out of bounds\")\n\t}\n\tvar key string\n\tvar party string\n\tif sender {\n\t\tkey = s.send[msgIndex]\n\t\tparty = \"sender\"\n\t} else {\n\t\tkey = s.recv[msgIndex]\n\t\tparty = \"recipient\"\n\t}\n\t// make sure key wasn't used yet\n\tif key == \"\" {\n\t\treturn nil, log.Error(session.ErrMessageKeyUsed)\n\t}\n\t// decode key\n\tvar messageKey [64]byte\n\tk, err := base64.Decode(key)\n\tif err != nil {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: cannot decode %s key for %s\", party,\n\t\t\t\tsessionKey)\n\t}\n\tif copy(messageKey[:], k) != 64 {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: %s key for %s has wrong length\", party,\n\t\t\t\tsessionKey)\n\t}\n\treturn &messageKey, nil\n}", "func (st *SessionStoreMySQL) SessionID() string {\n\treturn st.sid\n}", "func (cache *LRUCache) GetMostRecentKey() (string, bool) {\n\tif cache.listofMostRecent.head == nil {\n\t\treturn \"\", false\n\t}\n\treturn cache.listofMostRecent.head.key, true\n}", "func (m *MemoryStorer) Get(key string) (value string, err error) {\n\tm.mut.RLock()\n\tsession, ok := m.sessions[key]\n\tm.mut.RUnlock()\n\tif !ok {\n\t\treturn \"\", errNoSession{}\n\t}\n\n\treturn session.value, nil\n}", "func (c *Client) SessionKey() []byte {\n\treturn c.sessionSecret\n}", "func getSessionTicketKey() [32]byte {\n\tvar key [32]byte\n\tkeySlice, err := ioutil.ReadFile(\"session_ticket_key\")\n\tif err != nil {\n\t\tkeySlice = make([]byte, 32)\n\t\tn, err := rand.Read(keySlice)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Unable to generate session ticket key: %v\", err)\n\t\t\treturn key\n\t\t}\n\t\tif n != 32 {\n\t\t\tlog.Errorf(\"Generated unexpected length of random data %d\", n)\n\t\t\treturn key\n\t\t}\n\t\terr = ioutil.WriteFile(\"session_ticket_key\", keySlice, 0600)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Unable to save session_ticket_key: %v\", err)\n\t\t} else {\n\t\t\tlog.Debug(\"Saved new session_ticket_key\")\n\t\t}\n\t}\n\tcopy(key[:], keySlice)\n\treturn key\n}", "func (st *MemSessionStore) Get(key interface{}) interface{} {\n\tst.lock.RLock()\n\tdefer st.lock.RUnlock()\n\tif v, ok := st.value[key]; ok {\n\t\treturn v\n\t}\n\treturn nil\n}", "func (s *streamKey) lastID() string {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\treturn s.lastIDUnlocked()\n}", "func (ms *MemStore) GetRootKeyHash(sessionKey string) (*[64]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\t// decode root key hash\n\tvar hash [64]byte\n\tk, err := base64.Decode(s.rootKeyHash)\n\tif err != nil {\n\t\treturn nil, log.Error(\"memstore: cannot decode root key hash\")\n\t}\n\tif copy(hash[:], k) != 64 {\n\t\treturn nil, log.Errorf(\"memstore: root key hash has wrong length\")\n\t}\n\treturn &hash, nil\n}", "func (ms *MemStore) GetChainKey(sessionKey string) (*[32]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\t// decode chain key\n\tvar key [32]byte\n\tk, err := base64.Decode(s.chainKey)\n\tif err != nil {\n\t\treturn nil, log.Error(\"memstore: cannot decode chain key\")\n\t}\n\tif copy(key[:], k) != 32 {\n\t\treturn nil, log.Errorf(\"memstore: chain key has wrong length\")\n\t}\n\treturn &key, nil\n}", "func GenerateSessionKey() (string, error) {\n\tkey := make([]byte, 64)\n\n\t_, err := rand.Read(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(key), nil\n}", "func (sid SessionID) getRedisKey() string {\n\t//convert the SessionID to a string and add the prefix \"sid:\" to keep\n\t//SessionID keys separate from other keys that might end up in this\n\t//redis instance\n\treturn \"sid:\" + sid.String()\n}", "func (s *MemorySession) SessionID() string {\n\treturn s.sid\n}", "func (s *inMemorySessionStore) Get(id string) *USSDSession {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\te := s.store[id]\n\tif e != nil {\n\t\ts.gcList.MoveToFront(e)\n\t\tif session, ok := e.Value.(*USSDSession); ok {\n\t\t\treturn session\n\t\t} else {\n\t\t\tpanic(\"Data Store corrupted: non-string key value in garbage collector\")\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "func (m *RedisStore) Get(key interface{}) interface{} {\n\tm.lock.RLock()\n\tdefer m.lock.RUnlock()\n\tif v, ok := m.sessionData[key]; ok {\n\t\treturn v\n\t}\n\treturn nil\n}", "func GenerateSessionKey(user_name string, j aqua.Aide) (token string, err error) {\n\tvar (\n\t\tConn *gorm.DB\n\t\t//token string\n\t\tsessionData []interface{}\n\t)\n\tif Conn, err = dbConn(); err == nil {\n\t\tif token, err = crypt.GenerateRandomString(32); err == nil {\n\t\t\texp_time := time.Now().Add(time.Minute * 30)\n\t\t\tinsertSession := `insert into user_session (\n\t\t\tsession_key, fk_user_name,\n\t\t\tlocation, expiry_time) values(?, ?, ?, ? )`\n\t\t\tsessionData = append(sessionData, token, user_name, \"bengaluru\", exp_time)\n\t\t\tif err = Conn.Debug().Exec(insertSession, sessionData...).Error; err == nil {\n\t\t\t\tj.Response.Header().Add(\"session-key\", token)\n\t\t\t\tj.Response.Header().Add(\"connection\", \"keep-alive\")\n\t\t\t\tfmt.Println(\"err\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"session not generated\")\n\t\t}\n\t} else {\n\t\tfmt.Println(\"connection not established\")\n\t}\n\treturn\n}", "func (m *SessionManager) Get(key string) (session Session) {\n\tstmt := Sessions.Select().Where(Sessions.C(\"key\").Equals(key))\n\tm.conn.Query(stmt, &session)\n\treturn\n}", "func (c *conn) Key() string {\n\t// We don't need to lock because the key never changes after creation\n\treturn c.key.String()\n}", "func (s *SessionStore) Get(key interface{}) interface{} {\n\treturn s.session.Values[key]\n}", "func SessionByKey(key string) *Session {\n\tvar data member.SessionData\n\tif scol.Find(bson.M{\"key\": key}).One(&data) != nil {\n\t\treturn nil\n\t}\n\treturn &Session{data: &data}\n}", "func (iter *dbCacheIterator) Key() []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.Key()\n}", "func (rs *Store) SessionID(ctx context.Context) string {\n\treturn rs.sid\n}", "func (mci *XMCacheIterator) Key() []byte {\n\tif mci.err != nil || mci.dir == dirReleased {\n\t\treturn nil\n\t}\n\tswitch mci.index {\n\tcase 0, 1:\n\t\treturn mci.iters[mci.index].Key()\n\tcase 2:\n\t\tif mci.mc.isPenetrate {\n\t\t\treturn mci.mIter.Key()\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (m *KeyUint) Key() driver.Value { return driver.Value(m.ID) }", "func (sess Session) Get(key string) string {\n\treturn sess[key]\n}", "func clientSessionCacheKey(config *tls.Config) string {\n\treturn config.ServerName\n}", "func (ctx *Context) Session(key interface{}) interface{} {\r\n\treturn ctx.CruSession.Get(key)\r\n}", "func (p *Provider) SessionID() string {\n\tp.sessionLock.RLock()\n\tdefer p.sessionLock.RUnlock()\n\treturn p.sessionID\n}", "func (_Univ2 *Univ2Session) KLast() (*big.Int, error) {\n\treturn _Univ2.Contract.KLast(&_Univ2.CallOpts)\n}", "func (input *BeegoInput) Session(key interface{}) interface{} {\n\treturn input.CruSession.Get(nil, key)\n}", "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "func (ms *MemStore) GetSessionState(sessionStateKey string) (\n\t*session.State,\n\terror,\n) {\n\treturn ms.sessionStates[sessionStateKey], nil\n}", "func (it *Iter) Key() byte { return it.top().key }", "func (m *RegistryKeyState) GetKey()(*string) {\n return m.key\n}", "func (xmlmc *XmlmcInstStruct) GetSessionID() string {\n\treturn xmlmc.sessionID\n}", "func GetSessionToken (strOID string) (string) {\n\thasher := sha256.New()\n\thasher.Write([]byte(strOID + time.Now().String()))\n\treturn EncodeSegment(hasher.Sum(nil))\n}", "func GetStoreIdentKey() []byte {\n\treturn storeIdentKey\n}", "func (self *Store) NextPk() []byte {\n\tself.mu.Lock()\n\tself.mu.Unlock()\n\treturn nil\n}", "func (image *image) SessionID() int32 {\n\treturn image.sessionID\n}", "func (c *client) getSessionId() string {\n\tc.acquireWriter()\n\tdefer c.releaseWriter()\n\treturn c.sessId\n}", "func (_Univ2 *Univ2CallerSession) KLast() (*big.Int, error) {\n\treturn _Univ2.Contract.KLast(&_Univ2.CallOpts)\n}", "func Get(redisdb *redis.Client, sessionID, key string) (string, error) {\n\n\tvalue, err := redisdb.HGet(sessionID, key).Result()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to read %s from session: %s\", key, err.Error())\n\t}\n\n\treturn value, nil\n}", "func (c *FakeZkConn) SessionID() int64 {\n\tc.history.addToHistory(\"SessionID\")\n\treturn int64(0)\n}", "func (c *Container) Key() string {\n\tc.Lock()\n\tdefer c.Unlock()\n\treturn c.ID\n}", "func SessionID(ctx *context.Context) *string {\n\tsessionID := (*ctx).Value(KeySessionID)\n\tif sessionID != nil {\n\t\tv := sessionID.(string)\n\t\treturn &v\n\t}\n\treturn nil\n}", "func (m *MemAdmin) Key(_ string) (key string, err error) {\n\treturn m.key, nil\n}", "func (itr *Iterator) Key() []byte {\n\treturn retrieveAppKey(itr.Iterator.Key())\n}", "func SessionId() string {\n\tid := RandString(32)\n\t//TODO; this isnt \n\treturn id\n}", "func (u User) Key() interface{} {\n\treturn u.ID\n}", "func (entry *LogEntry) GetKey() []byte {\n\treturn entry.getWriteRequest().GetKey()\n}", "func (pder *MemSessionProvider) GetSession(sid string) (Session, error) {\r\n\tpder.lock.RLock()\r\n\tdefer pder.lock.RUnlock()\r\n\r\n\tif element, ok := pder.sessions[sid]; ok {\r\n\t\tsw := element.Value.(Session)\r\n\t\tif sw == nil {\r\n\t\t\treturn nil, nil\r\n\t\t}\r\n\t\tattributes := sw.Attributes().(*MemSessionAttributes)\r\n\t\tif attributes != nil {\r\n\t\t\tattributes.timeAccessed = time.Now()\r\n\t\t}\r\n\t\treturn sw, nil\r\n\t} else {\r\n\t\treturn nil, nil\r\n\t}\r\n}", "func (s UserSet) ComputeSessionToken(sid string) string {\n\tres := s.Collection().Call(\"ComputeSessionToken\", sid)\n\tresTyped, _ := res.(string)\n\treturn resTyped\n}", "func (m *MacOSSoftwareUpdateStateSummary) GetProductKey()(*string) {\n val, err := m.GetBackingStore().Get(\"productKey\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (c *Counter) GetKey() string {\n\treturn c.key\n}", "func (c Node) GetKey() string {\n\treturn c.key\n}", "func getSessionID(appPath string) (string, error) {\n\tsettings, err := readDevelopmentSettings(appPath)\n\n\tif err != nil {\n\t\tsettings, err = getDefaultDevelopmentSettings()\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"Couldn't create new development settings.\")\n\t\t\treturn \"\", err\n\t\t}\n\n\t\terr = writeDevelopmentSettings(appPath, settings)\n\n\t\tif err != nil {\n\t\t\tlog.Println(\"Could not save new development settings file.\")\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn settings.SessionID, nil\n}", "func (store *SessionCookieStore) Save(sess Session) (key string, err error) {\n\tbuf := bufPool.Get().(*bytes.Buffer)\n\tdefer func() {\n\t\tbuf.Reset()\n\t\tbufPool.Put(buf)\n\t}()\n\tif err := codec.NewEncoder(buf, codecHandler).Encode(sess); err != nil {\n\t\treturn \"\", err\n\t}\n\tencrypted, err := store.encrypt(buf.Bytes())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn store.encode(store.sign(encrypted)), nil\n}", "func (f *Factor) Key() string { return f.ID }", "func (symmetricKey *SymmetricKey) GetKey() []byte {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.SymmetricKey\n}", "func (s *State) RootKey() session.RootKeyable {\n\treturn s.rootKey\n}", "func (s *Store) Get(clientID string) (*entities.Session, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.sess[clientID], nil\n}", "func (st *RedBlackBST) Max() Key {\n\tif st.IsEmpty() {\n\t\tpanic(\"call Max on empty RedBlackbst\")\n\t}\n\treturn st.max(st.root).key\n}", "func Next() int64 {\n\tkeygen.Lock()\n\tkey := keygen.random.Int63()\n\tkeygen.Unlock()\n\treturn key\n}", "func getSessionByKey(key string) *user.SessionState {\n\t// here goes our logic to check if passed API key is valid and appropriate key session can be retrieved\n\n\t// perform auth (only one token \"abc\" is allowed)\n\t// Here you add code to query your database\n\tif key != \"abc\" {\n\t\treturn nil\n\t}\n\n\t// return session\n\treturn &user.SessionState{\n\t\tOrgID: \"default\",\n\t\tAlias: \"abc-session\",\n\t}\n}", "func (m *MemoryCache) Get(id string) (*Session, error) {\n\tm.mx.RLock()\n\ts, ok := m.store[id]\n\tif !ok {\n\t\tm.mx.RUnlock()\n\t\treturn nil, ErrNotFound\n\t}\n\tif !s.Valid() {\n\t\t// We have to upgrade the lock. There's no harm in a yield between.\n\t\tm.mx.RUnlock()\n\t\tm.mx.Lock()\n\t\tdelete(m.store, id)\n\t\tm.mx.Unlock()\n\t\treturn nil, ErrExpired\n\t}\n\tm.mx.RUnlock()\n\treturn s, nil\n}", "func (i *TelemetryStorage) GetSessionLength() int64 {\n\treturn atomic.LoadInt64(&i.records.session)\n}", "func SessionID(ctx context.Context) string {\n\ts, ok := ctx.Value(sessionKey).(*Session)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn s.id\n}", "func (s *SessionTrackerV1) GetSessionID() string {\n\treturn s.Spec.SessionID\n}", "func (s *BoltState) GetExecSession(id string) (string, error) {\n\tif !s.valid {\n\t\treturn \"\", define.ErrDBClosed\n\t}\n\n\tif id == \"\" {\n\t\treturn \"\", define.ErrEmptyID\n\t}\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\tctrID := \"\"\n\terr = db.View(func(tx *bolt.Tx) error {\n\t\texecBucket, err := getExecBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tctr := execBucket.Get([]byte(id))\n\t\tif ctr == nil {\n\t\t\treturn fmt.Errorf(\"no exec session with ID %s found: %w\", id, define.ErrNoSuchExecSession)\n\t\t}\n\t\tctrID = string(ctr)\n\t\treturn nil\n\t})\n\treturn ctrID, err\n}", "func (s *Connection) GetKey() ConnectionName {\n\tif s == nil {\n\t\treturn \"\"\n\t}\n\treturn s.Key\n}", "func (ips *IPAMState) GetKey() string {\n\treturn ips.IPAMPolicy.GetKey()\n}", "func (s *RedisQueue) Key() string {\n\treturn s.key\n}", "func (symmetricKey *SymmetricKey) GetKeyID() string {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.KeyID\n}", "func (f binaryEqualsFunc) key() Key {\n\treturn f.k\n}", "func getTokenKey(userID interface{}) string {\n\treturn utils.RedisKey(\"TOKEN\", \"getToken\", userID)\n}", "func (st *State) Session(id string) *cache.Session {\n\tfor _, s := range st.Sessions() {\n\t\tif s.ID() == id {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}", "func (lmem *lockedMemRepo) Get(name string) (types.KeyInfo, error) {\n\tif err := lmem.checkToken(); err != nil {\n\t\treturn types.KeyInfo{}, err\n\t}\n\tlmem.RLock()\n\tdefer lmem.RUnlock()\n\n\tkey, ok := lmem.mem.keystore[name]\n\tif !ok {\n\t\treturn types.KeyInfo{}, xerrors.Errorf(\"getting key '%s': %w\", name, types.ErrKeyInfoNotFound)\n\t}\n\treturn key, nil\n}", "func (s *Store) getSessionID(c *fiber.Ctx) string {\n\tid := c.Cookies(s.sessionName)\n\tif len(id) > 0 {\n\t\treturn utils.CopyString(id)\n\t}\n\n\tif s.source == SourceHeader {\n\t\tid = string(c.Request().Header.Peek(s.sessionName))\n\t\tif len(id) > 0 {\n\t\t\treturn id\n\t\t}\n\t}\n\n\tif s.source == SourceURLQuery {\n\t\tid = c.Query(s.sessionName)\n\t\tif len(id) > 0 {\n\t\t\treturn utils.CopyString(id)\n\t\t}\n\t}\n\n\treturn \"\"\n}", "func (m *KeyValue) GetKey()(*string) {\n return m.key\n}", "func getSessionId() string {\n signByte := []byte(time.Now().String())\n hash := md5.New()\n hash.Write(signByte)\n return hex.EncodeToString(hash.Sum(nil))\n}", "func (s *MemorySession) Get(key string) (interface{}, error) {\n\tif value, ok := s.data[key]; ok {\n\t\treturn value, nil\n\t}\n\treturn nil, fmt.Errorf(\"key %q in session (id %s) not found\", key, s.sid)\n}", "func (st *MemStorage) GetKey(gun, role string) (algorithm string, public []byte, err error) {\n\t// no need for lock. It's ok to return nil if an update\n\t// wasn't observed\n\tg, ok := st.keys[gun]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\tk, ok := g[role]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\n\treturn k.algorithm, k.public, nil\n}", "func (nc *NetClient) SessionID() string {\n\treturn nc.Session.ID\n}", "func GetIterationKey(clientStore sdk.KVStore, height exported.Height) []byte {\n\tkey := IterationKey(height)\n\treturn clientStore.Get(key)\n}", "func KeySession(priv, pub []byte) (*Session, bool) {\n\tprivKey, err := public.UnmarshalPrivate(priv)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\tdefer privKey.Zero()\n\n\tpubKey, err := public.UnmarshalPublic(pub)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\n\tshared := public.KeyExchange(privKey, pubKey)\n\treturn &Session{shared: shared}, true\n}" ]
[ "0.66067576", "0.6544803", "0.6505307", "0.64512503", "0.6407087", "0.6332514", "0.62486035", "0.61219746", "0.606997", "0.6033466", "0.6021937", "0.6005555", "0.59739584", "0.5952178", "0.59406084", "0.593616", "0.5876714", "0.5831891", "0.58072", "0.5770329", "0.56571907", "0.5640494", "0.5622952", "0.56096035", "0.55640864", "0.554677", "0.5493878", "0.5479823", "0.5468491", "0.54653335", "0.54612416", "0.54611504", "0.5429929", "0.54177743", "0.5416482", "0.5413051", "0.5384917", "0.53732485", "0.53583336", "0.53528774", "0.5329778", "0.532653", "0.5324067", "0.5319978", "0.53119093", "0.53110176", "0.52975136", "0.5283552", "0.5277436", "0.52718574", "0.5266444", "0.5262129", "0.5256869", "0.5252625", "0.5251263", "0.5246236", "0.5245893", "0.52415687", "0.52373534", "0.52234715", "0.5208509", "0.5181885", "0.51798296", "0.51640314", "0.51573837", "0.51433694", "0.51349473", "0.51219714", "0.51204866", "0.511681", "0.51145774", "0.5112477", "0.51086146", "0.5095534", "0.5093477", "0.5082772", "0.508216", "0.50813895", "0.50804114", "0.50587595", "0.50581735", "0.50536615", "0.5053117", "0.5049288", "0.5045474", "0.50436026", "0.50418967", "0.50383866", "0.50370646", "0.5036403", "0.5033205", "0.50276923", "0.50244623", "0.502237", "0.50194174", "0.501511", "0.5012849", "0.50064045", "0.50029254", "0.50011146" ]
0.7522756
0
AddPrivateKeyEntry adds private KeyEntry to memory store.
AddPrivateKeyEntry добавляет private KeyEntry в хранилище в памяти.
func (ms *MemStore) AddPrivateKeyEntry(ke *uid.KeyEntry) { ms.privateKeyEntryMap[ke.HASH] = ke }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Service) AddPrivateKey(keyID string, privateKey crypto.PrivateKey) error {\n\tif _, ok := s.keys[keyID]; ok {\n\t\ts.log.Error(\"The specified key ID is already in use\", \"keyID\", keyID)\n\t\treturn signingkeys.ErrSigningKeyAlreadyExists.Errorf(\"The specified key ID is already in use: %s\", keyID)\n\t}\n\ts.keys[keyID] = privateKey.(crypto.Signer)\n\treturn nil\n}", "func (ks *KeyStore) Add(privateKey *rsa.PrivateKey, kid string) {\n\tks.mu.Lock()\n\tdefer ks.mu.Unlock()\n\n\tks.store[kid] = privateKey\n}", "func (keyDB *KeyDB) AddPrivateKeyInit(\n\tki *uid.KeyInit,\n\tpubKeyHash, sigPubKey, privateKey, serverSignature string,\n) error {\n\t_, err := keyDB.addPrivateKeyInitQuery.Exec(\n\t\tki.SigKeyHash(),\n\t\tpubKeyHash,\n\t\tki.JSON(),\n\t\tsigPubKey,\n\t\tprivateKey,\n\t\tserverSignature,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ms *MemStore) AddPublicKeyEntry(identity string, ke *uid.KeyEntry) {\n\tms.publicKeyEntryMap[identity] = ke\n}", "func (ms *MemStore) GetPrivateKeyEntry(pubKeyHash string) (*uid.KeyEntry, error) {\n\tke, ok := ms.privateKeyEntryMap[pubKeyHash]\n\tif !ok {\n\t\treturn nil, log.Error(session.ErrNoKeyEntry)\n\t}\n\treturn ke, nil\n}", "func (keyDB *KeyDB) AddPrivateUIDReply(\n\tmsg *uid.Message,\n\tmsgReply *uid.MessageReply,\n) error {\n\t_, err := keyDB.addPrivateUIDReplyQuery.Exec(msgReply.JSON(), msg.JSON())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (cache *Cache) AddEntry (path string) *FilePrint {\n ent, ok := cache.FilePrints[path]\n if ! ok {\n ent = new(FilePrint)\n ent.Local.Changed = true\n ent.Remote.Changed = true\n cache.FilePrints[path] = ent\n }\n return ent\n}", "func (o *TppCertificateParams) SetPrivateKey(v string) {\n\to.PrivateKey = v\n}", "func (r *extendedKeyring) Add(key agent.AddedKey) error {\n\t// Figure out what key type we're trying to inject\n\tswitch key.PrivateKey.(type) {\n\tcase *rsa.PrivateKey:\n\t\t// Load the injected key\n\t\tdata := &pem.Block{\n\t\t\tType: \"RSA PRIVATE KEY\",\n\t\t\tBytes: x509.MarshalPKCS1PrivateKey(key.PrivateKey.(*rsa.PrivateKey)),\n\t\t}\n\n\t\t// Ensure the key doesn't exist\n\t\tos.Remove(r.targetKeyLocation)\n\n\t\t// Write the key out to disk\n\t\tvar file, err = os.Create(r.targetKeyLocation)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"\\nssh_agent_download: Could not create key file\", err.Error())\n\t\t}\n\t\tdefer file.Close() // Ensure we close the file later\n\n\t\t// Secure before writing\n\t\t// Note: Technically someone could write in here before we do this\n\t\tos.Chmod(r.targetKeyLocation, 0400)\n\n\t\t// Dump the (un-encrypted) key into this file\n\t\tpem.Encode(file, data)\n\n\t\t// Let the keyboard monkey know\n\t\tfmt.Printf(\"ssh_agent_download: saved key to %s\\n\", r.targetKeyLocation)\n\n\t// Let the user know this won't work\n\tdefault:\n\t\tlog.Fatal(\"ssh_agent_download: unsupported key type %T\", key.PrivateKey)\n\t}\n\n\treturn nil\n}", "func (o *PipelineSshKeyPairAllOf) SetPrivateKey(v string) {\n\to.PrivateKey = &v\n}", "func (o SslCertificateSelfManagedSslCertificateOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificate) *string { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (wt *Wallet) ImportPrivateKey(scope waddrmgr.KeyScope, wif *utils.WIF) (string, error) {\n\n\tmanager, err := wt.Manager.FetchScopedKeyManager(scope)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Attempt to import private key into wallet.\n\tvar addr types.Address\n\terr = walletdb.Update(wt.db, func(tx walletdb.ReadWriteTx) error {\n\t\taddrMgrNs := tx.ReadWriteBucket(waddrmgrNamespaceKey)\n\t\tmaddr, err := manager.ImportPrivateKey(addrMgrNs, wif)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\taddr = maddr.Address()\n\t\t_, err = manager.AccountProperties(\n\t\t\taddrMgrNs, waddrmgr.ImportedAddrAccount,\n\t\t)\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 \"\", err\n\t}\n\taddrStr := addr.Encode()\n\tlog.Trace(\"ImportPrivateKey succ\", \"address\", addrStr)\n\n\t// Return the payment address string of the imported private key.\n\treturn addrStr, nil\n}", "func (a *Account) GetPrivateKey() crypto.PrivateKey { return a.key }", "func (kc *Keychain) Add(key *crypto.PublicKeySECP256K1R) {\n\taddr := key.Address()\n\tkc.Addrs.Add(addr)\n}", "func (ms *MemStore) AddSessionKey(\n\thash, json, privKey string,\n\tcleanupTime uint64,\n) error {\n\tms.sessionKeys[hash] = &sessionKey{\n\t\tjson: json,\n\t\tprivKey: privKey,\n\t\tcleanupTime: cleanupTime,\n\t}\n\treturn nil\n}", "func PrivateKeyFile(usage Usage, version scrypto.KeyVersion) string {\n\treturn fmt.Sprintf(\"%s-v%d.key\", usage, version)\n}", "func (o *SecurityCertificateCollectionGetParams) SetPrivateKey(privateKey *string) {\n\to.PrivateKey = privateKey\n}", "func createPrivateKey() {\n\tnewPrivateKey, err := rsa.GenerateKey(rand.Reader, KEY_BITS)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to generate private key: %s\", err)\n\t}\n\n\tprivateKey = newPrivateKey\n\tkeyOut, err := os.OpenFile(PrivateKeyFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to open %s for writing: %s\", PrivateKeyFile, err)\n\t}\n\tif err := pem.Encode(keyOut, &pem.Block{Type: PEM_HEADER_PRIVATE_KEY, Bytes: x509.MarshalPKCS1PrivateKey(privateKey)}); err != nil {\n\t\tlog.Fatalf(\"Unable to PEM encode private key: %s\", err)\n\t}\n\tkeyOut.Close()\n\tlog.Printf(\"Wrote private key to %s\", PrivateKeyFile)\n}", "func ExportPrivateKey(key *rsa.PrivateKey) []byte {\n\tkeyBytes := x509.MarshalPKCS1PrivateKey(key)\n\treturn pem.EncodeToMemory(\n\t\t&pem.Block{\n\t\t\tType: \"RSA PRIVATE KEY\",\n\t\t\tBytes: keyBytes,\n\t\t},\n\t)\n}", "func (d *DocsCrypto) ExportPrivate(out io.Writer) error {\n\td.Info(\"Exporting private key\")\n\tif err := pem.Encode(out, &pem.Block{\n\t\tType: \"PRIVATE KEY\",\n\t\tBytes: x509.MarshalPKCS1PrivateKey(d.GetPrivate()),\n\t}); err != nil {\n\t\td.Error(err)\n\t\treturn errExportPrivateKey\n\t}\n\treturn nil\n}", "func (c *FilesBuilder) AddKeyPair(ctx context.Context, name string,\n\tf func(context.Context, *cke.Node) (cert, key []byte, err error)) error {\n\tvar mu sync.Mutex\n\tcertMap := make(map[string][]byte)\n\tkeyMap := make(map[string][]byte)\n\n\tenv := well.NewEnvironment(ctx)\n\tfor _, n := range c.nodes {\n\t\tn := n\n\t\tenv.Go(func(ctx context.Context) error {\n\t\t\tcertData, keyData, err := f(ctx, n)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmu.Lock()\n\t\t\tcertMap[n.Address] = certData\n\t\t\tkeyMap[n.Address] = keyData\n\t\t\tmu.Unlock()\n\t\t\treturn nil\n\t\t})\n\t}\n\tenv.Stop()\n\terr := env.Wait()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.files = append(c.files, fileData{name + \".crt\", certMap})\n\tc.files = append(c.files, fileData{name + \".key\", keyMap})\n\treturn nil\n}", "func (znp *Znp) ZdoSecAddLinkKey(shortAddress string, extendedAddress string, key [16]uint8) (rsp *StatusResponse, err error) {\n\treq := &ZdoSecAddLinkKey{ShortAddress: shortAddress, ExtendedAddress: extendedAddress, Key: key}\n\terr = znp.ProcessRequest(unp.C_SREQ, unp.S_ZDO, 0x42, req, &rsp)\n\treturn\n}", "func (o SslCertificateSelfManagedSslCertificatePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificate) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (r *Report) addEntry(key string, suppressedKinds []string, kind string, context int, diffs []difflib.DiffRecord, changeType string) {\n\tentry := ReportEntry{\n\t\tkey,\n\t\tsuppressedKinds,\n\t\tkind,\n\t\tcontext,\n\t\tdiffs,\n\t\tchangeType,\n\t}\n\tr.entries = append(r.entries, entry)\n}", "func NewPrivateKey() PEMPrivateKeyLoaderInterface {\n\treturn &PrivateKey{\n\t\tpemDecoder: pemDecoder.NewPEMDecoder(),\n\t\tx509Parser: x509parser.Newx509Parser(),\n\t}\n}", "func (user *User) SetPrivateKey(privateKey *rsa.PrivateKey) {\n\tuser.privateKey = privateKey\n}", "func (keyDB *KeyDB) AddPrivateUID(msg *uid.Message) error {\n\t_, err := keyDB.addPrivateUIDQuery.Exec(\n\t\tmsg.UIDContent.IDENTITY,\n\t\tmsg.UIDContent.MSGCOUNT,\n\t\tmsg.JSON(),\n\t\tmsg.PrivateSigKey(),\n\t\tmsg.PrivateEncKey(),\n\t\t\"\",\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o SslCertificateSelfManagedSslCertificateResponsePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificateResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (o ProviderOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (w *Whisper) AddKeyPair(key *ecdsa.PrivateKey) (string, error) {\n\tid, err := GenerateRandomID()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to generate ID: %s\", err)\n\t}\n\n\tw.keyMu.Lock()\n\tw.privateKeys[id] = key\n\tw.keyMu.Unlock()\n\n\treturn id, nil\n}", "func ImportPrivateKeyFile(filename string) ([]byte, error) {\n\treturn indirectkeyfiles.MarshalPrivateKey([]byte(filename))\n}", "func (kp *KeyPool) AddVerifyKey(key *[ed25519.PublicKeySize]byte) {\n\tkp.mapMutex.Lock()\n\tdefer kp.mapMutex.Unlock()\n\tkp.VerifyPubKeys[*key] = true\n}", "func (grc *GitRemoteConfiguration) SetPrivateKey(privateKey *string) {\n\tgrc.PrivateKey = privateKey\n}", "func (a *Account) ImportPrivateKey(wif *btcutil.WIF, bs *keystore.BlockStamp,\n\trescan bool) (string, error) {\n\n\t// Attempt to import private key into wallet.\n\taddr, err := a.KeyStore.ImportPrivateKey(wif, bs)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Immediately write wallet to disk.\n\tAcctMgr.ds.ScheduleWalletWrite(a)\n\tif err := AcctMgr.ds.FlushAccount(a); err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot write account: %v\", err)\n\t}\n\n\taddrStr := addr.EncodeAddress()\n\n\t// Rescan blockchain for transactions with txout scripts paying to the\n\t// imported address.\n\tif rescan {\n\t\taddrs := []btcutil.Address{addr}\n\t\tjob := &RescanJob{\n\t\t\tAddresses: map[*Account][]btcutil.Address{a: addrs},\n\t\t\tOutPoints: nil,\n\t\t\tStartHeight: 0,\n\t\t}\n\n\t\t// Submit rescan job and log when the import has completed.\n\t\t// Do not block on finishing the rescan.\n\t\tdoneChan := AcctMgr.rm.SubmitJob(job)\n\t\tgo func() {\n\t\t\t<-doneChan\n\t\t\tlog.Infof(\"Finished import for address %s\", addrStr)\n\t\t}()\n\t}\n\n\t// Associate the imported address with this account.\n\tAcctMgr.MarkAddressForAccount(addr, a)\n\n\tlog.Infof(\"Imported payment address %s\", addrStr)\n\n\t// Return the payment address string of the imported private key.\n\treturn addrStr, nil\n}", "func (s *LunaKeyStore) AddKey(keyInfo trustmanager.KeyInfo, privKey data.PrivateKey) error {\n\n\tvar (\n\t\tecdsaPublicKey *data.ECDSAPublicKey\n\t\trsaPublicKey *data.RSAPublicKey\n\t\terr error\n\t)\n\n\tlogrus.Debugf(\"LunaKeyStore.AddKey\")\n\n\trole := keyInfo.Role\n\n\tgeneratateRootKeyOnly := strings.ToLower(os.Getenv(\"NOTARY_LUNA_GENERATE_ROOT_KEYS_ONLY\")) == \"true\"\n\n\tif generatateRootKeyOnly && role != data.CanonicalRootRole {\n\t\treturn errors.New(\"Can only generate root keys in generate root keys only mode.\")\n\t}\n\n\talg := privKey.Algorithm()\n\n\tif alg == data.ECDSAKey {\n\t\tecdsaPublicKey, err = getECDSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting ECDSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else if alg == data.RSAKey {\n\t\trsaPublicKey, err = getRSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting RSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn errors.New(\"Invalid key type.\")\n\t}\n\n\tp, session, c, err := SetupLuna(true, s.passRetriever)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer CleanupLuna(p, session, c)\n\tgun := keyInfo.Gun\n\n\tif alg == data.ECDSAKey {\n\t\tlunaPrivateKey, err := generateECDSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t//Store the public key value for the generated key in the public key for the added key.\n\t\tlunaECDSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.ECDSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\tecdsaPublicKey.Value = lunaECDSAPublicKey.Value\n\t\tecdsaPublicKey.ResetID()\n\t} else if alg == data.RSAKey {\n\t\tlunaPrivateKey, err := generateRSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlunaRSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.RSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\trsaPublicKey.Value = lunaRSAPublicKey.Value\n\t\trsaPublicKey.ResetID()\n\t}\n\tfmt.Printf(\"Luna: Generated %s key: %s\\n\", role, privKey.ID())\n\n\treturn nil\n}", "func (mc *MoacChain) exportWalletPrivateKey(addr, addrPasswd string) (privateKey string, err error) {\n\n\tdefer func() {\n\t\tif re := recover(); re != nil {\n\t\t\terr = re.(error)\n\t\t}\n\t}()\n\n\tvar acc accounts.Account\n\tacc, err = mc.fetchKeystore().Find(accounts.Account{Address: common.HexToAddress(addr)})\n\tif err == nil {\n\t\tvar jsonBytes []byte\n\t\tjsonBytes, err = ioutil.ReadFile(acc.URL.Path)\n\t\tif err == nil {\n\t\t\tvar storeKey *keystore.Key\n\t\t\tstoreKey, err = keystore.DecryptKey(jsonBytes, addrPasswd)\n\t\t\tif err == nil {\n\t\t\t\tprivateKey = hex.EncodeToString(ethMath.PaddedBigBytes(storeKey.PrivateKey.D, storeKey.PrivateKey.Params().BitSize/8))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn privateKey, err\n}", "func DerivePrivateKey(mnemonic, hdPath string) (*ecdsa.PrivateKey, error) {\n\t// Parse the seed string into the master BIP32 key.\n\tseed, err := bip39.NewSeedWithErrorChecking(mnemonic, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprivKey, err := hdkeychain.NewMaster(seed, fakeNetworkParams{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse the derivation path and derive a child for each level of the\n\t// BIP32 derivation path.\n\tderivationPath, err := accounts.ParseDerivationPath(hdPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, child := range derivationPath {\n\t\tprivKey, err = privKey.Child(child)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\trawPrivKey, err := privKey.SerializedPrivKey()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn crypto.ToECDSA(rawPrivKey)\n}", "func loadPrivateKey() {\n\tif privateKeyData, err := ioutil.ReadFile(PrivateKeyFile); err != nil {\n\t\tlog.Print(\"Unable to read private key file from disk, creating\")\n\t\tcreatePrivateKey()\n\t} else {\n\t\tblock, _ := pem.Decode(privateKeyData)\n\t\tif block == nil {\n\t\t\tlog.Print(\"Unable to decode PEM encoded private key data, creating\")\n\t\t\tcreatePrivateKey()\n\t\t} else {\n\t\t\tprivateKey, err = x509.ParsePKCS1PrivateKey(block.Bytes)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(\"Unable to decode X509 private key data, creating\")\n\t\t\t\tcreatePrivateKey()\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Read private key\")\n\t\t\t}\n\t\t}\n\t}\n}", "func (mc *MoacChain) ImportWalletPrivateKey(privateKey, passwd string) (err error) {\n\n\tdefer func() {\n\t\tif re := recover(); re != nil {\n\t\t\terr = re.(error)\n\t\t}\n\t}()\n\n\treturn errors.New(\"\")\n}", "func NewMemoryPrivateKeyStore(wrappedIntKek []byte) (keystore *MemoryStore) {\n\tkeystore = &MemoryStore{\n\t\tKeys: map[string]jose.Jwk{},\n\t\tKeyIdMap: map[string]string{},\n\t\taeGen: &gose.AuthenticatedEncryptionKeyGenerator{},\n\t\twrappedIntKek: wrappedIntKek,\n\t}\n\n\treturn\n}", "func (k *Keeper) addKeyToKeeper(client cmd.HTTPClient, privKeyHex string) (string, error) {\n\tprivkey, err := crypto.HexToECDSA(utils.RemoveHexPrefix(privKeyHex))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to decode priv key %s: %v\", privKeyHex, err)\n\t}\n\taddress := crypto.PubkeyToAddress(privkey.PublicKey).Hex()\n\tlog.Printf(\"importing keeper key %s\", address)\n\tkeyJSON, err := ethkey.FromPrivateKey(privkey).ToEncryptedJSON(defaultChainlinkNodePassword, utils.FastScryptParams)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to encrypt piv key %s: %v\", privKeyHex, err)\n\t}\n\timportUrl := url.URL{\n\t\tPath: \"/v2/keys/evm/import\",\n\t}\n\tquery := importUrl.Query()\n\n\tquery.Set(\"oldpassword\", defaultChainlinkNodePassword)\n\tquery.Set(\"evmChainID\", fmt.Sprint(k.cfg.ChainID))\n\n\timportUrl.RawQuery = query.Encode()\n\tresp, err := client.Post(importUrl.String(), bytes.NewReader(keyJSON))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to import priv key %s: %v\", privKeyHex, err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode >= 400 {\n\t\tbody, err := io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to read error response body: %s\", err)\n\t\t}\n\n\t\treturn \"\", fmt.Errorf(\"unable to create ocr2keeper job: '%v' [%d]\", string(body), resp.StatusCode)\n\t}\n\n\treturn address, nil\n}", "func (e *Domain) Private() *PrivateKey {\n\tif e.ClearPrivateKey == nil {\n\t\te.decrypt_privatekey()\n\t}\n\treturn e.ClearPrivateKey\n}", "func (w Wallet) ExportWithPrivateKey() (string, error) {\n\tw.PrivateKey = w.keyPair.String()\n\n\ts := memguard.NewStream()\n\n\tenc := json.NewEncoder(s)\n\terr := enc.Encode(w)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tenclave := s.Front().Value.(*memguard.Enclave)\n\tdata, err := enclave.Open()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdata.Melt()\n\n\tdefer data.Destroy()\n\n\treturn strings.TrimSpace(string(data.Bytes())), err\n}", "func (c EasyCert) savePrivateKey(key crypto.PrivateKey, file string) error {\n\tkeyOut, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer keyOut.Close()\n\n\tswitch v := key.(type) {\n\tcase *rsa.PrivateKey:\n\t\tkeyBytes := x509.MarshalPKCS1PrivateKey(v)\n\t\tpem.Encode(keyOut, &pem.Block{Type: \"RSA PRIVATE KEY\", Bytes: keyBytes})\n\tcase *ecdsa.PrivateKey:\n\t\tkeyBytes, err := x509.MarshalECPrivateKey(v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpem.Encode(keyOut, &pem.Block{Type: \"EC PRIVATE KEY\", Bytes: keyBytes})\n\tdefault:\n\t\treturn fmt.Errorf(\"Unsupport private key type: %#v\", key)\n\t}\n\n\treturn nil\n}", "func (recv *TypeClass) AddPrivate(privateSize uint64) {\n\tc_private_size := (C.gsize)(privateSize)\n\n\tC.g_type_class_add_private((C.gpointer)(recv.native), c_private_size)\n\n\treturn\n}", "func (e *dataUsageEntry) addChild(hash dataUsageHash) {\n\tif _, ok := e.Children[hash.Key()]; ok {\n\t\treturn\n\t}\n\tif e.Children == nil {\n\t\te.Children = make(dataUsageHashMap, 1)\n\t}\n\te.Children[hash.Key()] = struct{}{}\n}", "func (addr *Address) PrivateKey() *btcec.PrivateKey {\n\tpk := addr.calcDoubleHash()[:32]\n\tprivKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), pk)\n\treturn privKey\n}", "func (instance *cache) AddEntry(content Cacheable) (_ *Entry, xerr fail.Error) {\n\tif instance == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif content == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"content\")\n\t}\n\n\tinstance.lock.Lock()\n\tdefer instance.lock.Unlock()\n\n\tid := content.GetID()\n\tif xerr := instance.unsafeReserveEntry(id); xerr != nil {\n\t\treturn nil, xerr\n\t}\n\tdefer func() {\n\t\tif xerr != nil {\n\t\t\tif derr := instance.unsafeFreeEntry(id); derr != nil {\n\t\t\t\t_ = xerr.AddConsequence(fail.Wrap(derr, \"cleaning up on failure, failed to free cache entry '%s'\", id))\n\t\t\t}\n\t\t}\n\t}()\n\n\tcacheEntry, xerr := instance.unsafeCommitEntry(id, content)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn cacheEntry, nil\n}", "func (kb *Keybase) ExportPrivateKeyObject(name string, passphrase string) (crypto.PrivKey, error) {\n\tkb.mx.Lock()\n\tdefer kb.mx.Unlock()\n\treturn kb.kb.ExportPrivateKeyObject(name, passphrase)\n}", "func NewPrivateKey() (*rsa.PrivateKey, error) {\n\treturn rsa.GenerateKey(cryptorand.Reader, rsaKeySize)\n}", "func GeneratePrivateKey() (privateKey PrivateKey, err error) {\n\t_, privateKey, err = GenerateKey()\n\n\treturn\n}", "func (l *InMemoryUserRecordLayer) AddUserRecord(u model.UserRecord) {\n\tl.users[u.ID] = u\n}", "func (wlt *Wallet) AddEntry(entry Entry) error {\n\t// dup check\n\tfor _, e := range wlt.Entries {\n\t\tif e.Address == entry.Address {\n\t\t\treturn errors.New(\"duplicate address entry\")\n\t\t}\n\t}\n\n\twlt.Entries = append(wlt.Entries, entry)\n\treturn nil\n}", "func (d *identityManager) PrivateKey() []byte {\n\treturn d.key.PrivateKey\n}", "func GeneratePrivateKey() *PrivateKey {\n\tpriv := new(PrivateKey)\n\tseckey := NewSeckey()\n\tpriv.seckey = seckey\n\treturn priv\n}", "func (gc *GceCache) AddMachine(machineType MachineType, zone string) {\n\tgc.cacheMutex.Lock()\n\tdefer gc.cacheMutex.Unlock()\n\n\tgc.machinesCache[MachineTypeKey{zone, machineType.Name}] = machineType\n}", "func (p *PGP) SavePrivateKey(keyFilename, version, passphrase string) error {\n\tkeyBytes, err := p.toPrivateKey(version)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot save private key: %s\", err)\n\t}\n\tif len(passphrase) > 0 {\n\t\tif len(passphrase) == 16 || len(passphrase) == 24 || len(passphrase) == 32 {\n\t\t\tc := &AesCrypto{\n\t\t\t\tCipherMode: CBC,\n\t\t\t\tPadding: NoPadding,\n\t\t\t}\n\t\t\tencStr, err := c.Encrypt(string(keyBytes[:]), []byte(passphrase))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tkeyBytes = []byte(encStr)\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"passphrase length incorrect, valid lengths are 0, 16, 24 or 32 characters\")\n\t\t}\n\t}\n\t// write the private key to a file\n\terr = ioutil.WriteFile(keyFilename, keyBytes, os.ModePerm)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot save private key: %s\", err)\n\t}\n\treturn nil\n}", "func NewPrivateKey(keyType string) (interface{}, error) {\n\tswitch keyType {\n\tcase \"ecdsa256\":\n\t\treturn ecdsa.GenerateKey(elliptic.P256(), rand.Reader)\n\tcase \"ecdsa384\":\n\t\treturn ecdsa.GenerateKey(elliptic.P384(), rand.Reader)\n\tcase \"ecdsa521\":\n\t\treturn ecdsa.GenerateKey(elliptic.P521(), rand.Reader)\n\tcase \"ed25519\":\n\t\t_, privateKey, err := ed25519.GenerateKey(rand.Reader)\n\t\treturn privateKey, err\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported key type: %v\", keyType)\n\t}\n}", "func (o SslCertificateSelfManagedSslCertificateResponseOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificateResponse) string { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func NewPrivateKey(name ndn.Name, key *rsa.PrivateKey) (keychain.PrivateKeyKeyLocatorChanger, error) {\n\tif !keychain.IsKeyName(name) {\n\t\treturn nil, keychain.ErrKeyName\n\t}\n\tvar pvt privateKey\n\tpvt.name = name\n\tpvt.key = key\n\treturn &pvt, nil\n}", "func StoreECDSAPrivateKey(privateKey *ecdsa.PrivateKey, password string, path string) error {\n\tpemBlock, err := EncodeECDSAPrivateKeyToPEM(privateKey, password)\n\tif err != nil {\n\t\treturn errors.WithStackTrace(err)\n\t}\n\treturn errors.WithStackTrace(StorePEM(pemBlock, path))\n}", "func (keyDB *KeyDB) AddHashChainEntry(\n\tdomain string,\n\tposition uint64,\n\tentry string,\n) error {\n\tdmn := identity.MapDomain(domain)\n\t_, err := keyDB.addHashChainEntryQuery.Exec(dmn, position, entry)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func LoadPrivateKey(path string) (SignatureCreator, error) {\r\n\tdat, err := ioutil.ReadFile(path)\r\n\tLogErrorF(err)\r\n\treturn parsePrivateKey(dat)\r\n}", "func (s *ExtSession) AddPrivateCommand(category string, check func(ctx *Context) bool, c *Command) {\n\tc.Check = check\n\ts.AddCommand(category, c)\n}", "func NewPrivateKey() (*rsa.PrivateKey, error) {\n\treturn rsa.GenerateKey(rand.Reader, 2048)\n}", "func (keys *RSAKeyPair) ExportRSAPrivateKeyBinaryFile(filePath string) error {\n\tpemfile, err := os.Create(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pemfile.Close()\n\n\t// Private key in PEM format\n\terr = binary.Write(pemfile, binary.LittleEndian, keys.PrivateKeyPKCS8Bytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (v *Virter) addDHCPEntry(mac string, id uint) (net.IP, error) {\n\tnetwork, err := v.libvirt.NetworkLookupByName(v.networkName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get network: %w\", err)\n\t}\n\n\tipNet, err := v.getIPNet(network)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnetworkBaseIP := ipNet.IP.Mask(ipNet.Mask)\n\tip := addToIP(networkBaseIP, id)\n\n\tif !ipNet.Contains(ip) {\n\t\treturn nil, fmt.Errorf(\"computed IP %v is not in network\", ip)\n\t}\n\n\tlog.Printf(\"Add DHCP entry from %v to %v\", mac, ip)\n\terr = v.libvirt.NetworkUpdate(\n\t\tnetwork,\n\t\t// the following 2 arguments are swapped; see\n\t\t// https://github.com/digitalocean/go-libvirt/issues/87\n\t\tuint32(libvirt.NetworkSectionIPDhcpHost),\n\t\tuint32(libvirt.NetworkUpdateCommandAddLast),\n\t\t-1,\n\t\tfmt.Sprintf(\"<host mac='%s' ip='%v'/>\", mac, ip),\n\t\tlibvirt.NetworkUpdateAffectLive|libvirt.NetworkUpdateAffectConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not add DHCP entry: %w\", err)\n\t}\n\n\treturn ip, nil\n}", "func GenerateFromPrivateKey(privateKey string) (*Wallet, error) {\n\tpb := hex2bytes(privateKey)\n\tvar priv btckey.PrivateKey\n\terr := priv.FromBytes(pb)\n\tif err != nil {\n\t\treturn &Wallet{}, err\n\t}\n\twallet := &Wallet{\n\t\tPublicKey: priv.PublicKey.ToBytes(),\n\t\tPrivateKey: priv.ToBytes(),\n\t\tAddress: priv.ToNeoAddress(),\n\t\tWIF: priv.ToWIFC(),\n\t\tHashedSignature: priv.ToNeoSignature(),\n\t}\n\treturn wallet, nil\n}", "func (room *Room) AddEntry(entry, issuer string) error {\n\tif room.game == nil {\n\t\treturn errors.New(\"there isn't a started game\")\n\t}\n\n\tif err := room.game.AddEntry(entry, issuer); err != nil {\n\t\treturn err\n\t}\n\n\tif room.game.Finished {\n\t\troom.previousGame = room.game\n\t\troom.game = nil\n\t}\n\treturn nil\n}", "func (s *session) AddRecord(key string, member interface{}, unixstamp int64) error {\n\taction, err := s.addRecord(key, member, unixstamp)\n\tif err != nil {\n\t\treturn s.catch(\"AddRecord: \"+action, err)\n\t}\n\treturn nil\n}", "func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error) {\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, bitSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = privateKey.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn privateKey, nil\n}", "func Add(kp *keypool.KeyPool, keyDir string) error {\n\terr := os.MkdirAll(keyDir, 0700)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkp.RegisterStorage(nil, writeKeyToDir(keyDir), loadKeysFromDir(keyDir))\n\treturn nil\n}", "func NewPrivateKey(str string) (key PrivateKey, err error) {\n\tbs, err := base58.Decode(str)\n\tif err != nil {\n\t\treturn key, err\n\t}\n\tif len(bs) != KeySize {\n\t\treturn key, errors.New(\"invalid key\")\n\t}\n\tcopy(key[:], bs)\n\treturn key, nil\n}", "func PrivateKeyValidate(priv *rsa.PrivateKey,) error", "func (x *Ed25519Credentials) SetPrivateKey(privatekey PrivateKey) error {\n\n\tif privatekey.Algorithm != AlgorithmEd25519 {\n\t\treturn fmt.Errorf(\"Algorithm mismatch %v vs %v\", privatekey.Algorithm, AlgorithmEd25519)\n\t}\n\n\tst, ok := privatekey.Private.(string)\n\tif !ok {\n\t\treturn ErrInvalidPrivateKeyType\n\t}\n\n\tif len(st) != base64.URLEncoding.EncodedLen(ed25519.PrivateKeySize) {\n\t\treturn fmt.Errorf(\"Key data incorrect length\")\n\t}\n\n\tbytes, err := base64.URLEncoding.DecodeString(st)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tx.Private = bytes\n\n\treturn nil\n\n}", "func LoadPrivateKey(basepath, name string) (*PrivateKey, error) {\n\tkeysdir := filepath.Join(basepath, \"keys\")\n\tprivateKeyPath := fmt.Sprintf(DefaultKeystoreFile, keysdir, name, PrivateType)\n\n\tprivateExists, err := checkFileStat(privateKeyPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !privateExists {\n\t\treturn nil, ErrKeyNotFound\n\t}\n\n\tprivateKeyData, err := ioutil.ReadFile(privateKeyPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpemBlock, _ := pem.Decode(privateKeyData)\n\tecdsaPrivateKey, err := x509.ParseECPrivateKey(pemBlock.Bytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &PrivateKey{\n\t\tecdsaPrivateKey,\n\t}, nil\n}", "func newPrivateKey(size int) (*rsa.PrivateKey, error) {\n\t// TODO: support more key types\n\tprivateKey, err := rsa.GenerateKey(rand.Reader, size)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn privateKey, nil\n}", "func WithPrivateKey(privKey *ecdsa.PrivateKey) WakuNodeOption {\n\treturn func(params *WakuNodeParameters) error {\n\t\tprivk := crypto.PrivKey((*crypto.Secp256k1PrivateKey)(privKey))\n\t\tparams.privKey = &privk\n\t\treturn nil\n\t}\n}", "func (b *BigIP) AddKey(config *Key) error {\n\treturn b.post(config, uriSys, uriCrypto, uriKey)\n}", "func (w *Wallet) ImportPrivateKey(scope waddrmgr.KeyScope, wif *btcutil.WIF,\n\tbs *waddrmgr.BlockStamp, rescan bool) (string, er.R) {\n\n\tmanager, err := w.Manager.FetchScopedKeyManager(scope)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// The starting block for the key is the genesis block unless otherwise\n\t// specified.\n\tif bs == nil {\n\t\tbs = &waddrmgr.BlockStamp{\n\t\t\tHash: *w.chainParams.GenesisHash,\n\t\t\tHeight: 0,\n\t\t\tTimestamp: genesis.Block(w.chainParams.GenesisHash).Header.Timestamp,\n\t\t}\n\t} else if bs.Timestamp.IsZero() {\n\t\t// Only update the new birthday time from default value if we\n\t\t// actually have timestamp info in the header.\n\t\theader, err := w.chainClient.GetBlockHeader(&bs.Hash)\n\t\tif err == nil {\n\t\t\tbs.Timestamp = header.Timestamp\n\t\t}\n\t}\n\n\t// Attempt to import private key into wallet.\n\tvar addr btcutil.Address\n\tvar props *waddrmgr.AccountProperties\n\terr = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) er.R {\n\t\taddrmgrNs := tx.ReadWriteBucket(waddrmgrNamespaceKey)\n\t\tmaddr, err := manager.ImportPrivateKey(addrmgrNs, wif, bs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\taddr = maddr.Address()\n\t\tprops, err = manager.AccountProperties(\n\t\t\taddrmgrNs, waddrmgr.ImportedAddrAccount,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// We'll only update our birthday with the new one if it is\n\t\t// before our current one. Otherwise, if we do, we can\n\t\t// potentially miss detecting relevant chain events that\n\t\t// occurred between them while rescanning.\n\t\tbirthdayBlock, _, err := w.Manager.BirthdayBlock(addrmgrNs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif bs.Height >= birthdayBlock.Height {\n\t\t\treturn nil\n\t\t}\n\n\t\terr = w.Manager.SetBirthday(addrmgrNs, bs.Timestamp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// To ensure this birthday block is correct, we'll mark it as\n\t\t// unverified to prompt a sanity check at the next restart to\n\t\t// ensure it is correct as it was provided by the caller.\n\t\treturn w.Manager.SetBirthdayBlock(addrmgrNs, *bs, false)\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Rescan blockchain for transactions with txout scripts paying to the\n\t// imported address.\n\tif rescan {\n\t\tjob := &RescanJob{\n\t\t\tAddrs: []btcutil.Address{addr},\n\t\t\tOutPoints: nil,\n\t\t\tBlockStamp: *bs,\n\t\t}\n\n\t\t// Submit rescan job and log when the import has completed.\n\t\t// Do not block on finishing the rescan. The rescan success\n\t\t// or failure is logged elsewhere, and the channel is not\n\t\t// required to be read, so discard the return value.\n\t\t_ = w.SubmitRescan(job)\n\t} else {\n\t\terr := w.chainClient.NotifyReceived([]btcutil.Address{addr})\n\t\tif err != nil {\n\t\t\treturn \"\", er.Errorf(\"Failed to subscribe for address ntfns for \"+\n\t\t\t\t\"address %s: %s\", addr.EncodeAddress(), err)\n\t\t}\n\t}\n\n\taddrStr := addr.EncodeAddress()\n\tlog.Infof(\"Imported payment address %s\", addrStr)\n\n\tw.NtfnServer.notifyAccountProperties(props)\n\n\t// Return the payment address string of the imported private key.\n\treturn addrStr, nil\n}", "func (mc *MemCache) Add(key string, value interface{}) {\n\t_, expTime, found := mc.c.GetWithExpiration(key)\n\tif found { // do not reset expiration if the key already exists\n\t\tmc.c.Set(key, value, time.Until(expTime))\n\t\treturn\n\t}\n\n\tmc.c.Set(key, value, mc.expiration)\n}", "func TypeAddInstancePrivate(classType Type, privateSize uint64) int32 {\n\tc_class_type := (C.GType)(classType)\n\n\tc_private_size := (C.gsize)(privateSize)\n\n\tretC := C.g_type_add_instance_private(c_class_type, c_private_size)\n\tretGo := (int32)(retC)\n\n\treturn retGo\n}", "func ImportFromPrivateKey(privateKey, name, passphrase string) (string, error) {\n\tprivateKey = strings.TrimPrefix(privateKey, \"0x\")\n\n\tif name == \"\" {\n\t\tname = generateName() + \"-imported\"\n\t\tfor store.DoesNamedAccountExist(name) {\n\t\t\tname = generateName() + \"-imported\"\n\t\t}\n\t} else if store.DoesNamedAccountExist(name) {\n\t\treturn \"\", fmt.Errorf(\"account %s already exists\", name)\n\t}\n\n\tprivateKeyBytes, err := hex.DecodeString(privateKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(privateKeyBytes) != common.Secp256k1PrivateKeyBytesLength {\n\t\treturn \"\", common.ErrBadKeyLength\n\t}\n\n\t// btcec.PrivKeyFromBytes only returns a secret key and public key\n\tsk, _ := btcec.PrivKeyFromBytes(btcec.S256(), privateKeyBytes)\n\toneAddress := address.ToBech32(crypto.PubkeyToAddress(sk.PublicKey))\n\n\tif store.FromAddress(oneAddress) != nil {\n\t\treturn \"\", fmt.Errorf(\"address %s already exists\", oneAddress)\n\t}\n\n\tks := store.FromAccountName(name)\n\t_, err = ks.ImportECDSA(sk.ToECDSA(), passphrase)\n\treturn name, err\n}", "func (k2h *K2hash) AddDecryptionPassword(pass string) (bool, error) {\n\tcPass := C.CString(pass)\n\tdefer C.free(unsafe.Pointer(cPass))\n\tok := C.k2h_add_attr_crypt_pass(k2h.handle, cPass, false)\n\tif ok != true {\n\t\treturn false, fmt.Errorf(\"k2h_add_attr_crypt_pass() returns false\")\n\t}\n\treturn true, nil\n}", "func GeneratePrivateKey() (*rsa.PrivateKey, error) {\n\treturn rsa.GenerateKey(rand.Reader, RSA_BITS)\n}", "func GetPrivateKey() ed25519.PrivateKey {\n\tkey, _ := DecodePrivateKey(privateKey)\n\treturn key\n}", "func (i *Interpreter) AddDictionaryEntry(e DictionaryEntry) {\n\ti.dictionary[dictionaryKey{e.EnterpriseID, e.FieldID}] = e\n}", "func (authcl *Client) AddKey(key, description string, temp bool) error {\n\terr := authcl.LoadToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewkey := gogs.PublicKey{Key: key, Title: description}\n\taddress := fmt.Sprintf(\"/api/v1/user/keys\")\n\tres, err := authcl.Post(address, newkey)\n\tif err != nil {\n\t\treturn err\n\t} else if res.StatusCode != http.StatusCreated {\n\t\treturn fmt.Errorf(\"[Add key] Failed. Server returned %s\", res.Status)\n\t}\n\tweb.CloseRes(res.Body)\n\treturn nil\n}", "func AddENCEntry(hostName string, class string, entry Entry, backend gitlab.ENCBackend, force bool) {\n\t// TODO class should be directly injected in the entry array\n\tb := []string{class}\n\tentry.Classes = b\n\n\t// Marshal to yaml\n\tenc, err := yaml.Marshal(entry)\n\tif err != nil {\n\t\tlog.Fatalf(\"error: %v\", err)\n\t}\n\tfileName, err := writeToFile(enc, hostName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// TODO implement error handling for\n\tgitlab.AddToGitlab(fileName, enc, backend, force)\n}", "func (w *rpcWallet) AddressPrivKey(ctx context.Context, address stdaddr.Address) (*secp256k1.PrivateKey, error) {\n\twif, err := w.rpcClient.DumpPrivKey(ctx, address)\n\tif err != nil {\n\t\treturn nil, translateRPCCancelErr(err)\n\t}\n\tvar priv secp256k1.PrivateKey\n\tif overflow := priv.Key.SetByteSlice(wif.PrivKey()); overflow || priv.Key.IsZero() {\n\t\treturn nil, errors.New(\"invalid private key\")\n\t}\n\treturn &priv, nil\n}", "func (s *Store) AddRecipient(ctx context.Context, id string) error {\n\trs, err := s.GetRecipients(ctx, \"\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read recipient list: %w\", err)\n\t}\n\n\tdebug.Log(\"new recipient: %q - existing: %+v\", id, rs)\n\n\tidAlreadyInStore := rs.Has(id)\n\tif idAlreadyInStore {\n\t\tif !termio.AskForConfirmation(ctx, fmt.Sprintf(\"key %q already in store. Do you want to re-encrypt with public key? This is useful if you changed your public key (e.g. added subkeys).\", id)) {\n\t\t\treturn nil\n\t\t}\n\t} else {\n\t\trs.Add(id)\n\n\t\tif err := s.saveRecipients(ctx, rs, \"Added Recipient \"+id); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to save recipients: %w\", err)\n\t\t}\n\t}\n\n\tout.Printf(ctx, \"Reencrypting existing secrets. This may take some time ...\")\n\n\tcommitMsg := \"Recipient \" + id\n\tif idAlreadyInStore {\n\t\tcommitMsg = \"Re-encrypted Store for \" + commitMsg\n\t} else {\n\t\tcommitMsg = \"Added \" + commitMsg\n\t}\n\n\treturn s.reencrypt(ctxutil.WithCommitMessage(ctx, commitMsg))\n}", "func (a *Account) ImportPrivateKey(pk []byte, compressed bool,\n\tbs *wallet.BlockStamp, rescan bool) (string, error) {\n\n\t// Attempt to import private key into wallet.\n\taddr, err := a.Wallet.ImportPrivateKey(pk, compressed, bs)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Immediately write wallet to disk.\n\tAcctMgr.ds.ScheduleWalletWrite(a)\n\tif err := AcctMgr.ds.FlushAccount(a); err != nil {\n\t\treturn \"\", fmt.Errorf(\"cannot write account: %v\", err)\n\t}\n\n\taddrStr := addr.EncodeAddress()\n\n\t// Rescan blockchain for transactions with txout scripts paying to the\n\t// imported address.\n\tif rescan {\n\t\taddrs := []btcutil.Address{addr}\n\t\tjob := &RescanJob{\n\t\t\tAddresses: map[*Account][]btcutil.Address{a: addrs},\n\t\t\tOutPoints: nil,\n\t\t\tStartHeight: 0,\n\t\t}\n\n\t\t// Submit rescan job and log when the import has completed.\n\t\t// Do not block on finishing the rescan.\n\t\tdoneChan := AcctMgr.rm.SubmitJob(job)\n\t\tgo func() {\n\t\t\t<-doneChan\n\t\t\tlog.Infof(\"Finished import for address %s\", addrStr)\n\t\t}()\n\t}\n\n\t// Associate the imported address with this account.\n\tAcctMgr.MarkAddressForAccount(addr, a)\n\n\tlog.Infof(\"Imported payment address %s\", addrStr)\n\n\t// Return the payment address string of the imported private key.\n\treturn addrStr, nil\n}", "func (s ServiceClientWrapper) AddKey(name string, password string) (addr string, mnemonic string, err error) {\n\treturn s.ServiceClient.Insert(name, password)\n}", "func (txt *DNSSdTxtRecord) Add(key, value string) {\n\t*txt = append(*txt, DNSSdTxtItem{key, value, false})\n}", "func (a *Archive) AddEntry(typ EntryType, name string, mtime int64, uid, gid int, mode os.FileMode, size int64, r io.Reader) {\n\toff, err := a.f.Seek(0, os.SEEK_END)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tn, err := fmt.Fprintf(a.f, entryHeader, exactly16Bytes(name), mtime, uid, gid, mode, size)\n\tif err != nil || n != entryLen {\n\t\tlog.Fatal(\"writing entry header: \", err)\n\t}\n\tn1, _ := io.CopyN(a.f, r, size)\n\tif n1 != size {\n\t\tlog.Fatal(err)\n\t}\n\tif (off+size)&1 != 0 {\n\t\ta.f.Write([]byte{0}) // pad to even byte\n\t}\n\ta.Entries = append(a.Entries, Entry{\n\t\tName: name,\n\t\tType: typ,\n\t\tMtime: mtime,\n\t\tUid: uid,\n\t\tGid: gid,\n\t\tMode: mode,\n\t\tData: Data{off + entryLen, size},\n\t})\n}", "func (a *Account) GetPrivateKey() crypto.PrivateKey {\n\treturn a.key\n}", "func FromPrivateKey(privateKey []byte) (*Identity, error) {\n\tidentity := Identity{}\n\tidentity.PrivateKey = ed25519.NewKeyFromSeed(privateKey)\n\tidentity.PublicKey = make([]byte, ed25519.PublicKeySize)\n\tcopy(identity.PublicKey, identity.PrivateKey[32:])\n\tidentity.addConvenienceDerivatives()\n\treturn &identity, nil\n}", "func (o SslCertificateOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCertificate) pulumi.StringOutput { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func (o SslCertOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCert) pulumi.StringOutput { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func EvalPrivateKey(s sexprs.Sexp) (k PrivateKey, err error) {\n\tl, ok := s.(sexprs.List)\n\tif !ok {\n\t\treturn k, fmt.Errorf(\"Key S-expression must be a list\")\n\t}\n\tif !privateKeyAtom.Equal(l[0]) {\n\t\treturn k, fmt.Errorf(\"Key S-expression must start with 'private-key'\")\n\t}\n\tif len(l) != 2 {\n\t\treturn k, fmt.Errorf(\"Key S-expression must have two elements\")\n\t}\n\treturn evalECDSAPrivateKey(l[1])\n\tpanic(\"Can't reach here\")\n}" ]
[ "0.70359194", "0.6639596", "0.5902523", "0.5467966", "0.5320013", "0.5296554", "0.5258727", "0.5252541", "0.52133185", "0.51536345", "0.513239", "0.5129155", "0.5101568", "0.5091105", "0.5075747", "0.5056588", "0.5034122", "0.50106305", "0.5004521", "0.50001854", "0.49769345", "0.49704066", "0.4938369", "0.4909113", "0.49002528", "0.48905975", "0.4885787", "0.4878356", "0.4875934", "0.48756424", "0.48742846", "0.48551857", "0.48473918", "0.48216462", "0.4798918", "0.47928366", "0.47836795", "0.47719955", "0.47707888", "0.4759229", "0.47559237", "0.47558984", "0.47497687", "0.4749009", "0.47450963", "0.4720073", "0.4719256", "0.47190616", "0.4711242", "0.4710108", "0.46986276", "0.46891147", "0.46851507", "0.46828052", "0.4679464", "0.46665522", "0.46624866", "0.46571058", "0.46518365", "0.4650488", "0.46473458", "0.46463478", "0.4643828", "0.46393606", "0.4638807", "0.4637869", "0.4634329", "0.46276066", "0.46173805", "0.45981768", "0.45965204", "0.45905977", "0.45896998", "0.45829868", "0.4570078", "0.45669773", "0.45661268", "0.45608836", "0.45525742", "0.45513195", "0.45506507", "0.45359617", "0.45319998", "0.45302558", "0.45243338", "0.45168152", "0.4507622", "0.45011365", "0.4500933", "0.4498331", "0.44932413", "0.44929093", "0.44903117", "0.44868523", "0.4485161", "0.44829336", "0.44808862", "0.44772974", "0.4476372", "0.44683376" ]
0.8498008
0
AddPublicKeyEntry adds public KeyEntry from identity to memory store.
AddPublicKeyEntry добавляет публичную запись KeyEntry из идентичности в хранилище в памяти.
func (ms *MemStore) AddPublicKeyEntry(identity string, ke *uid.KeyEntry) { ms.publicKeyEntryMap[identity] = ke }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (rd *RootDomain) AddNewMemberToPublicKeyMap(publicKey string, memberRef insolar.Reference) error {\n\ttrimmedPublicKey := foundation.TrimPublicKey(publicKey)\n\tshardIndex := foundation.GetShardIndex(trimmedPublicKey, insolar.GenesisAmountPublicKeyShards)\n\tif shardIndex >= len(rd.PublicKeyShards) {\n\t\treturn fmt.Errorf(\"incorrect public key shard index\")\n\t}\n\tpks := pkshard.GetObject(rd.PublicKeyShards[shardIndex])\n\terr := pks.SetRef(trimmedPublicKey, memberRef.String())\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to set reference in public key shard\")\n\t}\n\treturn nil\n}", "func (_IRMAScheme *IRMASchemeTransactor) AddIssuerPublicKey(opts *bind.TransactOpts, _issuerId string, _key []byte) (*types.Transaction, error) {\n\treturn _IRMAScheme.contract.Transact(opts, \"addIssuerPublicKey\", _issuerId, _key)\n}", "func (ms *MemStore) GetPublicKeyEntry(uidMsg *uid.Message) (*uid.KeyEntry, string, error) {\n\tke, ok := ms.publicKeyEntryMap[uidMsg.Identity()]\n\tif !ok {\n\t\treturn nil, \"\", log.Error(session.ErrNoKeyEntry)\n\t}\n\treturn ke, \"undefined\", nil\n}", "func (keyDB *KeyDB) AddPublicKeyInit(ki *uid.KeyInit) error {\n\t_, err := keyDB.addPublicKeyInitQuery.Exec(ki.SigKeyHash(), ki.JSON())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ms *MemStore) AddPrivateKeyEntry(ke *uid.KeyEntry) {\n\tms.privateKeyEntryMap[ke.HASH] = ke\n}", "func (_IRMAScheme *IRMASchemeTransactorSession) AddIssuerPublicKey(_issuerId string, _key []byte) (*types.Transaction, error) {\n\treturn _IRMAScheme.Contract.AddIssuerPublicKey(&_IRMAScheme.TransactOpts, _issuerId, _key)\n}", "func (s *service) AddPublicKeyTag(ctx context.Context, tenant, fingerprint, tag string) error {\n\t// Checks if the namespace exists.\n\tnamespace, err := s.store.NamespaceGet(ctx, tenant)\n\tif err != nil || namespace == nil {\n\t\treturn NewErrNamespaceNotFound(tenant, err)\n\t}\n\n\t// Checks if the public key exists.\n\tkey, err := s.store.PublicKeyGet(ctx, fingerprint, tenant)\n\tif err != nil || key == nil {\n\t\treturn NewErrPublicKeyNotFound(fingerprint, err)\n\t}\n\n\tif key.Filter.Hostname != \"\" {\n\t\treturn NewErrPublicKeyFilter(nil)\n\t}\n\n\tif len(key.Filter.Tags) == DeviceMaxTags {\n\t\treturn NewErrTagLimit(DeviceMaxTags, nil)\n\t}\n\n\ttags, _, err := s.store.TagsGet(ctx, tenant)\n\tif err != nil {\n\t\treturn NewErrTagEmpty(tenant, err)\n\t}\n\n\tif !contains(tags, tag) {\n\t\treturn NewErrTagNotFound(tag, nil)\n\t}\n\n\t// Trys to add a public key.\n\terr = s.store.PublicKeyAddTag(ctx, tenant, fingerprint, tag)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase store.ErrNoDocuments:\n\t\t\treturn ErrDuplicateTagName\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (_IRMAScheme *IRMASchemeSession) AddIssuerPublicKey(_issuerId string, _key []byte) (*types.Transaction, error) {\n\treturn _IRMAScheme.Contract.AddIssuerPublicKey(&_IRMAScheme.TransactOpts, _issuerId, _key)\n}", "func NewPublicKey(pk map[string]interface{}) PublicKey {\n\treturn pk\n}", "func (o *DKSharesInfo) SetPublicKey(v string) {\n\to.PublicKey = v\n}", "func (c *Included) MustPublicKeyEntry(key Key) *PublicKeyEntry {\n\tvar publicKeyEntry PublicKeyEntry\n\tif c.tryFindEntry(key, &publicKeyEntry) {\n\t\treturn &publicKeyEntry\n\t}\n\treturn nil\n}", "func AddSSHPublicKeyToConfig(name string, file string) (*SSHPublicKey, error) {\n\tsshPublicKey, err := parseSSHPublicKey(name, file)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while parsing ssh key from file '%s' config: %s\", file, err)\n\t}\n\n\tsshPublicKey.WriteToConfig()\n\n\treturn sshPublicKey, nil\n}", "func (p Planner) AddEntry(planIdentifier string, user users.User, startAtUnix, duration int64) (PlanEntry, error) {\n\t// Get the plan based on identifier\n\tplan, err := p.data.GetPlan(planIdentifier)\n\tif err != nil {\n\t\treturn PlanEntry{}, fmt.Errorf(\"no plan: %w\", err)\n\t}\n\t// Check that the duration is longer than the plan's minimum availability\n\tif plan.MinimumAvailabilitySeconds > uint(duration) {\n\t\treturn PlanEntry{}, dataerror.ErrBasic(fmt.Sprintf(\"Entry duration cannot be shorter than the plan's (%d)\", plan.MinimumAvailabilitySeconds))\n\t}\n\n\tcreatedEntry, err := p.data.AddEntry(&plan, user, startAtUnix, duration)\n\tif err != nil {\n\t\treturn PlanEntry{}, fmt.Errorf(\"failed saving entry: %w\", err)\n\t}\n\n\t// Now just convert createdEntry to PlanEntry\n\tfinalEntry := PlanEntry{}\n\tfinalEntry.FillFromDataType(createdEntry)\n\n\treturn finalEntry, nil\n}", "func (t *SimpleTable) AddEntry(addr Address, nextHop Node) {\n\tt.Lock()\n\tdefer t.Unlock()\n\tt.entries = append(t.entries, NewTableEntry(addr, nextHop))\n}", "func (s *MedianSubscriber) addEntry(e entry) {\n\tn := len(s.entries)\n\tpos := sort.Search(n, func(i int) bool {\n\t\treturn s.entries[i].Compare(e) >= 0\n\t}) // insert pos of entry\n\tif pos == n {\n\t\ts.entries = append(s.entries, e)\n\t} else {\n\t\ts.entries = append(s.entries[:pos+1], s.entries[pos:]...)\n\t\ts.entries[pos] = e\n\t}\n}", "func (instance *cache) AddEntry(content Cacheable) (_ *Entry, xerr fail.Error) {\n\tif instance == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif content == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"content\")\n\t}\n\n\tinstance.lock.Lock()\n\tdefer instance.lock.Unlock()\n\n\tid := content.GetID()\n\tif xerr := instance.unsafeReserveEntry(id); xerr != nil {\n\t\treturn nil, xerr\n\t}\n\tdefer func() {\n\t\tif xerr != nil {\n\t\t\tif derr := instance.unsafeFreeEntry(id); derr != nil {\n\t\t\t\t_ = xerr.AddConsequence(fail.Wrap(derr, \"cleaning up on failure, failed to free cache entry '%s'\", id))\n\t\t\t}\n\t\t}\n\t}()\n\n\tcacheEntry, xerr := instance.unsafeCommitEntry(id, content)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn cacheEntry, nil\n}", "func (keyRing *KeyRing) WritePublicKey(w io.Writer) (err error) {\n\tfor _, e := range keyRing.entities {\n\t\tif err = e.Serialize(w); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func (kc *Keychain) Add(key *crypto.PublicKeySECP256K1R) {\n\taddr := key.Address()\n\tkc.Addrs.Add(addr)\n}", "func (a *Archive) AddEntry(typ EntryType, name string, mtime int64, uid, gid int, mode os.FileMode, size int64, r io.Reader) {\n\toff, err := a.f.Seek(0, os.SEEK_END)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tn, err := fmt.Fprintf(a.f, entryHeader, exactly16Bytes(name), mtime, uid, gid, mode, size)\n\tif err != nil || n != entryLen {\n\t\tlog.Fatal(\"writing entry header: \", err)\n\t}\n\tn1, _ := io.CopyN(a.f, r, size)\n\tif n1 != size {\n\t\tlog.Fatal(err)\n\t}\n\tif (off+size)&1 != 0 {\n\t\ta.f.Write([]byte{0}) // pad to even byte\n\t}\n\ta.Entries = append(a.Entries, Entry{\n\t\tName: name,\n\t\tType: typ,\n\t\tMtime: mtime,\n\t\tUid: uid,\n\t\tGid: gid,\n\t\tMode: mode,\n\t\tData: Data{off + entryLen, size},\n\t})\n}", "func NewPublicKey(seed Trytes, index int) (Trytes, error) {\n\tbytesSec, err := seed.Trits().Bytes()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif mKey == nil {\n\t\tkey, err := hdkey.NewMaster(bytesSec, nil, 1)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tmKey = key\n\t}\n\n\tpubKey, err := mKey.Child(uint32(index))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tpkCompressed := pubKey.PublicKey().Compress()\n\tpkInt := new(big.Int).SetBytes(pkCompressed[:])\n\tkeyTrit := make([]byte, 48)\n\tcopy(keyTrit, pkInt.Bytes())\n\ttrits, err := BytesToTrits(keyTrit)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn trits.Trytes(), err\n}", "func (r *rsaPublicKey) Store() ([]byte, error) {\r\n\treturn x509.MarshalPKIXPublicKey(r.PublicKey)\r\n}", "func (p *Resolver) AddExecEntry(entry *model.ProcessCacheEntry) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tp.insertExecEntry(entry, model.ProcessCacheEntryFromEvent)\n}", "func ExportPublicKey(key *rsa.PublicKey) []byte {\n\tkeyBytes := x509.MarshalPKCS1PublicKey(key)\n\treturn pem.EncodeToMemory(&pem.Block{\n\t\tType: \"PUBLIC KEY\",\n\t\tBytes: keyBytes,\n\t})\n}", "func (c *publicKey) Encode() (*pb.PublicKey, error) {\n\tif c.ki == nil {\n\t\treturn nil, ErrPublicKeyCannotBeNil()\n\t}\n\n\tblob, err := crypto.MarshalPublicKey(c.ki)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpbuf := pb.PublicKey{Blob: blob}\n\n\treturn &pbuf, nil\n}", "func (o *PipelineSshKeyPairAllOf) SetPublicKey(v string) {\n\to.PublicKey = &v\n}", "func (keyDB *KeyDB) AddHashChainEntry(\n\tdomain string,\n\tposition uint64,\n\tentry string,\n) error {\n\tdmn := identity.MapDomain(domain)\n\t_, err := keyDB.addHashChainEntryQuery.Exec(dmn, position, entry)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewPublicKey(keyType KeyType, keyData []byte, keyID string) PublicKey {\n\treturn PublicKey{\n\t\tKeyType: keyType,\n\t\tKeyData: keyData,\n\t\tID: keyID,\n\t}\n}", "func (pk *PublicKey) Pack(buf *[PublicKeySize]byte) {\n\tvar tmp [mode2.PublicKeySize]byte\n\tpk.d.Pack(&tmp)\n\tcopy(buf[:mode2.PublicKeySize], tmp[:])\n\tcopy(buf[mode2.PublicKeySize:], pk.e)\n}", "func (s *Storage) Add(uuid []byte, e Entry) (err error) {\n\ttxn, dbis, err := s.startTxn(false, timeDB, entryDB, keyDB)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif e.Key != \"\" {\n\t\tDebug(\"Entry has key: \", e.Key)\n\n\t\tvar ouuid []byte\n\t\touuid, err = txn.Get(dbis[2], []byte(e.Key))\n\t\tif err != nil && err != mdb.NotFound {\n\t\t\ttxn.Abort()\n\t\t\treturn\n\t\t}\n\n\t\tif err == nil {\n\t\t\tDebug(\"Exising key found; removing.\")\n\n\t\t\terr = s.innerRemove(txn, dbis, ouuid)\n\t\t\tif err != nil {\n\t\t\t\ttxn.Abort()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\terr = txn.Put(dbis[2], []byte(e.Key), uuid, 0)\n\t\tif err != nil {\n\t\t\ttxn.Abort()\n\t\t\treturn\n\t\t}\n\t}\n\n\tk := uint64ToBytes(uint64(e.SendAt.UnixNano()))\n\terr = txn.Put(dbis[0], k, uuid, 0)\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\tb, err := e.ToBytes()\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\terr = txn.Put(dbis[1], uuid, b, 0)\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\tok, t, err := s.innerNextTime(txn, dbis[0])\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\terr = txn.Commit()\n\n\tif err == nil && ok {\n\t\ts.c <- t\n\t}\n\n\treturn\n}", "func AddENCEntry(hostName string, class string, entry Entry, backend gitlab.ENCBackend, force bool) {\n\t// TODO class should be directly injected in the entry array\n\tb := []string{class}\n\tentry.Classes = b\n\n\t// Marshal to yaml\n\tenc, err := yaml.Marshal(entry)\n\tif err != nil {\n\t\tlog.Fatalf(\"error: %v\", err)\n\t}\n\tfileName, err := writeToFile(enc, hostName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// TODO implement error handling for\n\tgitlab.AddToGitlab(fileName, enc, backend, force)\n}", "func (router *Router) AddEntry(origin, address string, onlyIfNotExists bool) bool {\n\toldValue, found := router.GetAddress(origin)\n\tisNew := false\n\tif !found || (!onlyIfNotExists && oldValue.String() != address) {\n\t\tisNew = true\n\t\tnewEntry := utils.PeerAddress{}\n\t\terr := newEntry.Set(address)\n\t\tif err != nil {\n\t\t\tlogger.Logw(\"Error updating router entry\")\n\t\t\treturn false\n\t\t}\n\t\trouter.setEntry(origin, newEntry)\n\t}\n\treturn isNew\n}", "func newPersistedEntry(value *value) (persistedEntry, error) {\n\tif len(value.data) > modules.RegistryDataSize {\n\t\tbuild.Critical(\"newPersistedEntry: called with too much data\")\n\t\treturn persistedEntry{}, errors.New(\"value's data is too large\")\n\t}\n\tcpk, err := newCompressedPublicKey(value.key)\n\tif err != nil {\n\t\treturn persistedEntry{}, errors.AddContext(err, \"newPersistedEntry: failed to compress key\")\n\t}\n\tif value.entryType == modules.RegistryTypeInvalid {\n\t\terr := modules.ErrInvalidRegistryEntryType\n\t\tbuild.Critical(err)\n\t\treturn persistedEntry{}, err\n\t}\n\tpe := persistedEntry{\n\t\tKey: cpk,\n\t\tSignature: value.signature,\n\t\tTweak: value.tweak,\n\t\tType: value.entryType,\n\n\t\tDataLen: uint8(len(value.data)),\n\t\tExpiry: compressedBlockHeight(value.expiry),\n\t\tRevision: value.revision,\n\t}\n\tcopy(pe.Data[:], value.data)\n\treturn pe, nil\n}", "func (r *RPCKeyRing) ImportPublicKey(pubKey *btcec.PublicKey,\n\taddrType waddrmgr.AddressType) error {\n\n\tctxt, cancel := context.WithTimeout(context.Background(), r.rpcTimeout)\n\tdefer cancel()\n\n\trpcAddrType, err := toRPCAddrType(&addrType)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error converting address type: %v\", err)\n\t}\n\n\t_, err = r.walletClient.ImportPublicKey(\n\t\tctxt, &walletrpc.ImportPublicKeyRequest{\n\t\t\tPublicKey: pubKey.SerializeCompressed(),\n\t\t\tAddressType: rpcAddrType,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error importing pubkey on remote signer \"+\n\t\t\t\"instance: %v\", err)\n\t}\n\n\terr = r.WalletController.ImportPublicKey(pubKey, addrType)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error importing pubkey on local signer \"+\n\t\t\t\"instance: %v\", err)\n\t}\n\n\treturn nil\n}", "func AddEntryToIPSet(setName string) {\n\tnumIPSetEntries.Inc()\n\tipsetInventoryMap[setName]++ // adds the setName with value 1 if it doesn't exist\n\tupdateIPSetInventory(setName)\n}", "func marshalPublicKey(pub interface{}) ([]byte, error) {\n\tvar publicKeyBytes []byte\n\tvar err error\n\tswitch p := pub.(type) {\n\tcase *ecdsa.PublicKey:\n\t\t// Stolen from https://golang.org/src/crypto/x509/x509.go?s=2771:2829#L87\n\t\tpublicKeyBytes = elliptic.Marshal(p.Curve, p.X, p.Y)\n\tcase *rsa.PublicKey:\n\t\t// TODO: Append exponent\n\t\tpublicKeyBytes = p.N.Bytes()\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unsupported public key type: %T\", pub)\n\t}\n\treturn publicKeyBytes, err\n}", "func AddEntry(storage core.StorageClient) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tvar (\n\t\t\terr error\n\t\t\tentry models.Entry\n\t\t)\n\n\t\terr = c.Bind(&entry)\n\t\tif err != nil {\n\t\t\tc.Status(http.StatusBadRequest)\n\n\t\t\treturn\n\t\t}\n\n\t\tentry.Id = uuid.New().String()\n\n\t\terr = storage.Add(entry)\n\t\tif err != nil {\n\t\t\tvar storageError *core.StorageError\n\n\t\t\tif errors.As(err, &storageError) {\n\t\t\t\tc.Status(storageError.StatusCode())\n\t\t\t} else {\n\t\t\t\tc.Status(http.StatusInternalServerError)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(http.StatusCreated, entry)\n\t}\n}", "func ValidatePublicKeyRecord(k u.Key, val []byte) error {\n\tkeyparts := bytes.Split([]byte(k), []byte(\"/\"))\n\tif len(keyparts) < 3 {\n\t\treturn errors.New(\"invalid key\")\n\t}\n\n\tpkh := u.Hash(val)\n\tif !bytes.Equal(keyparts[2], pkh) {\n\t\treturn errors.New(\"public key does not match storage key\")\n\t}\n\treturn nil\n}", "func (mr *MockAnonymousMockRecorder) StorePublicKey(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"StorePublicKey\", reflect.TypeOf((*MockAnonymous)(nil).StorePublicKey), arg0, arg1)\n}", "func (priv *PrivateKey) Public() crypto.PublicKey", "func (priv *PrivateKey) Public() crypto.PublicKey", "func NewPublicKey(r io.Reader) (*PublicKey, error) {\n\trawPub, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey, _, _, _, err := ssh.ParseAuthorizedKey(rawPub)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &PublicKey{key: key}, nil\n}", "func (wlt *Wallet) AddEntry(entry Entry) error {\n\t// dup check\n\tfor _, e := range wlt.Entries {\n\t\tif e.Address == entry.Address {\n\t\t\treturn errors.New(\"duplicate address entry\")\n\t\t}\n\t}\n\n\twlt.Entries = append(wlt.Entries, entry)\n\treturn nil\n}", "func (system *System) SavePublicKey(publicKey io.Reader) error {\n\tdb := GetGORMDbConnection()\n\tdefer Close(db)\n\n\tk, err := ioutil.ReadAll(publicKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot read public key for clientID %s: %s\", system.ClientID, err.Error())\n\t}\n\n\tkey, err := ReadPublicKey(string(k))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid public key for clientID %s: %s\", system.ClientID, err.Error())\n\t}\n\tif key == nil {\n\t\treturn fmt.Errorf(\"invalid public key for clientID %s\", system.ClientID)\n\t}\n\n\tencryptionKey := EncryptionKey{\n\t\tBody: string(k),\n\t\tSystemID: system.ID,\n\t}\n\n\t// Only one key should be valid per system. Soft delete the currently active key, if any.\n\terr = db.Where(\"system_id = ?\", system.ID).Delete(&EncryptionKey{}).Error\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to soft delete previous encryption keys for clientID %s: %s\", system.ClientID, err.Error())\n\t}\n\n\terr = db.Create(&encryptionKey).Error\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not save public key for clientID %s: %s\", system.ClientID, err.Error())\n\t}\n\n\treturn nil\n}", "func (pkv PublicKeyValidator) CreateRecord(signingKey crypto.PrivKey, encryptionKey *[32]byte) ([]byte, error) {\n\tpublicKey := &pb.PublicKey{\n\t\tType: pb.KeyType_Curve25519,\n\t\tCreatedAt: ptypes.TimestampNow(),\n\t\tData: encryptionKey[:],\n\t}\n\n\ttoSign, err := proto.Marshal(publicKey)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tpublicKey.Signature, err = signingKey.Sign(toSign)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tpublicKey.SignatureKey, err = signingKey.GetPublic().Bytes()\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tserialized, err := proto.Marshal(publicKey)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\treturn serialized, nil\n}", "func (ks *KeyStore) Add(privateKey *rsa.PrivateKey, kid string) {\n\tks.mu.Lock()\n\tdefer ks.mu.Unlock()\n\n\tks.store[kid] = privateKey\n}", "func addEntry(t *testing.T, key string, keyspace uint) {\n\t// Insert at least one event to make sure db exists\n\tc, err := rd.Dial(\"tcp\", host)\n\tif err != nil {\n\t\tt.Fatal(\"connect\", err)\n\t}\n\t_, err = c.Do(\"SELECT\", keyspace)\n\tif err != nil {\n\t\tt.Fatal(\"select\", err)\n\t}\n\tdefer c.Close()\n\t_, err = c.Do(\"SET\", key, \"bar\", \"EX\", \"360\")\n\tif err != nil {\n\t\tt.Fatal(\"SET\", err)\n\t}\n}", "func (h *IPSecVppHandler) AddSAEntry(saID uint32, sa *ipsec.SecurityAssociations_SA) error {\n\treturn h.sadAddDelEntry(saID, sa, true)\n}", "func ecdsaPublicKeyImport(x509Cert *x509.Certificate) (*ecdsa.PublicKey, error) {\n\tpk := x509Cert.PublicKey\n\n\tlowLevelKey, ok := pk.(*ecdsa.PublicKey)\n\tif !ok {\n\t\treturn nil, errors.New(\"certificate does not contain valid ECDSA public key\")\n\t}\n\n\treturn lowLevelKey, nil\n}", "func (pk *PublicKey) Pack(buf []byte) {\n\tif len(buf) != PublicKeySize {\n\t\tpanic(\"buf must be of length PublicKeySize\")\n\t}\n\n\tpk.pk.Pack(buf)\n}", "func encodePublicKey(public *rsa.PublicKey) ([]byte, error) {\n\tpublicBytes, err := x509.MarshalPKIXPublicKey(public)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pem.EncodeToMemory(&pem.Block{\n\t\tBytes: publicBytes,\n\t\tType: \"PUBLIC KEY\",\n\t\tHeaders: nil,\n\t}), nil\n}", "func (c *directClient) PutEntry(ctx context.Context, _ cipher.SecKey, entry *disc.Entry) error {\n\tc.mx.Lock()\n\tdefer c.mx.Unlock()\n\tc.entries[entry.Static] = entry\n\treturn nil\n}", "func (p *Resolver) AddForkEntry(entry *model.ProcessCacheEntry) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tp.insertForkEntry(entry, model.ProcessCacheEntryFromEvent)\n}", "func (lib *PKCS11Lib) exportRSAPublicKey(session pkcs11.SessionHandle, pubHandle pkcs11.ObjectHandle) (crypto.PublicKey, error) {\n\tlogger.Tracef(\"session=0x%X, obj=0x%X\", session, pubHandle)\n\ttemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_MODULUS, nil),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_PUBLIC_EXPONENT, nil),\n\t}\n\texported, err := lib.Ctx.GetAttributeValue(session, pubHandle, template)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tvar modulus = new(big.Int)\n\tmodulus.SetBytes(exported[0].Value)\n\tvar bigExponent = new(big.Int)\n\tbigExponent.SetBytes(exported[1].Value)\n\tif bigExponent.BitLen() > 32 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\tif bigExponent.Sign() < 1 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\texponent := int(bigExponent.Uint64())\n\tresult := rsa.PublicKey{\n\t\tN: modulus,\n\t\tE: exponent,\n\t}\n\tif result.E < 2 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\treturn &result, nil\n}", "func (s *BaserpnListener) EnterSignedAtom(ctx *SignedAtomContext) {}", "func (k *EnterpriseCertSigner) Public(ignored struct{}, publicKey *[]byte) (err error) {\n\tif len(k.cert.Certificate) == 0 {\n\t\treturn nil\n\t}\n\tcert, err := x509.ParseCertificate(k.cert.Certificate[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\t*publicKey, err = x509.MarshalPKIXPublicKey(cert.PublicKey)\n\treturn err\n}", "func (ctx Ctx) ImportPublicKeyInfo(cert Cert) (Key, error) {\n\tvar res Key\n\tif C.CryptImportPublicKeyInfoEx(ctx.hProv, C.MY_ENC_TYPE, &cert.pCert.pCertInfo.SubjectPublicKeyInfo, 0, 0, nil, &res.hKey) == 0 {\n\t\treturn res, getErr(\"Error importing public key info\")\n\t}\n\treturn res, nil\n}", "func (k Keeper) addPubkey(ctx sdk.Context, pubkey crypto.PubKey) {\n\taddr := pubkey.Address()\n\tk.setAddrPubkeyRelation(ctx, addr, pubkey)\n}", "func (a *Account) PublicKey() *PubKey {\n\tk := new(PubKey)\n\tcopy(k[:], a.pub[:])\n\treturn k\n}", "func (d *Deployer) AddEntry(name, value string) (*r.ChangeResourceRecordSetsResponse, error) {\n\tif !strings.HasPrefix(name, \"_dnslink.\") {\n\t\treturn nil, errors.New(\"invalid dnslink name\")\n\t}\n\tformattedValue := fmt.Sprintf(\"\\\"%s\\\"\", value)\n\treturn d.client.Zone(d.zoneID).Add(\"TXT\", name, formattedValue)\n}", "func (s Seed) PublicKey(index uint64) types.SiaPublicKey {\n\tkey := s.deriveKeyPair(index)\n\treturn types.SiaPublicKey{\n\t\tAlgorithm: types.SignatureEd25519,\n\t\tKey: key[len(key)-ed25519.PublicKeySize:],\n\t}\n}", "func NewPublicKey(ki crypto.PubKey) PublicKey {\n\treturn &publicKey{ki: ki}\n}", "func submitEntryToAnchorChain(aRecord *AnchorRecord) error {\n\n\t//Marshal aRecord into json\n\tjsonARecord, err := json.Marshal(aRecord)\n\tanchorLog.Debug(\"submitEntryToAnchorChain - jsonARecord: \", string(jsonARecord))\n\tif err != nil {\n\t\treturn err\n\t}\n\tbufARecord := new(bytes.Buffer)\n\tbufARecord.Write(jsonARecord)\n\t//Sign the json aRecord with the server key\n\taRecordSig := serverPrivKey.Sign(jsonARecord)\n\t//Encode sig into Hex string\n\tbufARecord.Write([]byte(hex.EncodeToString(aRecordSig.Sig[:])))\n\n\t//Create a new entry\n\tentry := common.NewEntry()\n\tentry.ChainID = anchorChainID\n\tanchorLog.Debug(\"anchorChainID: \", anchorChainID)\n\tentry.Content = bufARecord.Bytes()\n\n\tbuf := new(bytes.Buffer)\n\t// 1 byte version\n\tbuf.Write([]byte{0})\n\t// 6 byte milliTimestamp (truncated unix time)\n\tbuf.Write(milliTime())\n\t// 32 byte Entry Hash\n\tbuf.Write(entry.Hash().Bytes())\n\t// 1 byte number of entry credits to pay\n\tbinaryEntry, err := entry.MarshalBinary()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tanchorLog.Info(\"jsonARecord binary entry: \", hex.EncodeToString(binaryEntry))\n\tif c, err := util.EntryCost(binaryEntry); err != nil {\n\t\treturn err\n\t} else {\n\t\tbuf.WriteByte(byte(c))\n\t}\n\ttmp := buf.Bytes()\n\tsig := serverECKey.Sign(tmp)\n\tbuf = bytes.NewBuffer(tmp)\n\tbuf.Write(serverECKey.Pub.Key[:])\n\tbuf.Write(sig.Sig[:])\n\n\tcommit := common.NewCommitEntry()\n\terr = commit.UnmarshalBinary(buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create a CommitEntry msg and send it to the local inmsgQ\n\tcm := factomwire.NewMsgCommitEntry()\n\tcm.CommitEntry = commit\n\tinMsgQ <- cm\n\n\t// create a RevealEntry msg and send it to the local inmsgQ\n\trm := factomwire.NewMsgRevealEntry()\n\trm.Entry = entry\n\tinMsgQ <- rm\n\n\treturn nil\n}", "func (i service) AddKey(ctx context.Context, key id.KeyDID) error {\n\tDID, err := NewDIDFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontract, opts, err := i.prepareTransaction(ctx, DID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"Add key to identity contract %s\", DID.ToAddress().String())\n\ttxID, done, err := i.txManager.ExecuteWithinTX(context.Background(), DID, transactions.NilTxID(), \"Check TX for add key\",\n\t\ti.ethereumTX(opts, contract.AddKey, key.GetKey(), key.GetPurpose(), key.GetType()))\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(\"add key TX failed: txID:%s\", txID.String())\n\n\t}\n\treturn nil\n\n}", "func (s *streamKey) add(entryID string, values []string, now time.Time) (string, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif entryID == \"\" || entryID == \"*\" {\n\t\tentryID = s.generateID(now)\n\t}\n\n\tentryID, err := formatStreamID(entryID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif entryID == \"0-0\" {\n\t\treturn \"\", errors.New(msgStreamIDZero)\n\t}\n\tif streamCmp(s.lastIDUnlocked(), entryID) != -1 {\n\t\treturn \"\", errors.New(msgStreamIDTooSmall)\n\t}\n\n\ts.entries = append(s.entries, StreamEntry{\n\t\tID: entryID,\n\t\tValues: values,\n\t})\n\treturn entryID, nil\n}", "func (p *PGP) SavePublicKey(keyFilename, version, passphrase string) (err error) {\n\tkeyBytes, err := p.toPublicKey(version)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot save public key: %s\", err)\n\t}\n\tif len(passphrase) > 0 {\n\t\tc := &AesCrypto{\n\t\t\tCipherMode: CBC,\n\t\t\tPadding: NoPadding,\n\t\t}\n\t\tencStr, err := c.Encrypt(string(keyBytes[:]), []byte(passphrase))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tkeyBytes = []byte(encStr)\n\t}\n\t// write the public key to a file\n\terr = ioutil.WriteFile(keyFilename, keyBytes, os.ModePerm)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot save public key: %s\", err)\n\t}\n\treturn nil\n}", "func (pk PublicKey) Encode() []byte {\n\treturn pk.publicKey.Encode()\n}", "func (nr NodeRecord) GetPublicKey() (string, error) {\n\treturn nr.Record.PublicKey, nil\n}", "func (s *LunaKeyStore) AddKey(keyInfo trustmanager.KeyInfo, privKey data.PrivateKey) error {\n\n\tvar (\n\t\tecdsaPublicKey *data.ECDSAPublicKey\n\t\trsaPublicKey *data.RSAPublicKey\n\t\terr error\n\t)\n\n\tlogrus.Debugf(\"LunaKeyStore.AddKey\")\n\n\trole := keyInfo.Role\n\n\tgeneratateRootKeyOnly := strings.ToLower(os.Getenv(\"NOTARY_LUNA_GENERATE_ROOT_KEYS_ONLY\")) == \"true\"\n\n\tif generatateRootKeyOnly && role != data.CanonicalRootRole {\n\t\treturn errors.New(\"Can only generate root keys in generate root keys only mode.\")\n\t}\n\n\talg := privKey.Algorithm()\n\n\tif alg == data.ECDSAKey {\n\t\tecdsaPublicKey, err = getECDSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting ECDSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else if alg == data.RSAKey {\n\t\trsaPublicKey, err = getRSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting RSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn errors.New(\"Invalid key type.\")\n\t}\n\n\tp, session, c, err := SetupLuna(true, s.passRetriever)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer CleanupLuna(p, session, c)\n\tgun := keyInfo.Gun\n\n\tif alg == data.ECDSAKey {\n\t\tlunaPrivateKey, err := generateECDSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t//Store the public key value for the generated key in the public key for the added key.\n\t\tlunaECDSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.ECDSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\tecdsaPublicKey.Value = lunaECDSAPublicKey.Value\n\t\tecdsaPublicKey.ResetID()\n\t} else if alg == data.RSAKey {\n\t\tlunaPrivateKey, err := generateRSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlunaRSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.RSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\trsaPublicKey.Value = lunaRSAPublicKey.Value\n\t\trsaPublicKey.ResetID()\n\t}\n\tfmt.Printf(\"Luna: Generated %s key: %s\\n\", role, privKey.ID())\n\n\treturn nil\n}", "func MakePublicKey(privateKey *[64]byte) (publicKey *[32]byte) {\n\tpublicKey = new([32]byte)\n\n\th := sha512.New()\n\th.Write(privateKey[:32])\n\tdigest := h.Sum(nil)\n\n\tdigest[0] &= 248\n\tdigest[31] &= 127\n\tdigest[31] |= 64\n\n\tvar A edwards25519.ExtendedGroupElement\n\tvar hBytes [32]byte\n\tcopy(hBytes[:], digest)\n\tedwards25519.GeScalarMultBase(&A, &hBytes)\n\tA.ToBytes(publicKey)\n\n\tcopy(privateKey[32:], publicKey[:])\n\treturn\n}", "func Add(a, b *ecdsa.PublicKey) *ecdsa.PublicKey {\n\tkey := new(ecdsa.PublicKey)\n\tkey.Curve = Secp256k1()\n\tkey.X, key.Y = Secp256k1().Add(a.X, a.Y, b.X, b.Y)\n\treturn key\n}", "func (t *EnterEntry) Encode(w io.Writer) error {\n\tif _, err := w.Write([]byte{EntryEnter}); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := leb128.WriteVarUint32(w, uint32(len(t.ModuleName))); err != nil {\n\t\treturn err\n\t}\n\tif _, err := w.Write([]byte(t.ModuleName)); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := leb128.WriteVarUint32(w, t.FunctionIndex); err != nil {\n\t\treturn err\n\t}\n\n\treturn t.FunctionSignature.MarshalWASM(w)\n}", "func NewPublicKey(name ndn.Name, key *rsa.PublicKey) (keychain.PublicKey, error) {\n\tif !keychain.IsKeyName(name) {\n\t\treturn nil, keychain.ErrKeyName\n\t}\n\tvar pub publicKey\n\tpub.name = name\n\tpub.key = key\n\treturn &pub, nil\n}", "func (s *Store) Add(ctx context.Context, key interface{}, v json.Marshaler) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\n\tb, err := v.MarshalJSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\n\tif _, ok := s.m[key]; ok {\n\t\treturn store.ErrKeyExists\n\t}\n\n\ts.m[key] = entry{data: b}\n\treturn nil\n}", "func (ks *KeyStore) PublicKey(kid string) (*rsa.PublicKey, error) {\n\tks.mu.RLock()\n\tdefer ks.mu.RUnlock()\n\n\tprivateKey, found := ks.store[kid]\n\tif !found {\n\t\treturn nil, errors.New(\"kid lookup failed\")\n\t}\n\treturn &privateKey.PublicKey, nil\n}", "func (o *TppCertificateParams) SetPublicKey(v string) {\n\to.PublicKey = v\n}", "func (c *Client) FilterEntryAdd(tenant, filter, entry, etherType, ipProto, srcPortFrom, srcPortTo, dstPortFrom, dstPortTo string) error {\n\n\tme := \"FilterEntryAdd\"\n\n\trn := rnFilterEntry(entry)\n\tdn := dnFilterEntry(tenant, filter, entry)\n\n\tapi := \"/api/node/mo/uni/\" + dn + \".json\"\n\n\turl := c.getURL(api)\n\n\tj := fmt.Sprintf(`{\"vzEntry\":{\"attributes\":{\"dn\":\"uni/%s\",\"name\":\"%s\",\"etherT\":\"%s\",\"status\":\"created,modified\",\"prot\":\"%s\",\"sFromPort\":\"%s\",\"sToPort\":\"%s\",\"dFromPort\":\"%s\",\"dToPort\":\"%s\",\"rn\":\"%s\"}}}`,\n\t\tdn, entry, etherType, ipProto, srcPortFrom, srcPortTo, dstPortFrom, dstPortTo, rn)\n\n\tc.debugf(\"%s: url=%s json=%s\", me, url, j)\n\n\tbody, errPost := c.post(url, contentTypeJSON, bytes.NewBufferString(j))\n\tif errPost != nil {\n\t\treturn fmt.Errorf(\"%s: %v\", me, errPost)\n\t}\n\n\tc.debugf(\"%s: reply: %s\", me, string(body))\n\n\treturn parseJSONError(body)\n}", "func readPublicKey(d *pluginsdk.ResourceData, pubKey interface{}) error {\n\tpubKeyBytes, err := x509.MarshalPKIXPublicKey(pubKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal public key error: %s\", err)\n\t}\n\tpubKeyPemBlock := &pem.Block{\n\t\tType: \"PUBLIC KEY\",\n\t\tBytes: pubKeyBytes,\n\t}\n\n\td.Set(\"public_key_pem\", string(pem.EncodeToMemory(pubKeyPemBlock)))\n\n\tsshPubKey, err := ssh.NewPublicKey(pubKey)\n\tif err == nil {\n\t\t// Not all EC types can be SSH keys, so we'll produce this only\n\t\t// if an appropriate type was selected.\n\t\tsshPubKeyBytes := ssh.MarshalAuthorizedKey(sshPubKey)\n\t\td.Set(\"public_key_openssh\", string(sshPubKeyBytes))\n\t} else {\n\t\td.Set(\"public_key_openssh\", \"\")\n\t}\n\treturn nil\n}", "func (mc *MemoryStorage) Add(key string, data interface{}) {\n\tmc.Lock()\n\tif _, found := mc.bucket[key]; found {\n\t\tdelete(mc.bucket, key)\n\t}\n\tmc.bucket[key] = entity{object: data}\n\tmc.Unlock()\n}", "func _dbKeyForMessageEntry(publicKey []byte, tstampNanos uint64) []byte {\n\t// Make a copy to avoid multiple calls to this function re-using the same slice.\n\tprefixCopy := append([]byte{}, _PrefixPublicKeyTimestampToPrivateMessage...)\n\tkey := append(prefixCopy, publicKey...)\n\tkey = append(key, EncodeUint64(tstampNanos)...)\n\treturn key\n}", "func (oz *OutputZip) addZipEntry(name string, source ZipEntryContents) (ZipEntryContents, error) {\n\tif existingSource, exists := oz.sourceByDest[name]; exists {\n\t\treturn existingSource, nil\n\t}\n\toz.sourceByDest[name] = source\n\t// Delay writing an entry if entries need to be rearranged.\n\tif oz.emulateJar || oz.sortEntries {\n\t\treturn nil, nil\n\t}\n\treturn nil, source.WriteToZip(name, oz.outputWriter)\n}", "func (s *slotsPosition) PutEntryHeader(e *EntryHeader) bool {\n\te.nextFree &= IdMask\n\treturn s.Put(e.nextFree)\n}", "func NewPublicKey(authenticatorType AuthenticatorType, signatureAlgorithm SignatureAlgorithm, keyData []byte, keyID string) (*PublicKey, error) {\n\tnewKeyID := \"\"\n\tswitch authenticatorType {\n\tcase Pgp:\n\t\tid, err := extractPgpKeyID(keyData)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnewKeyID = id\n\t\tif signatureAlgorithm != PGPUnused {\n\t\t\treturn nil, fmt.Errorf(\"expected undefined signature algorithm with PGP key type\")\n\t\t}\n\tcase Pkix, Jwt:\n\t\tid, err := extractPkixKeyID(keyData, keyID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnewKeyID = id\n\t\tif signatureAlgorithm == UnknownSigningAlgorithm || signatureAlgorithm == PGPUnused {\n\t\t\treturn nil, fmt.Errorf(\"expected signature algorithm with JWT/PKIX key type\")\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid AuthenticatorType\")\n\t}\n\n\treturn &PublicKey{\n\t\tAuthenticatorType: authenticatorType,\n\t\tSignatureAlgorithm: signatureAlgorithm,\n\t\tKeyData: keyData,\n\t\tID: newKeyID,\n\t}, nil\n}", "func (j *Journal) AddEntry(entry entry.Entry) {\n\tj.Entries = append(j.Entries, entry)\n\tj.NumEntries++\n\n\treturn\n}", "func MyIdentityKey() []byte {\n\treturn identityKey.PublicKey.Serialize()\n}", "func (ec *EthereumChain) OnPublicKeyPublished(\n\tkeepAddress common.Address,\n\thandler func(event *eth.PublicKeyPublishedEvent),\n) (subscription.EventSubscription, error) {\n\tkeepContract, err := ec.getKeepContract(keepAddress)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create contract abi: [%v]\", err)\n\t}\n\n\treturn keepContract.WatchPublicKeyPublished(\n\t\tfunc(\n\t\t\tPublicKey []byte,\n\t\t\tblockNumber uint64,\n\t\t) {\n\t\t\thandler(&eth.PublicKeyPublishedEvent{\n\t\t\t\tPublicKey: PublicKey,\n\t\t\t})\n\t\t},\n\t\tfunc(err error) error {\n\t\t\treturn fmt.Errorf(\"keep created callback failed: [%v]\", err)\n\t\t},\n\t)\n}", "func (h *HostsManager) add(ip, hostname string) error {\n\th.Lock()\n\tdefer h.Unlock()\n\th.hosts[ip] = hostname\n\tif err := OverwriteFile(h.path, h.String()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s NativeSigner) PublicKey() ([]byte, error) {\n\tkeybuf := new(bytes.Buffer)\n\tif err := (*openpgp.Entity)(&s).Serialize(keybuf); err != nil {\n\t\treturn nil, err\n\t}\n\treturn keybuf.Bytes(), nil\n}", "func (authcl *Client) AddKey(key, description string, temp bool) error {\n\terr := authcl.LoadToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewkey := gogs.PublicKey{Key: key, Title: description}\n\taddress := fmt.Sprintf(\"/api/v1/user/keys\")\n\tres, err := authcl.Post(address, newkey)\n\tif err != nil {\n\t\treturn err\n\t} else if res.StatusCode != http.StatusCreated {\n\t\treturn fmt.Errorf(\"[Add key] Failed. Server returned %s\", res.Status)\n\t}\n\tweb.CloseRes(res.Body)\n\treturn nil\n}", "func StoreECDSAPublicKey(publicKey *ecdsa.PublicKey, path string) error {\n\tpemBlock, err := EncodePublicKeyToPEM(publicKey)\n\tif err != nil {\n\t\treturn errors.WithStackTrace(err)\n\t}\n\treturn errors.WithStackTrace(StorePEM(pemBlock, path))\n}", "func (i *Identity) Public() (*ecdsa.PublicKey, error) {\n\treturn crypto.ParseECDSAPublicKey(i.PublicKey)\n}", "func (o KeystoresAliasesPkcs12CertsInfoCertInfoOutput) PublicKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KeystoresAliasesPkcs12CertsInfoCertInfo) *string { return v.PublicKey }).(pulumi.StringPtrOutput)\n}", "func (store *keyStore) GetPublicKey(address string) (*openpgp.Entity, error) {\n\tel := store.lookupPublicKey(address)\n\tif len(el) > 0 {\n\t\treturn el[0], nil\n\t}\n\treturn nil, nil\n}", "func (kp *KeyPool) AddVerifyKey(key *[ed25519.PublicKeySize]byte) {\n\tkp.mapMutex.Lock()\n\tdefer kp.mapMutex.Unlock()\n\tkp.VerifyPubKeys[*key] = true\n}", "func (rm *ReconstructingMember) individualPublicKey() *bn256.G2 {\n\treturn rm.publicKeySharePoints[0]\n}", "func (pk *PublicKey) SaveToDB() error {\n\treturn model.SetPublicKey(string(pk.ID), pk)\n}", "func (store *KVStore) add(key string, val []byte, isOrigin bool) {\n\tstore.ht[key] = val\n\tstore.isOrigin[key] = isOrigin\n}", "func (ec *ECPoint) ToPublicKey() *ecdsa.PublicKey {\n\tres := new(ecdsa.PublicKey)\n\tres.X = ec.X\n\tres.Y = ec.Y\n\tres.Curve = ec.Curve\n\n\treturn res\n}", "func (kb *Keybase) ImportPubKey(name, armor string) (err error) {\n\tkb.mx.Lock()\n\tdefer kb.mx.Unlock()\n\treturn kb.kb.ImportPubKey(name, armor)\n}", "func (o KeystoresAliasesKeyCertFileCertsInfoCertInfoOutput) PublicKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KeystoresAliasesKeyCertFileCertsInfoCertInfo) *string { return v.PublicKey }).(pulumi.StringPtrOutput)\n}", "func WithPublicKey(publicKey *PublicKeyType) Opt {\n\treturn func(opts *Options) {\n\t\topts.PublicKey = publicKey\n\t}\n}" ]
[ "0.63024616", "0.59909403", "0.569348", "0.5526946", "0.5513472", "0.5460001", "0.5453411", "0.5379979", "0.533164", "0.53291917", "0.532534", "0.5313849", "0.5195983", "0.515629", "0.51547736", "0.51377964", "0.50954324", "0.50908095", "0.50813365", "0.50612247", "0.5059582", "0.5053476", "0.5044166", "0.5040529", "0.50394887", "0.50099945", "0.5005571", "0.4987909", "0.49824768", "0.49661624", "0.49561372", "0.49363592", "0.49344683", "0.49298465", "0.49046123", "0.48988062", "0.48965222", "0.48780137", "0.48716468", "0.48716468", "0.4867667", "0.4828541", "0.48273677", "0.48048905", "0.47933063", "0.4783816", "0.47535288", "0.47443968", "0.47397164", "0.47362936", "0.472725", "0.471893", "0.47145432", "0.47057664", "0.47021678", "0.47018716", "0.46941057", "0.46899536", "0.4689769", "0.46842408", "0.46769923", "0.4675316", "0.46740147", "0.46712714", "0.46687576", "0.4662243", "0.4654695", "0.4650483", "0.46481568", "0.46354544", "0.46345562", "0.46269768", "0.46248388", "0.46231812", "0.46205243", "0.4619878", "0.46175912", "0.46086717", "0.45992547", "0.45967022", "0.45963252", "0.45948568", "0.45944494", "0.4587871", "0.45850253", "0.45767793", "0.45748705", "0.45710596", "0.4568785", "0.4563817", "0.45554936", "0.45529372", "0.45380667", "0.4536425", "0.4532901", "0.45322222", "0.45303544", "0.45266858", "0.45243704", "0.45096633" ]
0.847996
0
SetSessionState implemented in memory.
SetSessionState реализован в памяти.
func (ms *MemStore) SetSessionState( sessionStateKey string, sessionState *session.State, ) error { ms.sessionStates[sessionStateKey] = sessionState return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (mc *mgmtClient) SetSessionState(ctx context.Context, sessionID string, state []byte) error {\n\tuuid, err := uuid.New()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tamqpMsg := &amqp.Message{\n\t\tValue: map[string]interface{}{\n\t\t\t\"session-id\": sessionID,\n\t\t\t\"session-state\": state,\n\t\t},\n\t\tApplicationProperties: map[string]interface{}{\n\t\t\t\"operation\": \"com.microsoft:set-session-state\",\n\t\t\t\"com.microsoft:tracking-id\": uuid.String(),\n\t\t},\n\t}\n\n\tresp, err := mc.doRPCWithRetry(ctx, amqpMsg, 5, 5*time.Second)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.Code != 200 {\n\t\treturn ErrAMQP(*resp)\n\t}\n\n\treturn nil\n}", "func (b *BaseHandler) SetSession(key interface{}, value interface{}) {\n\tb.sessionStore.Set(b, key, value)\n}", "func (s *StorageBase) SetSession(ctx context.Context, sessionId string, sessionData *gmap.StrAnyMap, ttl time.Duration) error {\n\treturn ErrorDisabled\n}", "func (csm *RedisCsm) Set(sessionID int64, state string) {\n\tkey := csm.key(sessionID)\n\toldData := csm.getOrCreate(key)\n\n\toldData[\"__state__\"] = state\n\n\tbody, err := json.Marshal(oldData)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcsm.set(key, string(body))\n\n}", "func (cmd *Start) SetState(agg types.Aggregate) error {\n\tif s, ok := agg.(*aggregates.Session); ok {\n\t\tcmd.session = s\n\t\treturn nil\n\t} else {\n\t\treturn errors.New(\"can't cast\")\n\t}\n}", "func (w *Worker) SetSession(s *Session) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\tw.s = s\n}", "func (b *BaseHandler) setSessionStore(store SessionStore) {\n\tb.sessionStore = store\n}", "func SetSession(client *client.Client, db *db.Database, log *log.Logger) {\n\ts = &Session{client, db, log}\n}", "func (s *StorageFile) SetSession(ctx context.Context, sessionId string, sessionData *gmap.StrAnyMap, ttl time.Duration) error {\n\tintlog.Printf(ctx, \"StorageFile.SetSession: %s, %v, %v\", sessionId, sessionData, ttl)\n\tpath := s.sessionFilePath(sessionId)\n\tcontent, err := json.Marshal(sessionData)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Encrypt with AES.\n\tif s.cryptoEnabled {\n\t\tcontent, err = gaes.Encrypt(content, DefaultStorageFileCryptoKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfile, err := gfile.OpenWithFlagPerm(\n\t\tpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tif _, err = file.Write(gbinary.EncodeInt64(gtime.TimestampMilli())); err != nil {\n\t\terr = gerror.Wrapf(err, `write data failed to file \"%s\"`, path)\n\t\treturn err\n\t}\n\tif _, err = file.Write(content); err != nil {\n\t\terr = gerror.Wrapf(err, `write data failed to file \"%s\"`, path)\n\t\treturn err\n\t}\n\treturn nil\n}", "func setSession(c echo.Context, r *http.Response) {\r\n\r\n\tfor _, cookie := range r.Cookies() {\r\n\r\n\t\tif cookie.Name == \"PHPSESSID\" {\r\n\r\n\t\t\tsess, _ := session.Get(\"Session\", c)\r\n\t\t\tsess.Options = &sessions.Options{\r\n\t\t\t\tPath: \"*\",\r\n\t\t\t\tMaxAge: 60 * 3,\r\n\t\t\t\tHttpOnly: true,\r\n\t\t\t}\r\n\t\t\tsess.Values[\"PHPSESSID\"] = cookie.Value\r\n\r\n\t\t\tsess.Save(c.Request(), c.Response())\r\n\t\t}\r\n\t}\r\n}", "func (node *DataNode) SetSession(session *sessionutil.Session) {\n\tnode.sessionMu.Lock()\n\tdefer node.sessionMu.Unlock()\n\tnode.session = session\n}", "func (c *Controller) SetSession(name interface{}, value interface{}) error {\n\tif c.CruSession == nil {\n\t\tc.StartSession()\n\t}\n\treturn c.CruSession.Set(context2.Background(), name, value)\n}", "func (s *SessionTrackerV1) SetState(state SessionState) error {\n\tswitch state {\n\tcase SessionState_SessionStateRunning, SessionState_SessionStatePending, SessionState_SessionStateTerminated:\n\t\ts.Spec.State = state\n\t\treturn nil\n\tdefault:\n\t\treturn trace.BadParameter(\"invalid session state: %v\", state)\n\t}\n}", "func (p *PersistentStorage) UpdateSimSessionState(simID string, state SimulatorState) error {\n\tdefer func(now time.Time) {\n\t\trequestTime.With(\"method\", updateSimSessionState, \"data_store\", redisStore).Observe(time.Since(now).Seconds() * 1e3)\n\t}(time.Now())\n\n\tsession, err := p.FindSimSession(simID)\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn ErrNoSimSession\n\t\t}\n\n\t\treturn err\n\t}\n\tsession.State = state\n\n\treturn p.SetSimSession(session)\n}", "func NewServerSessionState(pool *redis.Pool, keyPairs [][]byte, options ...Option) (*session.ServerSessionState, error) {\n\trs := &storage{\n\t\tpool: pool,\n\t\tserializer: driver.GobSerializer,\n\t\tdefaultExpire: 604800, // 7 days\n\t\tidleTimeout: 604800, // 7 days\n\t\tabsoluteTimeout: 5184000, // 60 days\n\t}\n\tfor _, option := range options {\n\t\toption(rs)\n\t}\n\t_, err := rs.ping()\n\treturn session.NewServerSessionState(rs, keyPairs...), err\n}", "func (c *minecraftConn) setSessionHandler(handler sessionHandler) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tc.setSessionHandler0(handler)\n}", "func (s *SessionStore) Set(key, value interface{}) {\n\ts.session.Values[key] = value\n}", "func SetSession(w http.ResponseWriter, sid string) {\n\thttp.SetCookie(w, &http.Cookie{Name: SidName, Value: sid})\n}", "func (sess Session) Set(key, value string) {\n\tsess[key] = value\n}", "func (s *SessionManager) SetSession(user *User, w http.ResponseWriter, r *http.Request) error {\n\tlog.Printf(\"Saving new session for %s (id: %s)\", user.Username, user.ID)\n\tif user.Username == \"\" || user.PasswordHash == nil || user.ID == \"\" {\n\t\t// Internal sanity check to ensure we are provided valid session\n\t\treturn errors.New(errors.CodeInternal, \"incomplete user session information\")\n\t}\n\tsession, _ := s.Store.Get(r, \"session\")\n\tsession.Values[\"user_id\"] = user.ID\n\tsession.Values[\"username\"] = user.Username\n\terr := session.Save(r, w)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to save session: %s\", err)\n\t\treturn errors.InternalError(err)\n\t}\n\tlog.Printf(\"Saved new session for %s (id: %s)\", user.Username, user.ID)\n\treturn nil\n}", "func (s *Store) Set(session *entities.Session) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.sess[session.ClientID] = session\n\treturn nil\n}", "func (s *Session) Set(args SetSessionArgs) error {\n\ttReq := &Request{\n\t\tArguments: args,\n\t\tMethod: \"session-set\",\n\t}\n\tr := &Response{}\n\terr := s.Client.request(tReq, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *TrafficOpsSessionThreadsafe) setSession(url, username, password string, insecure bool, userAgent string, useCache bool, timeout time.Duration) error {\n\toptions := cookiejar.Options{\n\t\tPublicSuffixList: publicsuffix.List,\n\t}\n\tjar, err := cookiejar.New(&options)\n\tif err != nil {\n\t\treturn err\n\t}\n\tto := client.NewSession(username, password, url, userAgent, &http.Client{\n\t\tTimeout: timeout,\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},\n\t\t},\n\t\tJar: jar,\n\t}, useCache)\n\t*s.session = to\n\treturn nil\n}", "func (m *RedisStore) Set(key interface{}, value interface{}) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.sessionData[key] = value\n\treturn nil\n}", "func SetSession(id interface{}, user interface{}) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tsession := sessions.Default(c)\n\t\tsession.Set(\"id\", id)\n\t\tsession.Set(\"username\", user)\n\t\tsession.Save()\n\t}\n}", "func (l *localSimHostStorage) UpdateSimSessionState(simID string, state SimulatorState) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tsimSession, ok := l.simSessions[simID]\n\tif !ok {\n\t\treturn ErrNoSimSession\n\t}\n\n\tsimSession.State = state\n\n\tl.simSessions[simID] = simSession\n\n\treturn nil\n}", "func SetState(newState map[string]interface{}) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tfor key, value := range newState {\n\t\tstate[key] = value\n\t}\n}", "func (m *MemoryStorer) Set(key, value string) error {\n\tm.mut.Lock()\n\tm.sessions[key] = memorySession{\n\t\texpires: time.Now().UTC().Add(m.maxAge),\n\t\tvalue: value,\n\t}\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (mgr *SessionMgr) Set(sessionID string, key interface{}, value interface{}) {\n\tmgr.Lock.Lock()\n\tdefer mgr.Lock.Unlock()\n\n\tif session, ok := mgr.Sessions[sessionID]; ok {\n\t\tsession.Values[key] = value\n\t}\n}", "func (s *UserTurnInputSpecification) SetSessionState(v *InputSessionStateSpecification) *UserTurnInputSpecification {\n\ts.SessionState = v\n\treturn s\n}", "func SessionSetValue(ctx context.Context, name string, value interface{}) {\n\ts, ok := ctx.Value(sessionKey).(*Session)\n\tif ok {\n\t\ts.set(name, value)\n\t}\n}", "func (s *SecureSessionStore) Set(key, value string, rw http.ResponseWriter, req *http.Request) error {\n\tsession := s.getSession(req)\n\tsession.Values[key] = value\n\treturn session.Save(req, rw)\n}", "func (m *VppToken) SetState(value *VppTokenState)() {\n m.state = value\n}", "func (s *Store) SetSessionID(id []byte) {\n\ts.lock.Lock()\n\ts.sessionID = id\n\ts.lock.Unlock()\n}", "func (ms *MemStore) GetSessionState(sessionStateKey string) (\n\t*session.State,\n\terror,\n) {\n\treturn ms.sessionStates[sessionStateKey], nil\n}", "func (m *ExactMatchDataStore) SetSessions(value []ExactMatchSessionable)() {\n err := m.GetBackingStore().Set(\"sessions\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetSession(ctx context.Context, session bool, logoutURL string) context.Context {\n\tctx = context.WithValue(ctx, sessionKey, session)\n\tctx = context.WithValue(ctx, logoutKey, logoutURL)\n\treturn ctx\n}", "func (s *Sessions) Set(r *http.Request, session Session) error {\n\ts.RLock()\n\tdefer s.RUnlock()\n\tsess, err := s.Get(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.sessions[sess.ID] = session\n\treturn nil\n}", "func (st *MemSessionStore) Set(key, value interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.value[key] = value\n\treturn nil\n}", "func (p *PersistentStorage) SetSimSession(s *SimulatorSession) error {\n\tdefer func(now time.Time) {\n\t\trequestTime.With(\"method\", setSimSession, \"data_store\", redisStore).Observe(time.Since(now).Seconds() * 1e3)\n\t}(time.Now())\n\n\tkey := fmt.Sprintf(simSessionKeyFmt, s.SimulatorID)\n\terr := p.setRedisJSON(\"SET\", key, \"\", s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (hc *httpContext) setSession(userInfo *Authentication) {\n\n\tsession := hc.getSession()\n\tif session == nil {\n\t\treturn\n\t}\n\n\tsession.Values[sv[\"provider\"]] = userInfo.Provider\n\tsession.Values[sv[\"name\"]] = userInfo.Name\n\tsession.Values[sv[\"email\"]] = userInfo.Email\n\tsession.Values[sv[\"user\"]] = userInfo.UserName\n\tsession.Values[sv[\"token\"]] = userInfo.Token\n\thc.clearFlashes()\n\tsession.AddFlash(\"Logged in via \" + userInfo.Provider)\n\n\thc.saveSession(session)\n}", "func (sm *SessionMap) Set(sessionID string, session *Session) {\n\tsm.Lock.Lock()\n\tdefer sm.Lock.Unlock()\n\tsm.Sessions[sessionID] = session\n}", "func (delegateObject *delegateObject) SetState(db Database, key, value common.Hash) {\n\tdelegateObject.db.journal = append(delegateObject.db.journal, storageChange{\n\t\taccount: &delegateObject.address,\n\t\tkey: key,\n\t\tprevalue: delegateObject.GetState(db, key),\n\t})\n\tdelegateObject.setState(key, value)\n}", "func setSession(userName, token string, response http.ResponseWriter) {\n\tvalue := map[string]string{\n\t\t\"name\": userName,\n\t\t\"token\": token,\n\t}\n\tif encoded, err := cookieHandler.Encode(\"session\", value); err == nil {\n\t\tcookie := &http.Cookie{\n\t\t\tName: \"session\",\n\t\t\tValue: encoded,\n\t\t\tPath: \"/\",\n\t\t}\n\t\thttp.SetCookie(response, cookie)\n\t} else {\n\t\tlog.Println(err)\n\t}\n}", "func Set(redisdb *redis.Client, sessionID, key string, value interface{}) error {\n\n\tif _, err := redisdb.HSet(sessionID, key, value).Result(); err != nil {\n\t\treturn fmt.Errorf(\"failed to write %s to session: %s\", key, err.Error())\n\t}\n\n\treturn nil\n}", "func (m *Mob) SetState(state MobStateType) {\n\tnext := time.Now().UnixMilli()\n\n\tswitch state {\n\tcase MobStateFind:\n\t\tnext += m.FindInterval\n\tcase MobStateMove:\n\t\tnext += m.MoveInterval\n\t}\n\n\tm.mutex.Lock()\n\tm.state = state\n\tm.nextRun = next\n\tm.findRemain = m.FindCount\n\tm.mutex.Unlock()\n}", "func (s TrafficOpsSessionThreadsafe) Set(session *to.Session) {\n\ts.m.Lock()\n\t*s.session = session\n\ts.m.Unlock()\n}", "func SessionSetUser(user *models.User, session *session.Session, r *http.Request) {\n\t(*session).Set(\"id\", user.Id)\n\t(*session).Set(\"name\", user.Name)\n\t(*session).Set(\"email\", user.Email)\n}", "func Benchmark_Session(b *testing.B) {\n\tapp, store := fiber.New(), New()\n\tc := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(c)\n\tc.Request().Header.SetCookie(store.CookieName, \"12356789\")\n\n\tb.Run(\"default\", func(b *testing.B) {\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tsess, _ := store.Get(c)\n\t\t\tsess.Set(\"john\", \"doe\")\n\t\t\t_ = sess.Save()\n\t\t}\n\t})\n\n\tb.Run(\"storage\", func(b *testing.B) {\n\t\tstore = New(Config{\n\t\t\tStorage: memory.New(),\n\t\t})\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tsess, _ := store.Get(c)\n\t\t\tsess.Set(\"john\", \"doe\")\n\t\t\t_ = sess.Save()\n\t\t}\n\t})\n}", "func Test_Session_Save(t *testing.T) {\n\tt.Parallel()\n\n\t// session store\n\tstore := New()\n\n\t// fiber instance\n\tapp := fiber.New()\n\n\t// fiber context\n\tctx := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(ctx)\n\n\t// get store\n\tsess, _ := store.Get(ctx)\n\n\t// set value\n\tsess.Set(\"name\", \"john\")\n\n\t// save session\n\terr := sess.Save()\n\tutils.AssertEqual(t, nil, err)\n\n}", "func SetSessionInContext(ctx context.Context, session *Session) context.Context {\n\treturn context.WithValue(ctx, sessionContextKey, session)\n}", "func (db *DB) SetSession(sess *Session) error {\n\tif sess == nil {\n\t\treturn errors.New(\"sess is nil\")\n\t}\n\treturn db.db.Save(sess).Error\n}", "func (st *MemSessionStore) Set(key, value interface{}) error {\n\treturn (*session.MemSessionStore)(st).Set(context.Background(), key, value)\n}", "func (session *Session) Set(key string, v string) {\n\tif session.Data == nil {\n\t\tsession.Data = make(map[string]string)\n\t}\n\tsession.Data[key] = v\n}", "func SetCtx(p PTR, _ctxid int64, rpc *memrpc.Server) {\n\tC.set_ctxid(C.PTR(p), C.int64_t(_ctxid))\n\tsessionBuf[_ctxid] = &session{ctxId: _ctxid, rpcServer: rpc}\n}", "func StoreInSession(key string, value string, req *http.Request, res http.ResponseWriter) error {\n\tsession, _ := Store.New(req, SessionName)\n\n\tif err := updateSessionValue(session, key, value); err != nil {\n\t\treturn err\n\t}\n\n\treturn session.Save(req, res)\n}", "func (s *Session) Set(key string, value interface{}) {\n\tdefer s.refresh()\n\ts.values[key] = value\n}", "func (s *Session) Set(key string, value interface{}) (err error) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.Values[key] = value\n\treturn\n}", "func (c *connAttrs) SetSessionVariables(sessionVariables SessionVariables) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tc._sessionVariables = maps.Clone(sessionVariables)\n}", "func (p *OIDCIBMProvider) ValidateSessionState(s *SessionState) bool {\n\t//ctx := context.Background()\n\t//_, err := p.Verifier.Verify(ctx, s.IdToken)\n\t//if err != nil {\n\t// 20180629 - TL: Testing. This should be set back to return false and log removed.\n\t//fmt.Printf(\"oidcibm ValidateSessionState() Error: %s\\n...Returning VALID for IBM.\", err)\n\t//return false\n\t//}\n\n\t// 20180703 - TL: Logging and testing.\n\t//fmt.Printf(\"oidcibm ValidateSessionState() - Returning VALID for IBM.\", err)\n\t// return true\n\tctx := context.Background()\n\t_, err := p.Verifier.Verify(ctx, s.IDToken)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (c *minecraftConn) setSessionHandler0(handler sessionHandler) {\n\tif c.sessionHandler != nil {\n\t\tc.sessionHandler.deactivated()\n\t}\n\tc.sessionHandler = handler\n\thandler.activated()\n}", "func (ms *MemStore) StoreSession(\n\tsessionKey, rootKeyHash, chainKey string,\n\tsend, recv []string,\n) error {\n\tif len(send) != len(recv) {\n\t\treturn log.Error(\"memstore: len(send) != len(recv)\")\n\t}\n\tlog.Debugf(\"memstore.StoreSession(): %s\", sessionKey)\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\tms.sessions[sessionKey] = &memSession{\n\t\t\trootKeyHash: rootKeyHash,\n\t\t\tchainKey: chainKey,\n\t\t\tsend: send,\n\t\t\trecv: recv,\n\t\t}\n\t\tms.sessionKey = sessionKey\n\t} else {\n\t\t// session already exists -> update\n\t\t// rootKeyHash stays the same!\n\t\ts.chainKey = chainKey\n\t\ts.send = append(s.send, send...)\n\t\ts.recv = append(s.recv, recv...)\n\t}\n\treturn nil\n}", "func (s *SessionStorer) Set(f string, u []byte) {\n\ts.SetInvoked = true\n\ts.SetFn(f, u)\n}", "func SetValue(c echo.Context, key string, value interface{}) error {\n\tsess, _ := Get(c)\n\tsess.Values[key] = value\n\treturn nil\n}", "func (s *session) Set(key string, value interface{}) {\n\ts.mu.Lock()\n\ts.values[key] = value\n\ts.mu.Unlock()\n\ts.provider.update(s.sid)\n}", "func (s *Session) Set(key string, val interface{}) {\n\t// Better safe than sorry\n\tif s.data == nil {\n\t\treturn\n\t}\n\ts.data.Set(key, val)\n}", "func TestSet(t *testing.T) {\n\tsessionHandler = newDefaultHandler()\n\tret := &Session{hasStarted: false}\n\n\tvar ok bool\n\n\t//set\n\tok = ret.Set(\"name\", \"wgf\")\n\tif !ok {\n\t\tt.Error(\"set error\")\n\t}\n\n\t//get\n\tvar val string\n\tok = ret.Get(\"name\", &val)\n\n\tif !ok {\n\t\tt.Error(\"content missed after set\")\n\t}\n\tif val != \"wgf\" {\n\t\tt.Error(\"content mismatched after set\")\n\t}\n}", "func SetGlobalState(key, value string) {\n\tglobalState.Lock()\n\tglobalState.m[key] = value\n\tglobalState.Unlock()\n}", "func setSession(userName string, response http.ResponseWriter) {\n value := map[string]string{\n \"name\": userName,\n }\n if encoded, err := cookieHandler.Encode(\"session\", value); err == nil {\n cookie := &http.Cookie{\n Name: \"session\",\n Value: encoded,\n Path: \"/\",\n }\n http.SetCookie(response, cookie)\n }\n }", "func SetSessionUser(sessionID string, userID int) error {\n\tkey := stringutil.Build(\"sessionid:\", sessionID, \":userid\")\n\terr := Set(key, userID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot set key in Redis\")\n\t}\n\treturn nil\n}", "func (s *TrafficOpsSessionThreadsafe) setLegacySession(url, username, password string, insecure bool, userAgent string, useCache bool, timeout time.Duration) error {\n\toptions := cookiejar.Options{\n\t\tPublicSuffixList: publicsuffix.List,\n\t}\n\tjar, err := cookiejar.New(&options)\n\tif err != nil {\n\t\treturn err\n\t}\n\tto := legacyClient.NewSession(username, password, url, userAgent, &http.Client{\n\t\tTimeout: timeout,\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},\n\t\t},\n\t\tJar: jar,\n\t}, useCache)\n\t*s.legacySession = to\n\treturn nil\n}", "func (w *Watcher) SetState(key string, value any) {\n\tw.lock.Lock()\n\tdefer w.lock.Unlock()\n\n\tw.stateCache[key] = value\n}", "func (s *Session) Set(key string, value interface{}) {\n\ts.Values[key] = value\n}", "func (m *MacOSSoftwareUpdateStateSummary) SetState(value *MacOSSoftwareUpdateState)() {\n err := m.GetBackingStore().Set(\"state\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *session) Set(key interface{}, val interface{}) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\ts.values[key] = val\n}", "func (p *Resolver) SetState(state int64) {\n\tp.state.Store(state)\n}", "func (m *ScheduleChangeRequest) SetState(value *ScheduleChangeState)() {\n err := m.GetBackingStore().Set(\"state\", value)\n if err != nil {\n panic(err)\n }\n}", "func (c *cache) Set(session *Session) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\tsession.Lock()\n\tsession.lastAccess = time.Now()\n\tid := session.id\n\tsession.Unlock()\n\n\t// Try to compact the cache.\n\tvar requiredSpace int\n\tif _, ok := c.sessions[id]; !ok {\n\t\trequiredSpace = 1\n\t}\n\tc.compact(requiredSpace)\n\n\t// Save in cache.\n\tif MaxSessionCacheSize != 0 {\n\t\tc.sessions[id] = session\n\t}\n\n\t// Write through to database.\n\tif err := Persistence.SaveSession(id, session); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (mgr ScsManager) Use(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tvar data []byte\n\t\tvar temp string\n\t\t// get the session. All of our session data is stored in only one key in the session manager.\n\t\tsession := mgr.Manager.Load(r)\n\t\tif err := session.Touch(w); err != nil { // Make sure to get a cookie in our header if we don't have one\n\t\t\tlog.Errorf(\"Error loading session: %s\", err.Error()) // we can't panic here, because our panic handlers have not been set up\n\t\t}\n\t\tdata, _ = session.GetBytes(scsSessionDataKey)\n\t\tsessionData := NewSession()\n\t\tif data != nil {\n\t\t\tif err := sessionData.UnmarshalBinary(data); err != nil {\n\t\t\t\tlog.Errorf(\"Error unpacking session data: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif sessionData.Has(sessionResetKey) {\n\t\t\t// Our previous session requested a reset. We can't reset after writing, so we reset here at the start of the next request.\n\t\t\tsessionData.Delete(sessionResetKey)\n\t\t\tif err := session.RenewToken(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error renewing session token: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tctx := r.Context()\n\t\tctx = context.WithValue(ctx, sessionContext, sessionData)\n\t\tr = r.WithContext(ctx)\n\t\tnext.ServeHTTP(w, r)\n\n\t\t// write out the changed session. The below will attempt to write a cookie, but it can't because headers have already been written.\n\t\t// That is OK, because of our Touch above.\n\t\tif sessionData.Len() > 0 {\n\t\t\tvar err error\n\t\t\tdata, err = sessionData.MarshalBinary()\n\t\t\tif err != nil {\n\t\t\t\t// This is an application error. We put data into the session which is not serializable.\n\t\t\t\ts := \"Error marshalling session data: %s\" + err.Error()\n\t\t\t\tlog.Error(s)\n\t\t\t\thttp.Error(w, s, 500)\n\t\t\t}\n\t\t\ttemp = string(data)\n\t\t\t_ = temp\n\t\t\tif err := session.PutBytes(w, scsSessionDataKey, data); err != nil {\n\t\t\t\tlog.Errorf(\"Error putting session data: %s\", err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tif err := session.Clear(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error clearing session: %s\", err.Error())\n\t\t\t}\n\t\t}\n\t}\n\treturn mgr.Manager.Use(http.HandlerFunc(fn))\n}", "func (m *AccessPackageAssignment) SetState(value *AccessPackageAssignmentState)() {\n m.state = value\n}", "func (s *StateMgr) SetState(n State) {\n\ts.current = n\n}", "func (m *AccessPackageCatalog) SetState(value *AccessPackageCatalogState)() {\n m.state = value\n}", "func setSession(email string, writer http.ResponseWriter) {\n\tvalue := map[string]string{\n\t\t\"email\": email,\n\t}\n\tif encoded, err := cookieHandler.Encode(\"session\", value); err == nil {\n\t\tcookie := &http.Cookie{\n\t\t\tName: \"session\",\n\t\t\tValue: encoded,\n\t\t\tPath: \"/\",\n\t\t\tExpires: time.Now().Add(4 * time.Hour),\n\t\t}\n\t\thttp.SetCookie(writer, cookie)\n\t}\n}", "func SetIPNState(state string, wantRunning bool) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tipnState = state\n\tipnWantRunning = wantRunning\n\tselfCheckLocked()\n}", "func SetState(state bool, macAdd string) {\n\tvar statebit string\n\tif state == true {\n\t\tstatebit = \"01\"\n\t} else {\n\t\tstatebit = \"00\"\n\t}\n\tsendMessage(\"686400176463\"+macAdd+twenties+\"00000000\"+statebit, sockets[macAdd].IP)\n\tgo func() { Events <- EventStruct{\"stateset\", *sockets[macAdd]} }()\n}", "func (obj *StateObject) SetState(db Database, key, value math.Hash) {\n\t// If the new value is the same as old, don't set\n\tprev := obj.GetState(db, key)\n\tif prev == value {\n\t\treturn\n\t}\n\n\tobj.setState(key, value)\n}", "func (s *MemorySession) Set(key string, value interface{}) error {\n\ts.data[key] = value\n\treturn nil\n}", "func (p *OktaProvider) ValidateSessionState(s *sessions.SessionState) bool {\n\tif s.AccessToken == \"\" {\n\t\treturn false\n\t}\n\n\tvar response struct {\n\t\tActive bool `json:\"active\"`\n\t}\n\n\tform := url.Values{}\n\tform.Add(\"token\", s.AccessToken)\n\tform.Add(\"token_type_hint\", \"access_token\")\n\tform.Add(\"client_id\", p.ClientID)\n\tform.Add(\"client_secret\", p.ClientSecret)\n\n\terr := p.oktaRequest(\"POST\", p.ValidateURL.String(), form, []string{\"action:validate\"}, nil, &response)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif !response.Active {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (mg *MoveGen) SetState(st *GameState) {\n\tmg.state = st\n\n\t// reset any data associated with the old state\n\tmg.Clear()\n}", "func (r *Runner) SetState(state RunnerState) {\n\tr.state = state\n\tswitch r.state {\n\tcase Idle:\n\t\tr.animation.Play(\"Idle\")\n\tcase Running:\n\t\tr.animation.Play(\"Run\")\n\t}\n}", "func pvtNewSession(c *db.SessionCookie, firstname string, rid int, updateSessionTable bool) *Session {\n\t// lib.Ulog(\"Entering NewSession: %s (%d)\\n\", username, uid)\n\tuid := int(c.UID)\n\ts := new(Session)\n\ts.Token = c.Cookie\n\ts.Username = c.UserName\n\ts.Firstname = firstname\n\ts.UID = c.UID\n\ts.UIDorig = c.UID\n\ts.ImageURL = ui.GetImageLocation(uid)\n\ts.Breadcrumbs = make([]ui.Crumb, 0)\n\ts.Expire = c.Expire\n\ts.IP = c.IP\n\ts.UserAgent = c.UserAgent\n\tauthz.GetRoleInfo(rid, &s.PMap)\n\n\tif authz.Authz.SecurityDebug {\n\t\tfor i := 0; i < len(s.PMap.Urole.Perms); i++ {\n\t\t\tlib.Ulog(\"f: %s, perm: %02x\\n\", s.PMap.Urole.Perms[i].Field, s.PMap.Urole.Perms[i].Perm)\n\t\t}\n\t}\n\n\tvar d db.PersonDetail\n\td.UID = uid\n\n\terr := SessionManager.db.QueryRow(fmt.Sprintf(\"SELECT CoCode FROM people WHERE UID=%d\", uid)).Scan(&s.CoCode)\n\tif nil != err {\n\t\tlib.Ulog(\"Unable to read CoCode for userid=%d, err = %v\\n\", uid, err)\n\t}\n\n\tif updateSessionTable {\n\t\tlib.Console(\"JUST BEFORE InsertSessionCookie: s.IP = %s, s.UserAgent = %s\\n\", s.IP, s.UserAgent)\n\t\terr = InsertSessionCookie(s)\n\t\tif err != nil {\n\t\t\tlib.Ulog(\"Unable to save session for UID = %d to database, err = %s\\n\", uid, err.Error())\n\t\t}\n\t}\n\n\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\tSessions[c.Cookie] = s\n\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\n\treturn s\n}", "func Test_Session_Reset(t *testing.T) {\n\tt.Parallel()\n\t// session store\n\tstore := New()\n\t// fiber instance\n\tapp := fiber.New()\n\t// fiber context\n\tctx := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(ctx)\n\t// get session\n\tsess, _ := store.Get(ctx)\n\n\tsess.Set(\"name\", \"fenny\")\n\tsess.Destroy()\n\tname := sess.Get(\"name\")\n\tutils.AssertEqual(t, nil, name)\n}", "func (t *CookieAuthTransport) setSessionObject() error {\n\treq, err := t.buildAuthRequest()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar authClient = &http.Client{\n\t\tTimeout: time.Second * 60,\n\t}\n\tresp, err := authClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tt.SessionObject = resp.Cookies()\n\treturn nil\n}", "func (st *SessionStoreMySQL) Set(key, value interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.values[key] = value\n\treturn nil\n}", "func NewSessionIniter(m map[string]string) func(driver.Conn) error {\r\n\treturn func(cx driver.Conn) error {\r\n\t\tfor k, v := range m {\r\n\t\t\tqry := fmt.Sprintf(\"ALTER SESSION SET %s = '%s'\", k, strings.Replace(v, \"'\", \"''\", -1))\r\n\t\t\tst, err := cx.Prepare(qry)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn errors.Errorf(\"%s: %w\", qry, err)\r\n\t\t\t}\r\n\t\t\t_, err = st.Exec(nil) //lint:ignore SA1019 it's hard to use ExecContext here\r\n\t\t\tst.Close()\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn nil\r\n\t}\r\n}", "func SetSessionContextKey(ctx context.Context, s *Session) context.Context {\n\treturn context.WithValue(ctx, sessionCtxKey, s)\n}", "func (stateObj *stateObject) SetState(db StateDatabase, key, value common.Hash) {\n\t// If the fake storage is set, put the temporary state update here.\n\tif stateObj.fakeStorage != nil {\n\t\tstateObj.fakeStorage[key] = value\n\t\treturn\n\t}\n\t// If the new value is the same as old, don't set\n\tprev := stateObj.GetState(db, key)\n\tif prev == value {\n\t\treturn\n\t}\n\t// New value is different, update and journal the change\n\tstateObj.db.journal.append(storageChange{\n\t\taccount: &stateObj.address,\n\t\tkey: key,\n\t\tprevalue: prev,\n\t})\n\tstateObj.setState(key, value)\n}", "func SetState(stub shim.ChaincodeStubInterface) peer.Response {\r\n\targs := stub.GetStringArgs()\r\n\r\n\tif len(args) != 3 {\r\n\t\treturn shim.Error(\"Incorrect arguments. Expecting two arguments 'name of state' & 'state code'\")\r\n\t}\r\n\r\n\t_, err := strconv.Atoi(args[2])\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Incorrect data type state code should be a number!!!\")\r\n\t}\r\n\r\n\tkey := strings.ToLower(args[1])\r\n\tstub.PutState(key, []byte(args[2]))\r\n\r\n\treturn shim.Success([]byte(\"true\"))\r\n}", "func (sc *SessionCreate) SetSessionStatus(i int8) *SessionCreate {\n\tsc.mutation.SetSessionStatus(i)\n\treturn sc\n}", "func (lockedCtx *UserCtx) SetState(s aka.AkaState) {\n\tif !lockedCtx.locked {\n\t\tpanic(\"Expected locked\")\n\t}\n\tlockedCtx.state, lockedCtx.stateTime = s, time.Now()\n}" ]
[ "0.75131947", "0.6425117", "0.6318091", "0.6184344", "0.6074247", "0.6017674", "0.59498626", "0.58186895", "0.5739513", "0.57371587", "0.5629504", "0.56084186", "0.5596258", "0.5556739", "0.55478746", "0.5545527", "0.5541016", "0.5524564", "0.55016655", "0.5493186", "0.5469984", "0.5464513", "0.5445337", "0.54163444", "0.54157525", "0.5414373", "0.54126495", "0.5405365", "0.538467", "0.53321534", "0.5302065", "0.529565", "0.5285866", "0.52417654", "0.5239457", "0.5207996", "0.516072", "0.51568276", "0.51536924", "0.5148869", "0.5141785", "0.5139549", "0.51190525", "0.5114985", "0.5105479", "0.509941", "0.5081707", "0.5077738", "0.50675076", "0.5033573", "0.5033009", "0.5031834", "0.50282407", "0.50184065", "0.5003774", "0.49961704", "0.49885786", "0.49846208", "0.4984233", "0.49772", "0.49769086", "0.4957123", "0.49569422", "0.49459967", "0.4943852", "0.49270922", "0.49245882", "0.49233758", "0.49199188", "0.4916901", "0.49020776", "0.48995543", "0.48979405", "0.4892443", "0.48882467", "0.4876604", "0.48765904", "0.48734057", "0.48698193", "0.48624787", "0.48610118", "0.4860939", "0.48607576", "0.48539793", "0.48403057", "0.4833458", "0.48289764", "0.48239654", "0.48101443", "0.48081192", "0.4794619", "0.47869816", "0.4781404", "0.47685128", "0.47682968", "0.47470245", "0.47454494", "0.47451678", "0.47451183", "0.4744167" ]
0.7806558
0
StoreSession implemented in memory.
StoreSession реализован в памяти.
func (ms *MemStore) StoreSession( sessionKey, rootKeyHash, chainKey string, send, recv []string, ) error { if len(send) != len(recv) { return log.Error("memstore: len(send) != len(recv)") } log.Debugf("memstore.StoreSession(): %s", sessionKey) s, ok := ms.sessions[sessionKey] if !ok { ms.sessions[sessionKey] = &memSession{ rootKeyHash: rootKeyHash, chainKey: chainKey, send: send, recv: recv, } ms.sessionKey = sessionKey } else { // session already exists -> update // rootKeyHash stays the same! s.chainKey = chainKey s.send = append(s.send, send...) s.recv = append(s.recv, recv...) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Store() gorillaSessions.Store {\n\n}", "func (session *Session) Store() error {\n\treturn session.cache.Store(session.id, session)\n}", "func (s *inMemorySessionStore) Save(session USSDSession) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.deleteOldestIfFull()\n\tif s.store[session.ID] == nil {\n\t\ts.currentSize++\n\t}\n\ts.gcList.PushFront(&session)\n\ts.store[session.ID] = s.gcList.Front()\n}", "func (service *SessionService) StoreSession(session *entity.Session) (*entity.Session, error) {\n\tsess, err := service.conn.StoreSession(session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func (s *MemoryStore) Save(r *http.Request, w http.ResponseWriter, session *Session) error {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\tsid := session.ID\n\ts.value[sid] = session.Values\n\ts.gc[sid] = time.Now().Unix()\n\n\tcookie := NewCookie(session.CookieName(), session.ID, session.Options)\n\thttp.SetCookie(w, cookie)\n\n\treturn nil\n}", "func (ss *SessionServiceImpl) StoreSession(session *entities.Session) (*entities.Session, []error) {\n\treturn ss.sessionRepo.StoreSession(session)\n}", "func StoreInSession(key string, value string, req *http.Request, res http.ResponseWriter) error {\n\tsession, _ := Store.New(req, SessionName)\n\n\tif err := updateSessionValue(session, key, value); err != nil {\n\t\treturn err\n\t}\n\n\treturn session.Save(req, res)\n}", "func (s *Store) Set(session *entities.Session) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.sess[session.ClientID] = session\n\treturn nil\n}", "func (m *MemoryCache) Save(s *Session) error {\n\t// Basically, this provides to option to replace an old session\n\t// with a new one (change the pointer), provided that the old\n\t// one existed and is still valid.\n\tm.mx.Lock()\n\tdefer m.mx.Unlock()\n\n\tif old, ok := m.store[s.Id]; !ok || !old.Valid() {\n\t\treturn ErrUnrecognized\n\t}\n\n\tm.store[s.Id] = s\n\treturn nil\n}", "func (s *SessionStore) Save(r *http.Request, w http.ResponseWriter) {\n\ts.session.Save(r, w)\n}", "func (ss *SessionServiceImpl) StoreSession(session *entity.Session) (*entity.Session, error) {\n\tsess, err := ss.sessionRepo.StoreSession(session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func Test_Session_Save(t *testing.T) {\n\tt.Parallel()\n\n\t// session store\n\tstore := New()\n\n\t// fiber instance\n\tapp := fiber.New()\n\n\t// fiber context\n\tctx := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(ctx)\n\n\t// get store\n\tsess, _ := store.Get(ctx)\n\n\t// set value\n\tsess.Set(\"name\", \"john\")\n\n\t// save session\n\terr := sess.Save()\n\tutils.AssertEqual(t, nil, err)\n\n}", "func (store *SessionPostgresStore) save(session *sessions.Session) error {\n\tb, err := store.serializer.Serialize(session)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif store.maxLength != 0 && len(b) > store.maxLength {\n\t\treturn errors.New(\"SessionStore: the value to store is too big\")\n\t}\n\tage := session.Options.MaxAge\n\tif age == 0 {\n\t\tage = store.DefaultMaxAge\n\t}\n\ttoken := store.keyPrefix + session.ID\n\texpiry := time.Now().Add(time.Second * time.Duration(age))\n\tvar sessionData orm.Session\n\tif orm.Engine.First(&sessionData, \"token = ?\", token).RecordNotFound() {\n\t\tsessionData = orm.Session{\n\t\t\tToken: store.keyPrefix + session.ID,\n\t\t\tData: b,\n\t\t\tExpiry: expiry,\n\t\t}\n\t\tif err := orm.Engine.Create(&sessionData).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tsessionData.Data = b\n\t\tsessionData.Expiry = expiry\n\t\tif err := orm.Engine.Save(&sessionData).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (sr *SessionGormRepo) StoreSession(session *entity.Session) (*entity.Session, []error) {\n\tsess := session\n\terrs := sr.conn.Save(sess).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn sess, errs\n}", "func persistInCache(sesh *Sesh) error {\n\tif seshCache == nil {\n\t\treturn errors.New(\"This is not a session server\")\n\t}\n\tseshCache.Set(sesh.Key, *sesh)\n\treturn nil\n}", "func (s *Store) Save(session *Session) error {\n\tremoved := session.Removed()\n\tif len(removed) > 0 {\n\t\tif _, err := s.client.HDel(session.ID(), removed...).Result(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tsessionVals := make(map[string]interface{}, 0)\n\tfor key, value := range session.Values() {\n\t\tsessionVals[key] = value\n\t}\n\n\tif _, err := s.client.HMSet(session.ID(), sessionVals).Result(); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := s.client.Expire(session.ID(), s.valid).Result(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (b *BaseHandler) SetSession(key interface{}, value interface{}) {\n\tb.sessionStore.Set(b, key, value)\n}", "func (s *Session) Save() error {\n\t// Better safe than sorry\n\tif s.data == nil {\n\t\treturn nil\n\t}\n\n\t// Check if session has your own expiration, otherwise use default value\n\tif s.exp <= 0 {\n\t\ts.exp = s.config.Expiration\n\t}\n\n\t// Update client cookie\n\ts.setSession()\n\n\t// Convert data to bytes\n\tmux.Lock()\n\tdefer mux.Unlock()\n\tencCache := gob.NewEncoder(s.byteBuffer)\n\terr := encCache.Encode(&s.data.Data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to encode data: %w\", err)\n\t}\n\n\t// copy the data in buffer\n\tencodedBytes := make([]byte, s.byteBuffer.Len())\n\tcopy(encodedBytes, s.byteBuffer.Bytes())\n\n\t// pass copied bytes with session id to provider\n\tif err := s.config.Storage.Set(s.id, encodedBytes, s.exp); err != nil {\n\t\treturn err\n\t}\n\n\t// Release session\n\t// TODO: It's not safe to use the Session after called Save()\n\treleaseSession(s)\n\n\treturn nil\n}", "func (sess *Session) Store() Store {\n\treturn sess.store\n}", "func (st *MemSessionStore) Set(key, value interface{}) error {\n\treturn (*session.MemSessionStore)(st).Set(context.Background(), key, value)\n}", "func SaveSession(session *Session) {\n\n\tconn := redisConnPool.Get()\n\tdefer conn.Close()\n\n\tsessionBytes, err := json.Marshal(session)\n\tif err != nil {\n\t\tfmt.Println(\"Couldn't marshal session to string: \", err.Error())\n\t\treturn\n\t}\n\n\tkey := fmt.Sprintf(\"sessions:%s\", session.ID)\n\t_, err = conn.Do(\"SET\", key, string(sessionBytes))\n\tif err != nil {\n\t\tfmt.Println(\"Failed to set session: \", err.Error())\n\t}\n}", "func (s *SessionStore) Add(session *Session) {\n\tfmt.Println(session.AccessToken)\n\n\ts.atM.Lock()\n\ts.accessTokens[session.AccessToken] = session\n\ts.atM.Unlock()\n\n\ts.rtM.Lock()\n\ts.refreshTokens[session.RefreshToken] = session\n\ts.rtM.Unlock()\n}", "func (s *SessionStore) Set(key, value interface{}) {\n\ts.session.Values[key] = value\n}", "func (c *cache) Set(session *Session) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\tsession.Lock()\n\tsession.lastAccess = time.Now()\n\tid := session.id\n\tsession.Unlock()\n\n\t// Try to compact the cache.\n\tvar requiredSpace int\n\tif _, ok := c.sessions[id]; !ok {\n\t\trequiredSpace = 1\n\t}\n\tc.compact(requiredSpace)\n\n\t// Save in cache.\n\tif MaxSessionCacheSize != 0 {\n\t\tc.sessions[id] = session\n\t}\n\n\t// Write through to database.\n\tif err := Persistence.SaveSession(id, session); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (st *MemSessionStore) Flush() error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.value = make(map[interface{}]interface{})\n\treturn nil\n}", "func (this *SessionStorage) CreateSession(w http.ResponseWriter) (*Session) {\n session := &Session{ lastAccessed: time.Now(), storage: make(map[string]string) }\n this.sessions[this.sessionCounter] = session\n http.SetCookie(w, &http.Cookie{Name: \"session\", Value: fmt.Sprint(this.sessionCounter)})\n this.sessionCounter += 1\n session.lastAccessed = time.Now()\n return session\n}", "func (s *StorageBase) SetSession(ctx context.Context, sessionId string, sessionData *gmap.StrAnyMap, ttl time.Duration) error {\n\treturn ErrorDisabled\n}", "func (cl *APIClient) SaveSession(sessionobj map[string]interface{}) *APIClient {\n\tsessionobj[\"socketcfg\"] = map[string]string{\n\t\t\"entity\": cl.socketConfig.GetSystemEntity(),\n\t\t\"session\": cl.socketConfig.GetSession(),\n\t}\n\treturn cl\n}", "func (session *Session) StoreEngine(storeEngine string) *Session {\n\tsession.Session = session.Session.StoreEngine(storeEngine)\n\treturn session\n}", "func (m *RedisStore) Set(key interface{}, value interface{}) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.sessionData[key] = value\n\treturn nil\n}", "func (s *StorageFile) SetSession(ctx context.Context, sessionId string, sessionData *gmap.StrAnyMap, ttl time.Duration) error {\n\tintlog.Printf(ctx, \"StorageFile.SetSession: %s, %v, %v\", sessionId, sessionData, ttl)\n\tpath := s.sessionFilePath(sessionId)\n\tcontent, err := json.Marshal(sessionData)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Encrypt with AES.\n\tif s.cryptoEnabled {\n\t\tcontent, err = gaes.Encrypt(content, DefaultStorageFileCryptoKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfile, err := gfile.OpenWithFlagPerm(\n\t\tpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tif _, err = file.Write(gbinary.EncodeInt64(gtime.TimestampMilli())); err != nil {\n\t\terr = gerror.Wrapf(err, `write data failed to file \"%s\"`, path)\n\t\treturn err\n\t}\n\tif _, err = file.Write(content); err != nil {\n\t\terr = gerror.Wrapf(err, `write data failed to file \"%s\"`, path)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (b *BaseHandler) setSessionStore(store SessionStore) {\n\tb.sessionStore = store\n}", "func (m *ExactMatchDataStore) SetSessions(value []ExactMatchSessionable)() {\n err := m.GetBackingStore().Set(\"sessions\", value)\n if err != nil {\n panic(err)\n }\n}", "func CreateSessionStorage(config SessionConfig) *SessionStorage {\n storage := &SessionStorage {\n sessions: make(map[uint64]*Session),\n sessionCounter: 0,\n done: make(chan bool),\n config: config,\n }\n storage.StartClearingSessions()\n return storage\n}", "func Benchmark_Session(b *testing.B) {\n\tapp, store := fiber.New(), New()\n\tc := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(c)\n\tc.Request().Header.SetCookie(store.CookieName, \"12356789\")\n\n\tb.Run(\"default\", func(b *testing.B) {\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tsess, _ := store.Get(c)\n\t\t\tsess.Set(\"john\", \"doe\")\n\t\t\t_ = sess.Save()\n\t\t}\n\t})\n\n\tb.Run(\"storage\", func(b *testing.B) {\n\t\tstore = New(Config{\n\t\t\tStorage: memory.New(),\n\t\t})\n\t\tb.ReportAllocs()\n\t\tb.ResetTimer()\n\t\tfor n := 0; n < b.N; n++ {\n\t\t\tsess, _ := store.Get(c)\n\t\t\tsess.Set(\"john\", \"doe\")\n\t\t\t_ = sess.Save()\n\t\t}\n\t})\n}", "func (e *engine) loadSession(ctx *Context) {\n\tif AppSessionManager().IsStateful() {\n\t\tctx.subject.Session = AppSessionManager().GetSession(ctx.Req.Unwrap())\n\t}\n}", "func (st *MemSessionStore) Set(key, value interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.value[key] = value\n\treturn nil\n}", "func (pdr *ProviderMySQL) SessionNew(sid string) (session.Store, error) {\n\tc := pdr.connectInit()\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", sid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\tif err == sql.ErrNoRows {\n\t\t_, err = c.Exec(\"insert into \"+TableName+\"(`session_key`,`session_data`,`session_expiry`) values(?,?,?)\",\n\t\t\tsid, \"\", time.Now().Unix())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar kv map[interface{}]interface{}\n\tif len(data) == 0 {\n\t\tkv = make(map[interface{}]interface{})\n\t} else {\n\t\tkv, err = session.DecodeGob(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\trs := &SessionStoreMySQL{conn: c, sid: sid, values: kv}\n\treturn rs, nil\n}", "func (s *Store) Get(c *fiber.Ctx) (*Session, error) {\n\tvar fresh bool\n\tloadData := true\n\n\tid := s.getSessionID(c)\n\n\tif len(id) == 0 {\n\t\tfresh = true\n\t\tvar err error\n\t\tif id, err = s.responseCookies(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// If no key exist, create new one\n\tif len(id) == 0 {\n\t\tloadData = false\n\t\tid = s.KeyGenerator()\n\t}\n\n\t// Create session object\n\tsess := acquireSession()\n\tsess.ctx = c\n\tsess.config = s\n\tsess.id = id\n\tsess.fresh = fresh\n\n\t// Fetch existing data\n\tif loadData {\n\t\traw, err := s.Storage.Get(id)\n\t\t// Unmarshal if we found data\n\t\tif raw != nil && err == nil {\n\t\t\tmux.Lock()\n\t\t\tdefer mux.Unlock()\n\t\t\t_, _ = sess.byteBuffer.Write(raw) //nolint:errcheck // This will never fail\n\t\t\tencCache := gob.NewDecoder(sess.byteBuffer)\n\t\t\terr := encCache.Decode(&sess.data.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to decode session data: %w\", err)\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\t// both raw and err is nil, which means id is not in the storage\n\t\t\tsess.fresh = true\n\t\t}\n\t}\n\n\treturn sess, nil\n}", "func (m *MemoryStorer) Set(key, value string) error {\n\tm.mut.Lock()\n\tm.sessions[key] = memorySession{\n\t\texpires: time.Now().UTC().Add(m.maxAge),\n\t\tvalue: value,\n\t}\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (s *RedisStore) save(ctx context.Context, session *sessions.Session) error {\n\tb, err := s.serializer.Serialize(session)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif s.maxLength != 0 && len(b) > s.maxLength {\n\t\treturn errors.New(\"SessionStore: the value to store is too big\")\n\t}\n\n\tage := time.Duration(session.Options.MaxAge) * time.Second\n\tif age == 0 {\n\t\tage = time.Duration(s.DefaultMaxAge) * time.Second\n\t}\n\n\treturn s.Cmd.SetEX(ctx, s.keyPrefix+session.ID, b, age).Err()\n}", "func (s *RestStore) SaveSession(w http.ResponseWriter, r *http.Request, sessionState *SessionState) error {\n\tencToken, err := MarshalSession(sessionState, s.Cipher)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonBytes, err := json.Marshal(\n\t\t&RestStoreResponse{\n\t\t\tToken: encToken,\n\t\t\tExpiry: sessionState.RefreshDeadline,\n\t\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"internal/sessions: couldn't marshal token struct: %v\", err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(jsonBytes)\n\treturn nil\n}", "func (sess *Session) Save(w http.ResponseWriter) error {\n\treturn sess.store.Save(w, sess)\n}", "func (s *DgraphStore) Save(r *http.Request, w http.ResponseWriter,\n\tsession *sessions.Session) error {\n\t// Delete if max-age is <= 0\n\tif session.Options.MaxAge <= 0 {\n\t\tif err := s.erase(session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttp.SetCookie(w, sessions.NewCookie(session.Name(), \"\", session.Options))\n\t\treturn nil\n\t}\n\n\tif session.ID == \"\" {\n\t\tsession.ID = strings.TrimRight(\n\t\t\tbase32.StdEncoding.EncodeToString(\n\t\t\t\tsecurecookie.GenerateRandomKey(32)), \"=\")\n\t}\n\n\tif err := s.save(session); err != nil {\n\t\treturn err\n\t}\n\n\tencoded, err := securecookie.EncodeMulti(session.Name(), session.ID,\n\t\ts.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thttp.SetCookie(w, sessions.NewCookie(session.Name(), encoded, session.Options))\n\treturn nil\n}", "func (s *DatastoreStore) save(r *http.Request,\n\tsession *sessions.Session) error {\n\tif len(session.Values) == 0 {\n\t\t// Don't need to write anything.\n\t\treturn nil\n\t}\n\tserialized, err := serialize(session.Values)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tk := datastore.NameKey(s.kind, session.ID, nil)\n\tk, err = ds.Put(context.Background(), k, &Session{\n\t\tDate: time.Now(),\n\t\tValue: serialized,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not put session %s: %v\", session.ID, err)\n\t}\n\treturn nil\n}", "func (s *SessionStore) New(w http.ResponseWriter) (*Session, error) {\n\tsessionID := generateSessionID()\n\n\tif s.isCookieBased {\n\t\thttp.SetCookie(w, &http.Cookie{\n\t\t\tName: s.name,\n\t\t\tValue: sessionID,\n\t\t\tMaxAge: 0,\n\t\t\tHttpOnly: true})\n\t}\n\n\tsession := Session{\n\t\tID: sessionID,\n\t\tstore: s,\n\t\tData: make(map[string]interface{})}\n\tsession.Save()\n\treturn &session, nil\n}", "func (s *UserSession) Save(session map[string]string) bool {\n if !s.IsEncrypted() && !s.Encrypt() {\n revel.ERROR.Println(\"failed to encrypt user session when saving in cookie\")\n return false\n }\n\n session[app.STR_NAME] = s.UserName\n session[app.STR_PASSWORD] = s.Password\n session[app.STR_KEY] = s.AesKey\n session[app.STR_EXPIRE] = s.Expire\n return true\n}", "func (s *FilesystemStore) save(session *SessionImp) error {\n\tencoded, err := securecookie.EncodeMulti(session.name, session.Values,\n\t\ts.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfilename := filepath.Join(s.path, \"session_\"+session.ID)\n\tfileMutex.Lock()\n\tdefer fileMutex.Unlock()\n\treturn ioutil.WriteFile(filename, []byte(encoded), 0600)\n}", "func NewMemorySessionStore(duration time.Duration) *MemorySessionStore {\n\tm := &MemorySessionStore{\n\t\tstore: make(map[string]time.Time),\n\t\tduration: duration,\n\t\tmu: new(sync.Mutex),\n\t}\n\tgo scavenge(m)\n\treturn m\n}", "func (s *Session) Save() error {\n\treturn s.store.provider.Save(s.ID, s.Data)\n}", "func (s *RedisStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error {\n\t// Marked for deletion.\n\tif session.Options.MaxAge <= 0 {\n\t\tif err := s.delete(r.Context(), session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttp.SetCookie(w, sessions.NewCookie(session.Name(), \"\", session.Options))\n\t} else {\n\t\t// Build an alphanumeric key for the redis store.\n\t\tif session.ID == \"\" {\n\t\t\tsession.ID = strings.TrimRight(base32.StdEncoding.EncodeToString(securecookie.GenerateRandomKey(32)), \"=\")\n\t\t}\n\t\tif err := s.save(r.Context(), session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tencoded, err := securecookie.EncodeMulti(session.Name(), session.ID, s.Codecs...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttp.SetCookie(w, sessions.NewCookie(session.Name(), encoded, session.Options))\n\t}\n\treturn nil\n}", "func NewSession(cfg Config) (*Session, error) {\n\tif cfg.PortBegin >= cfg.PortEnd {\n\t\treturn nil, errors.New(\"invalid port range\")\n\t}\n\tvar err error\n\tcfg.Database, err = homedir.Expand(cfg.Database)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcfg.DataDir, err = homedir.Expand(cfg.DataDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = os.MkdirAll(filepath.Dir(cfg.Database), 0750)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl := logger.New(\"session\")\n\tdb, err := bolt.Open(cfg.Database, 0640, &bolt.Options{Timeout: time.Second})\n\tif err == bolt.ErrTimeout {\n\t\treturn nil, errors.New(\"resume database is locked by another process\")\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tdb.Close()\n\t\t}\n\t}()\n\tvar ids []string\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t_, err2 := tx.CreateBucketIfNotExists(sessionBucket)\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\tb, err2 := tx.CreateBucketIfNotExists(torrentsBucket)\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\treturn b.ForEach(func(k, _ []byte) error {\n\t\t\tids = append(ids, string(k))\n\t\t\treturn nil\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := boltdbresumer.New(db, torrentsBucket)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar dhtNode *dht.DHT\n\tif cfg.DHTEnabled {\n\t\tdhtConfig := dht.NewConfig()\n\t\tdhtConfig.Address = cfg.DHTHost\n\t\tdhtConfig.Port = int(cfg.DHTPort)\n\t\tdhtConfig.DHTRouters = strings.Join(cfg.DHTBootstrapNodes, \",\")\n\t\tdhtConfig.SaveRoutingTable = false\n\t\tdhtNode, err = dht.New(dhtConfig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = dhtNode.Start()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tports := make(map[int]struct{})\n\tfor p := cfg.PortBegin; p < cfg.PortEnd; p++ {\n\t\tports[int(p)] = struct{}{}\n\t}\n\tbl := blocklist.New()\n\tc := &Session{\n\t\tconfig: cfg,\n\t\tdb: db,\n\t\tresumer: res,\n\t\tblocklist: bl,\n\t\ttrackerManager: trackermanager.New(bl, cfg.DNSResolveTimeout),\n\t\tlog: l,\n\t\ttorrents: make(map[string]*Torrent),\n\t\ttorrentsByInfoHash: make(map[dht.InfoHash][]*Torrent),\n\t\tavailablePorts: ports,\n\t\tdht: dhtNode,\n\t\tpieceCache: piececache.New(cfg.PieceCacheSize, cfg.PieceCacheTTL, cfg.ParallelReads),\n\t\tram: resourcemanager.New(cfg.MaxActivePieceBytes),\n\t\tcreatedAt: time.Now(),\n\t\tcloseC: make(chan struct{}),\n\t\twebseedClient: http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tDialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {\n\t\t\t\t\tip, port, err := resolver.Resolve(ctx, addr, cfg.DNSResolveTimeout, bl)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tvar d net.Dialer\n\t\t\t\t\ttaddr := &net.TCPAddr{IP: ip, Port: port}\n\t\t\t\t\tdctx, cancel := context.WithTimeout(ctx, cfg.WebseedDialTimeout)\n\t\t\t\t\tdefer cancel()\n\t\t\t\t\treturn d.DialContext(dctx, network, taddr.String())\n\t\t\t\t},\n\t\t\t\tTLSHandshakeTimeout: cfg.WebseedTLSHandshakeTimeout,\n\t\t\t\tResponseHeaderTimeout: cfg.WebseedResponseHeaderTimeout,\n\t\t\t},\n\t\t},\n\t}\n\text, err := bitfield.NewBytes(c.extensions[:], 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\text.Set(61) // Fast Extension (BEP 6)\n\text.Set(43) // Extension Protocol (BEP 10)\n\tif cfg.DHTEnabled {\n\t\text.Set(63) // DHT Protocol (BEP 5)\n\t}\n\terr = c.startBlocklistReloader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif cfg.DHTEnabled {\n\t\tc.dhtPeerRequests = make(map[*torrent]struct{})\n\t\tgo c.processDHTResults()\n\t}\n\tc.loadExistingTorrents(ids)\n\tif c.config.RPCEnabled {\n\t\tc.rpc = newRPCServer(c)\n\t\terr = c.rpc.Start(c.config.RPCHost, c.config.RPCPort)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tgo c.updateStatsLoop()\n\treturn c, nil\n}", "func Session(m *session.Manager) jsonapi.Middleware {\n\treturn func(h jsonapi.Handler) jsonapi.Handler {\n\t\treturn func(req jsonapi.Request) (i interface{}, e error) {\n\t\t\tr := req.R()\n\t\t\tsess, err := m.Start(req.W(), r)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, jsonapi.E500.SetOrigin(err)\n\t\t\t}\n\n\t\t\tr = r.WithContext(context.WithValue(\n\t\t\t\tr.Context(),\n\t\t\t\tsession.SessionObjectKey,\n\t\t\t\tsess,\n\t\t\t))\n\t\t\ti, e = h(jsonapi.WrapRequest(req, r))\n\n\t\t\t_ = sess.Save(req.W())\n\t\t\treturn\n\t\t}\n\t}\n}", "func Test_Session(t *testing.T) {\n\tt.Parallel()\n\n\t// session store\n\tstore := New()\n\n\t// fiber instance\n\tapp := fiber.New()\n\n\t// fiber context\n\tctx := app.AcquireCtx(&fasthttp.RequestCtx{})\n\tdefer app.ReleaseCtx(ctx)\n\n\t// set cookie\n\tctx.Request().Header.SetCookie(store.CookieName, \"123\")\n\n\t// get session\n\tsess, err := store.Get(ctx)\n\tutils.AssertEqual(t, nil, err)\n\tutils.AssertEqual(t, true, sess.Fresh())\n\n\t// get value\n\tname := sess.Get(\"name\")\n\tutils.AssertEqual(t, nil, name)\n\n\t// set value\n\tsess.Set(\"name\", \"john\")\n\n\t// get value\n\tname = sess.Get(\"name\")\n\tutils.AssertEqual(t, \"john\", name)\n\n\t// delete key\n\tsess.Delete(\"name\")\n\n\t// get value\n\tname = sess.Get(\"name\")\n\tutils.AssertEqual(t, nil, name)\n\n\t// get id\n\tid := sess.ID()\n\tutils.AssertEqual(t, \"123\", id)\n\n\t// delete cookie\n\tctx.Request().Header.Del(fiber.HeaderCookie)\n\n\t// get session\n\tsess, err = store.Get(ctx)\n\tutils.AssertEqual(t, nil, err)\n\tutils.AssertEqual(t, true, sess.Fresh())\n\n\t// get id\n\tid = sess.ID()\n\tutils.AssertEqual(t, 36, len(id))\n}", "func (st *MemSessionStore) Flush() error {\n\treturn (*session.MemSessionStore)(st).Flush(context.Background())\n}", "func NewMemorySession() Session {\n\treturn memorySession{store: new(sync.Map)}\n}", "func (s *Session) Persist() *errors.Error {\n\tconnPool, err := GetDBConnectionFunc(sessionStore)\n\tif err != nil {\n\t\treturn errors.PackError(err.ErrNo(), \"error while trying to connecting to DB: \", err.Error())\n\t}\n\tif err = connPool.Create(\"session\", s.Token, s); err != nil {\n\t\treturn errors.PackError(err.ErrNo(), \"error while trying to create new session: \", err.Error())\n\t}\n\treturn nil\n}", "func (m *MemorySessionStore) Create() (sessionID string, err error) {\n\tid := randString(128)\n\tm.mu.Lock()\n\tm.store[id] = time.Now().Add(m.duration)\n\tm.mu.Unlock()\n\treturn id, nil\n}", "func (m *MongoDBStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error {\n\tif session.Options.MaxAge < 0 {\n\t\tif err := m.delete(session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Token.SetToken(w, session.Name(), \"\", session.Options)\n\t\treturn nil\n\t}\n\n\tif session.ID == \"\" {\n\t\tsession.ID = primitive.NewObjectID().Hex()\n\t}\n\n\tif err := m.upsert(session); err != nil {\n\t\treturn err\n\t}\n\n\tencoded, err := securecookie.EncodeMulti(session.Name(), session.ID, m.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tm.Token.SetToken(w, session.Name(), encoded, session.Options)\n\treturn nil\n}", "func (s TrafficOpsSessionThreadsafe) Set(session *to.Session) {\n\ts.m.Lock()\n\t*s.session = session\n\ts.m.Unlock()\n}", "func (s *FilesystemStore) Save(c *kelly.Context, session *SessionImp) error {\n\t// Delete if max-age is <= 0\n\tif session.Options.MaxAge <= 0 {\n\t\tif err := s.erase(session); err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttp.SetCookie(c, NewCookie(session.name, \"\", session.Options))\n\t\treturn nil\n\t}\n\n\tif session.ID == \"\" {\n\t\t// Because the ID is used in the filename, encode it to\n\t\t// use alphanumeric characters only.\n\t\tsession.ID = strings.TrimRight(\n\t\t\tbase32.StdEncoding.EncodeToString(securecookie.GenerateRandomKey(32)), \"=\")\n\t}\n\tif err := s.save(session); err != nil {\n\t\treturn err\n\t}\n\tencoded, err := securecookie.EncodeMulti(session.name, session.ID,\n\t\ts.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\thttp.SetCookie(c, NewCookie(session.name, encoded, session.Options))\n\treturn nil\n}", "func (s *InMemoryDocumentSessionOperations) Store(entity Object) error {\n\t_, hasID := s.generateEntityIdOnTheClient.tryGetIdFromInstance(entity)\n\tconcu := ConcurrencyCheck_AUTO\n\tif !hasID {\n\t\tconcu = ConcurrencyCheck_FORCED\n\t}\n\treturn s.storeInternal(entity, nil, \"\", concu)\n}", "func (rs *RedisStore) Save(sid SessionID, sessionState interface{}) error {\n\tlog.Printf(\"!!! I am about to save something to the redis db\")\n\n\tj, err := json.Marshal(sessionState)\n\tif err != nil {\n\t\tlog.Printf(\"!!! There was an error in saving\" + err.Error())\n\t\treturn err\n\t}\n\t//rs.Client.Set(sid.getRedisKey(), j, rs.SessionDuration)\n\trs.Client.Set(sid.getRedisKey(), j, time.Hour)\n\t//JAY MADE THE ABOVE CHANGE TO ATTEMPT A HARDCODED DEBUG FIX\n\treturn nil\n}", "func (mgr *SessionMgr) Set(sessionID string, key interface{}, value interface{}) {\n\tmgr.Lock.Lock()\n\tdefer mgr.Lock.Unlock()\n\n\tif session, ok := mgr.Sessions[sessionID]; ok {\n\t\tsession.Values[key] = value\n\t}\n}", "func Session() HandlerFunc {\n\treturn func(c *Context) {\n\t\tif sessionManager == nil {\n\t\t\tpanic(\"please call gow.InitSession()\")\n\t\t}\n\t\tsessionID = sessionManager.Start(c.Writer, c.Req)\n\t\tsessionManager.Extension(c.Writer, c.Req)\n\t\tc.Next()\n\t}\n}", "func (sc *SessionCreate) Save(ctx context.Context) (*Session, error) {\n\tvar (\n\t\terr error\n\t\tnode *Session\n\t)\n\tsc.defaults()\n\tif len(sc.hooks) == 0 {\n\t\tif err = sc.check(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnode, err = sc.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*SessionMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tif err = sc.check(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tsc.mutation = mutation\n\t\t\tif node, err = sc.sqlSave(ctx); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tmutation.id = &node.ID\n\t\t\tmutation.done = true\n\t\t\treturn node, err\n\t\t})\n\t\tfor i := len(sc.hooks) - 1; i >= 0; i-- {\n\t\t\tif sc.hooks[i] == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"ent: uninitialized hook (forgotten import ent/runtime?)\")\n\t\t\t}\n\t\t\tmut = sc.hooks[i](mut)\n\t\t}\n\t\tv, err := mut.Mutate(ctx, sc.mutation)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnv, ok := v.(*Session)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected node type %T returned from SessionMutation\", v)\n\t\t}\n\t\tnode = nv\n\t}\n\treturn node, err\n}", "func (st *MemSessionStore) SessionID() string {\n\treturn st.sid\n}", "func (t *SimpleChaincode) SaveSession(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\n\tvar err error\n\tfmt.Println(\"running savesession\")\n\n\tif len(args) != 2 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting 2.\")\n\t}\n\tif len(args[0]) <= 0 {\n\t\treturn nil, errors.New(\"1st argument must be a non-empty string\")\n\t}\n\tif len(args[1]) <= 0 {\n\t\treturn nil, errors.New(\"2nd argument must be a non-empty string\")\n\t}\n\tauthsession := SessionAunthentication{}\n\tauthsession.Token = args[0]\n\tauthsession.Email = args[1]\n\t//get session empty[]\n\tUserAsBytes, err := stub.GetState(\"savesessionvfm\")\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to get users session\")\n\t}\n\tvar session Session\n\tjson.Unmarshal(UserAsBytes, &session) //un stringify it aka JSON.parse()\n\n\tsession.StoreSession = append(session.StoreSession, authsession)\n\tfmt.Println(\"allsessions\", session.StoreSession) //append each users session to allsession[]\n\tfmt.Println(\"! appended user to allsessions\")\n\tjsonAsBytes, _ := json.Marshal(session)\n\tfmt.Println(\"json\", jsonAsBytes)\n\terr = stub.PutState(\"savesessionvfm\", jsonAsBytes) //rewrite allsession[]\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfmt.Println(\"- end save session\")\n\treturn nil, nil\n}", "func (m *RedisStore) Flush() error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.sessionData = make(map[interface{}]interface{})\n\treturn nil\n}", "func SaveSession(ctx context.Context, session *sessions.Session) error {\n\thttpContext := ctx.Value(HTTPKey(\"http\")).(HTTP)\n\n\terr := session.Save(httpContext.R, *httpContext.W)\n\n\treturn err\n}", "func (s *DatastoreStore) Save(r *http.Request, w http.ResponseWriter,\n\tsession *sessions.Session) error {\n\tif session.ID == \"\" {\n\t\tsession.ID = string(newToken(\"\", 32))\n\t}\n\tif err := s.save(r, session); err != nil {\n\t\treturn err\n\t}\n\tencoded, err := securecookie.EncodeMulti(session.Name(), session.ID,\n\t\ts.Codecs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\toptions := s.Options\n\thttp.SetCookie(w, sessions.NewCookie(session.Name(), encoded, options))\n\treturn nil\n}", "func pvtNewSession(c *db.SessionCookie, firstname string, rid int, updateSessionTable bool) *Session {\n\t// lib.Ulog(\"Entering NewSession: %s (%d)\\n\", username, uid)\n\tuid := int(c.UID)\n\ts := new(Session)\n\ts.Token = c.Cookie\n\ts.Username = c.UserName\n\ts.Firstname = firstname\n\ts.UID = c.UID\n\ts.UIDorig = c.UID\n\ts.ImageURL = ui.GetImageLocation(uid)\n\ts.Breadcrumbs = make([]ui.Crumb, 0)\n\ts.Expire = c.Expire\n\ts.IP = c.IP\n\ts.UserAgent = c.UserAgent\n\tauthz.GetRoleInfo(rid, &s.PMap)\n\n\tif authz.Authz.SecurityDebug {\n\t\tfor i := 0; i < len(s.PMap.Urole.Perms); i++ {\n\t\t\tlib.Ulog(\"f: %s, perm: %02x\\n\", s.PMap.Urole.Perms[i].Field, s.PMap.Urole.Perms[i].Perm)\n\t\t}\n\t}\n\n\tvar d db.PersonDetail\n\td.UID = uid\n\n\terr := SessionManager.db.QueryRow(fmt.Sprintf(\"SELECT CoCode FROM people WHERE UID=%d\", uid)).Scan(&s.CoCode)\n\tif nil != err {\n\t\tlib.Ulog(\"Unable to read CoCode for userid=%d, err = %v\\n\", uid, err)\n\t}\n\n\tif updateSessionTable {\n\t\tlib.Console(\"JUST BEFORE InsertSessionCookie: s.IP = %s, s.UserAgent = %s\\n\", s.IP, s.UserAgent)\n\t\terr = InsertSessionCookie(s)\n\t\tif err != nil {\n\t\t\tlib.Ulog(\"Unable to save session for UID = %d to database, err = %s\\n\", uid, err.Error())\n\t\t}\n\t}\n\n\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\tSessions[c.Cookie] = s\n\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\n\treturn s\n}", "func (s *SecureSessionStore) Set(key, value string, rw http.ResponseWriter, req *http.Request) error {\n\tsession := s.getSession(req)\n\tsession.Values[key] = value\n\treturn session.Save(req, rw)\n}", "func NewSessionStore(db *sql.DB) *SessionStore {\n\treturn &SessionStore{kallax.NewStore(db)}\n}", "func (pdr *ProviderMySQL) SessionRegenerate(oldSid, sid string) (session.Store, error) {\n\tc := pdr.connectInit()\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", oldSid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\tif err == sql.ErrNoRows {\n\t\t_, err = c.Exec(\"insert into \"+TableName+\"(`session_key`,`session_data`,`session_expiry`) values(?,?,?)\", oldSid, \"\", time.Now().Unix())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t_, err = c.Exec(\"update \"+TableName+\" set `session_key`=?, `session_expiry`=? where session_key=?\", sid, time.Now().Unix(), oldSid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar kv map[interface{}]interface{}\n\tif len(data) == 0 {\n\t\tkv = make(map[interface{}]interface{})\n\t} else {\n\t\tkv, err = session.DecodeGob(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\trs := &SessionStoreMySQL{conn: c, sid: sid, values: kv}\n\treturn rs, nil\n}", "func (s *Store) Create(ID string) (*Session, error) {\n\tsession := newSession(ID)\n\tsession.Add(\"exists\", true)\n\n\tif _, err := s.client.HMSet(ID, session.toRedisDict()).Result(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err := s.client.Expire(ID, s.valid).Result(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn session, nil\n}", "func (mgr ScsManager) Use(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tvar data []byte\n\t\tvar temp string\n\t\t// get the session. All of our session data is stored in only one key in the session manager.\n\t\tsession := mgr.Manager.Load(r)\n\t\tif err := session.Touch(w); err != nil { // Make sure to get a cookie in our header if we don't have one\n\t\t\tlog.Errorf(\"Error loading session: %s\", err.Error()) // we can't panic here, because our panic handlers have not been set up\n\t\t}\n\t\tdata, _ = session.GetBytes(scsSessionDataKey)\n\t\tsessionData := NewSession()\n\t\tif data != nil {\n\t\t\tif err := sessionData.UnmarshalBinary(data); err != nil {\n\t\t\t\tlog.Errorf(\"Error unpacking session data: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif sessionData.Has(sessionResetKey) {\n\t\t\t// Our previous session requested a reset. We can't reset after writing, so we reset here at the start of the next request.\n\t\t\tsessionData.Delete(sessionResetKey)\n\t\t\tif err := session.RenewToken(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error renewing session token: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tctx := r.Context()\n\t\tctx = context.WithValue(ctx, sessionContext, sessionData)\n\t\tr = r.WithContext(ctx)\n\t\tnext.ServeHTTP(w, r)\n\n\t\t// write out the changed session. The below will attempt to write a cookie, but it can't because headers have already been written.\n\t\t// That is OK, because of our Touch above.\n\t\tif sessionData.Len() > 0 {\n\t\t\tvar err error\n\t\t\tdata, err = sessionData.MarshalBinary()\n\t\t\tif err != nil {\n\t\t\t\t// This is an application error. We put data into the session which is not serializable.\n\t\t\t\ts := \"Error marshalling session data: %s\" + err.Error()\n\t\t\t\tlog.Error(s)\n\t\t\t\thttp.Error(w, s, 500)\n\t\t\t}\n\t\t\ttemp = string(data)\n\t\t\t_ = temp\n\t\t\tif err := session.PutBytes(w, scsSessionDataKey, data); err != nil {\n\t\t\t\tlog.Errorf(\"Error putting session data: %s\", err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tif err := session.Clear(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error clearing session: %s\", err.Error())\n\t\t\t}\n\t\t}\n\t}\n\treturn mgr.Manager.Use(http.HandlerFunc(fn))\n}", "func SessionSetValue(ctx context.Context, name string, value interface{}) {\n\ts, ok := ctx.Value(sessionKey).(*Session)\n\tif ok {\n\t\ts.set(name, value)\n\t}\n}", "func StoreSessionRealm(session *sessions.Session, realm *database.Realm) {\n\tif session == nil || realm == nil {\n\t\treturn\n\t}\n\tClearWelcomeMessageDisplayed(session)\n\tsession.Values[sessionKeyRealmID] = realm.ID\n}", "func NewSessionStore(domain string) *DatastoreStore {\n\n\tkind := \"session\"\n\tk := datastore.NameKey(\"sessionKey\", \"key\", nil)\n\tkp := &key{}\n\terr := ds.Get(context.Background(), k, kp)\n\tif err == datastore.ErrNoSuchEntity {\n\t\tkp.KeyPairs = [][]byte{securecookie.GenerateRandomKey(64)}\n\t\t_, err = ds.Put(context.Background(), k, kp)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &DatastoreStore{\n\t\tCodecs: securecookie.CodecsFromPairs(kp.KeyPairs...),\n\t\tOptions: &sessions.Options{\n\t\t\tDomain: domain,\n\t\t\tPath: \"/\",\n\t\t\tMaxAge: 86400 * 30,\n\t\t},\n\t\tkind: kind,\n\t}\n}", "func StartSession(w http.ResponseWriter, r *http.Request, u GSUser) {\n\tuID, _ := uuid.NewV4()\n\tcookie, err := r.Cookie(\"session\")\n\tif err == nil {\n\t\t//Value of cookie which named session, is checking\n\t\t_, err := uuid.FromString(cookie.Value)\n\t\tif err != nil {\n\t\t\t//invalid uuid(Cookie/Session Value) is detected by *Satori* and value is changed\n\t\t\tdelMaps(cookie.Value, u)\n\t\t\tcookie.Value = uID.String()\n\t\t\tcookie.MaxAge = SessionTime\n\t\t\thttp.SetCookie(w, cookie)\n\t\t}\n\t\t//System already have a session now. Checking harmony between uuid and RAM(dbUsers, dbSessions)\n\t\tif !checkDatabases(cookie.Value) {\n\t\t\t//RAM is cleared, now system have a cookie but RAM cleared by 'checkDatabases'(internal command)\n\t\t\t//fmt.Println(\"içerideyiz\", uID.String())\n\t\t\tcookie.Value = uID.String()\n\t\t\tcookie.MaxAge = SessionTime\n\t\t\thttp.SetCookie(w, cookie)\n\t\t\taddMaps(cookie.Value, u)\n\t\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t\t} else {\n\t\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t\t}\n\t} else {\n\t\t//System has no any cookie which named session and everything is created from A to Z\n\t\t//In this command, RAM isn't check because 1 session can point 1 user object.\n\t\t//but\n\t\t//1 user object can pointed more than one session(uuid)\n\t\t//\n\t\t//Why?: User have mobile, desktop, tablet devices which can login by.\n\t\tcreateSessionCookie(w, r, uID.String())\n\t\taddMaps(uID.String(), u)\n\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t}\n}", "func Run() {\n\tGlobalSessions, _ = session.NewManager(\"memory\", \"gosessionid\", 3600)\n\tgo GlobalSessions.GC()\n}", "func newSession(id rsession.ID, r *SessionRegistry, ctx *ServerContext) (*session, error) {\n\tserverSessions.Inc()\n\trsess := rsession.Session{\n\t\tID: id,\n\t\tTerminalParams: rsession.TerminalParams{\n\t\t\tW: teleport.DefaultTerminalWidth,\n\t\t\tH: teleport.DefaultTerminalHeight,\n\t\t},\n\t\tLogin: ctx.Identity.Login,\n\t\tCreated: time.Now().UTC(),\n\t\tLastActive: time.Now().UTC(),\n\t\tServerID: ctx.srv.ID(),\n\t\tNamespace: r.srv.GetNamespace(),\n\t}\n\tterm := ctx.GetTerm()\n\tif term != nil {\n\t\twinsize, err := term.GetWinSize()\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\trsess.TerminalParams.W = int(winsize.Width)\n\t\trsess.TerminalParams.H = int(winsize.Height)\n\t}\n\n\t// get the session server where session information lives. if the recording\n\t// proxy is being used and this is a node, then a discard session server will\n\t// be returned here.\n\tsessionServer := r.srv.GetSessionServer()\n\n\terr := sessionServer.CreateSession(rsess)\n\tif err != nil {\n\t\tif trace.IsAlreadyExists(err) {\n\t\t\t// if session already exists, make sure they are compatible\n\t\t\t// Login matches existing login\n\t\t\texisting, err := sessionServer.GetSession(r.srv.GetNamespace(), id)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\tif existing.Login != rsess.Login {\n\t\t\t\treturn nil, trace.AccessDenied(\n\t\t\t\t\t\"can't switch users from %v to %v for session %v\",\n\t\t\t\t\trsess.Login, existing.Login, id)\n\t\t\t}\n\t\t}\n\t\t// return nil, trace.Wrap(err)\n\t\t// No need to abort. Perhaps the auth server is down?\n\t\t// Log the error and continue:\n\t\tr.log.Errorf(\"Failed to create new session: %v.\", err)\n\t}\n\n\tsess := &session{\n\t\tlog: logrus.WithFields(logrus.Fields{\n\t\t\ttrace.Component: teleport.Component(teleport.ComponentSession, r.srv.Component()),\n\t\t}),\n\t\tid: id,\n\t\tregistry: r,\n\t\tparties: make(map[rsession.ID]*party),\n\t\twriter: newMultiWriter(),\n\t\tlogin: ctx.Identity.Login,\n\t\tcloseC: make(chan bool),\n\t\tlingerTTL: defaults.SessionIdlePeriod,\n\t}\n\treturn sess, nil\n}", "func (st *SessionStoreMySQL) Set(key, value interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tst.values[key] = value\n\treturn nil\n}", "func StoreSessionRegion(session *sessions.Session, region string) {\n\tif session == nil {\n\t\treturn\n\t}\n\tsession.Values[regionKey] = region\n}", "func (rs *RedisStore) Save(sid SessionID, state interface{}) error {\n\tj, err := json.Marshal(state)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = rs.Client.Set(sid.getRedisKey(), j, rs.SessionDuration).Err()\n\n\treturn err\n}", "func (m *Memory) Store(_ context.Context, key string, value process.Context) error {\n\tm.mx.Lock()\n\tdefer m.mx.Unlock()\n\tm.storage[key] = value\n\n\treturn nil\n}", "func (mgr *MemorySessionManager) Session(sid string) (Session, error) {\n\tmgr.lock.RLock()\n\tif s, ok := mgr.sessions[sid]; ok {\n\t\ts.createdAt = time.Now()\n\t\tmgr.lock.RUnlock()\n\t\treturn s, nil\n\t}\n\tmgr.lock.RUnlock()\n\treturn nil, fmt.Errorf(\"Can not retrieve session with id %s\", sid)\n}", "func TestSession_AsSession(t *testing.T) { var _ Session = newSession(nil, \"id\", 0, 0) }", "func NewInMemorySessionStore(maxSize int) inMemorySessionStore {\n\treturn inMemorySessionStore{maxSize: maxSize, store: map[string]*list.Element{}}\n}", "func (sess Session) Set(key, value string) {\n\tsess[key] = value\n}", "func Sessionload(next http.Handler) http.Handler {\n\treturn session.LoadAndSave(next)\n}", "func (w *Worker) SetSession(s *Session) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\tw.s = s\n}", "func (s *Session) Save() (err error) {\n\tvar (\n\t\tfile *os.File\n\t)\n\n\t// create the session directory\n\tif err = os.MkdirAll(s.Folder, 0600); err != nil {\n\t\treturn fmt.Errorf(\"could not create .clouditor in home directory: %w\", err)\n\t}\n\n\tif file, err = os.OpenFile(fmt.Sprintf(\"%s/session.json\", s.Folder), os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0600); err != nil {\n\t\treturn fmt.Errorf(\"could not save session.json: %w\", err)\n\t}\n\n\tdefer func(file *os.File) {\n\t\terr = file.Close()\n\t}(file)\n\n\tif err = json.NewEncoder(file).Encode(&s); err != nil {\n\t\treturn fmt.Errorf(\"could not serialize JSON: %w\", err)\n\t}\n\n\ts.dirty = false\n\n\treturn nil\n}", "func New(w http.ResponseWriter, r *http.Request, tmpdir string) (*Session, error) {\n\ts := Session{\n\t\tw: w,\n\t\tr: r,\n\t\ttmpdir: tmpdir,\n\t\tvarlist: &vars{\n\t\t\tBool: map[string]bool{},\n\t\t\tInt: map[string]int{},\n\t\t\tInt64: map[string]int64{},\n\t\t\tString: map[string]string{},\n\t\t},\n\t\tchanged: false,\n\t\thash: \"\",\n\t}\n\n\ts.varlist.Lock()\n\tdefer s.varlist.Unlock()\n\n\tcookie, err := r.Cookie(\"session\")\n\tif err == nil && len(cookie.Value) == 40 {\n\t\t// Load from file\n\t\ts.hash = cookie.Value\n\t\tfname := strings.Join([]string{s.tmpdir, s.hash}, string(os.PathSeparator))\n\n\t\tinfo, err := os.Stat(fname)\n\t\tif err != nil {\n\t\t\treturn &s, err\n\t\t}\n\n\t\tvar f *os.File\n\t\tf, err = os.Open(fname)\n\t\tif err != nil {\n\t\t\treturn &s, err\n\t\t}\n\t\tdefer f.Close()\n\n\t\tdec := json.NewDecoder(f)\n\t\terr = dec.Decode(&s.varlist)\n\t\tif err != nil {\n\t\t\treturn &s, err\n\t\t}\n\n\t\t// Update file last modify time\n\t\tif time.Since(info.ModTime()) > 30*time.Minute {\n\t\t\tif err := os.Chtimes(fname, time.Now(), time.Now()); err != nil {\n\t\t\t\treturn &s, err\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Create new\n\t\trand.Seed(time.Now().Unix())\n\n\t\t// Real remote IP for proxy servers\n\t\trRemoteAddr := r.RemoteAddr\n\t\tif r.Header.Get(\"X-Real-IP\") != \"\" && len(r.Header.Get(\"X-Real-IP\")) <= 25 {\n\t\t\trRemoteAddr = rRemoteAddr + \", \" + strings.TrimSpace(r.Header.Get(\"X-Real-IP\"))\n\t\t} else if r.Header.Get(\"X-Forwarded-For\") != \"\" && len(r.Header.Get(\"X-Forwarded-For\")) <= 25 {\n\t\t\trRemoteAddr = rRemoteAddr + \", \" + strings.TrimSpace(r.Header.Get(\"X-Forwarded-For\"))\n\t\t}\n\n\t\tsign := rRemoteAddr + r.Header.Get(\"User-Agent\") + fmt.Sprintf(\"%d\", int64(time.Now().Unix())) + fmt.Sprintf(\"%d\", int64(rand.Intn(9999999-99)+99))\n\t\ts.hash = fmt.Sprintf(\"%x\", sha1.Sum([]byte(sign)))\n\n\t\thttp.SetCookie(w, &http.Cookie{\n\t\t\tName: \"session\",\n\t\t\tValue: s.hash,\n\t\t\tPath: \"/\",\n\t\t\tExpires: time.Now().Add(7 * 24 * time.Hour),\n\t\t\tHttpOnly: true,\n\t\t})\n\t}\n\n\treturn &s, nil\n}", "func (ms memstore) Set(key string, data Sessiondata, timeout int) error {\n\tn := time.Now()\n\te := data[expiresTS].(time.Time)\n\tif e.After(n) {\n\t\t/*\n\t\t *\tdelete it from map when timeout\n\t\t */\n\t\ttmr := time.AfterFunc(e.Sub(n), func() {\n\t\t\tms.lock.Lock()\n\t\t\tdelete(ms.store, key)\n\t\t\tms.lock.Unlock()\n\t\t})\n\t\tdata[\"_tmr\"] = tmr\n\n\t\tms.lock.Lock()\n\t\tms.store[key] = data\n\t\tms.lock.Unlock()\n\t}\n\n\treturn nil\n}", "func New(name string, store gorillaSessions.Store) middleware.Handler {\n\treturn middleware.HandlerFunc(func(c context.Context, w http.ResponseWriter, r *http.Request) context.Context {\n\t\tsession, _ := store.Get(r, sessionName)\n\t\tc = context.WithValue(c, storeKey, store)\n\t\t// gogo.Session(c).Values[\"foo\"]\n\t\treturn c\n\t})\n}", "func For(ctx context.Context) (*Store, error) {\n\treturn ctx.Value(sessionContextKey).(*Store), nil\n\n}", "func setSession(c echo.Context, r *http.Response) {\r\n\r\n\tfor _, cookie := range r.Cookies() {\r\n\r\n\t\tif cookie.Name == \"PHPSESSID\" {\r\n\r\n\t\t\tsess, _ := session.Get(\"Session\", c)\r\n\t\t\tsess.Options = &sessions.Options{\r\n\t\t\t\tPath: \"*\",\r\n\t\t\t\tMaxAge: 60 * 3,\r\n\t\t\t\tHttpOnly: true,\r\n\t\t\t}\r\n\t\t\tsess.Values[\"PHPSESSID\"] = cookie.Value\r\n\r\n\t\t\tsess.Save(c.Request(), c.Response())\r\n\t\t}\r\n\t}\r\n}", "func SetSession(client *client.Client, db *db.Database, log *log.Logger) {\n\ts = &Session{client, db, log}\n}" ]
[ "0.7168202", "0.7162182", "0.7039447", "0.6854262", "0.68216854", "0.6818332", "0.6646486", "0.66210485", "0.6595175", "0.6536938", "0.6471403", "0.6465982", "0.6429156", "0.64185417", "0.6374666", "0.6370199", "0.63664067", "0.63397634", "0.6339028", "0.6318748", "0.6291724", "0.62836176", "0.6277572", "0.6244726", "0.6233536", "0.6208358", "0.62061423", "0.61995846", "0.61868966", "0.6184727", "0.6169451", "0.6134889", "0.61243856", "0.6091787", "0.6090805", "0.6083932", "0.6083635", "0.6075574", "0.60631156", "0.6032243", "0.6025108", "0.6019997", "0.6016463", "0.59937775", "0.5977907", "0.59646267", "0.59423244", "0.5934536", "0.5916189", "0.59161717", "0.59036213", "0.5898954", "0.5895022", "0.5891128", "0.5887665", "0.5872153", "0.58688474", "0.58563536", "0.5846014", "0.5824395", "0.5822099", "0.58153826", "0.5803791", "0.5799906", "0.578976", "0.5749049", "0.5734619", "0.5729709", "0.5703837", "0.5698235", "0.56889904", "0.5687449", "0.5682116", "0.5678704", "0.56659824", "0.5656173", "0.5651722", "0.564568", "0.5645227", "0.56352025", "0.5634383", "0.56298846", "0.562625", "0.56231874", "0.56215745", "0.5617588", "0.5612499", "0.560654", "0.5606417", "0.55954945", "0.55828404", "0.55792975", "0.55776787", "0.5566478", "0.5564723", "0.5562301", "0.556018", "0.554813", "0.5541952", "0.5540983" ]
0.7362877
0
HasSession implemented in memory.
HasSession реализован в памяти.
func (ms *MemStore) HasSession(sessionKey string) bool { _, ok := ms.sessions[sessionKey] return ok }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (pder *MemSessionProvider) HasSession(sid string) (bool, error) {\r\n\tpder.lock.RLock()\r\n\tdefer pder.lock.RUnlock()\r\n\r\n\t_, ok := pder.sessions[sid]\r\n\treturn ok, nil\r\n}", "func (f *Features) canSession(ctx context.Context, adminDB *mongo.Database) {\n\tcmd := bson.D{\n\t\t{\n\t\t\tKey: \"replSetGetStatus\",\n\t\t\tValue: 1,\n\t\t},\n\t}\n\tvar result replInfo\n\terr := adminDB.RunCommand(ctx, cmd).Decode(&result)\n\tif err != nil {\n\t\t// assume we don't have session support on error..\n\t\t// error code 76 will be thrown if replSet is not enabled.\n\t\treturn\n\t}\n\n\tf.HasSessions = result.Ok\n}", "func (pder *MemProvider) SessionExist(sid string) bool {\n\tres, _ := (*session.MemProvider)(pder).SessionExist(context.Background(), sid)\n\treturn res\n}", "func (ctx *RequestContext) HasSession(key string) bool {\n\tvars := ctx.token.Claims[\"vars\"].(map[string]interface{})\n\t_, ok := vars[key]\n\treturn ok\n}", "func (o *StatusAzureServiceBus) HasSessions() bool {\n\tif o != nil && !IsNil(o.Sessions) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (this *ConnackMessage) SessionPresent() bool {\n\treturn this.sessionPresent\n}", "func (ca *NullClientAdapter) IsSessionPresent() bool {\n\treturn ca.SessionPresent\n}", "func (s *SideTwistHandler) hasImplantSession(guid string) bool {\n\t_, ok := s.commandNumbers[guid]\n\treturn ok\n}", "func SessionExists(SID string) bool {\n\t_, exists := SessionMap[SID]\n\treturn exists\n}", "func (o *VirtualSessionProvider) Exist(sid string) bool {\n\treturn true\n}", "func (session Session) Exists() bool {\n\treturn session.Key != \"\"\n}", "func (asr *sessionRegistry) Exists(sessionKey string) bool {\n\tasr.lock.RLock()\n\t_, exists := asr.registry[sessionKey]\n\tasr.lock.RUnlock()\n\treturn exists\n}", "func hasUserSession(userID uuid.UUID) bool {\n\t_, ok := userCache[userID]\n\treturn ok\n}", "func HasActiveSessions() bool {\n\treturn len(activeSessions) > 0\n}", "func IsSession(r *http.Request) bool {\n\tval := r.Context().Value(authSessionActiveKey)\n\tswitch val.(type) {\n\tcase bool:\n\t\treturn val.(bool)\n\tdefault:\n\t\treturn false\n\t}\n}", "func (me TxsdCounterSimpleContentExtensionType) IsSession() bool { return me.String() == \"session\" }", "func (pdr *ProviderMySQL) SessionExist(sid string) bool {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", sid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\treturn err != sql.ErrNoRows\n}", "func (o *LoginRequest) HasSessionId() bool {\n\tif o != nil && o.SessionId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func SessionGet(token string) (*Session, bool) {\n\ts, ok := Sessions[token]\n\treturn s, ok\n}", "func (ds *DjangoSession) Exists() bool {\n\treturn ds._exists\n}", "func (o *EnvironmentUsageDto) HasSessionReplays() bool {\n\tif o != nil && o.SessionReplays != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (ss *SessionServiceImpl) Session(sessionID string) (*entities.Session, []error) {\n\treturn ss.sessionRepo.Session(sessionID)\n}", "func HasUserSession(userID uuid.UUID) bool {\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\treturn hasUserSession(userID)\n}", "func (s *userState) Sessions() map[string]string {\n\treturn s.sessions\n}", "func (ctx *Context) Session(key interface{}) interface{} {\r\n\treturn ctx.CruSession.Get(key)\r\n}", "func (o *KvmPolicyInventory) HasMaximumSessions() bool {\n\tif o != nil && o.MaximumSessions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (rp *Provider) SessionExist(ctx context.Context, sid string) (bool, error) {\n\tif ctx == nil {\n\t\tctx = context.TODO()\n\t}\n\treturn rp.c.Contains(ctx, sid), nil\n}", "func (sr *SessionGormRepo) Session(sessionID string) (*entity.Session, []error) {\n\tsession := entity.Session{}\n\terrs := sr.conn.Find(&session, \"uuid=?\", sessionID).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &session, errs\n}", "func GoodSession(r *http.Request) bool {\n\tstore, err := pgstore.NewPGStore(os.Getenv(\"PGURL\"), key)\n\tcheck(err)\n\tdefer store.Close()\n\n\tsession, err := store.Get(r, \"scheduler-session\")\n\tcheck(err)\n\n\t// Check if user is authenticated\n\tif auth, ok := session.Values[\"authenticated\"].(bool); !ok || !auth {\n\t\tlog.Info(\"Stale session rejected: \", session)\n\t\treturn false\n\t}\n\tlog.Info(\"Session OK: \", session)\n\treturn true\n}", "func (r *SmscSessionRepository) ExistsById(ID string) bool {\n\treturn app.BuntDBInMemory.View(func(tx *buntdb.Tx) error {\n\t\t_, err := tx.Get(SMSC_SESSION_PREFIX + ID)\n\t\treturn err\n\t}) == nil\n}", "func (srv *server) Session(id string) Session {\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\n\treturn srv.s[id]\n}", "func (gs *Service) IsSessionCreated(_ context.Context, req *api.IsSessionCreatedRequest, rsp *api.IsSessionCreatedResponse) error {\n\trsp.IsRunning = 2 // Stands for false.\n\tfor _, value := range gs.sessions {\n\t\tif value.currentGameID == req.GameId {\n\t\t\trsp.IsRunning = 1\n\t\t\trsp.SessionId = value.sessionID\n\t\t\trsp.ChatSocketAddress = value.chatAddress\n\t\t\trsp.SessionSocketAddress = value.sessionAddress\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (handler *IdentityProviderHandler) CheckSession(sessionID string, userAgent string, remoteAddr string) (r bool, err error) {\n\thandler.log.Printf(\"checkSession(%v, %v, %v)\", sessionID, userAgent, remoteAddr)\n\n\tsession, err := handler.SessionInteractor.Find(sessionID)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\tif !session.Domain.Enabled || !session.User.Enabled {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Domain and/or user disabled\"\n\t\treturn false, e\n\t}\n\n\tif session.UserAgent != userAgent || session.RemoteAddr != remoteAddr {\n\t\te := services.NewNotFoundError()\n\t\te.Msg = \"Session not found\"\n\t\treturn false, e\n\t}\n\n\tif session.IsExpired() {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Session expired\"\n\t\treturn false, e\n\t}\n\n\terr = handler.SessionInteractor.Retain(*session)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\treturn true, nil\n}", "func (st *State) Session(id string) *cache.Session {\n\tfor _, s := range st.Sessions() {\n\t\tif s.ID() == id {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}", "func (o *EnvironmentUsageDto) HasMobileSessions() bool {\n\tif o != nil && o.MobileSessions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (ss *SessionServiceImpl) Session(sessionID string) (*entity.Session, error) {\n\tsess, err := ss.sessionRepo.Session(sessionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func (pc *PFCPConnection) ForgetSession(seid SEID) bool {\n\tpc.Lock()\n\tdefer pc.Unlock()\n\t_, found := pc.sessions[seid]\n\tif !found {\n\t\treturn false\n\t}\n\tdelete(pc.sessions, seid)\n\treturn true\n}", "func (sm *SessionMap) Get(sessionID string) (*Session, bool) {\n\tsm.Lock.RLock()\n\tdefer sm.Lock.RUnlock()\n\n\tsession, ok := sm.Sessions[sessionID]\n\treturn session, ok\n}", "func (p *PostgresProvider) Exist(sid string) bool {\n\tvar data []byte\n\terr := p.c.QueryRow(\"SELECT data FROM session WHERE key=$1\", sid).Scan(&data)\n\tif err != nil && err != sql.ErrNoRows {\n\t\tpanic(\"session/postgres: error checking existence: \" + err.Error())\n\t}\n\treturn err != sql.ErrNoRows\n}", "func (w *Worker) Session() *Session {\n\tw.mu.RLock()\n\tdefer w.mu.RUnlock()\n\n\treturn w.s\n}", "func (_Contract *ContractSession) Exists(_tokenId *big.Int) (bool, error) {\n\treturn _Contract.Contract.Exists(&_Contract.CallOpts, _tokenId)\n}", "func (service *SessionService) Session(sessionID string) (*entity.Session, error) {\n\tsess, err := service.conn.Session(sessionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func (pder *MemProvider) SessionAll() int {\n\treturn (*session.MemProvider)(pder).SessionAll(context.Background())\n}", "func TestSession_AsSession(t *testing.T) { var _ Session = newSession(nil, \"id\", 0, 0) }", "func (s *Session) Exists(q db.Queryable) (bool, error) {\n\tif s == nil {\n\t\treturn false, apperror.NewServerError(\"session is nil\")\n\t}\n\n\tif s.UserID == \"\" {\n\t\treturn false, apperror.NewServerError(\"user id required\")\n\t}\n\n\t// Deleted sessions should be explicitly checked\n\tif s.DeletedAt != nil {\n\t\treturn false, nil\n\t}\n\n\tvar count int\n\tstmt := `SELECT count(1)\n\t\t\t\t\tFROM user_sessions\n\t\t\t\t\tWHERE deleted_at IS NULL\n\t\t\t\t\t\tAND id = $1\n\t\t\t\t\t\tAND user_id = $2`\n\terr := q.Get(&count, stmt, s.ID, s.UserID)\n\treturn (count > 0), err\n}", "func (o *SmscSession) HasRemoteAddr() bool {\n\tif o != nil && o.RemoteAddr != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *MemorySessionStore) Check(sessionID string) (status bool, err error) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tif t, ok := m.store[sessionID]; ok {\n\t\tif t.After(time.Now()) {\n\t\t\treturn true, nil\n\t\t}\n\t\tdelete(m.store, sessionID)\n\t}\n\treturn false, nil\n}", "func (m mongod) Session() *mgo.Session {\n\treturn m.session\n}", "func (db *Db) Session() *gocql.Session {\n\treturn db.session\n}", "func session(w http.ResponseWriter, r *http.Request) (sess data.Session, err error) {\n\t\n\t// リクエストからクッキーを取得\n\tcookie, err := r.Cookie(\"_cookie\")\n\t// ユーザーがログインしているならクッキーがあるはず\n\tif err == nil {\n\t\t// データベースを検索\n\t\t// ユニークIDが存在してるか?\n\t\tsess = data.Session{ Uuid: cookie.Value }\n\t\t\n\t\tif ok, _ := sess.Check(); !ok {\n\t\t\terr = errors.New(\"Invalid session\")\n\t\t}\n\t}\n\treturn\n}", "func (mgr *MemorySessionManager) Session(sid string) (Session, error) {\n\tmgr.lock.RLock()\n\tif s, ok := mgr.sessions[sid]; ok {\n\t\ts.createdAt = time.Now()\n\t\tmgr.lock.RUnlock()\n\t\treturn s, nil\n\t}\n\tmgr.lock.RUnlock()\n\treturn nil, fmt.Errorf(\"Can not retrieve session with id %s\", sid)\n}", "func NewSession() Session {\n\treturn Session{\n\t\tID: utils.NewBytes32ID(),\n\t\tLastUsed: Time{Time: time.Now()},\n\t}\n}", "func (p *CharacterCreateCommandPayload) Session() commands.DiscordConnector {\n\treturn p.session\n}", "func (irc *Bot) hijackSession() bool {\n\treturn false\n}", "func SessionCheck(writer http.ResponseWriter, request *http.Request) (sess Session, err error) {\n\tcookie, err := request.Cookie(\"_cookie\")\n\tif err == nil {\n\t\tsess = Session{Uuid: cookie.Value}\n\t\tif ok, _ := sess.Valid(); ok {\n\t\t\terr = errors.New(\"invalid session\")\n\t\t}\n\t}\n\treturn\n}", "func (s *Service) CheckIfPersonHaveSession(c context.Context, sessionID ulid.ULID, personID ulid.ULID) (*Session, error) {\n\treturn &Session{}, nil\n}", "func VerifySession(sid string) bool {\n\tvar session Session\n\tif err := cache.Get(SessionId+SESSION_KEY, &session); err != nil {\n\t\treturn false\n\t}\n\treturn sid == session.Id\n}", "func (s Store) getFreshSession() *mgo.Session {\n\treturn s.Session.Copy()\n}", "func (_DelegateProfile *DelegateProfileSession) Registered(_addr common.Address) (bool, error) {\n\treturn _DelegateProfile.Contract.Registered(&_DelegateProfile.CallOpts, _addr)\n}", "func (s Session) Session() string {\n\treturn s.session\n}", "func (rc *Ctx) Session() *Session {\n\treturn rc.session\n}", "func Session() HandlerFunc {\n\treturn func(c *Context) {\n\t\tif sessionManager == nil {\n\t\t\tpanic(\"please call gow.InitSession()\")\n\t\t}\n\t\tsessionID = sessionManager.Start(c.Writer, c.Req)\n\t\tsessionManager.Extension(c.Writer, c.Req)\n\t\tc.Next()\n\t}\n}", "func (mconn *MConn) Session() (*MSession, error) {\n\t// Start race (waiting-for-binding vs. timeout)\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\tmconn.bindWaitGroup.Wait()\n\t\t//TODO: ping to prolong session life? Because session can be aborted\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn mconn.session, nil\n\tcase <-time.After(TIMEOUT_SESSION_BINDING):\n\t\treturn nil, fmt.Errorf(\"No Session: session binding timeout\")\n\t}\n}", "func NewSession(id uint64) *Session {\n\tfactory := service.NewLocalServiceFactory(repository.NewInMemoryRepositoryFactory())\n\n\tscheduableSrv := factory.ScheduableService()\n\tdepSrv := factory.DependencyService()\n\n\treturn &Session{id: id, DepSrv: depSrv, ScheduableSrv: scheduableSrv, running: true}\n}", "func Session(w http.ResponseWriter, r *http.Request) (models.Session, error) {\n\tvar s models.Session\n\tcookie, err := r.Cookie(\"_cookie\")\n\tif err != nil {\n\t\tfmt.Printf(\"%s\", err.Error())\n\t\treturn s, err\n\t}\n\ts = models.Session{UUID: cookie.Value}\n\tif ok, _ := s.Check(); !ok {\n\t\treturn s, errors.New(\"Invalid session. \")\n\t}\n\treturn s, nil\n}", "func (d *DefaultContext) Session() *Session {\n\treturn d.session\n}", "func (m NoTradingSessions) HasTradingSessionID() bool {\n\treturn m.Has(tag.TradingSessionID)\n}", "func (s *Sessions) IsExist(r *http.Request) bool {\n\t// Getting cookie\n\tcookie, err := r.Cookie(cfg.SessionIDKey)\n\t// No sessionID in request's cookies.\n\tif err != nil {\n\t\treturn false\n\t}\n\tsessionID := cookie.Value\n\t// Atomic Check if sssion with given id contains in sessions map\n\ts.RLock()\n\t_, ok := s.sessions[sessionID]\n\ts.RUnlock()\n\n\treturn ok\n}", "func (clt *client) Session() *webwire.Session {\n\tclt.sessionLock.RLock()\n\tif clt.session == nil {\n\t\tclt.sessionLock.RUnlock()\n\t\treturn nil\n\t}\n\tclone := &webwire.Session{\n\t\tKey: clt.session.Key,\n\t\tCreation: clt.session.Creation,\n\t}\n\tif clt.session.Info != nil {\n\t\tclone.Info = clt.session.Info.Copy()\n\t}\n\tclt.sessionLock.RUnlock()\n\treturn clone\n}", "func (m NoMDEntries) HasTradingSessionID() bool {\n\treturn m.Has(tag.TradingSessionID)\n}", "func (m NoTradingSessions) HasTradingSessionSubID() bool {\n\treturn m.Has(tag.TradingSessionSubID)\n}", "func isAuthSession(r *http.Request, w http.ResponseWriter) bool {\n\tloggedIn, loggedInMat := loggedIn(r)\n\tloggedInUser, err := user.FromMatrikel(loggedInMat)\n\n\tif !loggedIn || loggedInUser.Usertype == user.STUDENT || err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func (m *memoryStorage) sessionChecker() {\n\tfor {\n\t\tm.mutex.Lock()\n\t\tfor sessionID, v := range m.sessions {\n\t\t\tif v.expires < time.Now().Unix() {\n\t\t\t\tdelete(m.sessions, sessionID)\n\t\t\t}\n\t\t}\n\t\tfor nonce, expires := range m.nonces {\n\t\t\tif time.Now().After(expires) {\n\t\t\t\tdelete(m.nonces, nonce)\n\t\t\t}\n\t\t}\n\t\tm.mutex.Unlock()\n\t\ttime.Sleep(sessionCheckInterval * time.Second)\n\t}\n}", "func CheckRunningSession(userID int64) bool {\n\tif err := GetSessionByUserID(&Session{}, userID); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func (s *Stream) Session() *Session {\n\treturn s.session\n}", "func (rp *Provider) SessionAll(ctx context.Context) int {\n\treturn 0\n}", "func (input *BeegoInput) Session(key interface{}) interface{} {\n\treturn input.CruSession.Get(nil, key)\n}", "func (e *engine) loadSession(ctx *Context) {\n\tif AppSessionManager().IsStateful() {\n\t\tctx.subject.Session = AppSessionManager().GetSession(ctx.Req.Unwrap())\n\t}\n}", "func (st *MemSessionStore) SessionID() string {\n\treturn st.sid\n}", "func (pc *PFCPConnection) ForgetSession(seid SEID) bool {\n\tpc.Lock()\n\tdefer pc.Unlock()\n\treturn pc.forgetSessionUnlocked(seid)\n}", "func (c *Config) Session() (*Session, diag.Diagnostics) {\n\tsess := &Session{\n\t\tjunosIP: c.junosIP,\n\t\tjunosPort: c.junosPort,\n\t\tjunosUserName: c.junosUserName,\n\t\tjunosPassword: c.junosPassword,\n\t\tjunosSSHKeyPEM: c.junosSSHKeyPEM,\n\t\tjunosSSHKeyFile: c.junosSSHKeyFile,\n\t\tjunosKeyPass: c.junosKeyPass,\n\t\tjunosGroupIntDel: c.junosGroupIntDel,\n\t\tjunosLogFile: c.junosDebugNetconfLogPath,\n\t\tjunosSleep: c.junosCmdSleepLock,\n\t\tjunosSleepShort: c.junosCmdSleepShort,\n\t}\n\n\treturn sess, nil\n}", "func (session *Session) IsValid() error {\n\tif err := mongo.Execute(\"monotonic\", SessionCollectionName(session.TenantID),\n\t\tfunc(collection *mgo.Collection) error {\n\t\t\tselector := bson.M{\n\t\t\t\t\"token\": session.Token,\n\t\t\t}\n\t\t\treturn collection.Find(selector).One(session)\n\t\t}); err != nil {\n\t\treturn fmt.Errorf(\"Error[%s] while finding session with token[%s]\", err, session.Token)\n\t}\n\t// if session.Expired() {\n\t// \treturn fmt.Errorf(\"Session expired\")\n\t// }\n\t// extend expired Time\n\tselector := bson.M{\n\t\t\"_id\": session.ID,\n\t}\n\tupdator := bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"e_at\": time.Now().Add(time.Duration(1) * time.Hour),\n\t\t\t\"u_at\": time.Now(),\n\t\t},\n\t}\n\treturn session.Update(session.TenantID, selector, updator)\n}", "func IsAuthenticatedQuick(socketID uuid.UUID) bool {\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\t_, ok := sessionCache[socketID]\n\treturn ok\n}", "func (o *SessionDevice) HasUserAgent() bool {\n\tif o != nil && o.UserAgent != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func addSession(s *sessions.Session, triggerEvent bool) {\n\t// Remove the session if closed from the map.\n\ts.OnceClose(removeSession)\n\n\t// Lock the mutex.\n\tactiveSessionsMutex.Lock()\n\tdefer activeSessionsMutex.Unlock()\n\n\t// Add the session to the map.\n\tactiveSessions[s.SessionID()] = s\n\n\tif triggerEvent {\n\t\t// Trigger the event.\n\t\ttriggerOnNewSession(s)\n\t}\n}", "func (pder *MemProvider) SessionInit(maxlifetime int64, savePath string) error {\n\treturn (*session.MemProvider)(pder).SessionInit(context.Background(), maxlifetime, savePath)\n}", "func GetSession(token string) (*Session, bool) {\n\tconst q = `SELECT * FROM Sessions WHERE token=$1 AND expires > now()`\n\n\tsession := &Session{}\n\terr := database.Get(session, q, token)\n\tif err != nil && err != sql.ErrNoRows {\n\t\tpanic(err)\n\t}\n\n\treturn session, err == nil\n}", "func session(rp core.Roundtrip) (sess model.Session, err error) {\n\tcookie := rp.GetCookie(\"_cookie\")\n\tif err == nil {\n\t\tsess = model.Session{Uuid: cookie}\n\t\tif ok, _ := sess.Check(); !ok {\n\t\t\terr = errors.New(\"Invalid session\")\n\t\t}\n\t}\n\treturn\n}", "func Get(ctx context.Context) *Session {\n\t// TODO maybe check this\n\treturn ctx.Value(sessionContextKey{}).(*Session)\n}", "func (c *ConsulClient) IsRegistered(ctx context.Context, sessionID string) bool {\n\tregistryOperationCount.WithLabelValues(env, \"IsRegistered\").Inc()\n\n\tstartTime := time.Now()\n\tdefer func() {\n\t\tregistryOperationTimeTaken.WithLabelValues(env, \"IsRegistered\").Observe(time.Now().Sub(startTime).Seconds())\n\t}()\n\n\tsession, _, err := c.client.Session().Info(sessionID, nil)\n\tif err != nil {\n\t\tlogger.Ctx(ctx).Errorw(\"failed to get session info\", \"error\", err.Error())\n\t\treturn false\n\t}\n\n\treturn session != nil\n}", "func (c _StoreImpl) Session_ById(Id int) (*Session, bool) {\n\to, ok := RowCacheIndex.Get(\"Session_Id:\" + fmt.Sprintf(\"%v\", Id))\n\tif ok {\n\t\tif obj, ok := o.(*Session); ok {\n\t\t\treturn obj, true\n\t\t}\n\t}\n\n\trow, err := NewSession_Selector().Id_Eq(Id).GetRow(base.DB)\n\tif err == nil {\n\t\tRowCacheIndex.Set(\"Session_Id:\"+fmt.Sprintf(\"%v\", row.Id), row, 0)\n\t\treturn row, true\n\t}\n\n\tXOLogErr(err)\n\treturn nil, false\n}", "func Session(c *gin.Context) {\n\tc.JSON(http.StatusOK, domain.GamesMap)\n}", "func (_FinalizableCrowdsaleImpl *FinalizableCrowdsaleImplSession) HasClosed() (bool, error) {\n\treturn _FinalizableCrowdsaleImpl.Contract.HasClosed(&_FinalizableCrowdsaleImpl.CallOpts)\n}", "func (p *MongodbProvider) Exist(sid string) bool {\n\tnum, err := p.c.Find(bson.M{\"key\": sid}).Count()\n\tif err != nil {\n\t\tpanic(\"session/mgoSession: error checking existence: \" + err.Error())\n\t}\n\treturn num != 0\n}", "func (sp *SessionProxy) GetSession() (session Session) {\n\tsp.lock.RLock()\n\tsession = sp.session\n\tsp.lock.RUnlock()\n\treturn\n}", "func (pder *MemProvider) SessionGC() {\n\t(*session.MemProvider)(pder).SessionGC(context.Background())\n}", "func (_Lmc *LmcSession) HasStakingStarted() (bool, error) {\n\treturn _Lmc.Contract.HasStakingStarted(&_Lmc.CallOpts)\n}", "func getSession(r *http.Request) (*sessions.Session, error) {\n\tsession, err := store.Get(r, sessionName)\n\tif err != nil {\n\t\tif session.IsNew {\n\t\t\tglog.V(1).Infof(\"ignoring initial session fetch error since session IsNew: %v\\n\", err)\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"error fetching session: %v\", err)\n\t\t}\n\t}\n\treturn session, nil\n}", "func VerifySession(key string, user int) bool {\n\tvar sessions []Session\n\tdb.Where(\"user is ?\", user).Find(&sessions)\n\tfor i := range sessions {\n\t\tif sessions[i].Key == key {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (s *State) MarkSession(req *rpc.RemainRequest, now time.Time) (ok bool) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tsessionID := req.Session.SessionId\n\n\tif sess, ok := s.sessions[sessionID]; ok {\n\t\tsess.SetLastMarked(now)\n\t\tif req.ApiKey != \"\" {\n\t\t\tif client, ok := s.clients.Load(sessionID); ok {\n\t\t\t\tclient.ApiKey = req.ApiKey\n\t\t\t\ts.clients.Store(sessionID, client)\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.73276985", "0.6829984", "0.663619", "0.66340333", "0.6624183", "0.66232616", "0.66033375", "0.65276873", "0.6525407", "0.6486037", "0.6478318", "0.6466748", "0.64379466", "0.6426397", "0.63889796", "0.6324362", "0.63059235", "0.6290662", "0.623621", "0.6206161", "0.6145826", "0.60492903", "0.604686", "0.6009767", "0.5994057", "0.59537107", "0.59120935", "0.5899927", "0.5887429", "0.5859137", "0.58505917", "0.5845827", "0.5845018", "0.58444893", "0.58395666", "0.58375734", "0.5833557", "0.5824095", "0.5810919", "0.58092326", "0.578658", "0.57701623", "0.576708", "0.5743296", "0.5741098", "0.57397825", "0.57375896", "0.57368535", "0.5728702", "0.5727856", "0.57264316", "0.57221794", "0.57143945", "0.57139426", "0.5708952", "0.57023615", "0.5691356", "0.56900615", "0.568958", "0.56877244", "0.56873816", "0.5681202", "0.56782955", "0.5669477", "0.56694275", "0.5662315", "0.5648669", "0.5647297", "0.5630967", "0.56274146", "0.5626108", "0.56189966", "0.56121725", "0.5607199", "0.5603774", "0.56023324", "0.55980414", "0.5583701", "0.5547827", "0.5546138", "0.5545076", "0.5536357", "0.5526894", "0.55265695", "0.55111", "0.5510963", "0.5508394", "0.5505777", "0.5501209", "0.54925615", "0.54891175", "0.54872507", "0.54861313", "0.5470696", "0.54658234", "0.54603684", "0.5455042", "0.5454483", "0.5448433", "0.5441484" ]
0.7448208
0
GetPrivateKeyEntry implemented in memory.
GetPrivateKeyEntry реализован в памяти.
func (ms *MemStore) GetPrivateKeyEntry(pubKeyHash string) (*uid.KeyEntry, error) { ke, ok := ms.privateKeyEntryMap[pubKeyHash] if !ok { return nil, log.Error(session.ErrNoKeyEntry) } return ke, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *Account) GetPrivateKey() crypto.PrivateKey { return a.key }", "func (a *Account) GetPrivateKey() crypto.PrivateKey {\n\treturn a.key\n}", "func (w *Whisper) GetPrivateKey(id string) (*ecdsa.PrivateKey, error) {\n\tw.keyMu.RLock()\n\tdefer w.keyMu.RUnlock()\n\tkey := w.privateKeys[id]\n\tif key == nil {\n\t\treturn nil, fmt.Errorf(\"invalid id\")\n\t}\n\treturn key, nil\n}", "func GetPrivateKey() ed25519.PrivateKey {\n\tkey, _ := DecodePrivateKey(privateKey)\n\treturn key\n}", "func (u user) GetPrivateKey() crypto.PrivateKey {\n\treturn u.key\n}", "func (c Certificate) GetPrivateKey() []byte {\n\treturn c.privateKey\n}", "func GetPrivateKey(passphrase string, address string) (string, error) {\n\tkeys, err := GetPublicPrivateKey(passphrase, address)\n\n\treturn keys.PrivateKey, err\n}", "func (d *identityManager) PrivateKey() []byte {\n\treturn d.key.PrivateKey\n}", "func (k *key) getPrivateKey() (*ecdsa.PrivateKey, error) {\n\tby, err := base64.StdEncoding.DecodeString(k.PrivateKeyB64)\n\tif err != nil {\n\t\treturn (*ecdsa.PrivateKey)(nil), err\n\t}\n\n\tblock, _ := pem.Decode([]byte(by))\n\ttempKey, err := x509.ParseECPrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn (*ecdsa.PrivateKey)(nil), err\n\t}\n\n\treturn tempKey, nil\n}", "func GetPrivateKey(address, password, folderPath string) (*ecdsa.PrivateKey, error) {\n\n\t// Get the file that contains the private key\n\tfile, err := getUTCFile(address[2:], folderPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Read the file\n\tjsonBytes, err := ioutil.ReadFile(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get the private key\n\tkeyWrapper, err := keystore.DecryptKey(jsonBytes, password)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn keyWrapper.PrivateKey, nil\n}", "func (o *PipelineSshKeyPairAllOf) GetPrivateKey() string {\n\tif o == nil || o.PrivateKey == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PrivateKey\n}", "func (decryptor *PgDecryptor) GetPrivateKey() (*keys.PrivateKey, error) {\n\tif decryptor.IsWithZone() {\n\t\treturn decryptor.keyStore.GetZonePrivateKey(decryptor.GetMatchedZoneID())\n\t}\n\treturn decryptor.keyStore.GetServerDecryptionPrivateKey(decryptor.clientID)\n}", "func (grc *GitRemoteConfiguration) GetPrivateKey() *string {\n\treturn grc.PrivateKey\n}", "func (e *Domain) Private() *PrivateKey {\n\tif e.ClearPrivateKey == nil {\n\t\te.decrypt_privatekey()\n\t}\n\treturn e.ClearPrivateKey\n}", "func (p *PrivateKey) PrivateKey() *ecdsa.PrivateKey {\n\treturn p.privateKey\n}", "func (k *KeyPair) GetPrivateKey() p2pCrypto.PrivKey {\n\treturn k.privKey\n}", "func (rm *ReconstructingMember) individualPrivateKey() *big.Int {\n\treturn rm.secretCoefficients[0]\n}", "func (ms *MemStore) AddPrivateKeyEntry(ke *uid.KeyEntry) {\n\tms.privateKeyEntryMap[ke.HASH] = ke\n}", "func (o SslCertificateSelfManagedSslCertificateOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificate) *string { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (w *Wallet) GetPrivateKey() string {\n\treturn hex.EncodeToString(w.PrivateKey.D.Bytes())\n}", "func GetKey(t *testing.T) []byte {\n\tt.Helper()\n\n\tk, _ := GeneratePrivateKey()\n\treturn k.Data[:]\n}", "func GetPrivateKey(bitSize int) *rsa.PrivateKey {\n\tfilePath := \"private.pem\"\n\n\tif _, err := os.Stat(filePath); os.IsNotExist(err) {\n\t\tprivateKey, err := GeneratePrivateKey(bitSize)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"could not generate private key, %v\", err)\n\t\t}\n\n\t\tEncodePrivateKeyToPEM(filePath, privateKey)\n\t\treturn privateKey\n\t}\n\treturn DecodePrivateKeyFromFile(filePath)\n\n}", "func GetPrivateKey() (*ecdsa.PrivateKey, error) {\n\t// Opens the wallet\n\tfile, err := os.Open(\"aurum_wallet.json\")\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to open wallet\")\n\t}\n\tdefer file.Close()\n\n\t// Reads the file and stores the data into a byte slice\n\tdata, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to read wallet\")\n\t}\n\n\t// Json struct for storing the private key from the json file\n\ttype jsonStruct struct {\n\t\tPrivateKey string\n\t}\n\n\t// Parse the data from the json file into a jsonStruct\n\tvar j jsonStruct\n\terr = json.Unmarshal(data, &j)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Decodes the private key from the jsonStruct\n\tpemEncoded, _ := hex.DecodeString(j.PrivateKey)\n\tprivateKey, err := privatekey.Decode(pemEncoded)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn privateKey, nil\n}", "func (o ProviderOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (s *Service) GetPrivateKey(keyID string) (crypto.PrivateKey, error) {\n\tprivateKey, ok := s.keys[keyID]\n\tif !ok {\n\t\ts.log.Error(\"The specified key was not found\", \"keyID\", keyID)\n\t\treturn nil, signingkeys.ErrSigningKeyNotFound.Errorf(\"The specified key was not found: %s\", keyID)\n\t}\n\n\treturn privateKey, nil\n}", "func (c ClientSettings) RetrievalPrivateKey() *fcrcrypto.KeyPair {\n\treturn c.retrievalPrivateKey\n}", "func (cfg *Config) PrivateKey() hotstuff.PrivateKey {\n\treturn cfg.privKey\n}", "func (c *ConfigurationData) GetServiceAccountPrivateKey() ([]byte, string) {\n\treturn []byte(c.v.GetString(varServiceAccountPrivateKey)), c.v.GetString(varServiceAccountPrivateKeyID)\n}", "func (u *walletIdentity) PrivateKey() core.Key {\n\treturn u.privateKey\n}", "func (w *XPubWallet) GetEntry(a cipher.Address) (Entry, bool) {\n\treturn w.Entries.get(a)\n}", "func (o SslCertificateSelfManagedSslCertificatePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificate) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (obj *bucket) PrivateKey() encryption.PrivateKey {\n\treturn obj.pk\n}", "func GetPrivateKey() (*ecdsa.PrivateKey, error) {\n\treturn crypto.HexToECDSA(\"1944dae12efeb1b1107dc1f3c7a459a01d865fff1c4b43a26f1755876aa1b820\")\n}", "func (handler *NonceSignHandler) GetPrivateKey() *ecdsa.PrivateKey {\n\treturn handler.privateKey\n}", "func getPrivateKey(data []byte) ([]byte, error) {\n\tvar der []byte\n\tvar derKey []byte\n\tfor {\n\t\tpemBlock, rest := pem.Decode(data)\n\t\tif pemBlock == nil {\n\t\t\tbreak\n\t\t}\n\t\tif pemBlock.Type != certType {\n\t\t\tder = pemBlock.Bytes\n\t\t}\n\t\tdata = rest\n\t}\n\n\tif key, err := x509.ParsePKCS1PrivateKey(der); err == nil {\n\t\tderKey = x509.MarshalPKCS1PrivateKey(key)\n\t}\n\n\tif key, err := x509.ParsePKCS8PrivateKey(der); err == nil {\n\t\tswitch key := key.(type) {\n\t\tcase *rsa.PrivateKey:\n\t\t\tderKey = x509.MarshalPKCS1PrivateKey(key)\n\t\tcase *ecdsa.PrivateKey:\n\t\t\tderKey, err = x509.MarshalECPrivateKey(key)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown private key type found while getting key. Only rsa and ecdsa are supported\")\n\t\t}\n\t}\n\tif key, err := x509.ParseECPrivateKey(der); err == nil {\n\t\tderKey, err = x509.MarshalECPrivateKey(key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tblock := &pem.Block{\n\t\tType: privateKeyType,\n\t\tBytes: derKey,\n\t}\n\n\treturn pem.EncodeToMemory(block), nil\n}", "func (k *EdX25519Key) PrivateKey() *[ed25519.PrivateKeySize]byte {\n\treturn k.privateKey\n}", "func (addr *Address) PrivateKey() *btcec.PrivateKey {\n\tpk := addr.calcDoubleHash()[:32]\n\tprivKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), pk)\n\treturn privKey\n}", "func GetAnotherPrivateKey() (*ecdsa.PrivateKey, error) {\n\treturn crypto.HexToECDSA(\"a05b7b4580376959940f3bbdb84dab4780c49e97f47c1e8792c12963552931b3\")\n}", "func (serv *ExchangeServer) GetAddrPrivKey(cp, addr string) (string, error) {\n\t_, key, err := serv.wallets.GetKeypair(cp, addr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn key, nil\n}", "func (o SslCertificateSelfManagedSslCertificateResponsePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificateResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (c *ConfigurationData) GetUserAccountPrivateKey() ([]byte, string) {\n\treturn []byte(c.v.GetString(varUserAccountPrivateKey)), c.v.GetString(varUserAccountPrivateKeyID)\n}", "func (km *Keystore) Get(name string) (ci.PrivKey, error) {\n\tif err := validateName(name); err != nil {\n\t\treturn nil, err\n\t}\n\tif has, err := km.Has(name); err != nil {\n\t\treturn nil, err\n\t} else if !has {\n\t\treturn nil, errors.New(ErrNoSuchKey)\n\t}\n\tencryptedPKBytes, err := km.ds.Get(ds.NewKey(name))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treader := bytes.NewReader(encryptedPKBytes)\n\tpkBytes, err := km.em.Decrypt(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ci.UnmarshalPrivateKey(pkBytes)\n}", "func (*FactorySECP256K1R) ToPrivateKey(b []byte) (PrivateKey, error) {\n\treturn &PrivateKeySECP256K1R{\n\t\tsk: secp256k1.PrivKeyFromBytes(b),\n\t\tbytes: b,\n\t}, nil\n}", "func (e *EtcdCert) PrivateKeyPath() string { return path.Join(e.BaseDir, etcdKeyFileName) }", "func GetPrivateKey(loader KeyLoader) (*rsa.PrivateKey, error) {\n\tif loader == nil {\n\t\treturn nil, errors.New(\"no loader\")\n\t}\n\n\tdata, err := loader.GetBytes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprivPem, _ := pem.Decode(data)\n\tif privPem.Type != \"RSA PRIVATE KEY\" {\n\t\treturn nil, errors.New(\"incorrect pem type: \" + privPem.Type)\n\t}\n\n\tvar parsedKey interface{}\n\tif parsedKey, err = x509.ParsePKCS1PrivateKey(privPem.Bytes); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif privateKey, ok := parsedKey.(*rsa.PrivateKey); !ok {\n\t\treturn nil, errors.New(\"failed convert parsed key to private key\")\n\t} else {\n\t\treturn privateKey, nil\n\t}\n}", "func (o SslCertOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCert) pulumi.StringOutput { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func (kp *MockKeyProvider) GetPrivateKey() (crypto.PrivateKey, error) {\n\treturn kp.PrivateKey, kp.Err\n}", "func (o SslCertificateOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCertificate) pulumi.StringOutput { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func (c *Client) GetEntry(ctx context.Context, userID, appID string, opts ...grpc.CallOption) ([]byte, *trillian.SignedMapRoot, error) {\n\te, err := c.VerifiedGetEntry(ctx, appID, userID)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// Empty case.\n\tif e.GetCommitted() == nil {\n\t\treturn nil, e.GetSmr(), nil\n\t}\n\n\treturn e.GetCommitted().GetData(), e.GetSmr(), nil\n}", "func (o *TppCertificateParams) GetPrivateKey() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.PrivateKey\n}", "func (sc Credential) getPrivateKey(privateKeyPath string, privateKeyPassphrase string) (ssh.AuthMethod, error) {\n\tif !fileExist(privateKeyPath) {\n\t\tprivateKeyPath = filepath.Join(os.Getenv(\"HOME\"), \".ssh/id_rsa\")\n\t}\n\n\tkey, err := ioutil.ReadFile(privateKeyPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse private key: %v\", err)\n\t}\n\n\tvar signer ssh.Signer\n\tif privateKeyPassphrase != \"\" {\n\t\tsigner, err = ssh.ParsePrivateKeyWithPassphrase(key, []byte(privateKeyPassphrase))\n\t} else {\n\t\tsigner, err = ssh.ParsePrivateKey(key)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse private key failed: %v\", err)\n\t}\n\n\treturn ssh.PublicKeys(signer), nil\n}", "func getPrivateKeyHandle(p *pkcs11.Ctx, session pkcs11.SessionHandle, keyID []byte) (pkcs11.ObjectHandle, error) {\n\tfindTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, keyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n\t}\n\tif err := p.FindObjectsInit(session, findTemplate); err != nil {\n\t\tlogrus.Debugf(\"Failed to init: %s\", err.Error())\n\t\treturn 0, err\n\t}\n\tobj, _, err := p.FindObjects(session, 1)\n\tif err != nil {\n\t\tlogrus.Debugf(\"Failed to find objects: %v\", err)\n\t\treturn 0, err\n\t}\n\tif err := p.FindObjectsFinal(session); err != nil {\n\t\tlogrus.Debugf(\"Failed to finalize: %s\", err.Error())\n\t\treturn 0, err\n\t}\n\tif len(obj) != 1 {\n\t\tlogrus.Debugf(\"should have found one object\")\n\t\treturn 0, errors.New(\"no matching keys found inside of Luna\")\n\t}\n\treturn obj[0], nil\n}", "func GetPrivateKeyFromFile(keyFile string) (*ecdsa.PrivateKey, error) {\n\tkeyPEMBlock, err := os.ReadFile(keyFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//Following logic is derived from steps in\n\t//https://golang.org/src/crypto/tls/tls.go:X509KeyPair()\n\tvar keyDERBlock *pem.Block\n\tvar skippedBlockTypes []string\n\tfor {\n\t\tkeyDERBlock, keyPEMBlock = pem.Decode(keyPEMBlock)\n\t\tif keyDERBlock == nil {\n\t\t\tif len(skippedBlockTypes) == 0 {\n\t\t\t\treturn nil, errors.New(\"Failed to find any PEM data in key input\")\n\t\t\t}\n\t\t\tif len(skippedBlockTypes) == 1 && skippedBlockTypes[0] == \"CERTIFICATE\" {\n\t\t\t\treturn nil, errors.New(\"Got a certificate instead of key\")\n\t\t\t}\n\t\t\treturn nil, errors.New(\"No PEM block found with type PRIVATE KEY\")\n\t\t}\n\t\tif keyDERBlock.Type == \"PRIVATE KEY\" ||\n\t\t\tstrings.HasSuffix(keyDERBlock.Type, \"EC PRIVATE KEY\") {\n\t\t\tbreak\n\t\t}\n\t\tskippedBlockTypes = append(skippedBlockTypes, keyDERBlock.Type)\n\t}\n\tif key, err := x509.ParsePKCS8PrivateKey(keyDERBlock.Bytes); err == nil {\n\t\tvar pkey *ecdsa.PrivateKey\n\t\tvar ok bool\n\t\tif pkey, ok = key.(*ecdsa.PrivateKey); !ok {\n\t\t\treturn nil, errors.New(\"Private key is not ecdsa type\")\n\t\t}\n\t\treturn pkey, nil\n\t}\n\tif key, err := x509.ParseECPrivateKey(keyDERBlock.Bytes); err == nil {\n\t\treturn key, nil\n\t} else {\n\t\treturn nil, err\n\t}\n}", "func (o SslCertificateSelfManagedSslCertificateResponseOutput) PrivateKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificateResponse) string { return v.PrivateKey }).(pulumi.StringOutput)\n}", "func (c CertificateKey) Private() string {\n\treturn c.private\n}", "func PrivateKeyFile(usage Usage, version scrypto.KeyVersion) string {\n\treturn fmt.Sprintf(\"%s-v%d.key\", usage, version)\n}", "func (kt KeyType) PrivateKey() string {\n\treturn kt.KeyBaseName\n}", "func GetPrivateKeyByPath(hdKey *hdkeychain.ExtendedKey, chain, num uint32) (*bsvec.PrivateKey, error) {\r\n\r\n\t// Get the child key from the num & chain\r\n\tchildKeyNum, err := GetHDKeyByPath(hdKey, chain, num)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\t// Get the private key\r\n\treturn childKeyNum.ECPrivKey()\r\n}", "func (keyDB *KeyDB) GetPrivateKeyInit(\n\tpubKeyHash string,\n) (ki *uid.KeyInit, sigPubKey, privKey string, err error) {\n\tvar json string\n\terr = keyDB.getPrivateKeyInitQuery.QueryRow(pubKeyHash).Scan(&json, &sigPubKey, &privKey)\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, \"\", \"\", log.Error(err)\n\tdefault:\n\t\tki, err = uid.NewJSONKeyInit([]byte(json))\n\t\tif err != nil {\n\t\t\treturn nil, \"\", \"\", err\n\t\t}\n\t\treturn\n\t}\n}", "func (x *Ed25519Credentials) PrivateKey() PrivateKey {\n\n\treturn PrivateKey{\n\t\tAlgorithm: AlgorithmEd25519,\n\t\tPrivate: base64.URLEncoding.EncodeToString(x.Private[:]),\n\t}\n\n}", "func (mc *MoacChain) exportWalletPrivateKey(addr, addrPasswd string) (privateKey string, err error) {\n\n\tdefer func() {\n\t\tif re := recover(); re != nil {\n\t\t\terr = re.(error)\n\t\t}\n\t}()\n\n\tvar acc accounts.Account\n\tacc, err = mc.fetchKeystore().Find(accounts.Account{Address: common.HexToAddress(addr)})\n\tif err == nil {\n\t\tvar jsonBytes []byte\n\t\tjsonBytes, err = ioutil.ReadFile(acc.URL.Path)\n\t\tif err == nil {\n\t\t\tvar storeKey *keystore.Key\n\t\t\tstoreKey, err = keystore.DecryptKey(jsonBytes, addrPasswd)\n\t\t\tif err == nil {\n\t\t\t\tprivateKey = hex.EncodeToString(ethMath.PaddedBigBytes(storeKey.PrivateKey.D, storeKey.PrivateKey.Params().BitSize/8))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn privateKey, err\n}", "func readPrivateKey() ([]byte, error) {\n\tkeyData, err := ioutil.ReadFile(authConfigFile)\n\tif err != nil {\n\t\tlog.Errorf(\"Returning error, authConfigFile %s not found\", authConfigFile)\n\t\treturn []byte{}, err\n\t}\n\n\tlog.Debug(\"Key: %s\", string(keyData))\n\treturn keyData, nil\n}", "func parsePrivateKey(der []byte) (crypto.PrivateKey, error) {\n if key, err := x509.ParsePKCS1PrivateKey(der); err == nil {\n return key, nil\n }\n if key, err := x509.ParsePKCS8PrivateKey(der); err == nil {\n switch key := key.(type) {\n case *rsa.PrivateKey, *ecdsa.PrivateKey:\n return key, nil\n default:\n return nil, errors.New(\"crypto/tls: found unknown private key type in PKCS#8 wrapping\")\n }\n }\n if key, err := x509.ParseECPrivateKey(der); err == nil {\n return key, nil\n }\n\n return nil, errors.New(\"crypto/tls: failed to parse private key\")\n}", "func GetTokenPrivateKey() []byte {\n\treturn []byte(viper.GetString(varTokenPrivateKey))\n}", "func FindPrivateKey(clientID string) (string, *exception.Exception) {\n\texits, ex := redisservice.Exits(clientID)\n\tif ex != nil {\n\t\treturn \"\", ex.ResetCode(1001)\n\t}\n\n\tif !exits {\n\t\treturn \"\", exception.NewException(exception.Error, 1002, \"This client security session was not found.\")\n\t}\n\n\tkey, ex1 := redisservice.Get(clientID)\n\tif ex1 != nil {\n\t\treturn \"\", ex1.ResetCode(1001)\n\t}\n\n\treturn key, nil\n}", "func (e *EtcdClientCert) PrivateKeyPath() string { return path.Join(e.BaseDir, etcdClientKeyFileName) }", "func GetRSAKey(size int) (data.PrivateKey, error) {\n\traw := map[int][]byte{\n\t\t1024: []byte(`-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQDJ8BO2/HOHLJgrb3srafbNRUD8r0SGNJFi5h7t4vxZ4F5oBW/4\nO2/aZmdToinyuCm0eGguK77HAsTfSHqDUoEfuInNg7pPk4F6xa4feQzEeG6P0YaL\n+VbApUdCHLBE0tVZg1SCW97+27wqIM4Cl1Tcsbb+aXfgMaOFGxlyga+a6wIDAQAB\nAoGBAKDWLH2kGMfjBtghlLKBVWcs75PSbPuPRvTEYIIMNf3HrKmhGwtVG8ORqF5+\nXHbLo7vv4tpTUUHkvLUyXxHVVq1oX+QqiRwTRm+ROF0/T6LlrWvTzvowTKtkRbsm\nmqIYEbc+fBZ/7gEeW2ycCfE7HWgxNGvbUsK4LNa1ozJbrVEBAkEA8ML0mXyxq+cX\nCwWvdXscN9vopLG/y+LKsvlKckoI/Hc0HjPyraq5Docwl2trZEmkvct1EcN8VvcV\nvCtVsrAfwQJBANa4EBPfcIH2NKYHxt9cP00n74dVSHpwJYjBnbec5RCzn5UTbqd2\ni62AkQREYhHZAryvBVE81JAFW3nqI9ZTpasCQBqEPlBRTXgzYXRTUfnMb1UvoTXS\nZd9cwRppHmvr/4Ve05yn+AhsjyksdouWxyMqgTxuFhy4vQ8O85Pf6fZeM4ECQCPp\nWv8H4thJplqSeGeJFSlBYaVf1SRtN0ndIBTCj+kwMaOMQXiOsiPNmfN9wG09v2Bx\nYVFJ/D8uNjN4vo+tI8sCQFbtF+Qkj4uSFDZGMESF6MOgsGt1R1iCpvpMSr9h9V02\nLPXyS3ozB7Deq26pEiCrFtHxw2Pb7RJO6GEqH7Dg4oU=\n-----END RSA PRIVATE KEY-----`),\n\t\t2048: []byte(`-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAtKGse3BcxXAp5OkLGYq0HfDcCvgag3R/9e8pHUGsJhkSZFrn\nZWAsAVFKSYaYItf1D/g3izqVDMtMpXZ1chNzaRysnbrb/q7JTbiGzXo9FcshyUc9\ntcB60wFbvsXE2LaxZcKNxLYXbOvf+tdg/P07oPG24fzYI4+rbZ1wyoORbT1ys33Z\nhHyifFvO7rbe69y3HG+xbp7yWYAR4e8Nw9jX8/9sGslAV9vEXOdNL3qlcgsYRGDU\nDsUJsnWaMzjstvUxb8mVf9KG2W039ucgaXgBW/jeP3F1VSYFKLd03LvuJ8Ir5E0s\ncWjwTd59nm0XbbRI3KiBGnAgrJ4iK07HrUkpDQIDAQABAoIBAHfr1k1lfdH+83Fs\nXtgoRAiUviHyMfgQQlwO2eb4kMgCYTmLOJEPVmfRhlZmK18GrUZa7tVaoVYLKum3\nSaXg0AB67wcQ5bmiZTdaSPTmMOPlJpsw1wFxtpmcD0MKnfOa5w++KMzub4L63or0\nrwmHPi1ODLLgYMbLPW7a1eU9kDFLOnx3RRy9a29hQXxGsRYetrIbKmeDi6c+ndQ8\nI5YWObcixxl5GP6CTnEugV7wd2JmXuQRGFdopUwQESCD9VkxDSevQBSPoyZKHxGy\n/d3jf0VNlvwsxhD3ybhw8jTN/cmm2LWmP4jylG7iG7YRPVaW/0s39IZ9DnNDwgWB\n03Yk2gECgYEA44jcSI5kXOrbBGDdV+wTUoL24Zoc0URX33F15UIOQuQsypaFoRJ6\nJ23JWEZN99aquuo1+0BBSfiumbpLwSwfXi0nL3oTzS9eOp1HS7AwFGd/OHdpdMsC\nw2eInRwCh4GrEf508GXo+tSL2NS8+MFVAG2/SjEf06SroQ/rQ87Qm0ECgYEAyzqr\n6YvbAnRBy5GgQlTgxR9r0U8N7lM9g2Tk8uGvYI8zu/Tgia4diHAwK1ymKbl3lf95\n3NcHR+ffwOO+nnfFCvmCYXs4ggRCkeopv19bsCLkfnTBNTxPFh6lyLEnn3C+rcCe\nZAkKLrm8BHGviPIgn0aElMQAbhJxTWfClw/VVs0CgYAlDhfZ1R6xJypN9zx04iRv\nbpaoPQHubrPk1sR9dpl9+Uz2HTdb+PddznpY3vI5p4Mcd6Ic7eT0GATPUlCeAAKH\nwtC74aSx6MHux8hhoiriV8yXNJM/CwTDL+xGsdYTnWFvx8HhmKctmknAIT05QbsH\nG9hoS8HEJPAyhbYpz9eXQQKBgQCftPXQTPXJUe86uLBGMEmK34xtKkD6XzPiA/Hf\n5PdbXG39cQzbZZcT14YjLWXvOC8AE4qCwACaw1+VR+ROyDRy0W1iieD4W7ysymYQ\nXDHDk0gZEEudOE22RlNmCcHnjERsawiN+ISl/5P/sg+OASkdwd8CwZzM43VirP3A\nlNLEqQKBgHqj85n8ew23SR0GX0W1PgowaCHHD1p81y2afs1x7H9R1PNuQsTXKnpf\nvMiG7Oxakj4WDC5M5KsHWqchqKDycT+J1BfLI58Sf2qo6vtaV+4DARNgzcG/WB4b\nVnpsczK/1aUH7iBexuF0YqdPQwzpSvrY0XZcgCFQ52JDn3vjblhX\n-----END RSA PRIVATE KEY-----`),\n\t\t4096: []byte(`-----BEGIN RSA PRIVATE KEY-----\nMIIJKgIBAAKCAgEAw28m5P1j7Rv1Wy4AicNkR4DXVxJXlPma+c5U/KJzFg0emiyx\nfkGQnUWeFofOI3rgrgK3deQ6yspgavTKWnHs4YeAz2egMSDsobI1OAP7ocPrFhYc\nFB+pTLXm1CkvyxIt9UWPxgc4CGiO1wIlfL8PpFg5vur7sAqbzxKeFx8GikbjFbQg\nd/RMFYeQacuimo9yea9DqjELvwewby3iP81FP9JJKiM3G6+7BiI+pJv65dNLbBUY\nHgKrmBHYg7WVSdmR7pZucEDoBqJcjc+kIHDGMH2vndWhIybEpHxxXdW+DrnPlhGV\n/hqKWw5fqJvhdh0OR1yefCCva0m6mZAKardzqxndFJqJbs1ehXg0luijVRYXaUpP\nuvHaKj+QV2R/PJWxkCLZLFSEAE156QT1sfY5FOh8rYBWBNrJk7X6qUTaF7Jfeo3H\nCF94ioP0Up8bohIu0lH8WPfTxdZ2lvUGSteMEYWBSbKhcbSCOP6a2K4/znSNl/J3\nLV/YcbmuSb7sAp+sZXELarYg/JMNVP4Vo2vh5S4ZCPYtk2or2WY27rMHWQ1vIhjB\nxjuSKzpLx9klusoTHB3wD6K7FwyT4JLUTfxGloSSpOuLG5yp9dAL/i8WHY20w6jP\n7ZYOss6OsQzp5ZqpW5M/0z60NsEOhfFXd1bxPYUP7//6N14XHTg31fg7vykCAwEA\nAQKCAgEAnn+j/K0ggKlfGL67Qv9Lcc4lVwGSNEknDhfvxyB809J6EjHTFYFZJqPS\nbZVgclfypk2fuqYJpHPzNGspPacNpW7+4ba6LX31S8I69R4N0wkQvM3bodp3tLYF\n6eUpVLl+ul/bFZC/OdqKlgewnXZa2j+PPa5Xx1MjQBJqUnggFr8c5no6pu5jUkaq\nsZKsYkuaXOPurbWvQBOdXN3Kk1IIKpWCLwF2bSbdOEFHqrqyBfiSP6rv707dGazH\nezImTEl+2A/6q2GIi/DbvUs8Ye70XVlht1ENqXOEoZ4nVyHFTS4XFC9ZBUdDFEwY\n+qbJeMBh1zBffG4JtqqKAobWW+xCioKVn2ArSzh1/2Q5652yeVVhR+GTSK2yd1uE\n5a5Pc65C8LCRNTz0iHEUESfVO5QnUq9bWShgm0H/LQ3sk8gzQjuBS5Ya523vOl1w\nxRUYxjEFW0382BrG0dn+WE2Yn0z5i2X9+WRgiKrh8tNZ+wNGN3MtZ5mloHsocH4N\nuUIZ6J0x/YruW126b0XA6fE+3taQDmJ4Qj/puU7+sFCs7MXUtd3tClEH1NUalH0T\n5awjZcJnMmGVmtGGfP1DtuEd082mIUuvKZj1vCEiSavwK3JDVl5goxlDpvEgdh2X\no1eSIMMZb6FG5h3dsyyMpXaRobgL+qbLm0XDGwtiIu+d5BE8OQECggEBAPL+FwUB\n2w4bRGzmDNRJm3oDcDlBROn5nFpzzSuXRA8zSrJbNB9s55EqTnZw7xVNa6nUxi9C\nd2Hqcbp9HD8EezlbMWJ4LASlYPzdBpAo5eyvK8YccE1QjlGlP7ZOf4+ekwlreqZ4\nfhRb4r/q49eW3aAWbJPu67MYu1iBMpdINZpMzDdE1wKjRXWu0j7Lr3SXjzgjD94E\nG+4VvJ0xc8WgjM9YSLxFN/5VZd+us7l6V18vOrdPDpAlJuTkmSpP0Xx4oUKJs7X+\n84CEB47GgUqf3bPadS8XRC2slEA+or5BJnPTVQ5YgTeWZE2kD3tLDOVHE7gLmV61\njYy2Icm+sosnfeECggEBAM3lVYO3D5Cw9Z4CkewrzMUxd7sSd5YqHavfEjvFc4Pk\n6Q6hsH1KR4Ai6loB8ugSz2SIS6KoqGD8ExvQxWy4AJf/n39hxb8/9IJ3b6IqBs64\n+ELJ8zw3QheER93FwK/KbawzLES9RkdpvDBSHFFfbGxjHpm+quQ8JcNIHTg43fb+\nTWe+mXYSjIWVCNssHBl5LRmkly37DxvBzu9YSZugESr80xSMDkBmWnpsq2Twh3q4\n2yP6jgfaZtV9AQQ01jkPgqpcuSoHm2qyqfiIr3LkA34OQmzWpyPn17If1DSJhlXo\nClSSl5Guqt9r0ifuBcMbl69OyAgpGr4N5sFxRk0wGkkCggEBAMt34hSqSiAUywYY\n2DNGc28GxAjdU3RMNBU1lF5k6nOD8o9IeWu7CGhwsYTR6hC/ZGCwL0dRc5/E7XhH\n3MgT247ago6+q7U0OfNirGU4Kdc3kwLvu0WyJ4nMQn5IWt4K3XpsyiXtDT3E9yjW\n6fQTev7a6A4zaJ/uHKnufUtaBrBukC3TcerehoIVYi185y1M33sVOOsiK7T/9JD3\n4MZiOqZAeZ9Uop9QKN7Vbd7ox5KHfLYT99DRmzDdDjf04ChG5llN7vJ9Sq6ZX665\nH3g6Ry2bxrYo2EkakoT9Lc77xNQF6Nn7WDAQuWqd7uzBmkm+a4+X/tPkWGOz+rTw\n/pYw+mECggEBAKQiMe1yPUJHD0YLHnB66h44tQ24RwS6RjUA+vQTD2cRUIiNdLgs\nQptvOgrOiuleNV4bGNBuSuwlhsYhw4BLno2NBYTyWEWBolVvCNrpTcv1wFLd0r0p\n/9HnbbLpNhXs9UjU8nFJwYCkVZTfoBtuSmyNB5PgXzLaj/AAyOpMywVe7C3Lz2JE\nnyjOCeVOYIgeBUnv32SUQxMJiQFcDDG3hHgUW+CBVcsYzP/TKT6qUBYQzwD7d8Xi\n4R9HK0xDIpMSPkO47xMGRWrlSoIJ1HNuOSqAC4vgAhWpeFVS8kN/bkuFUtbglVtZ\nNnYs6bdTE9zZXi4uS1/WBK+FPXLv7e8SbaECggEAI2gTDuCm5kVoVJhGzWA5/hmB\nPAUhSQpMHrT8Em4cXss6Q07q9A2l8NuNrZt6kNhwagdng7v7NdPY3ZBl/ntmKmZN\nxWUKzQCtIddW6Z/veO86F15NyBBZFXIOhzvwnrTtS3iX0JP0dlTZTv/Oe3DPk3aq\nsFJtHM6s44ZBYYAgzSAxTdl+80oGmtdrGnSRfRmlav1kjWLAKurXw8FTl9rKgGNA\nUUv/jGSe1DxnEMvtoSwQVjcS0im57vW0x8LEz5eTWMYwkvxGHm0/WU2Yb0I6mL4j\nPWrHwwPdRoF/cPNWa7eTsZBKdVN9iNHSu7yE9owXyHSpesI1IZf8Zq4bqPNpaA==\n-----END RSA PRIVATE KEY-----`),\n\t}\n\tblock, _ := pem.Decode(raw[size])\n\tkey, err := x509.ParsePKCS1PrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprivKey, err := utils.RSAToPrivateKey(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn privKey, nil\n}", "func (instance *cache) GetEntry(key string) (*Entry, fail.Error) {\n\tif instance.isNull() {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif key == \"\" {\n\t\treturn nil, fail.InvalidParameterCannotBeEmptyStringError(\"id\")\n\t}\n\n\tinstance.lock.RLock()\n\tdefer instance.lock.RUnlock()\n\n\tif _, ok := instance.reserved[key]; ok {\n\t\treturn nil, fail.NotAvailableError(\"cache entry '%s' is reserved and cannot be use until freed or committed\", key)\n\t}\n\tif ce, ok := instance.cache[key]; ok {\n\t\treturn ce, nil\n\t}\n\n\treturn nil, fail.NotFoundError(\"failed to find cache entry with key '%s'\", key)\n}", "func (c *Client) Private(id *key.Identity) ([]byte, error) {\n\tephScalar := key.KeyGroup.Scalar()\n\tephPoint := key.KeyGroup.Point().Mul(ephScalar, nil)\n\tephBuff, err := ephPoint.MarshalBinary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobj, err := ecies.Encrypt(key.KeyGroup, id.Key, ephBuff, EciesHash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := c.client.PrivateRand(context.TODO(), id, &drand.PrivateRandRequest{Request: obj})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ecies.Decrypt(key.KeyGroup, ephScalar, resp.GetResponse(), EciesHash)\n}", "func PrivateKey(p *big.Int) *big.Int {\n\tkey := new(big.Int)\n\tlimit := new(big.Int).Sub(p, big.NewInt(2))\n\tseed := rand.New(rand.NewSource(time.Now().UnixNano()))\n\treturn key.Rand(seed, limit).Add(key, big.NewInt(2))\n}", "func (key Key) ToPrivKey() cryptotypes.PrivKey {\n\treturn key.k\n}", "func GetPrivateKeyFromHDKey(hdKey *hdkeychain.ExtendedKey) (*bsvec.PrivateKey, error) {\r\n\treturn hdKey.ECPrivKey()\r\n}", "func GetAddressByPrivateKey(ssk string) (address, ucs_s string, err error) {\n\taddress = \"\"\n\tucs_s = \"\"\n\n\tsk, err := hexString2SecretKey(ssk)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpk := sk.PublicKey()\n\n\tucs := types.UnlockConditions{\n\t\tPublicKeys: []types.SiaPublicKey{types.Ed25519PublicKey(pk)},\n\t\tSignaturesRequired: 1,\n\t}\n\n\tucs_b, err := json.Marshal(ucs)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tucs_s = string(ucs_b)\n\taddress = ucs.UnlockHash().String()\n\terr = nil\n\treturn\n}", "func GetRSAPrivateKey(raw []byte) (*rsa.PrivateKey, error) {\n\tdecoded, _ := pem.Decode(raw)\n\tif decoded == nil {\n\t\treturn nil, errors.New(\"Failed to decode the PEM-encoded RSA key\")\n\t}\n\tRSAPrivKey, err := x509.ParsePKCS1PrivateKey(decoded.Bytes)\n\tif err == nil {\n\t\treturn RSAPrivKey, nil\n\t}\n\tkey, err2 := x509.ParsePKCS8PrivateKey(decoded.Bytes)\n\tif err2 == nil {\n\t\tswitch key.(type) {\n\t\tcase *ecdsa.PrivateKey:\n\t\t\treturn nil, errors.New(\"Expecting RSA private key but found EC private key\")\n\t\tcase *rsa.PrivateKey:\n\t\t\treturn key.(*rsa.PrivateKey), nil\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Invalid private key type in PKCS#8 wrapping\")\n\t\t}\n\t}\n\treturn nil, errors.Wrap(err, \"Failed parsing RSA private key\")\n}", "func (tb *tableManager) getEntry(keyIn uint64) (*tableEntry, error) {\n\tkey, ok := CleanKey(keyIn)\n\tif !ok {\n\t\tlog.Println(\"Key out of range.\")\n\t\treturn nil, errors.New(\"Key out of range.\")\n\t}\n\tentry, ok := tb.data[key]\n\tif !ok {\n\t\treturn nil, errors.New(\"Key not found in table.\")\n\t}\n\treturn entry, nil\n}", "func (b *BtcWallet) fetchPrivKey(\n\tkeyDesc *keychain.KeyDescriptor) (*btcec.PrivateKey, error) {\n\n\t// If the key locator within the descriptor *isn't* empty, then we can\n\t// directly derive the keys raw.\n\temptyLocator := keyDesc.KeyLocator.IsEmpty()\n\tif !emptyLocator || keyDesc.PubKey == nil {\n\t\treturn b.deriveKeyByLocator(keyDesc.KeyLocator)\n\t}\n\n\thash160 := btcutil.Hash160(keyDesc.PubKey.SerializeCompressed())\n\taddr, err := btcutil.NewAddressWitnessPubKeyHash(hash160, b.netParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Otherwise, we'll attempt to derive the key based on the address.\n\t// This will only work if we've already derived this address in the\n\t// past, since the wallet relies on a mapping of addr -> key.\n\tkey, err := b.wallet.PrivKeyForAddress(addr)\n\tswitch {\n\t// If we didn't find this key in the wallet, then there's a chance that\n\t// this is actually an \"empty\" key locator. The legacy KeyLocator\n\t// format failed to properly distinguish an empty key locator from the\n\t// very first in the index (0, 0).IsEmpty() == true.\n\tcase waddrmgr.IsError(err, waddrmgr.ErrAddressNotFound) && emptyLocator:\n\t\treturn b.deriveKeyByLocator(keyDesc.KeyLocator)\n\n\tcase err != nil:\n\t\treturn nil, err\n\n\tdefault:\n\t\treturn key, nil\n\t}\n}", "func (c *CertInfo) PrivateKey() []byte {\n\tecKey, ok := c.KeyPair().PrivateKey.(*ecdsa.PrivateKey)\n\tif ok {\n\t\tdata, err := x509.MarshalECPrivateKey(ecKey)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn pem.EncodeToMemory(&pem.Block{Type: \"EC PRIVATE KEY\", Bytes: data})\n\t}\n\n\trsaKey, ok := c.KeyPair().PrivateKey.(*rsa.PrivateKey)\n\tif ok {\n\t\tdata := x509.MarshalPKCS1PrivateKey(rsaKey)\n\t\treturn pem.EncodeToMemory(&pem.Block{Type: \"RSA PRIVATE KEY\", Bytes: data})\n\t}\n\n\treturn nil\n}", "func (o *PipelineSshKeyPairAllOf) GetPrivateKeyOk() (*string, bool) {\n\tif o == nil || o.PrivateKey == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PrivateKey, true\n}", "func PrivateKey(i int) *keys.PrivateKey {\n\twif := WIF(i)\n\tpriv, err := keys.NewPrivateKeyFromWIF(wif)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn priv\n}", "func GetPrivateInfo(ctx context.Context, privateKeyDir string) (*ServerPrivateInfo, error) {\n\tsPriv, err := cryptoio.ReadStandardPrivateKey(ctx, &cryptoio.ReadStandardPrivateKeyParams{FilePath: path.Join(privateKeyDir, cryptoio.DefaultStandardPrivateKey)})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tePriv, err := cryptoio.ReadElGamalPrivateKey(path.Join(privateKeyDir, cryptoio.DefaultElgamalPrivateKey))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsecret, err := cryptoio.ReadElGamalSecret(path.Join(privateKeyDir, cryptoio.DefaultElgamalSecret))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ServerPrivateInfo{\n\t\tStandardPrivateKey: sPriv,\n\t\tElGamalPrivateKey: ePriv,\n\t\tSecret: secret,\n\t}, nil\n}", "func (c *HTTPClient) GetPrivKey() crypto.PrivateKey {\n\treturn c.privKey\n}", "func (ks *KeyStore) PrivateKey(kid string) (*rsa.PrivateKey, error) {\n\tks.mu.RLock()\n\tdefer ks.mu.RUnlock()\n\n\tprivateKey, found := ks.store[kid]\n\tif !found {\n\t\treturn nil, errors.New(\"kid lookup failed\")\n\t}\n\treturn privateKey, nil\n}", "func (ks *CSA) Unsafe_GetUnlockedPrivateKey(pubkey crypto.PublicKey) ([]byte, error) {\n\treturn ks.keys[pubkey.String()].Unsafe_GetPrivateKey()\n}", "func NewPrivateKey() PEMPrivateKeyLoaderInterface {\n\treturn &PrivateKey{\n\t\tpemDecoder: pemDecoder.NewPEMDecoder(),\n\t\tx509Parser: x509parser.Newx509Parser(),\n\t}\n}", "func PrivateKey(p *big.Int) *big.Int {\n\t// handle range requirement and generate random number within that range\n\tnum := big.NewInt(0)\n\tnum = num.Add(p, big.NewInt(-2))\n\trandNum, _ := rand.Int(rand.Reader, num)\n\n\tresult := randNum.Add(randNum, big.NewInt(2))\n\treturn result\n}", "func readPrivateKey() ([]byte, error) {\n\tprivateKey, e := ioutil.ReadFile(\"keys/sample-key\")\n\treturn privateKey, e\n}", "func (o *Gojwt) GetPrivKeyPath()(string){\n return o.privKeyPath\n}", "func (mgr *StateManager) GetEntry(vmAddress []byte) (*EvmEntry, error) {\n\taddress := toStateAddress(mgr.prefix, vmAddress)\n\n\t// Retrieve the account from global state\n\tentries, err := mgr.state.Get([]string{address})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tentryData, exists := entries[address]\n\tif !exists {\n\t\treturn nil, nil\n\t}\n\n\t// Deserialize the entry\n\tentry := &EvmEntry{}\n\terr = proto.Unmarshal(entryData, entry)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn entry, nil\n}", "func (c *Crypto) PrivateKeyPath() string {\n\treturn c.privateKeyPath\n}", "func (c *directClient) Entry(ctx context.Context, pubKey cipher.PubKey) (*disc.Entry, error) {\n\tc.mx.RLock()\n\tdefer c.mx.RUnlock()\n\tfor _, entry := range c.entries {\n\t\tif entry.Static == pubKey {\n\t\t\treturn entry, nil\n\t\t}\n\t}\n\treturn &disc.Entry{}, nil\n}", "func (ms *MemStore) GetPublicKeyEntry(uidMsg *uid.Message) (*uid.KeyEntry, string, error) {\n\tke, ok := ms.publicKeyEntryMap[uidMsg.Identity()]\n\tif !ok {\n\t\treturn nil, \"\", log.Error(session.ErrNoKeyEntry)\n\t}\n\treturn ke, \"undefined\", nil\n}", "func GetPrivateKeyFromSecret(secret string) []byte {\n\tsecretHash := GetSHA256Hash(secret)\n\t_, prKey, _ := ed25519.GenerateKey(bytes.NewReader(secretHash[:sha256.Size]))\n\n\treturn prKey\n}", "func (backend *JwtBackend) getSecretEntry(storage logical.Storage, roleID string, secretID string) (*secretStorageEntry, error) {\n\tif roleID == \"\" {\n\t\treturn nil, fmt.Errorf(\"Secrets Role ID is not specified\")\n\t}\n\n\tif secretID == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tvar result secretStorageEntry\n\tif entry, err := storage.Get(fmt.Sprintf(\"secrets/%s/%s\", roleID, secretID)); err != nil {\n\t\treturn nil, err\n\t} else if entry == nil {\n\t\treturn nil, nil\n\t} else if err := entry.DecodeJSON(&result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result, nil\n}", "func (s *Service) GetServerPrivateKey() crypto.PrivateKey {\n\t// The server private key is always available\n\tpk, _ := s.GetPrivateKey(serverPrivateKeyID)\n\treturn pk\n}", "func (s *ChaincodeStubWrapper) Get(key datastore.Key) ([]byte, error) {\n\tlogger.Debugf(\"Getting key %s\", key)\n\n\tv, err := s.stub.GetPrivateData(s.collection, key.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(v) == 0 {\n\t\treturn nil, datastore.ErrNotFound\n\t}\n\n\treturn v, nil\n}", "func LoadPrivateKey(path string) (Signer, error) {\n dat, _ := ioutil.ReadFile(path)\n if !strings.Contains(string(dat), \"PRIVATE\") {\n fmt.Println(path, \" MUST contain the Private Key.\")\n os.Exit(0)\n } // if not PRIVATE.\n\n return ParsePrivateKey([]byte(dat))\n}", "func (decryptor *PgDecryptor) GetPrivateKeys() ([]*keys.PrivateKey, error) {\n\tif decryptor.IsWithZone() {\n\t\treturn decryptor.keyStore.GetZonePrivateKeys(decryptor.GetMatchedZoneID())\n\t}\n\treturn decryptor.keyStore.GetServerDecryptionPrivateKeys(decryptor.clientID)\n}", "func (repo Keys) GetPrivateKey(ctx context.Context) (jwk.RSAPrivateKey, error) {\n\tlogger := logging.Logger\n\tprivateJWKBytes, err := repo.cache.Get(ctx, redisPrivateKeyKey).Bytes()\n\tif err != nil && err != redis.Nil {\n\t\treturn nil, err\n\t}\n\tif len(privateJWKBytes) != 0 {\n\t\tkey := jwk.NewRSAPrivateKey()\n\t\terr = json.Unmarshal(privateJWKBytes, &key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn key, nil\n\t}\n\n\trsaPrivateKey, err := rsa.GenerateKey(rand.Reader, 2048)\n\tif err != nil {\n\t\tlogger.Error(\"failed to generate rsa key\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\tprivateJWK, publicJWK, err := repo.newJWKRSAKeys(rsaPrivateKey)\n\tif err != nil {\n\t\tlogger.Error(\"could not create rsa jwk keys from rsa private key\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\n\terr = repo.savePrivateJWK(ctx, privateJWK)\n\tif err != nil {\n\t\tlogger.Error(\"could not save new private jwk\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\terr = repo.savePublicJWK(ctx, publicJWK)\n\tif err != nil {\n\t\tlogger.Error(\"could not save new public jwk\", zap.Error(err))\n\t\treturn nil, err\n\t}\n\n\treturn privateJWK, nil\n}", "func (o *Gojwt) GetRSAPrivKey()(*rsa.PrivateKey){\n return o.privRSAKey\n}", "func PEMtoPrivateKey(raw []byte, pwd []byte) (interface{}, error) {\n\tif len(raw) == 0 {\n\t\treturn nil, errors.New(\"Invalid PEM. It must be different from nil.\")\n\t}\n\tblock, _ := pem.Decode(raw)\n\tif block == nil {\n\t\treturn nil, fmt.Errorf(\"Failed decoding PEM. Block must be different from nil. [% x]\", raw)\n\t}\n\n\t// TODO: derive from header the type of the key\n\n\tif x509.IsEncryptedPEMBlock(block) {\n\t\tif len(pwd) == 0 {\n\t\t\treturn nil, errors.New(\"Encrypted Key. Need a password\")\n\t\t}\n\n\t\tdecrypted, err := x509.DecryptPEMBlock(block, pwd)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Failed PEM decryption [%s]\", err)\n\t\t}\n\n\t\tkey, err := DERToPrivateKey(decrypted)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn key, err\n\t}\n\n\tcert, err := DERToPrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cert, err\n}" ]
[ "0.7356036", "0.66376597", "0.65908307", "0.651616", "0.6494148", "0.647002", "0.6434694", "0.6398078", "0.6364217", "0.63412416", "0.6313559", "0.62824595", "0.62165207", "0.6210221", "0.6189422", "0.6186901", "0.61555266", "0.6147926", "0.6114492", "0.6103414", "0.60985696", "0.6088891", "0.6081246", "0.60599315", "0.6025552", "0.6021195", "0.60088646", "0.60081476", "0.59983903", "0.5977301", "0.5973766", "0.596736", "0.59609777", "0.59592056", "0.59415627", "0.592678", "0.59212714", "0.58920413", "0.5883392", "0.5878794", "0.58741164", "0.5830577", "0.58146125", "0.5809181", "0.5804035", "0.58026385", "0.57974195", "0.5766261", "0.5750245", "0.57494015", "0.5733975", "0.57330966", "0.5728371", "0.5707118", "0.5696396", "0.56676656", "0.5666867", "0.5636192", "0.5633757", "0.55746007", "0.5565054", "0.5551817", "0.5550865", "0.5548399", "0.5537251", "0.55314076", "0.5526348", "0.55089563", "0.5508883", "0.5508667", "0.55085135", "0.5507891", "0.5505429", "0.5495615", "0.549163", "0.5486947", "0.5472568", "0.5472253", "0.545498", "0.5454282", "0.5450632", "0.54462963", "0.54445195", "0.5419182", "0.5417824", "0.54169595", "0.541552", "0.541049", "0.5397873", "0.5394832", "0.5389838", "0.53826845", "0.53820527", "0.53739274", "0.53713", "0.537095", "0.53708005", "0.53592217", "0.5358756", "0.5355722" ]
0.71336013
1
GetPublicKeyEntry implemented in memory.
GetPublicKeyEntry реализован в памяти.
func (ms *MemStore) GetPublicKeyEntry(uidMsg *uid.Message) (*uid.KeyEntry, string, error) { ke, ok := ms.publicKeyEntryMap[uidMsg.Identity()] if !ok { return nil, "", log.Error(session.ErrNoKeyEntry) } return ke, "undefined", nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (pk PrivateKey) GetPublicKey() PublicKey {\n\treturn NewPublicKey(pk[32:])\n}", "func (store *keyStore) GetPublicKey(address string) (*openpgp.Entity, error) {\n\tel := store.lookupPublicKey(address)\n\tif len(el) > 0 {\n\t\treturn el[0], nil\n\t}\n\treturn nil, nil\n}", "func (pk *PrivateKey) GetPublicKey() *PublicKey {\n var publicKeyBytes PublicKey\n copy(publicKeyBytes[:], pk[32:])\n return &publicKeyBytes\n}", "func GetPublicKey(pub ssh.PublicKey) []byte {\n\tmarshaled := ssh.MarshalAuthorizedKey(pub)\n\t// Strip trailing newline\n\treturn marshaled[:len(marshaled)-1]\n}", "func (nr NodeRecord) GetPublicKey() (string, error) {\n\treturn nr.Record.PublicKey, nil\n}", "func (r *Member) GetPublicKey() string {\n\tvar args [0]interface{}\n\n\tvar argsSerialized []byte\n\n\terr := proxyctx.Current.Serialize(args, &argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tres, err := proxyctx.Current.RouteCall(r.Reference, true, \"GetPublicKey\", argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tret := [1]interface{}{}\n\tvar ret0 string\n\tret[0] = &ret0\n\n\terr = proxyctx.Current.Deserialize(res, &ret)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn ret0\n}", "func GetPublicKey(fingerprint string) (result string, err string) {\n\tr, e := chevronlib.GetPublicKey(fingerprint)\n\tresult = r\n\tif e != nil {\n\t\terr = e.Error()\n\t}\n\n\treturn\n}", "func (_UsersData *UsersDataCaller) GetPublicKey(opts *bind.CallOpts, uuid [16]byte) ([2][32]byte, error) {\n\tvar (\n\t\tret0 = new([2][32]byte)\n\t)\n\tout := ret0\n\terr := _UsersData.contract.Call(opts, out, \"getPublicKey\", uuid)\n\treturn *ret0, err\n}", "func (o *DKSharesInfo) GetPublicKey() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.PublicKey\n}", "func (_UsersData *UsersDataCallerSession) GetPublicKey(uuid [16]byte) ([2][32]byte, error) {\n\treturn _UsersData.Contract.GetPublicKey(&_UsersData.CallOpts, uuid)\n}", "func (_UsersData *UsersDataSession) GetPublicKey(uuid [16]byte) ([2][32]byte, error) {\n\treturn _UsersData.Contract.GetPublicKey(&_UsersData.CallOpts, uuid)\n}", "func GetPublicKey(passphrase string, address string) (string, error) {\n\tkeys, err := GetPublicPrivateKey(passphrase, address)\n\n\treturn keys.PublicKey, err\n}", "func (keyRing *KeyRing) GetPublicKey() (b []byte, err error) {\n\tvar outBuf bytes.Buffer\n\tif err = keyRing.WritePublicKey(&outBuf); err != nil {\n\t\treturn\n\t}\n\n\tb = outBuf.Bytes()\n\treturn\n}", "func (rm *ReconstructingMember) individualPublicKey() *bn256.G2 {\n\treturn rm.publicKeySharePoints[0]\n}", "func (_BondedECDSAKeep *BondedECDSAKeepCaller) GetPublicKey(opts *bind.CallOpts) ([]byte, error) {\n\tvar (\n\t\tret0 = new([]byte)\n\t)\n\tout := ret0\n\terr := _BondedECDSAKeep.contract.Call(opts, out, \"getPublicKey\")\n\treturn *ret0, err\n}", "func (rd *RootDomain) GetMemberByPublicKey(publicKey string) (*insolar.Reference, error) {\n\ttrimmedPublicKey := foundation.TrimPublicKey(publicKey)\n\ti := foundation.GetShardIndex(trimmedPublicKey, insolar.GenesisAmountPublicKeyShards)\n\tif i >= len(rd.PublicKeyShards) {\n\t\treturn nil, fmt.Errorf(\"incorrect shard index\")\n\t}\n\ts := pkshard.GetObject(rd.PublicKeyShards[i])\n\trefStr, err := s.GetRef(trimmedPublicKey)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get reference in shard\")\n\t}\n\tref, err := insolar.NewReferenceFromBase58(refStr)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"bad member reference for this public key\")\n\t}\n\n\treturn ref, nil\n}", "func GetPublicKey() ed25519.PublicKey {\n\tkey, _ := DecodePublicKey(publicKey)\n\treturn key\n}", "func GetAddressFromPublicKey(publicKey []byte) string {\n\t//publicKeyHash := sha256.Sum256(publicKey)\n\n\tpk, err := crypto.PublicKeyFromBytes(publicKey)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\treturn pk.ToAddress()\n\n}", "func (m *ValidatorStatusRequest) GetPublicKey() []byte {\n\tif m != nil {\n\t\treturn m.PublicKey\n\t}\n\treturn nil\n}", "func (o *PipelineSshKeyPairAllOf) GetPublicKey() string {\n\tif o == nil || o.PublicKey == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PublicKey\n}", "func getPublicKey(priv interface{}) interface{} {\n\tswitch k := priv.(type) {\n\tcase *rsa.PrivateKey:\n\t\treturn &k.PublicKey\n\tcase *ecdsa.PrivateKey:\n\t\treturn &k.PublicKey\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (i *Identity) GetPublicKey() (ic.PubKey, error) {\n\treturn ic.UnmarshalPublicKey(i.PublicKey)\n}", "func (c *Client) GetPublicKey(scope ...string) (map[string]interface{}, error) {\n\tlog.info(\"========== GET PUBLIC KEY ==========\")\n\turl := buildURL(path[\"client\"])\n\tdefaultScope := \"OAUTH|POST,USERS|POST,USERS|GET,USER|GET,USER|PATCH,SUBSCRIPTIONS|GET,SUBSCRIPTIONS|POST,SUBSCRIPTION|GET,SUBSCRIPTION|PATCH,CLIENT|REPORTS,CLIENT|CONTROLS\"\n\n\tif len(scope) > 0 {\n\t\tdefaultScope = scope[0]\n\t}\n\n\tqp := []string{\"issue_public_key=YES&scope=\" + defaultScope}\n\n\tif len(scope) > 1 {\n\t\tuserId := scope[1]\n\t\tqp[0] += \"&user_id=\" + userId\n\t}\n\n\treturn c.do(\"GET\", url, \"\", qp)\n}", "func searchPublicKey(p *onet.TreeNodeInstance, servID *network.ServerIdentity) kyber.Point {\n\tfor _, si := range p.Roster().List {\n\t\tif si.Equal(servID) {\n\t\t\treturn p.NodePublic(si)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (u *AttestationClient) GetPublicKey(\n\tctx context.Context,\n\tusername,\n\tlabel string) (string, error) {\n\treply, err := u.ac.GetKeyInfo(ctx, &apb.GetKeyInfoRequest{\n\t\tKeyLabel: &label,\n\t\tUsername: &username,\n\t})\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to call |GetKeyInfo|\")\n\t}\n\tif reply.GetStatus() != apb.AttestationStatus_STATUS_SUCCESS {\n\t\treturn \"\", &AttestationError{\n\t\t\terrors.Errorf(\"failed |GetKeyInfo|: %s\", reply.GetStatus().String()),\n\t\t\treply.GetStatus(),\n\t\t}\n\t}\n\treturn string(hexEncode(reply.GetPublicKey())), nil\n}", "func FetchPublicKey(ctx context.Context, client *http.Client, endpoint string) (*PublicKey, error) {\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hpke: error building hpke-public-key http request: %w\", err)\n\t}\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hpke: error requesting hpke-public-key endpoint: %w\", err)\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode/100 != 2 {\n\t\treturn nil, fmt.Errorf(\"hpke: error requesting hpke-public-key endpoint, invalid status code: %d\", res.StatusCode)\n\t}\n\n\tbs, err := io.ReadAll(io.LimitReader(res.Body, defaultMaxBodySize))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hpke: error reading hpke-public-key endpoint: %w\", err)\n\t}\n\treturn PublicKeyFromBytes(bs)\n}", "func (k *key) getPublicKey() (*ecdsa.PublicKey, error) {\n\tby, err := base64.StdEncoding.DecodeString(k.PublicKeyB64)\n\tif err != nil {\n\t\treturn (*ecdsa.PublicKey)(nil), err\n\t}\n\n\tblockPub, _ := pem.Decode([]byte(by))\n\tgenericPublicKey, err := x509.ParsePKIXPublicKey(blockPub.Bytes)\n\tif err != nil {\n\t\treturn (*ecdsa.PublicKey)(nil), err\n\t}\n\n\treturn genericPublicKey.(*ecdsa.PublicKey), nil\n}", "func (a *Client) GetPublicKey(params *GetPublicKeyParams, authInfo runtime.ClientAuthInfoWriter) (*GetPublicKeyOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetPublicKeyParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getPublicKey\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/publickeys/{userID}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetPublicKeyReader{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.(*GetPublicKeyOK), nil\n\n}", "func (c *Included) MustPublicKeyEntry(key Key) *PublicKeyEntry {\n\tvar publicKeyEntry PublicKeyEntry\n\tif c.tryFindEntry(key, &publicKeyEntry) {\n\t\treturn &publicKeyEntry\n\t}\n\treturn nil\n}", "func (h *FormatHandler) ExtractPublicKey(data []byte) (key [32]byte, err error) {\n\tvar obj map[string]interface{}\n\tif err = Unmarshal(data, &obj); err != nil {\n\t\treturn\n\t}\n\treturn format.ExtractPublicKeyHelper(obj)\n}", "func (pk PrivateKey) PublicKey() hotstuff.PublicKey {\n\treturn pk.Public()\n}", "func (ec *EthereumChain) GetPublicKey(keepAddress common.Address) ([]uint8, error) {\n\tkeepContract, err := ec.getKeepContract(keepAddress)\n\tif err != nil {\n\t\treturn []uint8{}, err\n\t}\n\n\treturn keepContract.GetPublicKey()\n}", "func (priv *PrivateKey) Public() crypto.PublicKey", "func (priv *PrivateKey) Public() crypto.PublicKey", "func GetPublicKey() {\n\tauthenticator := &core.IamAuthenticator{\n\t\tApiKey: apiKey,\n\t\tURL: url, //use for dev/preprod env\n\t}\n\tservice, _ := notificationsapiv1.NewNotificationsApiV1(&notificationsapiv1.NotificationsApiV1Options{\n\t\tAuthenticator: authenticator,\n\t\tURL: \"https://us-south.secadvisor.cloud.ibm.com/notifications\", //Specify url or use default\n\t})\n\n\tgetPublicKeyOptions := service.NewGetPublicKeyOptions(accountID)\n\tresult, resp, operationErr := service.GetPublicKey(getPublicKeyOptions)\n\tif operationErr != nil {\n\t\tfmt.Println(resp.Result)\n\t\tfmt.Println(\"Failed to get public key: \", operationErr)\n\t\treturn\n\t}\n\n\tfmt.Println(*result.PublicKey)\n}", "func (pk *PublicKey) Key() string {\n\treturn string(pk.PublicKeyHex.Value)\n}", "func (s Sig) PublicKey() ([]byte, error) {\n\treturn nil, fmt.Errorf(\"not implemented\")\n}", "func (gossiper *Gossiper) GetPublicKey(name string) *peersterCrypto.PublicPair {\n\tvar key *peersterCrypto.PublicPair\n\n\t// No blockChain initialised\n\tif gossiper.headBlock == nil {\n\t\treturn key\n\t}\n\n\tfound := false\n\tblockStruct := gossiper.headBlock\n\thasNext := true\n\n\tfor !found && hasNext {\n\t\tblock := blockStruct.Block\n\t\tfor _, transaction := range block.Transactions {\n\t\t\tif transaction.GetName() == name {\n\t\t\t\tfound = true\n\t\t\t\tkey = transaction.GetPublicKey()\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tblockStruct, hasNext = gossiper.blocksMap[hex.EncodeToString(block.PrevHash[:])]\n\t\t}\n\t}\n\n\treturn key\n}", "func (a *Account) PublicKey() *PubKey {\n\tk := new(PubKey)\n\tcopy(k[:], a.pub[:])\n\treturn k\n}", "func (s GPGSigner) PublicKey() ([]byte, error) {\n\tgpg2 := exec.Command(s.gpgExecutable, \"--export\", s.GPGUserName)\n\tif err := s.Rewriter(gpg2); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error invoking Rewrite: %v\", err)\n\t}\n\tout, err := gpg2.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error getting stdout pipe: %v\", err)\n\t}\n\tif err := gpg2.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error starting gpg command: %v\", err)\n\t}\n\tpubkey, err := ioutil.ReadAll(out)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error reading pubkey data: %v\", err)\n\t}\n\tif err := gpg2.Wait(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error running gpg: %v\", err)\n\t}\n\treturn pubkey, nil\n}", "func (c *directClient) Entry(ctx context.Context, pubKey cipher.PubKey) (*disc.Entry, error) {\n\tc.mx.RLock()\n\tdefer c.mx.RUnlock()\n\tfor _, entry := range c.entries {\n\t\tif entry.Static == pubKey {\n\t\t\treturn entry, nil\n\t\t}\n\t}\n\treturn &disc.Entry{}, nil\n}", "func GetAddressFromPublicKey(publicKey []byte) string {\n\tpublicKeyHash := sha256.Sum256(publicKey)\n\n\treturn GetBigNumberStringFromBytes(GetFirstEightBytesReversed(publicKeyHash[:sha256.Size])) + \"L\"\n}", "func (_BondedECDSAKeep *BondedECDSAKeepCallerSession) GetPublicKey() ([]byte, error) {\n\treturn _BondedECDSAKeep.Contract.GetPublicKey(&_BondedECDSAKeep.CallOpts)\n}", "func (_BondedECDSAKeep *BondedECDSAKeepSession) GetPublicKey() ([]byte, error) {\n\treturn _BondedECDSAKeep.Contract.GetPublicKey(&_BondedECDSAKeep.CallOpts)\n}", "func (s NativeSigner) PublicKey() ([]byte, error) {\n\tkeybuf := new(bytes.Buffer)\n\tif err := (*openpgp.Entity)(&s).Serialize(keybuf); err != nil {\n\t\treturn nil, err\n\t}\n\treturn keybuf.Bytes(), nil\n}", "func (ms *MemStore) AddPublicKeyEntry(identity string, ke *uid.KeyEntry) {\n\tms.publicKeyEntryMap[identity] = ke\n}", "func readPublicKey(d *pluginsdk.ResourceData, pubKey interface{}) error {\n\tpubKeyBytes, err := x509.MarshalPKIXPublicKey(pubKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal public key error: %s\", err)\n\t}\n\tpubKeyPemBlock := &pem.Block{\n\t\tType: \"PUBLIC KEY\",\n\t\tBytes: pubKeyBytes,\n\t}\n\n\td.Set(\"public_key_pem\", string(pem.EncodeToMemory(pubKeyPemBlock)))\n\n\tsshPubKey, err := ssh.NewPublicKey(pubKey)\n\tif err == nil {\n\t\t// Not all EC types can be SSH keys, so we'll produce this only\n\t\t// if an appropriate type was selected.\n\t\tsshPubKeyBytes := ssh.MarshalAuthorizedKey(sshPubKey)\n\t\td.Set(\"public_key_openssh\", string(sshPubKeyBytes))\n\t} else {\n\t\td.Set(\"public_key_openssh\", \"\")\n\t}\n\treturn nil\n}", "func GetPublicKey(stub shim.ChaincodeStubInterface) (string, error) {\r\n\tcert, err := GetCreatorCert(stub)\r\n\r\n\tbytePublicKey, _ := x509.MarshalPKIXPublicKey(cert.PublicKey)\r\n\treturn string(bytePublicKey), err\r\n}", "func (a *managedAddress) PubKey() chainec.PublicKey {\n\treturn a.pubKey\n}", "func (bn *BootstrapNode) GetPublicKey() crypto.PublicKey {\n\treturn bn.nodePublicKey\n}", "func getRSAPublicKey(modulus []byte, exponent []byte) (*rsa.PublicKey, error) {\n\tn := new(big.Int).SetBytes(modulus)\n\te := new(big.Int).SetBytes(exponent)\n\teInt := int(e.Int64())\n\trsaPubKey := rsa.PublicKey{N: n, E: eInt}\n\treturn &rsaPubKey, nil\n}", "func DisplayPublicKey(path string) (string) {\n dat, _ := ioutil.ReadFile(path)\n return string(dat)\n}", "func GetPublicKeyFromDB(id string) (*PublicKey, error) {\n\tpk := &PublicKey{}\n\terr := model.GetPublicKey(pk, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pk, nil\n}", "func NewPublicKey(pk map[string]interface{}) PublicKey {\n\treturn pk\n}", "func (s *Service) GetPublicKey(keyID string) (crypto.PublicKey, error) {\n\tprivateKey, ok := s.keys[keyID]\n\tif !ok {\n\t\ts.log.Error(\"The specified key was not found\", \"keyID\", keyID)\n\t\treturn nil, signingkeys.ErrSigningKeyNotFound.Errorf(\"The specified key was not found: %s\", keyID)\n\t}\n\n\treturn privateKey.Public(), nil\n}", "func (r *Member) GetPublicKeyNoWait() {\n\tvar args [0]interface{}\n\n\tvar argsSerialized []byte\n\n\terr := proxyctx.Current.Serialize(args, &argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t_, err = proxyctx.Current.RouteCall(r.Reference, false, \"GetPublicKey\", argsSerialized)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func getPublicKeyHandler(w http.ResponseWriter, r *http.Request) {\n userPubHash := validateHash(r.URL.Path[len(\"/user/\"):])\n userPub := LoadPubKey(userPubHash)\n if userPub == \"\" {\n http.Error(w, \"Not found\", http.StatusNotFound)\n } else {\n w.Write([]byte(userPub))\n }\n}", "func GetPublicKey() interface{} {\n\tfmt.Println(\"get public key from JWK_URI\")\n\topts := auth0.JWKClientOptions{URI: AUTH0_DOMAIN + \"/.well-known/jwks.json\"}\n\t// Creating key cacher with max age of 100sec and max size of 5 entries.\n\t// Defaults to persistent key cacher if not specified when creating a client.\n\tkeyCacher := auth0.NewMemoryKeyCacher(time.Duration(100)*time.Second, 5)\n\tclient := auth0.NewJWKClientWithCache(opts, nil, keyCacher)\n\n\tsearchedKey, err := client.GetKey(KID)\n\n\tif err != nil {\n\t\tfmt.Println(\"Cannot get key because of\", err)\n\t\treturn nil\n\t}\n\tfmt.Println(\"key:\", searchedKey)\n\treturn searchedKey.Certificates[0].PublicKey\n}", "func GetUserPubKey(username string) (map[string]interface{}, error) {\n\ttargetUser, err := auth.NewUser(username, \"pass\")\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, errors.New(err.Error())\n\n\t}\n\n\tpubKey, err := targetUser.GetPublicKey()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, errors.New(\"No data found for : \" + username)\n\t}\n\n\tmarshalledPublicKey := x509.MarshalPKCS1PublicKey(pubKey)\n\n\treturn map[string]interface{}{\n\t\t\"publicKey\": marshalledPublicKey,\n\t}, nil\n\n}", "func (p *PrivateKey) PublicKey() *ecdsa.PublicKey {\n\treturn &p.privateKey.PublicKey\n}", "func (w *XPubWallet) GetEntry(a cipher.Address) (Entry, bool) {\n\treturn w.Entries.get(a)\n}", "func (_ArbSys *ArbSysCallerSession) GetBlsPublicKey(addr common.Address) (*big.Int, *big.Int, *big.Int, *big.Int, error) {\n\treturn _ArbSys.Contract.GetBlsPublicKey(&_ArbSys.CallOpts, addr)\n}", "func (k *KeyPair) GetPublicKey() p2pCrypto.PubKey {\n\treturn k.pubKey\n}", "func (h *handler) publicKey(w http.ResponseWriter, req *http.Request) {\n\tresponse := struct {\n\t\tPublicKey *bakery.PublicKey\n\t}{\n\t\tPublicKey: h.config.Bakery.PublicKey(),\n\t}\n\n\twriteResponse(w, http.StatusOK, response)\n}", "func (_ArbSys *ArbSysCaller) GetBlsPublicKey(opts *bind.CallOpts, addr common.Address) (*big.Int, *big.Int, *big.Int, *big.Int, error) {\n\tvar out []interface{}\n\terr := _ArbSys.contract.Call(opts, &out, \"getBlsPublicKey\", addr)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\tout1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\tout2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\tout3 := *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\n\treturn out0, out1, out2, out3, err\n\n}", "func (d *DocsCrypto) GetPublic() *rsa.PublicKey {\n\td.Debug(\"gettting public key\")\n\treturn d.privateKey.Public().(*rsa.PublicKey)\n}", "func (k otherKey) Public() crypto.PublicKey {\n\treturn nil\n}", "func (n Node) PublicKey() p2pcrypto.PublicKey {\n\treturn n.pubKey\n}", "func (k PrivateKey) Public() crypto.PublicKey {\n\treturn &k.PublicKey\n}", "func (s Keygen) PublicKey() *ecdsa.PublicKey {\n\treturn nil\n}", "func (sk PrivateKey) PublicKey() PublicKey {\n\treturn PublicKey{publicKey: sk.privateKey.PublicKey()}\n}", "func (s *Server) GetTokenPublicKey(ctx context.Context, _ *pb.Noop) (*pb.TokenInfo, error) {\n\treturn &pb.TokenInfo{PublicKey: s.pubKey}, nil\n}", "func (p *PrivateKey) PublicKey() *PublicKey {\n\tresult := PublicKey(p.PrivateKey.PublicKey)\n\treturn &result\n}", "func (k *KeyPairEd25519) GetPublicKey() PublicKey {\n\treturn PublicKey{\n\t\tType: ED25519,\n\t\tData: k.privateKey.Public().(ed25519.PublicKey),\n\t}\n}", "func (kp *MockKeyProvider) GetPublicKey(keyID string) (crypto.PublicKey, error) {\n\tkey, ok := kp.PublicKeys[keyID]\n\tif !ok {\n\t\treturn nil, errors.New(\"couldn't find key\")\n\t}\n\n\treturn key, kp.Err\n}", "func (_ArbSys *ArbSysSession) GetBlsPublicKey(addr common.Address) (*big.Int, *big.Int, *big.Int, *big.Int, error) {\n\treturn _ArbSys.Contract.GetBlsPublicKey(&_ArbSys.CallOpts, addr)\n}", "func (notificationsApi *NotificationsApiV1) GetPublicKey(getPublicKeyOptions *GetPublicKeyOptions) (result *PublicKeyResponse, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getPublicKeyOptions, \"getPublicKeyOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getPublicKeyOptions, \"getPublicKeyOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathSegments := []string{\"v1\", \"notifications/public_key\"}\n\tpathParameters := []string{*getPublicKeyOptions.AccountID}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\t_, err = builder.ConstructHTTPURL(notificationsApi.Service.Options.URL, pathSegments, pathParameters)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getPublicKeyOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"notifications_api\", \"V1\", \"GetPublicKey\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tif getPublicKeyOptions.TransactionID != nil {\n\t\tbuilder.AddHeader(\"Transaction-Id\", fmt.Sprint(*getPublicKeyOptions.TransactionID))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = notificationsApi.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalPublicKeyResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "func (k *Keypair) PublicKey() *PubKey {\n\tpub := new(PubKey)\n\tcopy(pub[:], k.pub[:])\n\treturn pub\n}", "func (obj *key) Key() rsa.PublicKey {\n\treturn obj.ky\n}", "func (g *GPGKey) GetPublicKey() string {\n\tif g == nil || g.PublicKey == nil {\n\t\treturn \"\"\n\t}\n\treturn *g.PublicKey\n}", "func GetPublicKey(loader KeyLoader) (*rsa.PublicKey, error) {\n\tif loader == nil {\n\t\treturn nil, errors.New(\"no loader\")\n\t}\n\n\tdata, err := loader.GetBytes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpublicPem, _ := pem.Decode(data)\n\tif publicPem.Type != \"RSA PUBLIC KEY\" {\n\t\treturn nil, errors.New(\"incorrect pem type: \" + publicPem.Type)\n\t}\n\n\tvar parsedKey interface{}\n\tif parsedKey, err = x509.ParsePKCS1PublicKey(publicPem.Bytes); err != nil {\n\t\treturn nil, emperror.Wrap(err, \"failed to load public key x509.ParsePKCS1PublicKey\")\n\t}\n\n\tif publicKey, ok := parsedKey.(*rsa.PublicKey); !ok {\n\t\treturn nil, errors.New(\"failed convert parsed key to public key\")\n\t} else {\n\t\treturn publicKey, nil\n\t}\n}", "func (r *gorumsReplica) PublicKey() hotstuff.PublicKey {\n\treturn r.pubKey\n}", "func (x *X25519) PublicKey() []byte {\n\treturn x.publicKey[:]\n}", "func (k *VrfablePrivateKey) Public() PublicKey {\n\treturn &VrfablePublicKey{&k.PublicKey}\n}", "func (o *DKSharesInfo) GetPublicKeyOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.PublicKey, true\n}", "func (e *Domain) Public() *PublicKey {\n\tif e.PublicKey != nil {\n\t\treturn e.PublicKey\n\t}\n\n\tif e.ClearPrivateKey != nil {\n\t\treturn e.ClearPrivateKey.Public()\n\t}\n\treturn nil\n}", "func PrivateKeyPublic(priv *rsa.PrivateKey,) crypto.PublicKey", "func (_IRMAScheme *IRMASchemeCaller) GetIssuerPublicKeyById(opts *bind.CallOpts, _issuerId string, _keyIndex *big.Int) (*big.Int, []byte, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t\tret1 = new([]byte)\n\t)\n\tout := &[]interface{}{\n\t\tret0,\n\t\tret1,\n\t}\n\terr := _IRMAScheme.contract.Call(opts, out, \"getIssuerPublicKeyById\", _issuerId, _keyIndex)\n\treturn *ret0, *ret1, err\n}", "func (ak *AgentKey) Key() (PublicKey, error) {\r\n\tif key, _, ok := ParsePublicKey(ak.blob); ok {\r\n\t\treturn key, nil\r\n\t}\r\n\treturn nil, errors.New(\"ssh: failed to parse key blob\")\r\n}", "func (ks *KeyStore) PublicKey(kid string) (*rsa.PublicKey, error) {\n\tks.mu.RLock()\n\tdefer ks.mu.RUnlock()\n\n\tprivateKey, found := ks.store[kid]\n\tif !found {\n\t\treturn nil, errors.New(\"kid lookup failed\")\n\t}\n\treturn &privateKey.PublicKey, nil\n}", "func (lib *PKCS11Lib) exportRSAPublicKey(session pkcs11.SessionHandle, pubHandle pkcs11.ObjectHandle) (crypto.PublicKey, error) {\n\tlogger.Tracef(\"session=0x%X, obj=0x%X\", session, pubHandle)\n\ttemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_MODULUS, nil),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_PUBLIC_EXPONENT, nil),\n\t}\n\texported, err := lib.Ctx.GetAttributeValue(session, pubHandle, template)\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\tvar modulus = new(big.Int)\n\tmodulus.SetBytes(exported[0].Value)\n\tvar bigExponent = new(big.Int)\n\tbigExponent.SetBytes(exported[1].Value)\n\tif bigExponent.BitLen() > 32 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\tif bigExponent.Sign() < 1 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\texponent := int(bigExponent.Uint64())\n\tresult := rsa.PublicKey{\n\t\tN: modulus,\n\t\tE: exponent,\n\t}\n\tif result.E < 2 {\n\t\treturn nil, errors.WithStack(errMalformedRSAKey)\n\t}\n\treturn &result, nil\n}", "func (k *PrivateKeySECP256K1R) PublicKey() PublicKey {\n\tif k.pk == nil {\n\t\tk.pk = &PublicKeySECP256K1R{pk: k.sk.PubKey()}\n\t}\n\treturn k.pk\n}", "func NewPublicKey(seed Trytes, index int) (Trytes, error) {\n\tbytesSec, err := seed.Trits().Bytes()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif mKey == nil {\n\t\tkey, err := hdkey.NewMaster(bytesSec, nil, 1)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tmKey = key\n\t}\n\n\tpubKey, err := mKey.Child(uint32(index))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tpkCompressed := pubKey.PublicKey().Compress()\n\tpkInt := new(big.Int).SetBytes(pkCompressed[:])\n\tkeyTrit := make([]byte, 48)\n\tcopy(keyTrit, pkInt.Bytes())\n\ttrits, err := BytesToTrits(keyTrit)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn trits.Trytes(), err\n}", "func (d Dispatcher) PublicKey() string {\n\treturn d.GetPubString()\n}", "func dnsGetServerPublicKey(dnsParent string) *rsa.PublicKey {\n\tpubKeyPEM, err := LookupDomainKey(consts.SliverName, dnsParent)\n\tif err != nil {\n\t\t// {{if .Debug}}\n\t\tlog.Printf(\"Failed to fetch domain key %v\", err)\n\t\t// {{end}}\n\t\treturn nil\n\t}\n\n\tpubKeyBlock, _ := pem.Decode([]byte(pubKeyPEM))\n\tif pubKeyBlock == nil {\n\t\t// {{if .Debug}}\n\t\tlog.Printf(\"failed to parse certificate PEM\")\n\t\t// {{end}}\n\t\treturn nil\n\t}\n\t// {{if .Debug}}\n\tlog.Printf(\"RSA Fingerprint: %s\", fingerprintSHA256(pubKeyBlock))\n\t// {{end}}\n\n\tcertErr := rootOnlyVerifyCertificate([][]byte{pubKeyBlock.Bytes}, [][]*x509.Certificate{})\n\tif certErr == nil {\n\t\tcert, _ := x509.ParseCertificate(pubKeyBlock.Bytes)\n\t\treturn cert.PublicKey.(*rsa.PublicKey)\n\t}\n\n\t// {{if .Debug}}\n\tlog.Printf(\"Invalid certificate %v\", err)\n\t// {{end}}\n\treturn nil\n}", "func NewPublicKey(r io.Reader) (*PublicKey, error) {\n\trawPub, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey, _, _, _, err := ssh.ParseAuthorizedKey(rawPub)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &PublicKey{key: key}, nil\n}", "func publicKeyHandler(w http.ResponseWriter, r *http.Request) {\n\tuserPubHash := validateHash(r.URL.Path[len(\"/user/\"):])\n\tuserPub := LoadPubKey(userPubHash)\n\tif userPub == \"\" {\n\t\thttp.Error(w, \"Not found\", http.StatusNotFound)\n\t} else {\n\t\tw.Write([]byte(userPub))\n\t}\n}", "func (k *PrivateKey) PublicKey() *PublicKey {\n\tpointG2 := curve.GenG2.Mul(frToRepr(k.FR))\n\n\treturn &PublicKey{pointG2}\n}", "func (srv *Server) HostPublicKey() (types.SiaPublicKey, error) {\n\tif srv.node.Host == nil {\n\t\treturn types.SiaPublicKey{}, errors.New(\"can't get public host key of a non-host node\")\n\t}\n\treturn srv.node.Host.PublicKey(), nil\n}", "func (k *EdX25519Key) PublicKey() *EdX25519PublicKey {\n\treturn k.publicKey\n}" ]
[ "0.6892429", "0.68824655", "0.6855572", "0.68315506", "0.67732835", "0.6762745", "0.673968", "0.67140543", "0.667578", "0.66340315", "0.66220355", "0.6611298", "0.6580103", "0.6537619", "0.6503447", "0.6442019", "0.6441319", "0.6419658", "0.6399346", "0.63818866", "0.63710785", "0.63670164", "0.63117725", "0.62948847", "0.6286688", "0.62720555", "0.62667996", "0.62655824", "0.6258111", "0.6245775", "0.62413955", "0.62366194", "0.62303513", "0.62303513", "0.62212956", "0.6209783", "0.62081224", "0.6195677", "0.6185614", "0.6138895", "0.61350125", "0.61162734", "0.610378", "0.61005634", "0.60836947", "0.6062527", "0.60604787", "0.6033073", "0.6019353", "0.60143447", "0.6007136", "0.59818774", "0.59760135", "0.59701115", "0.5969596", "0.5963899", "0.59581375", "0.5942705", "0.58809525", "0.5880744", "0.5874513", "0.5872507", "0.58722407", "0.58694243", "0.5860168", "0.5858917", "0.585802", "0.5845215", "0.5842221", "0.5834345", "0.5833658", "0.5833142", "0.58294564", "0.5826411", "0.5818385", "0.58161014", "0.5808515", "0.5801777", "0.57978207", "0.5796589", "0.5792579", "0.5790896", "0.578813", "0.57765573", "0.5768135", "0.5765756", "0.5760818", "0.5759488", "0.5758738", "0.57570803", "0.5731719", "0.57280606", "0.57272947", "0.5719642", "0.5708272", "0.57071906", "0.5704055", "0.57038957", "0.57024723", "0.5696997" ]
0.7593955
0
NumMessageKeys implemented in memory.
NumMessageKeys реализован в памяти.
func (ms *MemStore) NumMessageKeys(sessionKey string) (uint64, error) { s, ok := ms.sessions[sessionKey] if !ok { return 0, log.Errorf("memstore: no session found for %s", sessionKey) } return uint64(len(s.send)), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Message) NKeys() int { return 12 }", "func (m *SubMessage) NKeys() int { return 4 }", "func (p BnetAuthCheckPacket) NumKeys() int {\n\tpb := PacketBuffer(p)\n\treturn pb.Uint32(16)\n}", "func (m *WatcherMetrics) NKeys() int { return 4 }", "func (m *Metric) NKeys() int { return 5 }", "func (d *Data) NKeys() int { return 1 }", "func (m *NodeMetricsMap) NKeys() int { return 0 }", "func (m *NodeMetrics) NKeys() int { return 3 }", "func (t *Tags) NKeys() int { return 0 }", "func (m *Metadata) NKeys() int { return 1 }", "func (*Integer) NKeys() int { return 2 }", "func (k *Keychain) KeyCount() int {\n\tk.m.RLock()\n\tc := len(k.keys)\n\tk.m.RUnlock()\n\treturn c\n}", "func (*Object) NKeys() int { return 2 }", "func (*Number) NKeys() int { return 2 }", "func (u *UserDetails) NKeys() int {\n\treturn 4 + u.UserMeta.NKeys()\n}", "func (z *KeyInv) Msgsize() (s int) {\n\ts = 1 + 4 + msgp.BytesPrefixSize + len(z.Key) + 4 + msgp.StringPrefixSize + len(z.Who) + 5 + msgp.TimeSize + 5 + msgp.Int64Size + 8 + msgp.BytesPrefixSize + len(z.Blake2b) + 4 + msgp.BytesPrefixSize + len(z.Val)\n\treturn\n}", "func (s *TaskDetails) NKeys() int {\n\treturn 7 + s.TaskMeta.NKeys()\n}", "func (*Array) NKeys() int { return 2 }", "func (*Null) NKeys() int { return 2 }", "func (v *FileSystemWatcher) NKeys() int { return 2 }", "func (v *ConfigurationParams) NKeys() int { return 1 }", "func (s *Store) numEntries() int {\r\n\treturn len(s.GetKeys())\r\n}", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (a ByKey) Len() int { return len(a) }", "func (v *ConfigurationItem) NKeys() int { return 2 }", "func (da *DoubleArray) NumKeys() int {\n\treturn da.numKeys\n}", "func (s *ScanKeys) Count() int {\n\treturn len(s.skbs)\n}", "func (d *tstKeyK) Size() int {\n\treturn int(unsafe.Sizeof(tstKeyK{}))\n}", "func (s *session) getMessageCount() uint64 {\n\treturn uint64(len(s.msgSizes) - len(s.markedDeleted))\n}", "func (v *FileEvent) NKeys() int { return 2 }", "func (c *Cache) Len() int {\n\treturn len(c.keyMap)\n}", "func (v *PublishDiagnosticsParams) NKeys() int { return 3 }", "func (z dataUsageHashMap) Msgsize() (s int) {\n\ts = msgp.ArrayHeaderSize\n\tfor zb0004 := range z {\n\t\ts += msgp.StringPrefixSize + len(zb0004)\n\t}\n\treturn\n}", "func (*Boolean) NKeys() int { return 3 }", "func (*String) NKeys() int { return 2 }", "func (a ByKey) Len() int {\n\treturn len(a)\n}", "func (p *Properties) NumRangeKeys() uint64 {\n\treturn p.NumRangeKeyDels + p.NumRangeKeySets + p.NumRangeKeyUnsets\n}", "func (i IntHashMap[T, V]) Len() int {\n\t// DEBUG:\n\tif len(i.hashToKey) != len(i.hashToVal) {\n\t\tpanic(\"hashToKey and hashToVal have different lengths\")\n\t}\n\treturn len(i.hashToKey)\n}", "func (keys *DupMD5Keys) Len() int {\n\treturn len(keys.md5Keys)\n}", "func (z *BotRecord) Msgsize() (s int) {\n\ts = 1 + 2 + z.ID.Msgsize() + 2 + z.Addresses.Msgsize() + 2 + z.Names.Msgsize() + 2 + z.PublicKey.Msgsize() + 2 + z.Expiration.Msgsize()\n\treturn\n}", "func (d DBase) CountKeys(table string) int {\n\tcount, err := d.Store.CountKeys(table)\n\tCritical(err)\n\treturn count\n}", "func InternalNodeNumKeys(node []byte) *uint32 {\n\treturn (*uint32)(unsafe.Pointer(&node[InternalNodeNumKeysOffset]))\n}", "func (w *Window) NKeys() int { return 3 }", "func (sm safeMap) Len() int {\n\treply := make(chan interface{})\n\tsm <- commandData{action: COUNT, result: reply}\n\treturn (<-reply).(int)\n}", "func (hm HashMap) Len(ctx context.Context) (int64, error) {\n\treq := newRequest(\"*2\\r\\n$4\\r\\nHLEN\\r\\n$\")\n\treq.addString(hm.name)\n\treturn hm.c.cmdInt(ctx, req)\n}", "func (z *MessageControl) Msgsize() (s int) {\n\ts = 1 + 5\n\tif z.Hash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.Hash.Msgsize()\n\t}\n\treturn\n}", "func (t *SBF) Keys() uint64 {\n return atomic.LoadUint64(&t.keys)\n}", "func (m *OMap) Count() int {\n\treturn len(m.keys)\n}", "func (m *peerMap) nodeCount() int {\n\treturn len(m.byNodeKey)\n}", "func (z *TokenInfo) Msgsize() (s int) {\n\ts = 1 + z.PublicOffering.Msgsize() + z.Sender.Msgsize()\n\tif z.CurrentValue == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.CurrentValue.Msgsize()\n\t}\n\ts += msgp.BoolSize\n\treturn\n}", "func (t *Map) Len() int {\n\treturn t.keys.Len()\n}", "func (z GraphiteApiItems) Msgsize() (s int) {\n\ts = msgp.ArrayHeaderSize\n\tfor zhct := range z {\n\t\tif z[zhct] == nil {\n\t\t\ts += msgp.NilSize\n\t\t} else {\n\t\t\ts += z[zhct].Msgsize()\n\t\t}\n\t}\n\treturn\n}", "func (z *TxBaseJson) Msgsize() (s int) {\n\ts = 1 + msgp.Uint16Size + z.Hash.Msgsize() + z.ParentsHash.Msgsize() + msgp.Uint64Size + msgp.Uint64Size + z.PublicKey.Msgsize() + z.Signature.Msgsize() + msgp.Uint64Size + msgp.Uint64Size + msgp.ByteSize\n\treturn\n}", "func (m *OrderedUintMap) Len() int { return len(m.m) }", "func (v *WorkspaceFolder) NKeys() int { return 2 }", "func (m *Map) Len() int {\n\tm.store.RLock()\n\tdefer m.store.RUnlock()\n\tn := len(m.store.kv)\n\treturn n\n}", "func (c *NoReplKeyCache) Len() int {\n\tc.lock.RLock()\n\tlength := len(c.cache)\n\tc.lock.RUnlock()\n\treturn length\n}", "func LLEN() int {\n\treturn globalListCache.countKeys()\n}", "func (m MessageID) size() int {\n\treturn INTEGER(m).size()\n}", "func (self *SimpleEqualDistribution) Len() int {\n\treturn len(self.keys)\n}", "func (k keyDecls) Len() int {\n\treturn len(k)\n}", "func (p OrderedMap) Len() int {\n\treturn len(p.keys)\n}", "func (fi *FastIntegerHashMap) Len() uint64 {\n\treturn fi.count\n}", "func (g *GlobalMessages) Len() int {\n\tg.locker.RLock()\n\tdefer g.locker.RUnlock()\n\treturn len(g.Events)\n}", "func (z SequencerHeaders) Msgsize() (s int) {\n\ts = msgp.ArrayHeaderSize\n\tfor zb0004 := range z {\n\t\tif z[zb0004] == nil {\n\t\t\ts += msgp.NilSize\n\t\t} else {\n\t\t\ts += 1 + z[zb0004].Hash.Msgsize() + msgp.Uint64Size\n\t\t}\n\t}\n\treturn\n}", "func messageKey(messageKeyLarge []byte) bin.Int128 {\n\tvar v bin.Int128\n\tb := messageKeyLarge[8 : 16+8]\n\tcopy(v[:len(b)], b)\n\treturn v\n}", "func (params *KeyParameters) MaxMsgBytes() int {\n\treturn (params.P.BitLen() / 8) - 4\n}", "func (z *MessageTxsRequest) Msgsize() (s int) {\n\ts = 1 + z.Hashes.Msgsize()\n\tif z.SeqHash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.SeqHash.Msgsize()\n\t}\n\ts += msgp.Uint64Size + msgp.Uint32Size\n\treturn\n}", "func (c *TwoQueueCache[K, V]) Len() int {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\treturn c.recent.Len() + c.frequent.Len()\n}", "func (z *MessageGetMsg) Msgsize() (s int) {\n\ts = 1 + 5\n\tif z.Hash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.Hash.Msgsize()\n\t}\n\treturn\n}", "func (a *AvroEventBatchEncoder) Size() int {\n\tif a.resultBuf == nil {\n\t\treturn 0\n\t}\n\tsum := 0\n\tfor _, msg := range a.resultBuf {\n\t\tsum += len(msg.Key)\n\t\tsum += len(msg.Value)\n\t}\n\treturn sum\n}", "func (z *metacache) Msgsize() (s int) {\n\ts = 1 + 3 + msgp.StringPrefixSize + len(z.id) + 2 + msgp.StringPrefixSize + len(z.bucket) + 5 + msgp.StringPrefixSize + len(z.root) + 4 + msgp.BoolSize + 4 + msgp.StringPrefixSize + len(z.filter) + 5 + msgp.Uint8Size + 4 + msgp.BoolSize + 4 + msgp.StringPrefixSize + len(z.error) + 3 + msgp.TimeSize + 4 + msgp.TimeSize + 2 + msgp.TimeSize + 3 + msgp.TimeSize + 2 + msgp.Uint8Size\n\treturn\n}", "func getMapLen(dec *msgpack.Decoder) (n int, nextKey func() int32, err error) {\n\tism, err := isMap(dec)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif ism {\n\t\tn, err = dec.DecodeMapLen()\n\t\treturn\n\t}\n\n\tn, err = dec.DecodeArrayLen()\n\tvar idx int32 // remember; lua indexes are 1 based, so we ++ and then return\n\tnextKey = func() int32 { idx++; return idx }\n\treturn\n}", "func (i StringHashMap[T, V]) Len() int {\n\t// DEBUG:\n\tif len(i.hashToKey) != len(i.hashToVal) {\n\t\tpanic(\"hashToKey and hashToVal have different lengths\")\n\t}\n\treturn len(i.hashToKey)\n}", "func (m *OrderedMap) Len() int {\n\treturn len(m.keypairs)\n}", "func (kr *KeyRequest) Size() int {\n\treturn kr.S\n}", "func (z *HashOrNumber) Msgsize() (s int) {\n\ts = 1\n\tif z.Hash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.Hash.Msgsize()\n\t}\n\ts += msgp.Uint64Size\n\treturn\n}", "func (z *MessageHeaderRequest) Msgsize() (s int) {\n\ts = 1 + 1\n\tif z.Origin.Hash == nil {\n\t\ts += msgp.NilSize\n\t} else {\n\t\ts += z.Origin.Hash.Msgsize()\n\t}\n\ts += msgp.Uint64Size + msgp.Uint64Size + msgp.Uint64Size + msgp.BoolSize + msgp.Uint32Size\n\treturn\n}", "func (dict *Dictionary) NumberOfElements() int {\n\tdict.lock.RLock()\n\tdefer dict.lock.RUnlock()\n\treturn len(dict.elements)\n}", "func (z *ClientStatsBucket) Msgsize() (s int) {\n\ts = 1 + 6 + msgp.Uint64Size + 9 + msgp.Uint64Size + 6 + msgp.ArrayHeaderSize\n\tfor za0001 := range z.Stats {\n\t\tif z.Stats[za0001] == nil {\n\t\t\ts += msgp.NilSize\n\t\t} else {\n\t\t\ts += z.Stats[za0001].Msgsize()\n\t\t}\n\t}\n\ts += 15 + msgp.Int64Size\n\treturn\n}", "func (z Bucket) Msgsize() (s int) {\n\ts = msgp.ArrayHeaderSize\n\tfor zhct := range z {\n\t\ts += msgp.BytesPrefixSize + len(z[zhct])\n\t}\n\treturn\n}" ]
[ "0.81549484", "0.78064597", "0.75367594", "0.7298265", "0.7173821", "0.7139803", "0.7030167", "0.6948036", "0.6934252", "0.69107145", "0.6790297", "0.6749787", "0.6585243", "0.65516406", "0.6520214", "0.6461423", "0.64228487", "0.64208007", "0.63739985", "0.63620496", "0.63162565", "0.63138884", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6306986", "0.6302333", "0.62972224", "0.6277249", "0.6240042", "0.6198029", "0.61766505", "0.6162629", "0.61595035", "0.6155946", "0.61409086", "0.61296475", "0.6123562", "0.6114381", "0.6106895", "0.6093166", "0.607992", "0.60797745", "0.6073021", "0.6072284", "0.60511374", "0.6050677", "0.6035836", "0.6031137", "0.60281783", "0.5991873", "0.59917295", "0.5989335", "0.5983765", "0.5982842", "0.5979868", "0.5975639", "0.59737676", "0.5964078", "0.5962425", "0.5952884", "0.59452987", "0.59093523", "0.5899819", "0.58952636", "0.58835226", "0.58730805", "0.5872093", "0.5865144", "0.58623147", "0.5860502", "0.58582306", "0.5842062", "0.58366495", "0.5834903", "0.5834856", "0.5830517", "0.5817592", "0.5804193", "0.5803685", "0.5803426", "0.57928526", "0.57898957" ]
0.80916345
1
GetMessageKey implemented in memory.
GetMessageKey реализован в памяти.
func (ms *MemStore) GetMessageKey( sessionKey string, sender bool, msgIndex uint64, ) (*[64]byte, error) { s, ok := ms.sessions[sessionKey] if !ok { return nil, log.Errorf("memstore: no session found for %s", sessionKey) } if msgIndex >= uint64(len(s.send)) { return nil, log.Error("memstore: message index out of bounds") } var key string var party string if sender { key = s.send[msgIndex] party = "sender" } else { key = s.recv[msgIndex] party = "recipient" } // make sure key wasn't used yet if key == "" { return nil, log.Error(session.ErrMessageKeyUsed) } // decode key var messageKey [64]byte k, err := base64.Decode(key) if err != nil { return nil, log.Errorf("memstore: cannot decode %s key for %s", party, sessionKey) } if copy(messageKey[:], k) != 64 { return nil, log.Errorf("memstore: %s key for %s has wrong length", party, sessionKey) } return &messageKey, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m Message) Key() []byte {\n\tstart, end, size := m.keyOffsets()\n\tif size == -1 {\n\t\treturn nil\n\t}\n\treturn m[start+4 : end]\n}", "func MessageKey(authKey Key, plaintextPadded []byte, mode Side) bin.Int128 {\n\t// `msg_key_large = SHA256 (substr (auth_key, 88+x, 32) + plaintext + random_padding);`\n\tmsgKeyLarge := msgKeyLarge(authKey, plaintextPadded, mode)\n\t// `msg_key = substr (msg_key_large, 8, 16);`\n\treturn messageKey(msgKeyLarge)\n}", "func messageKey(messageKeyLarge []byte) bin.Int128 {\n\tvar v bin.Int128\n\tb := messageKeyLarge[8 : 16+8]\n\tcopy(v[:len(b)], b)\n\treturn v\n}", "func (st *MemStorage) GetKey(gun, role string) (algorithm string, public []byte, err error) {\n\t// no need for lock. It's ok to return nil if an update\n\t// wasn't observed\n\tg, ok := st.keys[gun]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\tk, ok := g[role]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\n\treturn k.algorithm, k.public, nil\n}", "func (symmetricKey *SymmetricKey) GetKey() []byte {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.SymmetricKey\n}", "func MsgKey(s string) {\n\tmsgKey = s\n\tgenLevelSlices()\n}", "func (m *RegistryKeyState) GetKey()(*string) {\n return m.key\n}", "func (g *GetLanguagePackStringRequest) GetKey() (value string) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Key\n}", "func GetKey(size int) []byte {\n\treturn GetIV(size)\n}", "func (m *message) Key() string {\n\treturn m.TS.Format(time.RFC3339) + \"|\" + m.User\n}", "func (m LocalTransit) GetKey(context string) ([]byte, error) {\n\tif m.KeyProvider == nil {\n\t\treturn nil, ex.New(\"local transit; key provider is unset\")\n\t}\n\treturn m.KeyProvider(context)\n}", "func (p *Provider) GetKey() interface{} {\n\treturn p.key\n}", "func (m *KeyValue) GetKey()(*string) {\n return m.key\n}", "func (c *Counter) GetKey() string {\n\treturn c.key\n}", "func MsgKey(R, P *btcec.PublicKey, m []byte) *btcec.PublicKey {\n\th := Hash(R.SerializeCompressed(), m)\n\th = new(big.Int).Mod(new(big.Int).Neg(h), btcec.S256().N)\n\thP := new(btcec.PublicKey)\n\thP.X, hP.Y = btcec.S256().ScalarMult(P.X, P.Y, h.Bytes())\n\treturn SumPubs(R, hP)\n}", "func (c Node) GetKey() string {\n\treturn c.key\n}", "func (entry *LogEntry) GetKey() []byte {\n\treturn entry.getWriteRequest().GetKey()\n}", "func GetKey(t *testing.T) []byte {\n\tt.Helper()\n\n\tk, _ := GeneratePrivateKey()\n\treturn k.Data[:]\n}", "func (ips *IPAMState) GetKey() string {\n\treturn ips.IPAMPolicy.GetKey()\n}", "func (i SNSProtocol) Key() string {\n\tif val, ok := _SNSProtocolValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "func (cg *ConsumerGroup) GetKey() types.NamespacedName {\n\treturn types.NamespacedName{\n\t\tNamespace: cg.GetNamespace(),\n\t\tName: cg.GetName(),\n\t}\n}", "func (k Keeper) GetMessage(ctx sdk.Context, id uint64) types.Message {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MessageKey))\n\tvar message types.Message\n\tk.cdc.MustUnmarshalBinaryBare(store.Get(GetMessageIDBytes(id)), &message)\n\treturn message\n}", "func (key twofishKey) Key() []byte {\n\treturn key[:]\n}", "func GetMessage(locale, key string) string {\n\treturn locales[locale].Langs[key].(string)\n}", "func (s HTTPStore) GetKey(role data.RoleName) ([]byte, error) {\n\turl, err := s.buildKeyURL(role)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := s.roundTrip.RoundTrip(req)\n\tif err != nil {\n\t\treturn nil, NetworkError{Wrapped: err}\n\t}\n\tdefer resp.Body.Close()\n\tif err := translateStatusToError(resp, role.String()+\" key\"); err != nil {\n\t\treturn nil, err\n\t}\n\tb := io.LimitReader(resp.Body, MaxKeySize)\n\tbody, err := ioutil.ReadAll(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "func (d *Dispatcher) key(m *Message) string {\n\t// Message to runnable: Cmds\n\tif m.To != nil && m.To.Type == RunnableIdentifierType {\n\t\treturn fmt.Sprintf(\"to.runnable.%s.%s\", *m.To.Worker, *m.To.Name)\n\t}\n\n\t// Message from runnable: Events\n\tif m.From.Type == RunnableIdentifierType {\n\t\treturn fmt.Sprintf(\"from.runnable.%s.%s\", *m.From.Worker, *m.From.Name)\n\t}\n\treturn \"default\"\n}", "func (eln *EmptyLeafNode) GetKey() []byte {\n\treturn nil\n}", "func (area *MineArea) GetKey() string {\n\treturn GetKey(area.X, area.Y)\n}", "func (m *KeyUint) Key() driver.Value { return driver.Value(m.ID) }", "func (d *DynamicTranslation) Key() string {\n\treturn translationKey(d.RealmID, d.Locale, d.MessageID)\n}", "func (adminport *Adminport) GetMessageKeyFromRequest(r *http.Request) (string, error) {\n\tvar key string\n\t// remove adminport url prefix from path\n\tpath := r.URL.Path[len(base.AdminportUrlPrefix):]\n\t// remove trailing \"/\" in path if it exists\n\tif strings.HasSuffix(path, base.UrlDelimiter) {\n\t\tpath = path[:len(path)-1]\n\t}\n\n\tfor _, staticPath := range StaticPaths {\n\t\tif path == staticPath {\n\t\t\t// if path in url is a static path, use it as name\n\t\t\tkey = path\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif len(key) == 0 {\n\t\t// if path does not match any static paths, check if it has a prefix that matches dynamic path prefixes\n\t\tfor _, dynPathPrefix := range DynamicPathPrefixes {\n\t\t\tif strings.HasPrefix(path, dynPathPrefix) {\n\t\t\t\tkey = dynPathPrefix + DynamicSuffix\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(key) == 0 {\n\t\treturn \"\", base.InvalidPathInHttpRequestError(r.URL.Path)\n\t} else {\n\t\t// add http method suffix to name to ensure uniqueness\n\t\tkey += base.UrlDelimiter + strings.ToUpper(r.Method)\n\n\t\tlogger_ap.Debugf(\"Request key decoded: %v\\n\", key)\n\n\t\treturn key, nil\n\t}\n}", "func (l *LangPackStringPluralized) GetKey() (value string) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.Key\n}", "func (symmetricKey *SymmetricKey) GetKeyID() string {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.KeyID\n}", "func (e GetMessageRequestValidationError) Key() bool { return e.key }", "func msgToKey(m *dns.Msg) (b []byte) {\n\tq := m.Question[0]\n\tname := q.Name\n\tb = make([]byte, packedMsgLenSz+packedMsgLenSz+len(name))\n\n\t// Put QTYPE, QCLASS, and QNAME.\n\tbinary.BigEndian.PutUint16(b, q.Qtype)\n\tbinary.BigEndian.PutUint16(b[packedMsgLenSz:], q.Qclass)\n\tcopy(b[2*packedMsgLenSz:], strings.ToLower(name))\n\n\treturn b\n}", "func (kl *Keylogger) GetKey() Key {\n\tactiveKey := 0\n\tvar keyState uint16\n\n\tfor i := 0; i < 256; i++ {\n\t\tkeyState = w32.GetAsyncKeyState(i)\n\n\t\t// Check if the most significant bit is set (key is down)\n\t\t// And check if the key is not a non-char key (except for space, 0x20)\n\t\tif keyState&(1<<15) != 0 && !(i < 0x2F && i != 0x20) && (i < 160 || i > 165) && (i < 91 || i > 93) {\n\t\t\tactiveKey = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif activeKey != 0 {\n\t\tif activeKey != kl.lastKey {\n\t\t\tkl.lastKey = activeKey\n\t\t\treturn kl.ParseKeycode(activeKey, keyState)\n\t\t}\n\t} else {\n\t\tkl.lastKey = 0\n\t}\n\n\treturn Key{Empty: true}\n}", "func (l *LangPackString) GetKey() (value string) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.Key\n}", "func (g *Generator) GetKey(K string) interface{} {\n\treturn g.data[K]\n}", "func (m *Messages) Get(key string) string {\n\tresult, ok := (*m)[key]\n\tif ok == false {\n\t\tresult = key\n\t}\n\treturn result\n}", "func msgKeyLarge(authKey Key, plaintextPadded []byte, mode Side) []byte {\n\th := getSHA256()\n\tdefer sha256Pool.Put(h)\n\n\tx := getX(mode)\n\t_, _ = h.Write(authKey[88+x : 32+88+x])\n\t_, _ = h.Write(plaintextPadded)\n\treturn h.Sum(nil)\n}", "func (m *Message) ObjectStorageKey() []byte {\n\treturn m.ID().Bytes()\n}", "func (i service) GetKey(did id.DID, key [32]byte) (*id.KeyResponse, error) {\n\tcontract, opts, _, err := i.prepareCall(did)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, err := contract.GetKey(opts, key)\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Could not call identity contract: %v\", err)\n\t}\n\n\treturn &id.KeyResponse{result.Key, result.Purposes, result.RevokedAt}, nil\n\n}", "func (m *Metric) GetKey() string {\n\tif m == nil || m.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Key\n}", "func (c VpnCredential) GetKey() string {\n\treturn c.Key\n}", "func (e EnumByte) Key() EnumByteKey {\n return EnumByteKey(e)\n}", "func (t *Tkeyid) GetKey(id uint) (key string, ok bool) {\n\tkey, ok = t.idtokey[id]\n\treturn\n}", "func hostGetKeyId(key *byte, size int32) int32", "func (s *Arena) getKey(offset uint32, size uint16) []byte {\n\treturn s.data[offset : offset+uint32(size)]\n}", "func (kl *Keylogger) GetKey() Key {\n\tactiveKey := 0\n\tvar keyState uint16\n\n\tfor i := 0; i < 256; i++ {\n\t\tkeyState = w32.GetAsyncKeyState(i)\n\n\t\t// Check if the key is pressed (if the most significant bit is set)\n\t\t// And check if the key is not a ASCII control characters (except for enter, 13)\n\t\tif keyState&(1<<15) != 0 && !(i < 32 && i != 13) && (i < 160 || i > 165) {\n\t\t\tactiveKey = i\n\t\t\tif i == 13 {\n\t\t\t\tactiveKey = 32\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t}\n\n\tif activeKey != 0 {\n\t\tif activeKey != kl.lastKey {\n\t\t\tkl.lastKey = activeKey\n\t\t\treturn kl.ParseKeycode(activeKey, keyState)\n\t\t}\n\t} else {\n\t\tkl.lastKey = 0\n\t}\n\n\treturn Key{Empty: true}\n}", "func (l *LangPackStringDeleted) GetKey() (value string) {\n\tif l == nil {\n\t\treturn\n\t}\n\treturn l.Key\n}", "func (d Digest) GetKey(format KeyFormat) string {\n\tswitch format {\n\tcase KeyWithoutInstance:\n\t\t_, _, _, sizeBytesEnd := d.unpack()\n\t\treturn d.value[:sizeBytesEnd]\n\tcase KeyWithInstance:\n\t\treturn d.value\n\tdefault:\n\t\tpanic(\"Invalid digest key format\")\n\t}\n}", "func GetKeyID(recoveryFlag int) int {\n\treturn (recoveryFlag - 27) & 0b11\n}", "func (a *LocalKeyAgent) GetCoreKey() (*Key, error) {\n\treturn a.GetKey(\"\")\n}", "func (s *GCPCKMSSeal) KeyID() string {\n\treturn s.currentKeyID.Load().(string)\n}", "func (*produceRequest) Key() int16 { return 0 }", "func (pdu *Pdu) AsMapKey() string {\n // return fmt.Sprintf(\"%d[%x]\", pdu.MessageID, pdu.Token)\n return fmt.Sprintf(\"%x\", pdu.Token)\n // return fmt.Sprintf(\"%d\", pdu.MessageID)\n}", "func (s *Subscription) GetKey() string {\n\tbaseURL, _ := url.Parse(s.BaseURL)\n\tfields := []string{\n\t\ts.VCSType,\n\t\tbaseURL.Hostname(),\n\t\ts.OrgName,\n\t\ts.RepoName,\n\t}\n\tkey := strings.Join(fields, \"_\")\n\treturn util.GetKeyHash(key)\n}", "func (pmm *PrivateMsgMap) GetMsg(origin string, index uint32) string {\n\tvar toReturn string\n\tpmm.RLock()\n\tvalue, _ := pmm.messages[origin]\n\ttoReturn = value[index]\n\tpmm.RUnlock()\n\treturn toReturn\n}", "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "func GetKey(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *KeyState, opts ...pulumi.ResourceOption) (*Key, error) {\n\tvar resource Key\n\terr := ctx.ReadResource(\"google-native:apikeys/v2:Key\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (b *BigIP) GetKey(name string) (*Key, error) {\n\tvar key Key\n\terr, ok := b.getForEntity(&key, uriSys, uriCrypto, uriKey, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\n\treturn &key, nil\n}", "func (s *Connection) GetKey() ConnectionName {\n\tif s == nil {\n\t\treturn \"\"\n\t}\n\treturn s.Key\n}", "func (o *CustomHostMetadataKey) GetKey() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Key\n}", "func (m *SearchBucket) GetKey()(*string) {\n return m.key\n}", "func (r *MCRequest) Key() []byte {\n\treturn r.key\n}", "func (w *Wallet) GetKey(address types.UnlockHash) (pk types.PublicKey, sk types.ByteSlice, err error) {\n\tw.mu.RLock()\n\tpk, sk, err = w.getKey(address)\n\tw.mu.RUnlock()\n\treturn\n}", "func (e ApplicationPubSub_MessageValidationError) Key() bool { return e.key }", "func getKey(data string) string {\n\tsign := md5.Sum([]byte(data))\n\tsignStr := fmt.Sprintf(\"%x\", sign)\n\treturn signStr[:7]\n}", "func (v *Value) GetKey() *string {\n\tret := C.zj_GetKey(v.V)\n\tif ret == nil {\n\t\treturn nil\n\t}\n\tretStr := C.GoString(ret)\n\treturn &retStr\n}", "func (req *RequestMessage) GetAPIKey() int16 {\n\treturn req.kind\n}", "func (keyRing *KeyRing) GetKey(n int) (*Key, error) {\n\tif n >= keyRing.CountEntities() {\n\t\treturn nil, errors.New(\"gopenpgp: out of bound when fetching key\")\n\t}\n\treturn &Key{keyRing.entities[n]}, nil\n}", "func (o *LabelProperties) GetKey() *string {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.Key\n\n}", "func (l *License) GetKey() string {\n\tif l == nil || l.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *l.Key\n}", "func (o *LongProperty) GetKey() string {\n\tif o == nil || o.Key == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "func (p *PKCS11) GetKeyID() (err error) {\n findTemplate := []*pkcs11.Attribute{\n pkcs11.NewAttribute(pkcs11.CKA_ID, true), // KeyID\n pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n pkcs11.NewAttribute(pkcs11.CKA_PRIVATE, true),\n pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_RSA),\n }\n\n p.Ctx.FindObjectsInit(p.SessionHandle, findTemplate)\n obj, _, err := p.Ctx.FindObjects(p.SessionHandle, 1000)\n if err != nil {\n return\n }\n\n err = p.Ctx.FindObjectsFinal(p.SessionHandle)\n if err != nil {\n return\n }\n\n p.KeyID = map[int][]byte{}\n for num, objValue := range obj {\n attrs, _ := p.Ctx.GetAttributeValue(p.SessionHandle, objValue, findTemplate)\n p.KeyID[num] = attrs[0].Value\n }\n\n return\n}", "func (k *Key) GetKey() string {\n\tif k == nil || k.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *k.Key\n}", "func (sgp *SgpolicyState) GetKey() string {\n\treturn sgp.NetworkSecurityPolicy.GetKey()\n}", "func getKey() (string, error) {\n\tvar b [KeyLen]byte\n\t_, err := rand.Read(b[:])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hex.EncodeToString(b[:]), nil\n}", "func getKmsKeyFromKeyCache(keyHandle string) (string, string, error) {\n\tcounter := 0\n\tgoto GetKey\nGetKey:\n\t//search for the key in keyring\n\tdata, _, err := getKeyFromKeyCache(keyHandle)\n\tif err != nil {\n\t\tlogrus.Debugf(\"secureoverlay2: Error: Not able to get the key from keyring - %s, counter = %d\", err.Error(), counter)\n\t\tif counter < MAXKEYPOLL {\n\t\t\tgoto WaitForKey\n\t\t}\n\t\treturn \"\", \"\", err\n\t}\n\tlogrus.Debugf(\"secureoverlay2: Got the key in the keyring\")\n\treturn data, \"\", nil\n\nWaitForKey:\n\tlogrus.Debugf(\"secureoverlay2: Waiting for the key\")\n\ttime.Sleep(250 * time.Millisecond)\n\tcounter++\n\tgoto GetKey\n}", "func GetKey(allkeys [][]byte, loc Where) []byte {\n\tif loc == Left {\n\t\treturn allkeys[0]\n\t}\n\tif loc == Right {\n\t\treturn allkeys[len(allkeys)-1]\n\t}\n\t// select a random index between 1 and allkeys-2\n\t// nolint:gosec\n\tidx := rand.Int()%(len(allkeys)-2) + 1\n\treturn allkeys[idx]\n}", "func MGetCacheKey(c Cacheable, i int) string {\n\treturn c.cs.s[i+1]\n}", "func GetMapKey(UsernameHashed, PasswordHashed string) []byte {\r\n\treturn []byte(path.Join(keyPrefix4SubTree, UsernameHashed, PasswordHashed))\r\n}", "func (s *session) getKey() string {\n\treturn s.uuid\n}", "func GetKey(ctx context.Context) string {\n\tsv, ok := ctx.Value(ctxKeyKey).(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\treturn sv\n}", "func (mm *MessageKey) StringKey(params *BitCloutParams) string {\n\treturn PkToString(mm.PublicKey[:], params) + \"_\" + fmt.Sprint(mm.TstampNanos)\n}", "func GetKey(namespace, name string) string {\n\treturn fmt.Sprintf(\"%s/%s\", namespace, name)\n}", "func (c *chat) key() int64 {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\t// generates new possible key value\n\tvar key = time.Now().UnixNano()\n\n\t// generated key become actual if the previous key is absent\n\tif c.prev == 0 {\n\t\tc.prev = key\n\t\t// returns actual key\n\t\treturn c.prev\n\t}\n\n\t// calculates minimum next possible key value\n\tc.prev = c.prev + c.latency\n\n\t// generated key become actual if generated key greater than the minimum possible key\n\tif key > c.prev {\n\t\tc.prev = key\n\t}\n\n\t// returns actual key\n\treturn c.prev\n}", "func getKeyFromKeyCache(keyHandle string) (string, string, error) {\n\n\tctxkey := ctx.Value(keyHandle)\n\tif ctxkey == nil || ctxkey == \"\" {\n\t\tconn, err := net.Dial(\"unix\", RPCSocketFilePath)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"secureoverlay2: Failed to dial workload-agent wlagent.sock\")\n\t\t}\n\t\tclient := rpc.NewClient(conn)\n\t\tdefer client.Close()\n\t\tvar outKey KeyInfo\n\t\tvar args = KeyInfo{\n\t\t\tKeyID: keyHandle,\n\t\t}\n\t\terr = client.Call(\"VirtualMachine.FetchKey\", &args, &outKey)\n\t\tif err != nil {\n\t\t\tlogrus.Tracef(\"%+v\", err)\n\t\t\treturn \"\", \"\", fmt.Errorf(\"secureoverlay2: rpc call workload-agent fetch-key: Client call failed\")\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"Could not fetch the key from workload-agent\")\n\t\t}\n\t\tif len(outKey.Key) == 0 {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"Empty key received from workload-agent\")\n\t\t}\n\t\tunwrappedKey := base64.StdEncoding.EncodeToString(outKey.Key)\n\t\tctx = context.WithValue(context.TODO(), keyHandle, unwrappedKey)\n\t\treturn unwrappedKey, \"\", nil\n\t}\n\treturn fmt.Sprintf(\"%v\", ctx.Value(keyHandle)), \"\", nil\n\n}", "func (d *Disk) getKey(p *DiskParams) []byte {\n\treturn []byte(time_util.TimeToName(time.Unix(p.ExicutionTime, 0), fmt.Sprintf(\"%x\", d.hasher.Sum(nil))))\n}", "func (k *Index) GetKeyPtr() unsafe.Pointer { return unsafe.Pointer(k) }", "func (e MessageCValidationError) Key() bool { return e.key }", "func (this *DefaultHandler) GetKey(xesRedis redo.XesRedisBase) (ret string) {\n\tdefer func() {\n\t\tif xesRedis.GetCtx() == nil {\n\t\t\treturn\n\t\t}\n\t\tbench := xesRedis.GetCtx().Value(\"IS_BENCHMARK\")\n\t\tif cast.ToString(bench) == \"1\" {\n\t\t\tret = \"benchmark_\" + ret\n\t\t}\n\t}()\n\n\tkeyInfo := this.getKeyInfo(xesRedis)\n\tkey := cast.ToString(keyInfo[\"key\"])\n\tif key == \"\" {\n\t\tret = xesRedis.GetKeyName()\n\t\treturn\n\t}\n\tret = fmt.Sprintf(key, (xesRedis.GetKeyParams())...)\n\treturn\n}", "func GetMessage(id MessageID) string {\n\treturn messages[id]\n}", "func (e GetMessageResponseValidationError) Key() bool { return e.key }", "func (c *Client) GetKey() (types.EncKey, error) {\n\n\treturn types.EncKey{}, nil\n}", "func (e DeleteMessageRequestValidationError) Key() bool { return e.key }", "func (g *Genkey) Getkey() (key int64, err error) {\n\tselect {\n\tcase key = <-g.keys:\n\t\treturn\n\tcase <-time.After(genKeyTimeout):\n\t\terr = errors.New(\"getKey timeout\")\n\t\treturn\n\t}\n}", "func (ctx Ctx) Key(at KeyPairID) (res Key, err error) {\n\tif C.CryptGetUserKey(ctx.hProv, C.DWORD(at), &res.hKey) == 0 {\n\t\terr = getErr(\"Error getting key for container\")\n\t\treturn\n\t}\n\treturn\n}", "func (d *device) getKey() string {\n\treturn d.GetClass().ToString() + \",\" + d.GetName()\n}", "func (m *Module) GetKey(ctx context.Context, key string) (string, error) {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\treturn m.client.Get(ctx, key).Result()\n}" ]
[ "0.73595506", "0.6789251", "0.6704122", "0.66150147", "0.6544578", "0.6529682", "0.64331543", "0.641901", "0.6389284", "0.6387634", "0.63848305", "0.63806224", "0.63209355", "0.62894017", "0.62710315", "0.62678534", "0.6229667", "0.62214786", "0.6218583", "0.61587995", "0.61500424", "0.6149393", "0.61464775", "0.61439997", "0.61197335", "0.61177117", "0.61117333", "0.6092023", "0.6090333", "0.60739756", "0.6071076", "0.6067772", "0.6057327", "0.6052317", "0.60377324", "0.60341465", "0.60009253", "0.59898865", "0.59874946", "0.59791845", "0.59748864", "0.5968991", "0.5968132", "0.5964096", "0.5956948", "0.5948237", "0.59471965", "0.5939836", "0.5921703", "0.59110665", "0.59102887", "0.59096575", "0.58898175", "0.5889589", "0.5884898", "0.5870068", "0.5864815", "0.5862602", "0.58599037", "0.5858676", "0.58575016", "0.5854996", "0.5854242", "0.58506316", "0.5850183", "0.58496624", "0.584727", "0.58427906", "0.5840078", "0.5835007", "0.5828927", "0.58151484", "0.5813389", "0.5813112", "0.5809906", "0.5807087", "0.57995623", "0.57908314", "0.5785737", "0.5774968", "0.576822", "0.57656634", "0.57574713", "0.57457006", "0.5745137", "0.5743851", "0.57358515", "0.57311064", "0.5728112", "0.5719489", "0.57158303", "0.5710166", "0.5701322", "0.56989324", "0.5697165", "0.5667351", "0.5666986", "0.5666865", "0.5662102", "0.5654947" ]
0.7453689
0
GetChainKey implemented in memory.
GetChainKey реализован в памяти.
func (ms *MemStore) GetChainKey(sessionKey string) (*[32]byte, error) { s, ok := ms.sessions[sessionKey] if !ok { return nil, log.Errorf("memstore: no session found for %s", sessionKey) } // decode chain key var key [32]byte k, err := base64.Decode(s.chainKey) if err != nil { return nil, log.Error("memstore: cannot decode chain key") } if copy(key[:], k) != 32 { return nil, log.Errorf("memstore: chain key has wrong length") } return &key, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetChainKey(chainID string) []byte {\n\treturn append(KeyPrefix(ChainKey), []byte(chainID)...)\n}", "func (hs *HandshakeState) GetChainingKey() []byte {\n\treturn hs.ss.chainingKey[:]\n}", "func (k *Keychain) Key() (string, error) {\n\tkey, err := k.BinKey()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hex.EncodeToString(key), nil\n}", "func GetTheBlockKey(chain, index uint64) []byte {\n\tvar key Hash\n\tif chain == 0 {\n\t\treturn nil\n\t}\n\tif index == 0 {\n\t\tvar pStat BaseInfo\n\t\tgetDataFormDB(chain, dbStat{}, []byte{StatBaseInfo}, &pStat)\n\t\treturn pStat.Key[:]\n\t}\n\tgetDataFormLog(chain, logBlockInfo{}, runtime.Encode(index), &key)\n\tif key.Empty() {\n\t\treturn nil\n\t}\n\treturn key[:]\n}", "func GetKey(t *testing.T) []byte {\n\tt.Helper()\n\n\tk, _ := GeneratePrivateKey()\n\treturn k.Data[:]\n}", "func (m LocalTransit) GetKey(context string) ([]byte, error) {\n\tif m.KeyProvider == nil {\n\t\treturn nil, ex.New(\"local transit; key provider is unset\")\n\t}\n\treturn m.KeyProvider(context)\n}", "func (ctx *Context) APIKeychain() *Keychain {\n\treturn ctx.apiKeychain\n}", "func (s *State) SenderChainKey() session.ChainKeyable {\n\tchainKey := s.senderChain.chainKey\n\treturn chain.NewKey(kdf.DeriveSecrets, chainKey.Key(), chainKey.Index())\n}", "func (rk *caIdemixRevocationKey) GetKey() *ecdsa.PrivateKey {\n\treturn rk.key\n}", "func (w *Wallet) GetKey(address types.UnlockHash) (pk types.PublicKey, sk types.ByteSlice, err error) {\n\tw.mu.RLock()\n\tpk, sk, err = w.getKey(address)\n\tw.mu.RUnlock()\n\treturn\n}", "func (p *bitsharesAPI) GetChainID() objects.ChainID {\n\treturn p.chainID // return cached value\n}", "func (symmetricKey *SymmetricKey) GetKey() []byte {\n\tsymmetricKey.mutex.RLock()\n\tdefer symmetricKey.mutex.RUnlock()\n\treturn symmetricKey.SymmetricKey\n}", "func (s *SmartContract) queryChainKey(stub shim.ChaincodeStubInterface, args []string) sc.Response {\n\tif len(args) != 1 {\n\t\tshim.Error(\"Incorrect number of arguments, Expecting 1\")\n\t}\n\tchainkeyAsBytes, _ := stub.GetState(args[0])\n\tdata := string(chainkeyAsBytes)\n\tfmt.Println(\"Returning list of Asset %s args[0]\", data)\n\n\tif chainkeyAsBytes == nil {\n\t\treturn shim.Error(\"could not locate Asset\")\n\t}\n\treturn shim.Success(chainkeyAsBytes)\n}", "func NewKeychain() *Keychain {\n\treturn &Keychain{}\n}", "func (s *State) ReceiverChainKey(senderEphemeral ecc.ECPublicKeyable) *chain.Key {\n\treceiverChainAndIndex := s.receiverChain(senderEphemeral)\n\treceiverChain := receiverChainAndIndex.ReceiverChain\n\n\tif receiverChainAndIndex == nil || receiverChain == nil {\n\t\treturn nil\n\t}\n\n\treturn chain.NewKey(\n\t\tkdf.DeriveSecrets,\n\t\treceiverChain.chainKey.Key(),\n\t\treceiverChain.chainKey.Index(),\n\t)\n}", "func ChainName() string {\n\tglobalData.RLock()\n\tdefer globalData.RUnlock()\n\treturn globalData.chain\n}", "func NewKeychain() *Keychain {\n\tk := &Keychain{\n\t\tkeys: make([][]byte, 0, keychainLen),\n\t}\n\treturn k\n}", "func (ctx Ctx) Key(at KeyPairID) (res Key, err error) {\n\tif C.CryptGetUserKey(ctx.hProv, C.DWORD(at), &res.hKey) == 0 {\n\t\terr = getErr(\"Error getting key for container\")\n\t\treturn\n\t}\n\treturn\n}", "func GetValidatorKey(address sdk.Address, power sdk.Rational, cdc *wire.Codec) []byte {\n\tb, _ := cdc.MarshalJSON(power) // TODO need to handle error here?\n\treturn append(ValidatorKeyPrefix, append(b, address.Bytes()...)...) // TODO does this need prefix if its in its own store\n}", "func (key twofishKey) Key() []byte {\n\treturn key[:]\n}", "func GetWorkKey() ([]byte, error) {\n\t// get root key by key components\n\trootKey, genRootKeyErr := genRootKey(ComponentFilePath, SaltFilePath)\n\tif genRootKeyErr != nil {\n\t\tlog.Errorf(nil, \"Failed to generate root key by key components.\")\n\t\treturn nil, genRootKeyErr\n\t}\n\tlog.Info(\"Succeed to generate root key by key components.\")\n\n\t// decrypt work key by root key.\n\tworkKey, decryptedWorkKeyErr := decryptKey(rootKey, EncryptedWorkKeyFilePath, WorkKeyNonceFilePath)\n\t// clear root key\n\tClearByteArray(rootKey)\n\tif decryptedWorkKeyErr != nil {\n\t\tlog.Errorf(nil, decryptedWorkKeyErr.Error())\n\t\treturn nil, decryptedWorkKeyErr\n\t}\n\tlog.Info(\"Succeed to decrypt work key.\")\n\treturn workKey, nil\n}", "func (keyDB *KeyDB) GetHashChainEntry(domain string, position uint64) (string, error) {\n\tvar entry string\n\tdmn := identity.MapDomain(domain)\n\terr := keyDB.getHashChainEntryQuery.QueryRow(dmn, position).Scan(&entry)\n\tswitch {\n\tcase err != nil:\n\t\treturn \"\", log.Error(err)\n\tdefault:\n\t\treturn entry, nil\n\t}\n}", "func (k KeyStore) Get(address bitcoin.RawAddress) (*Key, error) {\r\n\thash, err := address.Hash()\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tkey, ok := k.Keys[*hash]\r\n\tif !ok {\r\n\t\treturn nil, ErrKeyNotFound\r\n\t}\r\n\treturn key, nil\r\n}", "func (ips *IPAMState) GetKey() string {\n\treturn ips.IPAMPolicy.GetKey()\n}", "func (d *Disk) getKey(p *DiskParams) []byte {\n\treturn []byte(time_util.TimeToName(time.Unix(p.ExicutionTime, 0), fmt.Sprintf(\"%x\", d.hasher.Sum(nil))))\n}", "func (l *License) GetKey() string {\n\tif l == nil || l.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *l.Key\n}", "func (level DepthOfMarketLevel) GetKey() float64 { return level[0] }", "func (st *MemStorage) GetKey(gun, role string) (algorithm string, public []byte, err error) {\n\t// no need for lock. It's ok to return nil if an update\n\t// wasn't observed\n\tg, ok := st.keys[gun]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\tk, ok := g[role]\n\tif !ok {\n\t\treturn \"\", nil, &ErrNoKey{gun: gun}\n\t}\n\n\treturn k.algorithm, k.public, nil\n}", "func (mci *XMCacheIterator) Key() []byte {\n\tif mci.err != nil || mci.dir == dirReleased {\n\t\treturn nil\n\t}\n\tswitch mci.index {\n\tcase 0, 1:\n\t\treturn mci.iters[mci.index].Key()\n\tcase 2:\n\t\tif mci.mc.isPenetrate {\n\t\t\treturn mci.mIter.Key()\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (keyRing *KeyRing) GetKey(n int) (*Key, error) {\n\tif n >= keyRing.CountEntities() {\n\t\treturn nil, errors.New(\"gopenpgp: out of bound when fetching key\")\n\t}\n\treturn &Key{keyRing.entities[n]}, nil\n}", "func (k *Keychain) BinKey() ([]byte, error) {\n\tk.m.RLock()\n\tif len(k.keys) == 0 {\n\t\tk.m.RUnlock()\n\t\treturn nil, ErrNoKeys\n\t}\n\tkey := k.keys[0]\n\tk.m.RUnlock()\n\treturn key, nil\n}", "func (c Node) GetKey() string {\n\treturn c.key\n}", "func (s *ChaincodeStubWrapper) Get(key datastore.Key) ([]byte, error) {\n\tlogger.Debugf(\"Getting key %s\", key)\n\n\tv, err := s.stub.GetPrivateData(s.collection, key.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(v) == 0 {\n\t\treturn nil, datastore.ErrNotFound\n\t}\n\n\treturn v, nil\n}", "func (s *PublicTransactionPoolAPI) GetTxKey(ctx context.Context, hash common.Hash, addr *common.Address) (*lkctypes.Key, error) {\n\treturn s.wallet.GetTxKey(&hash, addr)\n}", "func (m *KeyValue) GetKey()(*string) {\n return m.key\n}", "func GetChainID(ctx Context) string {\n\tif x := ctx.Value(contextKeyChainID); x == nil {\n\t\tpanic(\"Chain id is not in context\")\n\t}\n\treturn ctx.Value(contextKeyChainID).(string)\n}", "func (m *RegistryKeyState) GetKey()(*string) {\n return m.key\n}", "func (sgp *SgpolicyState) GetKey() string {\n\treturn sgp.NetworkSecurityPolicy.GetKey()\n}", "func (p *Provider) GetKey() interface{} {\n\treturn p.key\n}", "func (transaction *AccountCreateTransaction) GetKey() (Key, error) {\n\treturn transaction.key, nil\n}", "func (o *Gojwt) GetPubKeyPath()(string){\n return o.pubKeyPath\n}", "func GetValidatorKey(chainID string, valAddress sdk.ValAddress) []byte {\n\tkey := append(KeyPrefix(ValidatorKey), []byte(chainID)...)\n\n\t// We use \"_\" to separate chainID and proposalID to avoid prefix conflic since \"-\" is allowed in chainID\n\tkey = append(key, []byte(\"_\")...)\n\treturn append(key, valAddress.Bytes()...)\n}", "func (m *Win32LobAppRegistryDetection) GetKeyPath()(*string) {\n val, err := m.GetBackingStore().Get(\"keyPath\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (c VpnCredential) GetKey() string {\n\treturn c.Key\n}", "func (a *LocalKeyAgent) GetCoreKey() (*Key, error) {\n\treturn a.GetKey(\"\")\n}", "func (i GinJwtSignAlgorithm) Key() string {\n\tif val, ok := _GinJwtSignAlgorithmValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "func (s HTTPStore) GetKey(role data.RoleName) ([]byte, error) {\n\turl, err := s.buildKeyURL(role)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := s.roundTrip.RoundTrip(req)\n\tif err != nil {\n\t\treturn nil, NetworkError{Wrapped: err}\n\t}\n\tdefer resp.Body.Close()\n\tif err := translateStatusToError(resp, role.String()+\" key\"); err != nil {\n\t\treturn nil, err\n\t}\n\tb := io.LimitReader(resp.Body, MaxKeySize)\n\tbody, err := ioutil.ReadAll(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "func (km *KeyManager) GetPathKey(path string, i int) (*bip32.Key, error) {\n\tkey, ok := km.getKey(path)\n\tif ok {\n\t\treturn key, nil\n\t}\n\n\tif path == \"m\" {\n\t\treturn km.getMasterKey()\n\t}\n\n\tderivationPath, err := ParseDerivationPath(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tparentPath := derivationPath[:i] \t\n\tparent, err := km.GetPathKey(parentPath.toString(), i-1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey, err = parent.NewChildKey(derivationPath[i])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkm.setKey(path, key)\n\treturn key, nil\n}", "func (transaction *TokenUpdateTransaction) GetSupplyKey() Key {\n\treturn transaction.supplyKey\n}", "func (obj *key) Key() rsa.PublicKey {\n\treturn obj.ky\n}", "func (stateID StateID) Key() string {\n\treturn string(stateID.LastAppHash)\n}", "func (i service) GetKey(did id.DID, key [32]byte) (*id.KeyResponse, error) {\n\tcontract, opts, _, err := i.prepareCall(did)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, err := contract.GetKey(opts, key)\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Could not call identity contract: %v\", err)\n\t}\n\n\treturn &id.KeyResponse{result.Key, result.Purposes, result.RevokedAt}, nil\n\n}", "func (blockID BlockID) Key() string {\n\tpbph := blockID.PartSetHeader.ToProto()\n\tbz, err := pbph.Marshal()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn fmt.Sprint(string(blockID.Hash), string(bz))\n}", "func (blockID BlockID) Key() string {\n\tpbph := blockID.PartSetHeader.ToProto()\n\tbz, err := pbph.Marshal()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn fmt.Sprint(string(blockID.Hash), string(bz))\n}", "func (acc *Account) Key() []byte {\n\treturn []byte(acc.Email)\n}", "func (m *Win32LobAppRegistryRule) GetKeyPath()(*string) {\n return m.keyPath\n}", "func GetIterationKey(clientStore sdk.KVStore, height exported.Height) []byte {\n\tkey := IterationKey(height)\n\treturn clientStore.Get(key)\n}", "func GetKey(size int) []byte {\n\treturn GetIV(size)\n}", "func GetValidatorKey(pubKey crypto.PubKey, power types.Rational) []byte {\n\tb, _ := cdc.MarshalJSON(power) // TODO need to handle error here?\n\treturn append(ValidatorKeyPrefix, append(b, pubKey.Bytes()...)...) // TODO does this need prefix if its in its own store\n}", "func (eln *EmptyLeafNode) GetKey() []byte {\n\treturn nil\n}", "func (itr *Iterator) Key() []byte {\n\treturn retrieveAppKey(itr.Iterator.Key())\n}", "func GetAccountKey(chainID string, accountAddress sdk.AccAddress) []byte {\n\tkey := append(KeyPrefix(AccountKey), []byte(chainID)...)\n\n\t// We use \"_\" to separate chainID and proposalID to avoid prefix conflic since \"-\" is allowed in chainID\n\tkey = append(key, []byte(\"_\")...)\n\treturn append(key, accountAddress.Bytes()...)\n}", "func (f binaryEqualsFunc) key() Key {\n\treturn f.k\n}", "func (t *Tx) GetTxKey() (string, error) {\n\tif t.Tx == nil {\n\t\treturn \"\", ErrNilTx\n\t}\n\n\tb, err := ultpb.Encode(t.Tx)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"encode tx failed: %v\", err)\n\t}\n\n\ttxKey := &crypto.ULTKey{\n\t\tCode: crypto.KeyTypeTx,\n\t\tHash: crypto.SHA256HashBytes(b),\n\t}\n\tkeyStr := crypto.EncodeKey(txKey)\n\n\treturn keyStr, nil\n}", "func (area *MineArea) GetKey() string {\n\treturn GetKey(area.X, area.Y)\n}", "func (b *BigIP) GetKey(name string) (*Key, error) {\n\tvar key Key\n\terr, ok := b.getForEntity(&key, uriSys, uriCrypto, uriKey, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\n\treturn &key, nil\n}", "func GetEncryptionKey(agentID uuid.UUID) []byte {\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Entering into agents.GetEncryptionKey function\")\n\t}\n\tvar key []byte\n\n\tif isAgent(agentID) {\n\t\tkey = Agents[agentID].secret\n\t}\n\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Leaving agents.GetEncryptionKey function\")\n\t}\n\treturn key\n}", "func (coord *Coordinator) GetChain(chainID string) *TestChain {\n\tchain, found := coord.Chains[chainID]\n\trequire.True(coord.t, found, fmt.Sprintf(\"%s chain does not exist\", chainID))\n\treturn chain\n}", "func GetMyChain() BlockChain {\r\n\treturn myChain.Chain\r\n}", "func GetChainID(index int) string {\n\treturn ChainIDPrefix + strconv.Itoa(index)\n}", "func (pk *PublicKey) Key() string {\n\treturn string(pk.PublicKeyHex.Value)\n}", "func (key StepsCacheKey) Key() (string, error) {\n\treturn marshalAndHashStepsCacheKey(key, []string{})\n}", "func GetInteropChaincodeIDKey() string {\n\treturn \"interopChaincodeID\"\n}", "func (b *BitSet) Key() string {\n\tif b == nil {\n\t\treturn \"\"\n\t} else {\n\t\treturn string(b.Bits.Bytes())\n\t}\n}", "func (am *AppchainManager) GetPubKeyByChainID(id string) (bool, []byte) {\n\tok := am.Has(am.appchainKey(id))\n\tif !ok {\n\t\treturn false, []byte(\"chain is not existed\")\n\t} else {\n\t\tchain := &Appchain{}\n\t\tam.GetObject(am.appchainKey(id), chain)\n\t\treturn true, []byte(chain.PublicKey)\n\t}\n}", "func (iter *dbCacheIterator) Key() []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.Key()\n}", "func (ck *CertKey) Key() []byte { return ck.key }", "func Key(hash *chainhash.Hash) [gcs.KeySize]byte {\n\tvar key [gcs.KeySize]byte\n\tcopy(key[:], hash[:])\n\treturn key\n}", "func (model *Trade) Key() string {\n\treturn model.Tbk.GetItemKey()\n}", "func (m *SearchBucket) GetKey()(*string) {\n return m.key\n}", "func (s *Subscription) GetKey() string {\n\tbaseURL, _ := url.Parse(s.BaseURL)\n\tfields := []string{\n\t\ts.VCSType,\n\t\tbaseURL.Hostname(),\n\t\ts.OrgName,\n\t\ts.RepoName,\n\t}\n\tkey := strings.Join(fields, \"_\")\n\treturn util.GetKeyHash(key)\n}", "func (bi *Blockchainidentifier) GetChain(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(r.RemoteAddr + \" GET /chain\")\n\n\tresponseMessage := map[string]interface{}{\n\t\t\"chain\": bi.Blocks,\n\t\t\"length\": len(bi.Blocks),\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(responseMessage)\n}", "func (h dataUsageHash) Key() string {\n\treturn string(h)\n}", "func (n *lnode) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn buf[n.pos : n.pos+n.ksize]\n}", "func (o *Gojwt) GetPrivKeyPath()(string){\n return o.privKeyPath\n}", "func (k Keeper) getInviteStoreKey(user sdk.AccAddress) []byte {\n\treturn []byte(types.InviteStorePrefix + user.String())\n}", "func (cs ClientState) GetChainID() string {\n\treturn cs.ChainID\n}", "func (ce *ClientEncryption) GetKey(ctx context.Context, id primitive.Binary) *SingleResult {\n\tfilter := bsoncore.NewDocumentBuilder().AppendBinary(\"_id\", id.Subtype, id.Data).Build()\n\treturn ce.keyVaultColl.FindOne(ctx, filter)\n}", "func (_TokensNetwork *TokensNetworkCallerSession) ChainId() (*big.Int, error) {\n\treturn _TokensNetwork.Contract.ChainId(&_TokensNetwork.CallOpts)\n}", "func ChainLinksStoreKey(user, chainName, address string) []byte {\n\treturn append(UserChainLinksPrefix(user), []byte(chainName+address)...)\n}", "func (this *DefaultHandler) GetKey(xesRedis redo.XesRedisBase) (ret string) {\n\tdefer func() {\n\t\tif xesRedis.GetCtx() == nil {\n\t\t\treturn\n\t\t}\n\t\tbench := xesRedis.GetCtx().Value(\"IS_BENCHMARK\")\n\t\tif cast.ToString(bench) == \"1\" {\n\t\t\tret = \"benchmark_\" + ret\n\t\t}\n\t}()\n\n\tkeyInfo := this.getKeyInfo(xesRedis)\n\tkey := cast.ToString(keyInfo[\"key\"])\n\tif key == \"\" {\n\t\tret = xesRedis.GetKeyName()\n\t\treturn\n\t}\n\tret = fmt.Sprintf(key, (xesRedis.GetKeyParams())...)\n\treturn\n}", "func (it *iterator) Key() []byte {\n\treturn utils.CopyBytes(it.key)\n}", "func (c *Client) GetKey() (types.EncKey, error) {\n\n\treturn types.EncKey{}, nil\n}", "func (k *Keyring) Get(kid keys.ID) (*api.Key, error) {\n\tif err := k.initDB(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn getKey(k.db, kid)\n}", "func (_TokensNetwork *TokensNetworkSession) ChainId() (*big.Int, error) {\n\treturn _TokensNetwork.Contract.ChainId(&_TokensNetwork.CallOpts)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementLabelMatchStatementPtrOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementLabelMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Key\n\t}).(pulumi.StringPtrOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementLabelMatchStatementPtrOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementLabelMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Key\n\t}).(pulumi.StringPtrOutput)\n}", "func (core *coreService) ChainID() uint32 {\n\treturn core.bc.ChainID()\n}", "func GetProposalKey(chainID string, proposalID int32) []byte {\n\tkey := append(KeyPrefix(ProposalKey), []byte(chainID)...)\n\n\t// We use \"_\" to separate chainID and proposalID to avoid prefix conflic since \"-\" is allowed in chainID\n\tkey = append(key, []byte(\"_\")...)\n\treturn append(key, []byte(strconv.Itoa(int(proposalID)))...)\n}", "func (i *Iterator) Key() []byte {\n\treturn i.iterator.Item().KeyCopy(nil)\n}" ]
[ "0.7708475", "0.6766239", "0.6656993", "0.6499389", "0.6392745", "0.62943345", "0.62314993", "0.6175444", "0.6171842", "0.614765", "0.6102029", "0.6063963", "0.6012486", "0.59941924", "0.5986066", "0.5903795", "0.589596", "0.5884794", "0.58799124", "0.5879614", "0.58652234", "0.583999", "0.5836492", "0.5822572", "0.5781878", "0.57637817", "0.57624197", "0.57595277", "0.5757929", "0.5753992", "0.5751088", "0.57235897", "0.5719422", "0.57118845", "0.5702504", "0.57016224", "0.5700033", "0.5693133", "0.5689015", "0.56722546", "0.56717265", "0.5668787", "0.56571794", "0.56531423", "0.56474", "0.5646877", "0.56358916", "0.56295365", "0.56265545", "0.5623859", "0.56230706", "0.5622", "0.56169003", "0.56169003", "0.5615133", "0.5609858", "0.5607785", "0.5600417", "0.55967396", "0.5590956", "0.5586986", "0.55815446", "0.5579036", "0.5577469", "0.5567039", "0.55649054", "0.55573726", "0.55475765", "0.5538755", "0.55291915", "0.5525391", "0.5522816", "0.5521084", "0.5520661", "0.55096495", "0.5503217", "0.54931587", "0.54924536", "0.54855114", "0.547792", "0.54723054", "0.5472227", "0.5460194", "0.5453527", "0.54488385", "0.5443277", "0.5437515", "0.5435174", "0.5431243", "0.5425836", "0.5425288", "0.5420524", "0.5418184", "0.5391123", "0.539058", "0.53900325", "0.53894234", "0.5386728", "0.53834534", "0.53823787" ]
0.75926346
1
DelMessageKey implemented in memory.
DelMessageKey реализован в памяти.
func (ms *MemStore) DelMessageKey( sessionKey string, sender bool, msgIndex uint64, ) error { s, ok := ms.sessions[sessionKey] if !ok { return log.Errorf("memstore: no session found for %s", sessionKey) } if msgIndex >= uint64(len(s.send)) { return log.Error("memstore: message index out of bounds") } // delete key if sender { s.send[msgIndex] = "" } else { s.recv[msgIndex] = "" } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (k Keeper) RemoveMessage(ctx sdk.Context, id uint64) {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MessageKey))\n\tstore.Delete(GetMessageIDBytes(id))\n}", "func (c Context) Del(key string) {\n\tdelete(c.data, key)\n}", "func (u *UdMap) Del(key string) { delete(u.Data, key) }", "func (sm safeMap) Delete(key string) {\n\tsm <- commandData{action: REMOVE, key: key}\n}", "func (this *mMap) Del(k string) (result int64, err error) {\n\tkey := this.Key(k)\n\tresult, err = this.Client.Del(key).Result()\n\treturn\n}", "func (db *MemoryStorage) Del(key []byte) error {\n\tdb.data.Delete(common.BytesToHex(key))\n\treturn nil\n}", "func (c *memoryCache) Del(key string) {\n\tdelete(c.data, key)\n}", "func (s *State) RemoveMessageKeys(senderEphemeral ecc.ECPublicKeyable, counter uint32) *message.Keys {\n\t// Get our chain state that has our chain key.\n\tchainAndIndex := s.receiverChain(senderEphemeral)\n\tchainKey := chainAndIndex.ReceiverChain\n\n\t// If the chain is empty, we don't have any message keys.\n\tif chainKey == nil {\n\t\treturn nil\n\t}\n\n\t// Get our message keys from our receiver chain.\n\tmessageKeyList := chainKey.MessageKeys()\n\n\t// Loop through our message keys and compare its index with the\n\t// given counter. When we find a match, remove it from our list.\n\tvar rmIndex int\n\tfor i, messageKey := range messageKeyList {\n\t\tif messageKey.Index() == counter {\n\t\t\trmIndex = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Retrive the message key\n\tmessageKey := chainKey.messageKeys[rmIndex]\n\n\t// Delete the message key from the given position.\n\tchainKey.messageKeys = append(chainKey.messageKeys[:rmIndex], chainKey.messageKeys[rmIndex+1:]...)\n\n\treturn message.NewKeys(\n\t\tmessageKey.CipherKey(),\n\t\tmessageKey.MacKey(),\n\t\tmessageKey.Iv(),\n\t\tmessageKey.Index(),\n\t)\n}", "func DEL(key string) (err error) {\n\tconn := pool.Get()\n\tdefer conn.Close()\n\n\t_, err = conn.Do(\"DEL\", key)\n\treturn\n}", "func MessageKey(authKey Key, plaintextPadded []byte, mode Side) bin.Int128 {\n\t// `msg_key_large = SHA256 (substr (auth_key, 88+x, 32) + plaintext + random_padding);`\n\tmsgKeyLarge := msgKeyLarge(authKey, plaintextPadded, mode)\n\t// `msg_key = substr (msg_key_large, 8, 16);`\n\treturn messageKey(msgKeyLarge)\n}", "func (d Data) Del(key uint32) {\n\td.mutex.Lock()\n\tcount := d.counts[key]\n\tcount -= 1\n\tif count < 1 {\n\t\tdelete(d.data, key)\n\t\tdelete(d.counts, key)\n\t} else {\n\t\td.counts[key] = count\n\t}\n\td.mutex.Unlock()\n}", "func (db *memorydb) Del(key []byte) error {\n\n\tif db.enableBatch {\n\t\tdb.batch.Del(key)\n\t} else {\n\t\tdb.writeLock <- struct{}{}\n\t\tdefer func() {\n\t\t\t<-db.writeLock\n\t\t}()\n\n\t\tdb.sm.Lock()\n\t\tdefer db.sm.Unlock()\n\n\t\tdelete(db.db, string(key))\n\t}\n\n\treturn nil\n}", "func (m *Uint64) Delete(key interface{}) {\n\tm.m.Delete(key)\n}", "func (fi *FastIntegerHashMap) Delete(key uint64) {\n\tif fi.packets.delete(key) {\n\t\tfi.count--\n\t}\n}", "func (n *Notification) DelKey(key string) error {\n\tfor i, value := range n.apikeys {\n\t\tif strings.EqualFold(key, value) {\n\t\t\tcopy(n.apikeys[i:], n.apikeys[i+1:])\n\t\t\tn.apikeys[len(n.apikeys)-1] = \"\"\n\t\t\tn.apikeys = n.apikeys[:len(n.apikeys)-1]\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"Error, key not found\")\n}", "func DecryptMessage(key []byte, message []byte) ([]byte, error) {\n // Key should be 32byte (256bit)\n block, err := aes.NewCipher(key)\n if err != nil {\n return nil, err\n }\n\n aead, err := cipher.NewGCM(block)\n if err != nil {\n return nil, err\n }\n\n nonceSize := aead.NonceSize()\n if len(message) < nonceSize {\n return nil, err\n }\n\n nonce, ciphertext := message[:nonceSize], message[nonceSize:]\n return aead.Open(nil, nonce, ciphertext, nil)\n}", "func (md Metadata) Del(key string) {\n\t// fast path\n\tif _, ok := md[key]; ok {\n\t\tdelete(md, key)\n\t} else {\n\t\t// slow path\n\t\tdelete(md, textproto.CanonicalMIMEHeaderKey(key))\n\t}\n}", "func MsgKey(s string) {\n\tmsgKey = s\n\tgenLevelSlices()\n}", "func (ms *MongoStore) DeleteMessage(id MessageID) error {\n\terr := ms.Session.DB(ms.DatabaseName).C(ms.MessagesCollectionName).RemoveId(id)\n\treturn err\n}", "func (m *Message) Delete() error {\n\treturn globalMessage.Delete(m.ID)\n}", "func (h Header) Del(key string) {\n\ttextproto.MIMEHeader(h).Del(key)\n}", "func (t *Tkeyid) DelFromKey(key string) (id uint, ok bool) {\n\tid, ok = t.keytoid[key]\n\tif ok {\n\t\tdelete(t.idtokey, id)\n\t\tdelete(t.keytoid, key)\n\t}\n\treturn\n}", "func (p *Parser) Del(key string) {\n\tm, err := p.Map()\n\tif err != nil {\n\t\treturn\n\t}\n\tdelete(m, key)\n}", "func (c *SimpleMemoryCache) Del(ctx *Context, next Next) {\n\tdelete(c.data, ctx.Key)\n}", "func Del(key string) error {\n\treturn db.Update(func(txn *badger.Txn) error {\n\t\ttxn.Delete([]byte(key))\n\t\treturn nil\n\t})\n}", "func (m Message) Key() []byte {\n\tstart, end, size := m.keyOffsets()\n\tif size == -1 {\n\t\treturn nil\n\t}\n\treturn m[start+4 : end]\n}", "func (p *metadataService) deleteMessage(clientID string, pid uint16, direction uint8) {\n\tp.deleteMessageWithValidator(clientID, func(msg *base.Message) bool {\n\t\treturn msg.PacketId == pid && msg.Direction == direction\n\t})\n}", "func (h CommonHeader) Del(key string) {\n\tdelete(h, key)\n}", "func (f *Flash) Del(key string) {\n\tif !f.Has(key) {\n\t\treturn\n\t}\n\tif !f.changed {\n\t\tf.changed = true\n\t}\n\tf.v.Del(key)\n}", "func (h *hashMap) Del(strKey string) {\n\tkey := GetHash(strKey)\n\tbucket := h.getBucket(key)\n\tbucket.remove(Regularkey(key))\n}", "func deletedKey(key string) string {\n\treturn key + \":deleted\"\n}", "func (service *service) decrKey(key string) (int64, error) {\n\treturn service.client.Decr(key).Result()\n}", "func (e DeleteMessageRequestValidationError) Key() bool { return e.key }", "func handleMsgDelete(ctx sdk.Context, k Keeper, msg *MsgDelete) (*sdk.Result, error) {\n\tif err := k.Delete(ctx, msg); err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx.EventManager().EmitEvent(\n\t\tsdk.NewEvent(\n\t\t\tsdk.EventTypeMessage,\n\t\t\tsdk.NewAttribute(sdk.AttributeKeyModule, ModuleName),\n\t\t\tsdk.NewAttribute(sdk.AttributeKeySender, msg.Owner.String()),\n\t\t),\n\t)\n\n\treturn &sdk.Result{Events: ctx.EventManager().Events()}, nil\n}", "func (h *RequestHeader) Del(key string) {\n\tk := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing)\n\th.del(k)\n}", "func (s *service) Del(key string) error {\n\treturn s.redis.Del(key).Err()\n}", "func (o *AuthMessage) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no AuthMessage provided for delete\")\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), authMessagePrimaryKeyMapping)\n\tsql := \"DELETE FROM `auth_message` WHERE `id`=?\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from auth_message\")\n\t}\n\n\treturn nil\n}", "func ExampleClient_DeleteMessage() {\n\tclient := sqwiggle.NewClient(\"YOUR-API-KEY\")\n\n\tmessageID := 48914\n\terr := client.DeleteMessage(messageID)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (m XmlToMap) Del(key string) {\n\tdelete(m, key)\n}", "func DeleteMessage(clientId string, mid uint16, direction MessageDirection) error {\n\tmeta := broker.GetService(ServiceName).(*MetadataService)\n\treturn meta.deleteMessage(clientId, mid, direction)\n}", "func (p Parameters) Del(key string) {\n\tdelete(p, key)\n}", "func DelKey(filename, JSONpath string) error {\n\tjf, err := NewFile(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn jf.DelKey(JSONpath)\n}", "func (s *server) Del(key string) {\n\tres := make(chan bool)\n\ts.ops <- func() {\n\t\tdelete(s.store, key)\n\t\tres <- true\n\t}\n\t<-res\n}", "func (rc *RedisClient) Del(key string) (int64, error) {\n\tconn := rc.pool.Get()\n\tdefer conn.Close()\n\treply, errDo := conn.Do(\"DEL\", key)\n\tif errDo == nil && reply == nil {\n\t\treturn 0, nil\n\t}\n\tval, err := redis.Int64(reply, errDo)\n\treturn val, err\n}", "func (m *MemoryStorer) Del(key string) error {\n\tm.mut.Lock()\n\tdelete(m.sessions, key)\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (keyDB *KeyDB) DelPrivateUID(msg *uid.Message) error {\n\tif _, err := keyDB.delPrivateUIDQuery.Exec(msg.JSON()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func DeleteMessage() {\n\n}", "func (c *cache) Del(key string) error {\n\terr := c.cacheConn.Del(key).Err()\n\tif err != nil {\n\t\tlogger.Log().Error(\"Error while deleting key\", zap.String(\"key\", key), zap.Error(err))\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ms *MemStore) DelPrivSessionKey(hash string) error {\n\tsk, ok := ms.sessionKeys[hash]\n\tif !ok {\n\t\treturn nil\n\t}\n\tsk.privKey = \"\"\n\treturn nil\n}", "func messageKey(messageKeyLarge []byte) bin.Int128 {\n\tvar v bin.Int128\n\tb := messageKeyLarge[8 : 16+8]\n\tcopy(v[:len(b)], b)\n\treturn v\n}", "func (b *OGame) DeleteMessage(msgID int64) error {\n\treturn b.WithPriority(taskRunner.Normal).DeleteMessage(msgID)\n}", "func (fb *FlatBatch) Delete(key []byte) error { panic(\"not supported\") }", "func (db *Database) DeleteMessageRead(messageID mail.ID) error {\n\treturn db.db.Update(func(txn *badger.Txn) error {\n\t\treturn txn.Delete(db.messageReadKey(messageID))\n\t})\n}", "func (h *ResponseHeader) Del(key string) {\n\tk := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing)\n\th.del(k)\n}", "func (db *Database) DeleteMessage(id int) error {\n\t_, err := db.db.Exec(`\n\t\tDELETE FROM melodious.messages WHERE id=$1;\n\t`, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Delete(key string){\n n := keyValue[key]\n n.val = \"\"\n n.hash = \"\"\n keyValue[key] = n\n}", "func Del(kb KeyBucket) {\n\terr := kb.B.Del(kb.Key.Key)\n\tif err != nil {\n\t\tlog.Warnf(\"%v\\n\", err)\n\t}\n\tatomic.AddUint64(&donecounter, 1)\n}", "func (e *EntityChat) Delete(ctx context.Context) {\n\tmemKey := e.memcacheKey()\n\tif err := memcache.Delete(ctx, memKey); err != nil {\n\t\tlog.Errorf(ctx, \"failed to delete memcache key %s: %v\", memKey, err)\n\t}\n\tkey := e.datastoreKey(ctx)\n\tif err := datastore.Delete(ctx, key); err != nil {\n\t\tlog.Errorf(ctx, \"failed to delete datastore key %v: %v\", key, err)\n\t}\n}", "func (s *RedisSession) DelKey(key string) (int64, error) {\r\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(time.Second*5))\r\n\tdefer cancel()\r\n\r\n\tc, err := s.getClient()\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\tcnt, err := c.Del(ctx, []string{s.config.KeyPrefix + key}...).Result()\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\treturn cnt, nil\r\n}", "func DeleteMessage(ctx *context.Context, session *context.Session, w http.ResponseWriter, r *http.Request, vars map[string]string) {\n\terr := ctx.MessageService.DeleteMessage(vars[\"id\"], session.CurrentUser)\n\n\tif err != nil {\n\t\thandleError(w, err)\n\t\treturn\n\t}\n}", "func (s *svcManager) DeleteMessage(log log.T, update *UpdateDetail) (err error) {\n\tvar svc messageService.Service\n\n\tif svc, err = getMsgSvc(s.context); err != nil {\n\t\treturn fmt.Errorf(\"could not load message service %v\", err)\n\t}\n\n\treturn svc.DeleteMessage(log, update.MessageID)\n}", "func (d *DirectAddress) Delete(key int) {\n\tif err := d.validateKey(key); err != nil {\n\t\treturn\n\t}\n\td.array[key-d.uMin] = nil\n}", "func (h *descriptorHandler) delete(key string, value proto.Message, metadata kvs.Metadata) error {\n\tif h.descriptor == nil {\n\t\treturn nil\n\t}\n\tif h.descriptor.Delete == nil {\n\t\treturn kvs.ErrUnimplementedDelete\n\t}\n\tdefer trackDescMethod(h.descriptor.Name, \"Delete\")()\n\terr := h.descriptor.Delete(key, value, metadata)\n\tif nsErr := checkNetNs(); nsErr != nil {\n\t\terr = nsErr\n\t}\n\treturn err\n}", "func MsgKey(R, P *btcec.PublicKey, m []byte) *btcec.PublicKey {\n\th := Hash(R.SerializeCompressed(), m)\n\th = new(big.Int).Mod(new(big.Int).Neg(h), btcec.S256().N)\n\thP := new(btcec.PublicKey)\n\thP.X, hP.Y = btcec.S256().ScalarMult(P.X, P.Y, h.Bytes())\n\treturn SumPubs(R, hP)\n}", "func (b *Bucket) Del(key string) {\n\tb.cLock.Lock()\n\tif _, ok := b.chs[key]; ok {\n\t\tdelete(b.chs, key)\n\t}\n\tb.cLock.Unlock()\n}", "func (p *metadataService) deleteMessageWithValidator(clientID string, validator func(*base.Message) bool) {\n}", "func (s *MemStore) Delete(key interface{}) error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tdelete(s.data, key)\n\treturn nil\n}", "func (_ECC *ECCTransactor) ProposeRemoveKey(opts *bind.TransactOpts, key common.Address, keyType uint8) (*types.Transaction, error) {\n\treturn _ECC.contract.Transact(opts, \"proposeRemoveKey\", key, keyType)\n}", "func (db *MemoryCache) Delete(key []byte) error {\n\tdb.lock.Lock()\n\tdefer db.lock.Unlock()\n\n\tif db.db == nil {\n\t\treturn NewMemCacheError(MemCacheClosedError, nil)\n\t}\n\tkeyStr := base58.Base58Check{}.Encode(key, 0x0)\n\tdelete(db.db, keyStr)\n\treturn nil\n}", "func (client *MemcachedClient4T) Delete(key string) error {\n\treturn client.parse.Deletion(key)\n}", "func (jf *JFile) DelKey(JSONpath string) error {\n\terr := jf.rootnode.DelKey(JSONpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Use the correct JSON function, depending on the pretty parameter\n\tJSON := jf.rootnode.JSON\n\tif jf.pretty {\n\t\tJSON = jf.rootnode.PrettyJSON\n\t}\n\tdata, err := JSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn jf.Write(data)\n}", "func ( handle * MemcacheClient) Delete(key string ) error {\n\n\tif len(key) <= 0 {\n\t\tlog.Printf(\"Error: key passed is blank blank\\n\")\n\t\treturn fmt.Errorf(\"key Passed is blank\")\n\t}\n\t\n\terr := handle.mc.Delete(key)\n\tif err != nil{\n\t\tlog.Printf(\"Error: unable to delete key:%s:%s\\n\",key,err.Error())\n\t\treturn err\n\t}\n\tlog.Printf(\"Info:Key:%s deleted successfully\\n\",key)\n\treturn nil\n}", "func (m *MockCache) Del(key string) error {\n\treturn nil\n}", "func (s *Basememcached_protocolListener) ExitKey(ctx *KeyContext) {}", "func (c *RedisCache) Del(ctx context.Context, key string) error {\n\treturn c.client.Del(ctx, key).Err()\n}", "func (db *FlatDatabase) Delete(key []byte) error { panic(\"not supported\") }", "func (p *MemDB) Delete(key []byte) {\n\tp.Put(key, nil)\n}", "func (e *endpointMap) remove(key device.MultiDeviceKey) {\n\tdelete(e.m, key)\n}", "func (e DeleteMessageResponseValidationError) Key() bool { return e.key }", "func Delete(conn redis.Conn, key string) error {\n\t_, err := conn.Do(\"DEL\", key)\n\treturn err\n}", "func (o *AuthMessage) DeleteP(exec boil.Executor) {\n\tif err := o.Delete(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (cb *cachedBatch) Delete(namespace string, key []byte, errorMessage string) {\n\tcb.lock.Lock()\n\tdefer cb.lock.Unlock()\n\th := cb.hash(namespace, key)\n\tcb.touchKey(h)\n\tcb.currentCache().Evict(&h)\n\tcb.kvStoreBatch.batch(Delete, namespace, key, nil, errorMessage)\n}", "func (tx *transaction) deleteKey(key []byte, notifyIterators bool) {\n\t// Remove the key from the list of pendings keys to be written on\n\t// transaction commit if needed.\n\ttx.pendingKeys.Delete(key)\n\n\t// Add the key to the list to be deleted on transaction\tcommit.\n\ttx.pendingRemove.Put(key, nil)\n\n\t// Notify the active iterators about the change if the flag is set.\n\tif notifyIterators {\n\t\ttx.notifyActiveIters()\n\t}\n}", "func DeleteMsg(username string) {\n\tDB.Exec(\"delete from messages where user_id = ?;\", username)\n}", "func (ms *MemStore) GetMessageKey(\n\tsessionKey string,\n\tsender bool,\n\tmsgIndex uint64,\n) (*[64]byte, error) {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn nil, log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\tif msgIndex >= uint64(len(s.send)) {\n\t\treturn nil, log.Error(\"memstore: message index out of bounds\")\n\t}\n\tvar key string\n\tvar party string\n\tif sender {\n\t\tkey = s.send[msgIndex]\n\t\tparty = \"sender\"\n\t} else {\n\t\tkey = s.recv[msgIndex]\n\t\tparty = \"recipient\"\n\t}\n\t// make sure key wasn't used yet\n\tif key == \"\" {\n\t\treturn nil, log.Error(session.ErrMessageKeyUsed)\n\t}\n\t// decode key\n\tvar messageKey [64]byte\n\tk, err := base64.Decode(key)\n\tif err != nil {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: cannot decode %s key for %s\", party,\n\t\t\t\tsessionKey)\n\t}\n\tif copy(messageKey[:], k) != 64 {\n\t\treturn nil,\n\t\t\tlog.Errorf(\"memstore: %s key for %s has wrong length\", party,\n\t\t\t\tsessionKey)\n\t}\n\treturn &messageKey, nil\n}", "func (obj *MessengerFileCipher) delete() {\n\tC.vssq_messenger_file_cipher_delete(obj.cCtx)\n}", "func (h *RequestHeader) DelBytes(key []byte) {\n\th.bufKV.key = append(h.bufKV.key[:0], key...)\n\tnormalizeHeaderKey(h.bufKV.key, h.disableNormalizing)\n\th.del(h.bufKV.key)\n}", "func (txn *Txn) Del(dbi DBI, key, val []byte) error {\n\tckey := Wrap(key)\n\tif val == nil {\n\t\tret := C.mdb_del(txn._txn, C.MDB_dbi(dbi), (*C.MDB_val)(ckey), nil)\n\t\treturn errno(ret)\n\t}\n\tcval := Wrap(val)\n\tret := C.mdb_del(txn._txn, C.MDB_dbi(dbi), (*C.MDB_val)(ckey), (*C.MDB_val)(cval))\n\treturn errno(ret)\n}", "func Delete(s *discordgo.Session, m *discordgo.MessageCreate) {\n}", "func (ms memstore) Delete(key string) {\n\tms.lock.Lock()\n\tdelete(ms.store, key)\n\tms.lock.Unlock()\n}", "func (sess Session) Del(key string) {\n\tdelete(sess, key)\n}", "func (s *MemorySession) Delete(key string) error {\n\tdelete(s.data, key)\n\treturn nil\n}", "func (c Cipher) decryptMessage(k AuthKey, encrypted *EncryptedMessage) ([]byte, error) {\n\tif k.ID != encrypted.AuthKeyID {\n\t\treturn nil, errors.New(\"unknown auth key id\")\n\t}\n\tif len(encrypted.EncryptedData)%16 != 0 {\n\t\treturn nil, errors.New(\"invalid encrypted data padding\")\n\t}\n\n\tkey, iv := Keys(k.Value, encrypted.MsgKey, c.encryptSide.DecryptSide())\n\tcipher, err := aes.NewCipher(key[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tplaintext := make([]byte, len(encrypted.EncryptedData))\n\tige.DecryptBlocks(cipher, iv[:], plaintext, encrypted.EncryptedData)\n\n\treturn plaintext, nil\n}", "func (h Headers) Del(key string) {\n\tdelete(h, strings.ToLower(key))\n}", "func (d *Dam) Delete(key Marshallable) error {\n\tk, err := hash(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.freeze.Lock()\n\td.mutex.Lock()\n\tdelete(d.storage, k)\n\td.mutex.Unlock()\n\td.freeze.Unlock()\n\treturn nil\n}", "func (m *Memory) Delete(_ context.Context, key string) error {\n\tm.mx.Lock()\n\tdefer m.mx.Unlock()\n\tdelete(m.storage, key)\n\n\treturn nil\n}", "func (c *Context) Delete(key string) {\n\tdelete(c.Data, key)\n}", "func (s *API) DeleteMessage(w http.ResponseWriter, req *http.Request) {\n\tlog.Debug(\"DeleteMessage\")\n\tw.WriteHeader(http.StatusNotImplemented)\n}", "func (h *HBaseClient) Del(key int64) (err error) {\n\tvar (\n\t\ti int\n\t\tk = make([]byte, 8)\n\t\tks = [Size]byte{}\n\t\tc interface{}\n\t)\n\tbinary.BigEndian.PutUint64(k, uint64(key))\n\tks = sha1.Sum(k)\n\tif c, err = hbasePool.Get(); err != nil {\n\t\tlog.Errorf(\"hbasePool.Get() error(%v)\", err)\n\t\treturn\n\t}\n\tdefer hbasePool.Put(c, false)\n\tfor i = 0; i < retryCount; i++ {\n\t\tif err = c.(hbasethrift.THBaseService).DeleteSingle(filemeta.HbaseTable, &hbasethrift.TDelete{\n\t\t\tRow: ks[:],\n\t\t\tColumns: []*hbasethrift.TColumn{\n\t\t\t\t&hbasethrift.TColumn{\n\t\t\t\t\tFamily: filemeta.HbaseFamilyBasic,\n\t\t\t\t\tQualifier: filemeta.HbaseColumnVid,\n\t\t\t\t},\n\t\t\t\t&hbasethrift.TColumn{\n\t\t\t\t\tFamily: filemeta.HbaseFamilyBasic,\n\t\t\t\t\tQualifier: filemeta.HbaseColumnCookie,\n\t\t\t\t},\n\t\t\t},\n\t\t}); err == nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(retrySleep)\n\t}\n\tif err != nil {\n\t\tlog.Errorf(\"client.DeleteSingle error(%v)\", err)\n\t}\n\treturn\n}", "func (st *MemSessionStore) Delete(key interface{}) error {\n\treturn (*session.MemSessionStore)(st).Delete(context.Background(), key)\n}" ]
[ "0.6409165", "0.62833005", "0.62153774", "0.6165137", "0.6157906", "0.61292326", "0.60809404", "0.60754925", "0.60167915", "0.5963728", "0.5958929", "0.5957783", "0.5909399", "0.59034777", "0.58986545", "0.5890563", "0.5835201", "0.58141613", "0.5803102", "0.57944787", "0.57813394", "0.57808226", "0.5774079", "0.5773825", "0.5769236", "0.57629704", "0.5754254", "0.5748964", "0.57376426", "0.5735182", "0.5688034", "0.5686557", "0.56840396", "0.56823754", "0.56787974", "0.56674725", "0.5656569", "0.5655016", "0.56467783", "0.5630647", "0.56245637", "0.56191534", "0.5611942", "0.5610459", "0.56005347", "0.5595387", "0.5592902", "0.5591697", "0.5572802", "0.5571419", "0.5564263", "0.5544895", "0.5527644", "0.55259717", "0.55212915", "0.551812", "0.5514987", "0.5510157", "0.55089104", "0.55045706", "0.5504144", "0.5503181", "0.5501915", "0.5492139", "0.5491421", "0.5470766", "0.5466317", "0.54602766", "0.5458798", "0.54507214", "0.5449142", "0.54451156", "0.5443186", "0.5437209", "0.5431242", "0.5424897", "0.5416358", "0.5413509", "0.5412015", "0.5409874", "0.54089063", "0.5406855", "0.5403941", "0.54012823", "0.53973204", "0.53871214", "0.53828496", "0.5378081", "0.5375643", "0.537222", "0.5368236", "0.5366964", "0.5366716", "0.53658646", "0.536447", "0.535571", "0.5353002", "0.53462756", "0.5340865", "0.5338108" ]
0.805607
0
AddSessionKey implemented in memory.
AddSessionKey реализован в памяти.
func (ms *MemStore) AddSessionKey( hash, json, privKey string, cleanupTime uint64, ) error { ms.sessionKeys[hash] = &sessionKey{ json: json, privKey: privKey, cleanupTime: cleanupTime, } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Session) Add(key string, value interface{}) error {\n\tbts, err := json.Marshal(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.values[key] = string(bts)\n\n\treturn nil\n}", "func addSession(user *User) error {\n\trandBytes, err := scrypt.GenerateRandomBytes(32)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsessionId := string(randBytes)\n\t// TODO: store more than the username\n\terr = rd.Set(\"session:\"+sessionId, user.Username, sessionTimeout).Err()\n\tif err != nil {\n\t\treturn err\n\t}\n\tuser.sessionId = url.QueryEscape(sessionId)\n\treturn nil\n}", "func (b *BigIP) AddKey(config *Key) error {\n\treturn b.post(config, uriSys, uriCrypto, uriKey)\n}", "func (a *LocalKeyAgent) addKey(key *Key) error {\n\tif key == nil {\n\t\treturn trace.BadParameter(\"key is nil\")\n\t}\n\tif key.ProxyHost == \"\" {\n\t\tkey.ProxyHost = a.proxyHost\n\t}\n\tif key.Username == \"\" {\n\t\tkey.Username = a.username\n\t}\n\n\t// In order to prevent unrelated key data to be left over after the new\n\t// key is added, delete any already stored key with the same index if their\n\t// RSA private keys do not match.\n\tstoredKey, err := a.keyStore.GetKey(key.KeyIndex)\n\tif err != nil {\n\t\tif !trace.IsNotFound(err) {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t} else {\n\t\tif subtle.ConstantTimeCompare(storedKey.Priv, key.Priv) == 0 {\n\t\t\ta.log.Debugf(\"Deleting obsolete stored key with index %+v.\", storedKey.KeyIndex)\n\t\t\tif err := a.keyStore.DeleteKey(storedKey.KeyIndex); err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Save the new key to the keystore (usually into ~/.tsh).\n\tif err := a.keyStore.AddKey(key); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\treturn nil\n}", "func (gorilla Gorilla) Add(w http.ResponseWriter, req *http.Request, key string, value interface{}) error {\n\tdefer gorilla.saveSession(w, req)\n\n\tsession, err := gorilla.getSession(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif str, ok := value.(string); ok {\n\t\tsession.Values[key] = str\n\t} else {\n\t\tresult, _ := json.Marshal(value)\n\t\tsession.Values[key] = string(result)\n\t}\n\n\treturn nil\n}", "func (i service) AddKey(ctx context.Context, key id.KeyDID) error {\n\tDID, err := NewDIDFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontract, opts, err := i.prepareTransaction(ctx, DID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"Add key to identity contract %s\", DID.ToAddress().String())\n\ttxID, done, err := i.txManager.ExecuteWithinTX(context.Background(), DID, transactions.NilTxID(), \"Check TX for add key\",\n\t\ti.ethereumTX(opts, contract.AddKey, key.GetKey(), key.GetPurpose(), key.GetType()))\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(\"add key TX failed: txID:%s\", txID.String())\n\n\t}\n\treturn nil\n\n}", "func (s *SessionStore) Add(session *Session) {\n\tfmt.Println(session.AccessToken)\n\n\ts.atM.Lock()\n\ts.accessTokens[session.AccessToken] = session\n\ts.atM.Unlock()\n\n\ts.rtM.Lock()\n\ts.refreshTokens[session.RefreshToken] = session\n\ts.rtM.Unlock()\n}", "func (s *SharemeService) Add(c *gae.Context, session *Session, key string) (stat Share) {\n\tstat = s.Stat(c, key)\n\tif stat.IsError() {\n\t\treturn\n\t}\n\tsession.Set(fmt.Sprintf(\"%s%s\", KeySessionPrefix, key), stat.Name)\n\treturn\n}", "func (ctx *MqttSrvContext) AddSession(fd int, s interface{}) {\n\tctx.Clock.Lock()\n\tctx.Connections[fd] = s\n\tctx.Clock.Unlock()\n}", "func addSession(s *sessions.Session, triggerEvent bool) {\n\t// Remove the session if closed from the map.\n\ts.OnceClose(removeSession)\n\n\t// Lock the mutex.\n\tactiveSessionsMutex.Lock()\n\tdefer activeSessionsMutex.Unlock()\n\n\t// Add the session to the map.\n\tactiveSessions[s.SessionID()] = s\n\n\tif triggerEvent {\n\t\t// Trigger the event.\n\t\ttriggerOnNewSession(s)\n\t}\n}", "func (ms *MemStore) SessionKey() string {\n\treturn ms.sessionKey\n}", "func (ks *KeyStore) Add(privateKey *rsa.PrivateKey, kid string) {\n\tks.mu.Lock()\n\tdefer ks.mu.Unlock()\n\n\tks.store[kid] = privateKey\n}", "func (s ServiceClientWrapper) AddKey(name string, password string) (addr string, mnemonic string, err error) {\n\treturn s.ServiceClient.Insert(name, password)\n}", "func (a *Account) SessionKey() *big.Int {\n\tif a.sessionKey == nil {\n\t\ta.sessionKey, _ = new(big.Int).SetString(a.SessionKeyStr, 16)\n\t}\n\n\treturn a.sessionKey\n}", "func AddKey(s Server, password string, template *Key) (*Key, error) {\n\t// fill meta data about key\n\tnewkey := &Key{\n\t\tCreated: time.Now(),\n\t\tKDF: \"scrypt\",\n\t\tN: scryptN,\n\t\tR: scryptR,\n\t\tP: scryptP,\n\t}\n\n\thn, err := os.Hostname()\n\tif err == nil {\n\t\tnewkey.Hostname = hn\n\t}\n\n\tusr, err := user.Current()\n\tif err == nil {\n\t\tnewkey.Username = usr.Username\n\t}\n\n\t// generate random salt\n\tnewkey.Salt = make([]byte, scryptSaltsize)\n\tn, err := rand.Read(newkey.Salt)\n\tif n != scryptSaltsize || err != nil {\n\t\tpanic(\"unable to read enough random bytes for salt\")\n\t}\n\n\t// call scrypt() to derive user key\n\tnewkey.user, err = newkey.scrypt(password)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif template == nil {\n\t\t// generate new random master keys\n\t\tnewkey.master, err = newkey.newKeys()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\t// copy master keys from old key\n\t\tnewkey.master = template.master\n\t}\n\n\t// encrypt master keys (as json) with user key\n\tbuf, err := json.Marshal(newkey.master)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewkey.Data = GetChunkBuf(\"key\")\n\tn, err = newkey.EncryptUser(newkey.Data, buf)\n\tnewkey.Data = newkey.Data[:n]\n\n\t// dump as json\n\tbuf, err = json.Marshal(newkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// store in repository and return\n\tid, err := s.Create(backend.Key, buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnewkey.id = id\n\n\tFreeChunkBuf(\"key\", newkey.Data)\n\n\treturn newkey, nil\n}", "func AddKey(key * Key) {\n\tKeys = append(Keys, *key)\n\tSaveDatabase(Keys, \"keys\")\n}", "func StoreSessionAPIKey(session *sessions.Session, apiKey string) {\n\tif session == nil || len(apiKey) == 0 {\n\t\treturn\n\t}\n\tsession.Values[sessionKeyAPIKey] = apiKey\n}", "func (authcl *Client) AddKey(key, description string, temp bool) error {\n\terr := authcl.LoadToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewkey := gogs.PublicKey{Key: key, Title: description}\n\taddress := fmt.Sprintf(\"/api/v1/user/keys\")\n\tres, err := authcl.Post(address, newkey)\n\tif err != nil {\n\t\treturn err\n\t} else if res.StatusCode != http.StatusCreated {\n\t\treturn fmt.Errorf(\"[Add key] Failed. Server returned %s\", res.Status)\n\t}\n\tweb.CloseRes(res.Body)\n\treturn nil\n}", "func (be InmemBackend) Add(key []byte, value []byte) error {\n\treturn be.Put(key, value, false, false)\n}", "func (a *LocalKeyAgent) AddKey(key *Key) (*agent.AddedKey, error) {\n\tif err := a.addKey(key); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// Load key into the teleport agent and system agent.\n\treturn a.LoadKey(*key)\n}", "func (k *Keychain) AddKey(newKey string) error {\n\tkey, err := hex.DecodeString(newKey)\n\tif err != nil {\n\t\treturn ErrInvalidKey\n\t}\n\tk.pushKey(key)\n\treturn nil\n}", "func AddKey(sshFilePath string) error {\n\tconfigRepository := config.NewConfigRepository(func(error) {})\n\tuserRepo := api.NewUserRepository(configRepository, net.NewCloudControllerGateway(configRepository))\n\n\tuser, err := userRepo.GetUser(configRepository.Id())\n\tif err != nil {\n\t\treturn err\n\t}\n\tpublic, name, err := getKey(sshFilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkeyParams := api.KeyParams{\n\t\tPublic: public,\n\t\tName: name,\n\t}\n\t_, err = user.UploadKey(keyParams)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Key already exists\")\n\t}\n\n\tfmt.Println(\"Upload key successfully\")\n\treturn err\n}", "func KeyAdd(organizationId uint, clusterId uint) (string, error) {\n\tlog.Info(\"Generate and store SSH key \")\n\n\tsshKey, err := KeyGenerator()\n\tif err != nil {\n\t\tlog.Errorf(\"KeyGenerator failed reason: %s\", err.Error())\n\t\treturn \"\", err\n\t}\n\n\tdb := model.GetDB()\n\tcluster := model.ClusterModel{ID: clusterId}\n\tif err = db.First(&cluster).Error; err != nil {\n\t\tlog.Errorf(\"Cluster with id=% not found: %s\", cluster.ID, err.Error())\n\t\treturn \"\", err\n\t}\n\tsecretId, err := KeyStore(sshKey, organizationId, cluster.Name)\n\tif err != nil {\n\t\tlog.Errorf(\"KeyStore failed reason: %s\", err.Error())\n\t\treturn \"\", err\n\t}\n\treturn secretId, nil\n}", "func KeySession(priv, pub []byte) (*Session, bool) {\n\tprivKey, err := public.UnmarshalPrivate(priv)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\tdefer privKey.Zero()\n\n\tpubKey, err := public.UnmarshalPublic(pub)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\n\tshared := public.KeyExchange(privKey, pubKey)\n\treturn &Session{shared: shared}, true\n}", "func GenerateSessionKey(user_name string, j aqua.Aide) (token string, err error) {\n\tvar (\n\t\tConn *gorm.DB\n\t\t//token string\n\t\tsessionData []interface{}\n\t)\n\tif Conn, err = dbConn(); err == nil {\n\t\tif token, err = crypt.GenerateRandomString(32); err == nil {\n\t\t\texp_time := time.Now().Add(time.Minute * 30)\n\t\t\tinsertSession := `insert into user_session (\n\t\t\tsession_key, fk_user_name,\n\t\t\tlocation, expiry_time) values(?, ?, ?, ? )`\n\t\t\tsessionData = append(sessionData, token, user_name, \"bengaluru\", exp_time)\n\t\t\tif err = Conn.Debug().Exec(insertSession, sessionData...).Error; err == nil {\n\t\t\t\tj.Response.Header().Add(\"session-key\", token)\n\t\t\t\tj.Response.Header().Add(\"connection\", \"keep-alive\")\n\t\t\t\tfmt.Println(\"err\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"session not generated\")\n\t\t}\n\t} else {\n\t\tfmt.Println(\"connection not established\")\n\t}\n\treturn\n}", "func (r *extendedKeyring) Add(key agent.AddedKey) error {\n\t// Figure out what key type we're trying to inject\n\tswitch key.PrivateKey.(type) {\n\tcase *rsa.PrivateKey:\n\t\t// Load the injected key\n\t\tdata := &pem.Block{\n\t\t\tType: \"RSA PRIVATE KEY\",\n\t\t\tBytes: x509.MarshalPKCS1PrivateKey(key.PrivateKey.(*rsa.PrivateKey)),\n\t\t}\n\n\t\t// Ensure the key doesn't exist\n\t\tos.Remove(r.targetKeyLocation)\n\n\t\t// Write the key out to disk\n\t\tvar file, err = os.Create(r.targetKeyLocation)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"\\nssh_agent_download: Could not create key file\", err.Error())\n\t\t}\n\t\tdefer file.Close() // Ensure we close the file later\n\n\t\t// Secure before writing\n\t\t// Note: Technically someone could write in here before we do this\n\t\tos.Chmod(r.targetKeyLocation, 0400)\n\n\t\t// Dump the (un-encrypted) key into this file\n\t\tpem.Encode(file, data)\n\n\t\t// Let the keyboard monkey know\n\t\tfmt.Printf(\"ssh_agent_download: saved key to %s\\n\", r.targetKeyLocation)\n\n\t// Let the user know this won't work\n\tdefault:\n\t\tlog.Fatal(\"ssh_agent_download: unsupported key type %T\", key.PrivateKey)\n\t}\n\n\treturn nil\n}", "func (s * SortedBySizeKeys) AddKey(key Key) {\n\tif _, ok := keysMap[key]; ok { return }\n\tkeysMap[key] = true;\n\t*s = append(*s, key)\n}", "func (n *Notification) AddKey(key string) error {\n\n\tif len(key) != 40 {\n\t\treturn errors.New(\"Error, Apikey must be 40 characters long.\")\n\t}\n\n\tn.apikeys = append(n.apikeys, key)\n\treturn nil\n}", "func (h *WebDriverHub) AddSession(id string, session *WebDriverSession) {\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\tif h.sessions == nil {\n\t\th.sessions = map[string]*WebDriverSession{}\n\t}\n\th.sessions[id] = session\n}", "func SessionStoreKey() string {\n\treturn app.SessionStoreKey\n}", "func (keyRing *KeyRing) EncryptSessionKey(sessionSplit *SymmetricKey) ([]byte, error) {\n\toutbuf := &bytes.Buffer{}\n\n\tcf := sessionSplit.GetCipherFunc()\n\n\tvar pub *packet.PublicKey\n\tfor _, e := range keyRing.GetEntities() {\n\t\tif encryptionKey, ok := e.getRawEntity().EncryptionKey(pgp.getNow()); ok {\n\t\t\tpub = encryptionKey.PublicKey\n\t\t\tbreak\n\t\t}\n\t}\n\tif pub == nil {\n\t\treturn nil, errors.New(\"cannot set key: no public key available\")\n\t}\n\n\tif err := packet.SerializeEncryptedKey(outbuf, pub, cf, sessionSplit.Key, nil); err != nil {\n\t\terr = fmt.Errorf(\"gopenpgp: cannot set key: %v\", err)\n\t\treturn nil, err\n\t}\n\treturn outbuf.Bytes(), nil\n}", "func (trust *RufusSigner) addKey(k *data.PrivateKey) error {\n\treturn errors.New(\"Not implemented: RufusSigner.addKey\")\n}", "func addSession(context *echo.Context, id uint, classification int, username string) error {\n\tsess := getSession(\"authorization\", context)\n\tsess.Values[\"user_id\"] = id\n\tsess.Values[\"classification\"] = classification\n\tsess.Values[\"username\"] = username\n\tif classification == 1 {\n\t\tsess.Values[\"stringClassification\"] = \"الوزير\"\n\t} else if classification == 2 {\n\t\tsess.Values[\"stringClassification\"] = \"متابع\"\n\t} else {\n\t\tsess.Values[\"stringClassification\"] = \"قائم به\"\n\t}\n\n\treturn sess.Save((*context).Request(), (*context).Response())\n}", "func (b *BaseHandler) SetSession(key interface{}, value interface{}) {\n\tb.sessionStore.Set(b, key, value)\n}", "func (ctx *RequestContext) PutSession(key string, value interface{}) {\n\tvars := ctx.token.Claims[\"vars\"].(map[string]interface{})\n\tvars[key] = value\n}", "func (h *Hub) AddSession(s *Session) {\n\th.register <- HubRegistration{event: \"add\", session: s}\n}", "func (s *LunaKeyStore) AddKey(keyInfo trustmanager.KeyInfo, privKey data.PrivateKey) error {\n\n\tvar (\n\t\tecdsaPublicKey *data.ECDSAPublicKey\n\t\trsaPublicKey *data.RSAPublicKey\n\t\terr error\n\t)\n\n\tlogrus.Debugf(\"LunaKeyStore.AddKey\")\n\n\trole := keyInfo.Role\n\n\tgeneratateRootKeyOnly := strings.ToLower(os.Getenv(\"NOTARY_LUNA_GENERATE_ROOT_KEYS_ONLY\")) == \"true\"\n\n\tif generatateRootKeyOnly && role != data.CanonicalRootRole {\n\t\treturn errors.New(\"Can only generate root keys in generate root keys only mode.\")\n\t}\n\n\talg := privKey.Algorithm()\n\n\tif alg == data.ECDSAKey {\n\t\tecdsaPublicKey, err = getECDSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting ECDSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else if alg == data.RSAKey {\n\t\trsaPublicKey, err = getRSAPublicKeyFromPrivateKey(privKey)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Error getting RSA Public key: %s\", err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn errors.New(\"Invalid key type.\")\n\t}\n\n\tp, session, c, err := SetupLuna(true, s.passRetriever)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer CleanupLuna(p, session, c)\n\tgun := keyInfo.Gun\n\n\tif alg == data.ECDSAKey {\n\t\tlunaPrivateKey, err := generateECDSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t//Store the public key value for the generated key in the public key for the added key.\n\t\tlunaECDSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.ECDSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\tecdsaPublicKey.Value = lunaECDSAPublicKey.Value\n\t\tecdsaPublicKey.ResetID()\n\t} else if alg == data.RSAKey {\n\t\tlunaPrivateKey, err := generateRSAKey(p, session, gun, s.passRetriever, role)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlunaRSAPublicKey, ok := lunaPrivateKey.PublicKey.(*data.RSAPublicKey)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Unable to get PublicKey from luna private key.\")\n\t\t}\n\t\trsaPublicKey.Value = lunaRSAPublicKey.Value\n\t\trsaPublicKey.ResetID()\n\t}\n\tfmt.Printf(\"Luna: Generated %s key: %s\\n\", role, privKey.ID())\n\n\treturn nil\n}", "func (s *Basememcached_protocolListener) EnterKey(ctx *KeyContext) {}", "func (b *Buffer) Add(key string) {\n\tb.In <- key\n}", "func (r *KeyRing) AddKey(k *Key) {\n\tif r.isDuplicate(k.entity) {\n\t\treturn\n\t}\n\tr.entities = append(r.entities, k.entity)\n}", "func (c *Connect) AddKeySshAgent(sshAgent interface{}, key interface{}) {\n\taddedKey := agent.AddedKey{\n\t\tPrivateKey: key,\n\t\tConfirmBeforeUse: true,\n\t\tLifetimeSecs: 3000,\n\t}\n\n\tswitch ag := sshAgent.(type) {\n\tcase agent.Agent:\n\t\tag.Add(addedKey)\n\tcase agent.ExtendedAgent:\n\t\tag.Add(addedKey)\n\t}\n}", "func (w *Whisper) AddSymKeyDirect(key []byte) (string, error) {\n\tif len(key) != aesKeyLength {\n\t\treturn \"\", fmt.Errorf(\"wrong key size: %d\", len(key))\n\t}\n\n\tid, err := GenerateRandomID()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to generate ID: %s\", err)\n\t}\n\n\tw.keyMu.Lock()\n\tdefer w.keyMu.Unlock()\n\n\tif w.symKeys[id] != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to generate unique ID\")\n\t}\n\tw.symKeys[id] = key\n\treturn id, nil\n}", "func AddUserSession(userID int, sessionID string) error {\n\tkey := stringutil.Build(\"userid:\", strconv.Itoa(userID), \":sessionids\")\n\terr := SetAddMember(key, sessionID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot add member to set in Redis\")\n\t}\n\treturn nil\n}", "func (h *RequestHeader) Add(key, value string) {\n\th.AddBytesKV(s2b(key), s2b(value))\n}", "func (_ECC *ECCTransactorSession) VoteAddKey(key common.Address) (*types.Transaction, error) {\n\treturn _ECC.Contract.VoteAddKey(&_ECC.TransactOpts, key)\n}", "func (r *Redis) AddUser(id, key string) (err error) {\n\terr = r.client.HMSet(id, \"timestamp\", strconv.FormatInt(time.Now().UTC().Unix(), 10), \"key\", key, \"files\", \"\").Err()\n\treturn\n}", "func (session *Session) GetSessionKey() string {\n\treturn session.id.String()\n}", "func (b *SharingKeys) Add(name string, key *[32]byte) (*SharingKey, error) {\n\tif name == \"\" {\n\t\treturn nil, ErrSharingKeyNameInvalid\n\t}\n\tn := []byte(name)\n\tif v := b.b.Get(n); v != nil {\n\t\treturn nil, ErrSharingKeyExist\n\t}\n\tif err := b.b.Put([]byte(name), key[:]); err != nil {\n\t\treturn nil, err\n\t}\n\ts := &SharingKey{\n\t\tb: b,\n\t\tname: n,\n\t\tsecret: key[:],\n\t}\n\treturn s, nil\n}", "func (s *Envelope) AddKey(alias string, masterKey string, context map[string]string) (string, error) {\n\tkey, err := keysvc.GenerateDatakey(alias, masterKey, context)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\terr = s.Keyring.AddKey(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn key.ID.String(), nil\n}", "func AddKeyToRequest(req *http.Request, token string) {\n\treq.Header.Set(\"Authorisation\", fmt.Sprintf(\"Key %v\", token))\n}", "func SetSessionContextKey(ctx context.Context, s *Session) context.Context {\n\treturn context.WithValue(ctx, sessionCtxKey, s)\n}", "func (s *KeyAgentTestSuite) TestAddKey(c *check.C) {\n\t// make a new local agent\n\tlka, err := NewLocalAgent(s.keyDir, s.hostname, s.username)\n\tc.Assert(err, check.IsNil)\n\n\t// add the key to the local agent, this should write the key\n\t// to disk as well as load it in the agent\n\t_, err = lka.AddKey(s.key)\n\tc.Assert(err, check.IsNil)\n\n\t// check that the key has been written to disk\n\tfor _, ext := range []string{fileExtCert, \"\", fileExtPub} {\n\t\t_, err := os.Stat(fmt.Sprintf(\"%v/keys/%v/%v%v\", s.keyDir, s.hostname, s.username, ext))\n\t\tc.Assert(err, check.IsNil)\n\t}\n\n\t// get all agent keys from teleport agent and system agent\n\tteleportAgentKeys, err := lka.Agent.List()\n\tc.Assert(err, check.IsNil)\n\tsystemAgentKeys, err := lka.sshAgent.List()\n\tc.Assert(err, check.IsNil)\n\n\t// check that we've loaded a cert as well as a private key into the teleport agent\n\t// and it's for the user we expected to add a certificate for\n\tc.Assert(teleportAgentKeys, check.HasLen, 2)\n\tc.Assert(teleportAgentKeys[0].Type(), check.Equals, \"ssh-rsa-cert-v01@openssh.com\")\n\tc.Assert(teleportAgentKeys[0].Comment, check.Equals, \"teleport:\"+s.username)\n\tc.Assert(teleportAgentKeys[1].Type(), check.Equals, \"ssh-rsa\")\n\tc.Assert(teleportAgentKeys[1].Comment, check.Equals, \"teleport:\"+s.username)\n\n\t// check that we've loaded a cert as well as a private key into the system again\n\tfound := false\n\tfor _, sak := range systemAgentKeys {\n\t\tif sak.Comment == \"teleport:\"+s.username && sak.Type() == \"ssh-rsa\" {\n\t\t\tfound = true\n\t\t}\n\t}\n\tc.Assert(true, check.Equals, found)\n\tfound = false\n\tfor _, sak := range systemAgentKeys {\n\t\tif sak.Comment == \"teleport:\"+s.username && sak.Type() == \"ssh-rsa-cert-v01@openssh.com\" {\n\t\t\tfound = true\n\t\t}\n\t}\n\tc.Assert(true, check.Equals, found)\n\n\t// unload all keys for this user from the teleport agent and system agent\n\terr = lka.UnloadKey()\n\tc.Assert(err, check.IsNil)\n}", "func StoreInSession(key string, value string, req *http.Request, res http.ResponseWriter) error {\n\tsession, _ := Store.New(req, SessionName)\n\n\tif err := updateSessionValue(session, key, value); err != nil {\n\t\treturn err\n\t}\n\n\treturn session.Save(req, res)\n}", "func (self *Store) Add(k string) []byte {\n\tself.mu.Lock()\n\tself.mu.Unlock()\n\treturn nil\n}", "func (_ECC *ECCSession) VoteAddKey(key common.Address) (*types.Transaction, error) {\n\treturn _ECC.Contract.VoteAddKey(&_ECC.TransactOpts, key)\n}", "func (enc *Encoder) AddBoolKey(key string, v bool) {\n\tenc.BoolKey(key, v)\n}", "func (s *service) AddSession(session *Session) (*Session, []error) {\n\treturn (*s.repo).AddSession(session)\n}", "func Add(c context.Context, key string, data []byte) {\n\tmemcache.Add(c, &memcache.Item{\n\t\tKey: key,\n\t\tValue: data,\n\t})\n}", "func (ks *KeyStore) AddECDSAKey(session pkcs11.SessionHandle, privKey data.PrivateKey, hwslot common.HardwareSlot, passwd string, role data.RoleName) error {\n\tlogrus.Debugf(\"Attempting to add key to %s with ID: %s\", name, privKey.ID())\n\terr := pkcs11Ctx.Login(session, pkcs11.CKU_USER, passwd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pkcs11Ctx.Logout(session)\n\tecdsaPrivKey, err := x509.ParseECPrivateKey(privKey.Private())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tecdsaPrivKeyD := common.EnsurePrivateKeySize(ecdsaPrivKey.D.Bytes())\n\n\tstartTime := time.Now()\n\n\ttemplate, err := utils.NewCertificate(role.String(), startTime, startTime.AddDate(data.DefaultExpires(data.CanonicalRootRole).Year(), 0, 0))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create the certificate template: %v\", err)\n\t}\n\n\tcertBytes, err := x509.CreateCertificate(rand.Reader, template, template, ecdsaPrivKey.Public(), ecdsaPrivKey)\n\tecdsaPrivKey = nil\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create the certificate: %v\", err)\n\t}\n\tcertTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, \"Notary Certificate\"),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_CERTIFICATE),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CERTIFICATE_TYPE, pkcs11.CKC_X_509),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_VALUE, certBytes),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_SUBJECT, template.SubjectKeyId),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, hwslot.KeyID),\n\t}\n\n\tprivateKeyTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, \"Notary Private Key\"),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_ECDSA),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_PRIVATE, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, hwslot.KeyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07}),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_VALUE, ecdsaPrivKeyD),\n\t}\n\n\t_, err = pkcs11Ctx.CreateObject(session, certTemplate)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error importing: %v\", err)\n\t}\n\n\t_, err = pkcs11Ctx.CreateObject(session, privateKeyTemplate)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error importing: %v\", err)\n\t}\n\n\treturn nil\n}", "func (ms *MemStore) StoreSession(\n\tsessionKey, rootKeyHash, chainKey string,\n\tsend, recv []string,\n) error {\n\tif len(send) != len(recv) {\n\t\treturn log.Error(\"memstore: len(send) != len(recv)\")\n\t}\n\tlog.Debugf(\"memstore.StoreSession(): %s\", sessionKey)\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\tms.sessions[sessionKey] = &memSession{\n\t\t\trootKeyHash: rootKeyHash,\n\t\t\tchainKey: chainKey,\n\t\t\tsend: send,\n\t\t\trecv: recv,\n\t\t}\n\t\tms.sessionKey = sessionKey\n\t} else {\n\t\t// session already exists -> update\n\t\t// rootKeyHash stays the same!\n\t\ts.chainKey = chainKey\n\t\ts.send = append(s.send, send...)\n\t\ts.recv = append(s.recv, recv...)\n\t}\n\treturn nil\n}", "func AddKeyValue(key string, value interface{}) error {\n\treturn memoryconfigsource.NewMemoryConfigurationSource().AddKeyValue(key, value)\n}", "func (se *StringExpression) Add(key string, value string) *StringExpression {\n\tse.env[key] = value\n\treturn se\n}", "func addKey(keys map[rune]kb.Key, r rune, key kb.Key, scanCodeMap map[string][]int64, shouldPanic bool) {\n\tif _, ok := keys[r]; ok {\n\t\tif shouldPanic {\n\t\t\tpanic(fmt.Sprintf(\"rune %U (%s/%s) already defined in keys\", r, key.Code, key.Key))\n\t\t}\n\t\treturn\n\t}\n\n\tsc, ok := scanCodeMap[key.Code]\n\tif ok {\n\t\tkey.Native = sc[0]\n\t\tkey.Windows = sc[1]\n\t}\n\n\tkeys[r] = key\n}", "func AddSession(db *sql.DB, oauthClientName ClientName, userID UserID) (SessionID, error) {\n\tvar clientID string\n\terr := db.QueryRow(`\n\t\tselect id from oauth_clients where name = $1\n\t`, oauthClientName).Scan(&clientID)\n\tif err == sql.ErrNoRows {\n\t\treturn 0, errors.Errorf(\"failed to find oauth client: %s\", oauthClientName)\n\t} else if err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar sessionID SessionID\n\t\n\terr = db.QueryRow(`\n\t\tinsert into oauth_sessions(client_id, owner_type, owner_id, created_at, updated_at) values ($1, 'user', $2, now(), now()) returning id\n\t`, clientID, userID).Scan(&sessionID)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn sessionID, nil\n}", "func (c *CryptohomeBinary) AddKeyEx(ctx context.Context, username, password, label, newPassword, newLabel string, lowEntropy bool) ([]byte, error) {\n\targs := []string{\"--action=add_key_ex\", \"--user=\" + username, \"--password=\" + password, \"--key_label=\" + label, \"--new_password=\" + newPassword, \"--new_key_label=\" + newLabel}\n\tif lowEntropy {\n\t\targs = append(args, \"--key_policy=le\")\n\t}\n\treturn c.call(ctx, args...)\n}", "func (f *Flash) Add(key, value string) {\n\tif !f.changed {\n\t\tf.changed = true\n\t}\n\tf.v.Add(key, value)\n}", "func (c *Client) SessionKey() []byte {\n\treturn c.sessionSecret\n}", "func (i *instances) AddSSHKeyToAllInstances(_ context.Context, _ string, _ []byte) error {\n\treturn errors.New(\"not implemented\")\n}", "func (kc *Keychain) Add(key *crypto.PublicKeySECP256K1R) {\n\taddr := key.Address()\n\tkc.Addrs.Add(addr)\n}", "func (sess Session) Set(key, value string) {\n\tsess[key] = value\n}", "func GenerateSessionKey() (string, error) {\n\tkey := make([]byte, 64)\n\n\t_, err := rand.Read(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(key), nil\n}", "func (c *kvStatsCollector) Add(key sstable.InternalKey, value []byte) error {\n\tc.curSize += len(key.UserKey) + len(value)\n\tc.lastKey = append(c.lastKey[:0], key.UserKey...)\n\tif c.curSize >= c.bucketSize {\n\t\tc.addBucket()\n\t}\n\treturn nil\n}", "func (c Context) Add(key string, value interface{}) {\n\tc.data[key] = value\n}", "func addKey(Writer http.ResponseWriter, Request *http.Request) {\n\tdefer Request.Body.Close()\n\terr := jwt.ValidateToken(Request.Header[\"Authorization\"][0])\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stdout, \"POST\\t\\\\KeyHook\\t\"+string(http.StatusUnauthorized)+\"\\n\")\n\t\tWriter.WriteHeader(http.StatusUnauthorized)\n\t\tWriter.Write([]byte(\"Invalid Token\"))\n\t\treturn\n\t}\n\n\taddRequest := keyHookRequest{}\n\terr = json.NewDecoder(Request.Body).Decode(&addRequest)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, err.Error()+\"\\n\")\n\t\tfmt.Fprintf(os.Stdout, \"POST\\t\\\\KeyHook\\t\"+string(http.StatusInternalServerError)+\"\\n\")\n\t\tWriter.WriteHeader(http.StatusInternalServerError)\n\t\tWriter.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\n\terr = keyhook.AddNewKey(addRequest.ID, addRequest.Website)\n\tif err != nil {\n\t\tfmt.Printf(\"POST\\t\\\\Auth\\t500\\n\")\n\t\tWriter.WriteHeader(http.StatusInternalServerError)\n\t\tWriter.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\n\tfmt.Printf(\"POST\\t\\\\Auth\\t202\\n\")\n\tWriter.WriteHeader(http.StatusAccepted)\n\treturn\n\n}", "func (s *Store) Add(key []byte, value []byte) error {\n\tif s.HasKey(key) {\n\t\treturn fmt.Errorf(\"key already exists\")\n\t}\n\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\ts.addRec(key, value)\n\n\ts.count++\n\ts.rCount++\n\ts.txCount++\n\n\treturn s.updateHeader()\n}", "func (rh *RedisHandle) CreateHashKey_Session(key string) string {\n\treturn fmt.Sprintf(\"%s:%s\", \"session\", key)\n}", "func addSSHKey(serverKey string, sshKey string) core.BeforeFunc {\n\treturn func(ctx *core.BeforeFuncCtx) error {\n\t\tserver := ctx.Meta[serverKey].(*instance.Server)\n\t\ttags := append(server.Tags, formatSSHKeyToTag(sshKey))\n\n\t\tresp, err := instance.NewAPI(ctx.Client).UpdateServer(&instance.UpdateServerRequest{\n\t\t\tZone: server.Zone,\n\t\t\tServerID: server.ID,\n\t\t\tTags: &tags,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tctx.Meta[serverKey] = resp.Server\n\n\t\treturn nil\n\t}\n}", "func (k2h *K2hash) AddSubKey(k interface{}, s interface{}, v interface{}, options ...func(*K2hashParams)) (bool, error) {\n\t// 1. binary or text\n\tvar key string\n\tvar subkey string\n\tvar val string\n\tswitch k.(type) {\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported key data format %T\", k)\n\tcase string:\n\t\tkey = k.(string)\n\t}\n\tswitch s.(type) {\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported key data format %T\", s)\n\tcase string:\n\t\tsubkey = s.(string)\n\t}\n\tswitch v.(type) {\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported key data format %T\", v)\n\tcase string:\n\t\tval = v.(string)\n\t}\n\t//fmt.Printf(\"key %v val %v\\n\", key, val)\n\n\t// 2. set params\n\tparams := K2hashParams{\n\t\tpassword: \"\",\n\t\texpirationDuration: 0,\n\t}\n\n\tfor _, option := range options {\n\t\toption(&params)\n\t}\n\n\t// 3. get from k2hash get API\n\tcKey := C.CString(key)\n\tdefer C.free(unsafe.Pointer(cKey))\n\tcSubKey := C.CString(subkey)\n\tdefer C.free(unsafe.Pointer(cSubKey))\n\tcVal := C.CString(val)\n\tdefer C.free(unsafe.Pointer(cVal))\n\tcPass := C.CString(params.password)\n\tdefer C.free(unsafe.Pointer(cPass))\n\tvar expire *C.time_t\n\t// WARNING: You can't set zero expire.\n\tif params.expirationDuration != 0 {\n\t\texpire = (*C.time_t)(&params.expirationDuration)\n\t}\n\tok := C.k2h_add_str_subkey_wa(k2h.handle, (*C.char)(cKey), (*C.char)(cSubKey), (*C.char)(cVal), cPass, expire)\n\t//fmt.Printf(\"ok %v\\n\", ok)\n\tif ok != true {\n\t\treturn false, fmt.Errorf(\"C.C.k2h_add_str_subkey_wa return false\")\n\t}\n\treturn true, nil\n}", "func (tb *TaskBuilder) AddSessionParameters(params map[string]interface{}) string {\n\tp := make([]string, 0)\n\tsortedKeys := make([]string, 0)\n\tfor k := range params {\n\t\tsortedKeys = append(sortedKeys, k)\n\t}\n\tsort.Strings(sortedKeys)\n\n\tfor _, k := range sortedKeys {\n\t\tp = append(p, EscapeString(fmt.Sprintf(`%v = \"%v\"`, k, params[k])))\n\t}\n\n\treturn fmt.Sprintf(`ALTER TASK %v SET %v`, tb.QualifiedName(), strings.Join(p, \", \"))\n}", "func (s *Service) AddPrivateKey(keyID string, privateKey crypto.PrivateKey) error {\n\tif _, ok := s.keys[keyID]; ok {\n\t\ts.log.Error(\"The specified key ID is already in use\", \"keyID\", keyID)\n\t\treturn signingkeys.ErrSigningKeyAlreadyExists.Errorf(\"The specified key ID is already in use: %s\", keyID)\n\t}\n\ts.keys[keyID] = privateKey.(crypto.Signer)\n\treturn nil\n}", "func (ds *DataStore) Add(key uint64, value []byte) error {\n\tds.dataStoreLock.Lock()\n\tdefer ds.dataStoreLock.Unlock()\n\tif _, present := ds.kvSet[key]; present {\n\t\tds.kvTime[key] = time.Now().UnixNano()\n\t\treturn fmt.Errorf(\"Key %d already exists\", key)\n\t}\n\tds.kvSet[key] = value\n\treturn nil\n}", "func (mmap *stateSyncMap) add(key string, value interface{}) error {\n\treturn mmap.Add(key, value)\n}", "func WithSessionID(ctx context.Context, sessionID eh.UUID) context.Context {\n\treturn context.WithValue(ctx, sessionIDKey, sessionID)\n}", "func (_ECC *ECCTransactor) VoteAddKey(opts *bind.TransactOpts, key common.Address) (*types.Transaction, error) {\n\treturn _ECC.contract.Transact(opts, \"voteAddKey\", key)\n}", "func WithSessionID(ctx context.Context, sessionID string) context.Context {\n\treturn context.WithValue(ctx, sessionIDKey, sessionID)\n}", "func (c CryptoServiceTester) TestAddKey(t *testing.T) {\n\tcryptoService := c.cryptoServiceFactory()\n\tcryptoService.keyStores = append(cryptoService.keyStores,\n\t\ttrustmanager.NewKeyMemoryStore(passphraseRetriever))\n\n\tprivKey, err := utils.GenerateECDSAKey(rand.Reader)\n\trequire.NoError(t, err)\n\n\t// Add the key to the targets role\n\trequire.NoError(t, cryptoService.AddKey(data.CanonicalTargetsRole, c.gun, privKey))\n\n\t// Check that we added the key and its info to only the first keystore\n\tretrievedKey, retrievedRole, err := cryptoService.keyStores[0].GetKey(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, privKey.Private(), retrievedKey.Private())\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedRole)\n\n\tretrievedKeyInfo, err := cryptoService.keyStores[0].GetKeyInfo(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedKeyInfo.Role)\n\trequire.Equal(t, c.gun, retrievedKeyInfo.Gun)\n\n\t// The key should not exist in the second keystore\n\t_, _, err = cryptoService.keyStores[1].GetKey(privKey.ID())\n\trequire.Error(t, err)\n\t_, err = cryptoService.keyStores[1].GetKeyInfo(privKey.ID())\n\trequire.Error(t, err)\n\n\t// We should be able to successfully get the key from the cryptoservice level\n\tretrievedKey, retrievedRole, err = cryptoService.GetPrivateKey(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, privKey.Private(), retrievedKey.Private())\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedRole)\n\tretrievedKeyInfo, err = cryptoService.GetKeyInfo(privKey.ID())\n\trequire.NoError(t, err)\n\trequire.Equal(t, data.CanonicalTargetsRole, retrievedKeyInfo.Role)\n\trequire.Equal(t, c.gun, retrievedKeyInfo.Gun)\n\n\t// Add the same key to the targets role, since the info is the same we should have no error\n\trequire.NoError(t, cryptoService.AddKey(data.CanonicalTargetsRole, c.gun, privKey))\n\n\t// Try to add the same key to the snapshot role, which should error due to the role mismatch\n\trequire.Error(t, cryptoService.AddKey(data.CanonicalSnapshotRole, c.gun, privKey))\n}", "func AddSessionToContext(ctx context.Context, session *types.UserSession) context.Context {\n\tk := types.BenderContextKey(\"__SESSION__\")\n\treturn context.WithValue(ctx, k, session)\n}", "func (lru *KeyLRU) Add(key interface{}) error {\n\tlru.lazyInit()\n\tele := lru.ll.PushFront(key)\n\tif _, ok := lru.m[key]; ok {\n\t\treturn errors.New(\"key was already in LRU\")\n\t}\n\tlru.m[key] = ele\n\treturn nil\n}", "func Add(p *pool.Pool, key int, m *dns.Msg, duration time.Duration) error {\n\t// SETEX key duration m\n\tconn, err := p.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer p.Put(conn)\n\n\tresp := conn.Cmd(\"SETEX\", strconv.Itoa(key), int(duration.Seconds()), ToString(m))\n\n\treturn resp.Err\n}", "func (_ECC *ECCTransactorSession) ProposeAddKey(key common.Address, keyType uint8) (*types.Transaction, error) {\n\treturn _ECC.Contract.ProposeAddKey(&_ECC.TransactOpts, key, keyType)\n}", "func (mc *MemCache) Add(key string, value interface{}) {\n\t_, expTime, found := mc.c.GetWithExpiration(key)\n\tif found { // do not reset expiration if the key already exists\n\t\tmc.c.Set(key, value, time.Until(expTime))\n\t\treturn\n\t}\n\n\tmc.c.Set(key, value, mc.expiration)\n}", "func (r *request) Add(key string, payload interface{}) {\n\tr.details[key] = payload\n}", "func (h *RequestHeader) Add(key, val string) {\n\t// h.RequestHeader.Add(key, val)\n}", "func (keyRing *KeyRing) AddKey(key *Key) error {\n\tif key.IsPrivate() {\n\t\tunlocked, err := key.IsUnlocked()\n\t\tif err != nil || !unlocked {\n\t\t\treturn errors.New(\"gopenpgp: unable to add locked key to a keyring\")\n\t\t}\n\t}\n\n\tkeyRing.appendKey(key)\n\treturn nil\n}", "func (store *KapacitorStore) Add(ctx context.Context, kap chronograf.Server) (chronograf.Server, error) {\n\treturn chronograf.Server{}, fmt.Errorf(\"in-memory KapacitorStore does not support adding a Kapacitor\")\n}", "func (session *SafeSession) Append(shardSession *vtgatepb.Session_ShardSession) {\n\tsession.mu.Lock()\n\tdefer session.mu.Unlock()\n\tsession.ShardSessions = append(session.ShardSessions, shardSession)\n}", "func (s *session) getKey() string {\n\treturn s.uuid\n}", "func (t *Terminal) AddUserSession(username, session string, server *Server) {\n\tt.Lock()\n\tdefer t.Unlock()\n\n\t// check if it's exists, if not go and lazy initialize a new user instance\n\tvar user *User\n\tvar ok bool\n\tuser, ok = t.Users[username]\n\tif !ok {\n\t\tuser = NewUser(username)\n\t}\n\n\tuser.AddSession(session, server)\n\tt.Users[username] = user\n}", "func ( handle *MemcacheClient) Add(key string, value []byte) error {\n\n\tif len(key) <= 0 {\n\t\tlog.Printf(\"Error: passed key to be placd in memcache in blank\\n\")\n\t\treturn fmt.Errorf(\"passed key to be placd in memcache in blank\")\n\t}\n\tlog.Printf(\"Info: memcache set key:%s value:%s\\n\",key , string(value))\n\tit := memcache.Item{Key:key, Value:value, Expiration: defTTL}\n\terr := handle.mc.Set(&it)\n\tif err != nil{\n\t\tlog.Printf(\"Error: unable to set data:%s:%s\\n\",key,err.Error())\n\t\treturn fmt.Errorf(\"unable to set data:%s\\n\",err.Error())\n\t}\n\n\treturn nil\n}", "func AddUserToSession(user User, c *gin.Context) {\n\ts := sessions.Default(c)\n\t// Clear out password field\n\tuser.Password = \"\"\n\tuser.PasswordConfirm = \"\"\n\ts.Set(defaultUserKeystring, user)\n\ts.Save()\n\n\tlogrus.WithFields(logrus.Fields{\n\t\t\"module\": \"core\",\n\t\t\"action\": \"AddUserToSession\",\n\t\t\"data\": user,\n\t}).Info(\"User added to Session using default key\")\n}" ]
[ "0.6423503", "0.6323099", "0.62819356", "0.6256926", "0.61663294", "0.616442", "0.6119882", "0.6119334", "0.6081158", "0.6046519", "0.5989558", "0.5984429", "0.5983712", "0.59713036", "0.59532416", "0.59405285", "0.5913878", "0.59074885", "0.5815175", "0.5807486", "0.580188", "0.57989657", "0.5792403", "0.57757634", "0.57112783", "0.5703132", "0.56951594", "0.568648", "0.568323", "0.56731325", "0.56215906", "0.561825", "0.56174237", "0.55890334", "0.5584223", "0.5579639", "0.5578529", "0.55599296", "0.55573153", "0.5530858", "0.5506086", "0.5446968", "0.54311925", "0.542998", "0.5429458", "0.5421666", "0.5420896", "0.5419528", "0.5412513", "0.53996325", "0.5385608", "0.5377725", "0.53771996", "0.536344", "0.53586906", "0.5357903", "0.5339969", "0.53362525", "0.5325072", "0.5317272", "0.5309564", "0.5300848", "0.5297305", "0.5277424", "0.5277162", "0.52750283", "0.5273311", "0.52558786", "0.52461046", "0.52339023", "0.52330357", "0.52328426", "0.5229951", "0.522649", "0.522036", "0.52142996", "0.5212497", "0.5212496", "0.52082783", "0.52059865", "0.520325", "0.5202424", "0.51994187", "0.5195336", "0.518863", "0.518812", "0.517793", "0.5169337", "0.5160038", "0.5141562", "0.5139184", "0.51257825", "0.51235116", "0.51228774", "0.51203203", "0.51192343", "0.51122016", "0.5107569", "0.5105379", "0.5102183" ]
0.8089887
0
DelPrivSessionKey implemented in memory.
DelPrivSessionKey реализован в памяти.
func (ms *MemStore) DelPrivSessionKey(hash string) error { sk, ok := ms.sessionKeys[hash] if !ok { return nil } sk.privKey = "" return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (privKey *YubiHsmPrivateKey) UnloadYubiHsmPrivKey() {\n\tif privKey.sessionMgr == nil {\n\t\treturn\n\t}\n\tprivKey.sessionMgr.Destroy()\n}", "func (sess Session) Del(key string) {\n\tdelete(sess, key)\n}", "func (m *MemoryStorer) Del(key string) error {\n\tm.mut.Lock()\n\tdelete(m.sessions, key)\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (ms *MemStore) DelMessageKey(\n\tsessionKey string,\n\tsender bool,\n\tmsgIndex uint64,\n) error {\n\ts, ok := ms.sessions[sessionKey]\n\tif !ok {\n\t\treturn log.Errorf(\"memstore: no session found for %s\", sessionKey)\n\t}\n\tif msgIndex >= uint64(len(s.send)) {\n\t\treturn log.Error(\"memstore: message index out of bounds\")\n\t}\n\t// delete key\n\tif sender {\n\t\ts.send[msgIndex] = \"\"\n\t} else {\n\t\ts.recv[msgIndex] = \"\"\n\t}\n\treturn nil\n}", "func (keyDB *KeyDB) DelPrivateUID(msg *uid.Message) error {\n\tif _, err := keyDB.delPrivateUIDQuery.Exec(msg.JSON()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func DecryptPrivKey(entList openpgp.EntityList, pass string) {\n\tent := entList[0]\n\tpassphrase := []byte(pass)\n\n\t// Decrypt priv key\n\tif ent.PrivateKey != nil && ent.PrivateKey.Encrypted {\n\t\terr := ent.PrivateKey.Decrypt(passphrase)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Private key decryption failed.\")\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\t// Decrypt all subkeys\n\tfor _, subkey := range ent.Subkeys {\n\t\tif subkey.PrivateKey != nil && subkey.PrivateKey.Encrypted {\n\t\t\terr := subkey.PrivateKey.Decrypt(passphrase)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Subkey decryption failed.\")\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func DecryptPrivKey(data []byte, password string) (crypto.PrivateKey, error) {\n\tvar plain []byte\n\tif password != \"\" {\n\t\t// Set up the crypto stuff\n\t\thash := crypto.SHA256.New()\n\t\tif _, err := hash.Write([]byte(password)); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to hash: %w\", err)\n\t\t}\n\t\thashPW := hash.Sum(nil)\n\t\taes, err := aes.NewCipher(hashPW)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\taesGCM, err := cipher.NewGCM(aes)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnonceSize := aesGCM.NonceSize()\n\n\t\tnonce, ciphertext := data[:nonceSize], data[nonceSize:]\n\t\tplain, err = aesGCM.Open(nil, nonce, ciphertext, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tplain = data\n\t}\n\n\tkey, err := parsePrivateKey(plain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn key, nil\n}", "func (s *session) Delete(key string) {\n\ts.mu.Lock()\n\tdelete(s.values, key)\n\ts.mu.Unlock()\n\ts.provider.update(s.sid)\n}", "func (o *Gojwt) SetPrivKeyPath(path string)(){\n o.privKeyPath = path\n}", "func (d *Dao) DelPKGCache(c context.Context, mid int64) (err error) {\n\tkey := _pendantPKG + strconv.FormatInt(mid, 10)\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\tif err = conn.Send(\"DEL\", key); err != nil {\n\t\tlog.Error(\"conn.Send(DEL, %s) error(%v)\", key, err)\n\t\treturn\n\t}\n\treturn\n}", "func (m *Manager) Delete(sessionID string, key interface{}) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tif session, ok := m.session[sessionID]; ok {\n\t\tdelete(session.values, key)\n\t}\n}", "func (u *UdMap) Del(key string) { delete(u.Data, key) }", "func (key Key) ToPrivKey() cryptotypes.PrivKey {\n\treturn key.k\n}", "func (r *RPCKeyRing) DerivePrivKey(_ keychain.KeyDescriptor) (*btcec.PrivateKey,\n\terror) {\n\n\t// This operation is not supported with remote signing. There should be\n\t// no need for invoking this method unless a channel backup (SCB) file\n\t// for pre-0.13.0 channels are attempted to be restored. In that case\n\t// it is recommended to restore the channels using a node with the full\n\t// seed available.\n\treturn nil, ErrRemoteSigningPrivateKeyNotAvailable\n}", "func (system *System) RevokeSystemKeyPair() error {\n\tdb := database.GetGORMDbConnection()\n\tdefer database.Close(db)\n\n\tvar encryptionKey EncryptionKey\n\n\terr := db.Where(\"system_id = ?\", system.ID).Find(&encryptionKey).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = db.Delete(&encryptionKey).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (system *System) RevokeSystemKeyPair() error {\n\tdb := GetGORMDbConnection()\n\tdefer Close(db)\n\n\tvar encryptionKey EncryptionKey\n\n\terr := db.Where(\"system_id = ?\", system.ID).Find(&encryptionKey).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = db.Delete(&encryptionKey).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *memoryCache) Del(key string) {\n\tdelete(c.data, key)\n}", "func (c *CredCache) removeCachedTokenInternal() error {\n\tkeyring, err := keyctl.SessionKeyring()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get keyring during removing cached token, %v\", err)\n\t}\n\tkey, err := keyring.Search(c.keyName)\n\tif err != nil {\n\t\tif err == syscall.ENOKEY {\n\t\t\treturn fmt.Errorf(\"no cached token found for current user\")\n\t\t}\n\t\treturn fmt.Errorf(\"no cached token found for current user, %v\", err)\n\t}\n\terr = key.Unlink()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to remove cached token, %v\", err)\n\t}\n\n\tc.isPermSet = false\n\tc.key = nil\n\n\treturn nil\n}", "func (a *LocalKeyAgent) UnloadKey() error {\n\tagents := []agent.Agent{a.Agent}\n\tif a.sshAgent != nil {\n\t\tagents = append(agents, a.sshAgent)\n\t}\n\n\t// iterate over all agents we have and unload keys for this user\n\tfor _, agent := range agents {\n\t\t// get a list of all keys in the agent\n\t\tkeyList, err := agent.List()\n\t\tif err != nil {\n\t\t\ta.log.Warnf(\"Unable to communicate with agent and list keys: %v\", err)\n\t\t}\n\n\t\t// remove any teleport keys we currently have loaded in the agent for this user\n\t\tfor _, key := range keyList {\n\t\t\tif key.Comment == fmt.Sprintf(\"teleport:%v\", a.username) {\n\t\t\t\terr = agent.Remove(key)\n\t\t\t\tif err != nil {\n\t\t\t\t\ta.log.Warnf(\"Unable to communicate with agent and remove key: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (mph *MockPeerHandler) PrivKey() libp2pcry.PrivKey {\n\treturn nil\n}", "func RemoveSession(ctxid int64) {\n\tdelete(sessionBuf, ctxid)\n}", "func (st *MemSessionStore) Delete(key interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tdelete(st.value, key)\n\treturn nil\n}", "func (c Context) Del(key string) {\n\tdelete(c.data, key)\n}", "func (a *LocalKeyAgent) DeleteKey() error {\n\t// remove key from key store\n\terr := a.keyStore.DeleteKey(KeyIndex{ProxyHost: a.proxyHost, Username: a.username})\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\t// remove any keys that are loaded for this user from the teleport and\n\t// system agents\n\terr = a.UnloadKey()\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\treturn nil\n}", "func (st *MemSessionStore) Delete(key interface{}) error {\n\treturn (*session.MemSessionStore)(st).Delete(context.Background(), key)\n}", "func (s *server) Del(key string) {\n\tres := make(chan bool)\n\ts.ops <- func() {\n\t\tdelete(s.store, key)\n\t\tres <- true\n\t}\n\t<-res\n}", "func (ps *MemProfiles) Delete(key string) {\n\tps.Lock()\n\tdelete(ps.internal, key)\n\tps.Unlock()\n}", "func (this *mMap) Del(k string) (result int64, err error) {\n\tkey := this.Key(k)\n\tresult, err = this.Client.Del(key).Result()\n\treturn\n}", "func (g *GCache) Del(key string) error {\n\tg.db.Remove(key)\n\treturn nil\n}", "func PrivateKeyDecrypt(priv *rsa.PrivateKey, rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) ([]byte, error)", "func (module *ShutUpModule) PrivMsg(srv *Server, msg *InputMessage) {\n\tsrv.SendToChannelMinions(msg.ReplyTo, ClientCommand{\"shutup\", nil})\n\tsrv.Reply(msg, \"ok...\")\n}", "func (s *Session) Remove(key *Key) (err error) {\n\tatomic.AddUint64(&cDeletes, 1)\n\n\tvar cflags C.uint64_t\n\tvar ioflags C.uint64_t\n\terr = Error(C.dnet_remove_object_now(s.session, &key.id, cflags, ioflags))\n\treturn\n}", "func GenPrivKey() crypto.PrivKey {\n\treturn sr25519.GenPrivKey()\n}", "func (cc *Client) UnlinkAuthorizedKey(key string) error {\n\ts, err := cc.sshSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s.Close()\n\tk := Key{Key: key}\n\tin, err := s.StdinPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := json.NewEncoder(in).Encode(k); err != nil {\n\t\treturn err\n\t}\n\tj, err := json.Marshal(&k)\n\tif err != nil {\n\t\treturn err\n\t}\n\tb, err := s.Output(fmt.Sprintf(\"api-unlink %s\", string(j)))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(b) != 0 {\n\t\treturn ErrCouldNotUnlinkKey\n\t}\n\treturn nil\n}", "func (pk *JSONPasswordKeeper) Del(username string) error {\n\tpk.mutex.Lock()\n\tdefer pk.mutex.Unlock()\n\tif _, exists := pk.userInfo[username]; exists {\n\t\tdelete(pk.userInfo, username)\n\t\treturn pk.flushToDisk()\n\t}\n\treturn ErrNoSuchUser\n}", "func (m *MockCache) Del(key string) error {\n\treturn nil\n}", "func (c *SimpleMemoryCache) Del(ctx *Context, next Next) {\n\tdelete(c.data, ctx.Key)\n}", "func (db *MemoryStorage) Del(key []byte) error {\n\tdb.data.Delete(common.BytesToHex(key))\n\treturn nil\n}", "func (p *PgStore) DeleteByUserKey(ctx context.Context, key string, expID ...string) error {\n\tif len(expID) > 0 {\n\t\tq := fmt.Sprintf(\"DELETE FROM %s WHERE user_key = $1 AND id != ALL ($2);\", p.tName)\n\t\t_, err := p.db.ExecContext(ctx, q, append([]interface{}{key}, pq.Array(expID))...)\n\t\treturn err\n\t}\n\n\tq := fmt.Sprintf(\"DELETE FROM %s WHERE user_key = $1;\", p.tName)\n\t_, err := p.db.ExecContext(ctx, q, key)\n\treturn err\n}", "func (c *Controller) DelSession(name interface{}) error {\n\tif c.CruSession == nil {\n\t\tc.StartSession()\n\t}\n\treturn c.CruSession.Delete(context2.Background(), name)\n}", "func (ks *KeyStore) HardwareRemoveKey(session pkcs11.SessionHandle, hwslot common.HardwareSlot, passwd string, keyID string) error {\n\terr := pkcs11Ctx.Login(session, pkcs11.CKU_USER, passwd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pkcs11Ctx.Logout(session)\n\tcertTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, hwslot.KeyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_CERTIFICATE),\n\t}\n\n\tkeyTemplate := []*pkcs11.Attribute{\n\t\tpkcs11.NewAttribute(pkcs11.CKA_PRIVATE, true),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_ECDSA),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, hwslot.KeyID),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n\t}\n\ttemplates := [][]*pkcs11.Attribute{certTemplate, keyTemplate}\n\tfor _, template := range templates {\n\t\tif err := pkcs11Ctx.FindObjectsInit(session, template); err != nil {\n\t\t\tlogrus.Debugf(\"Failed to init find objects: %s\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tobj, b, err := pkcs11Ctx.FindObjects(session, 1)\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Failed to find objects: %s %v\", err.Error(), b)\n\t\t\treturn err\n\t\t}\n\t\tif err := pkcs11Ctx.FindObjectsFinal(session); err != nil {\n\t\t\tlogrus.Debugf(\"Failed to finalize find objects: %s\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tif len(obj) != 1 {\n\t\t\tlogrus.Debugf(\"should have found exactly one object\")\n\t\t\treturn err\n\t\t}\n\n\t\terr = pkcs11Ctx.DestroyObject(session, obj[0])\n\t\tif err != nil {\n\t\t\tlogrus.Debugf(\"Failed to delete cert/privkey\")\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func (c *cache) Del(key string) error {\n\terr := c.cacheConn.Del(key).Err()\n\tif err != nil {\n\t\tlogger.Log().Error(\"Error while deleting key\", zap.String(\"key\", key), zap.Error(err))\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *HTTPClient) GetPrivKey() crypto.PrivateKey {\n\treturn c.privKey\n}", "func (o SslCertificateSelfManagedSslCertificateOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SslCertificateSelfManagedSslCertificate) *string { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (c *RedisCache) Del(ctx context.Context, key string) error {\n\treturn c.client.Del(ctx, key).Err()\n}", "func (service *service) decrKey(key string) (int64, error) {\n\treturn service.client.Decr(key).Result()\n}", "func (p Parameters) Del(key string) {\n\tdelete(p, key)\n}", "func delPatricia(ptr patricia, bucket string, cb db.CachedBatch) {\n\tkey := ptr.hash()\n\tlogger.Debug().Hex(\"key\", key[:8]).Msg(\"del\")\n\tcb.Delete(bucket, key[:], \"failed to delete key = %x\", key)\n}", "func (h *hashMap) Del(strKey string) {\n\tkey := GetHash(strKey)\n\tbucket := h.getBucket(key)\n\tbucket.remove(Regularkey(key))\n}", "func TestRemovedCredentialKey(t *testing.T) {\n\tvar _, f = GenUser() // generate user\n\n\t// remove credential_key\n\tremoveUserCredKey(s.db, f.Get(\"UUID\"))\n\n\tr := PostRequest(\"\", f, s.CredentialHandler)\n\tvar newCreds Credentials\n\t_ = json.Unmarshal(r.Body.Bytes(), &newCreds)\n\tif len(newCreds.Key) == 0 || len(newCreds.Value) != 0 {\n\t\tt.Errorf(\"Error fetching new Credentials for user %v. Expected new key\", newCreds)\n\t}\n}", "func (c *Config) UnmarshalPrivKey() (crypto.PrivKey, error) {\n\treturn crypto.UnmarshalPrivateKey(c.PrivKey)\n}", "func (s *service) Del(key string) error {\n\treturn s.redis.Del(key).Err()\n}", "func (st *SessionStoreMySQL) Delete(key interface{}) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tdelete(st.values, key)\n\treturn nil\n}", "func (s *RedisStore) delete(ctx context.Context, session *sessions.Session) error {\n\tif err := s.Cmd.Del(ctx, s.keyPrefix+session.ID).Err(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (e *Domain) Private() *PrivateKey {\n\tif e.ClearPrivateKey == nil {\n\t\te.decrypt_privatekey()\n\t}\n\treturn e.ClearPrivateKey\n}", "func (m *Uint64) Delete(key interface{}) {\n\tm.m.Delete(key)\n}", "func (t *Tkeyid) DelFromKey(key string) (id uint, ok bool) {\n\tid, ok = t.keytoid[key]\n\tif ok {\n\t\tdelete(t.idtokey, id)\n\t\tdelete(t.keytoid, key)\n\t}\n\treturn\n}", "func GenPrivKey(curve elliptic.Curve) (PrivKey, error) {\n\tkey, err := ecdsa.GenerateKey(curve, rand.Reader)\n\tif err != nil {\n\t\treturn PrivKey{}, err\n\t}\n\treturn PrivKey{*key}, nil\n}", "func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) []byte {\n\tplaintext, err := rsa.DecryptOAEP(sha512.New(), rand.Reader, priv, ciphertext, nil)\n\tif err != nil {\n\t\tlog.Panic(err.Error)\n\t}\n\treturn plaintext\n}", "func (s *RedisSession) DelKey(key string) (int64, error) {\r\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(time.Second*5))\r\n\tdefer cancel()\r\n\r\n\tc, err := s.getClient()\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\tcnt, err := c.Del(ctx, []string{s.config.KeyPrefix + key}...).Result()\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\treturn cnt, nil\r\n}", "func (ctx *MqttSrvContext) RemoveSession(fd int) {\n\tctx.Clock.Lock()\n\tdelete(ctx.Connections, fd)\n\tctx.Clock.Unlock()\n}", "func (k Keeper) DelValue(ctx sdk.Context, accessPath *vm_grpc.VMAccessPath) {\n\tk.modulePerms.AutoCheck(types.PermStorageWrite)\n\n\tk.delValue(ctx, accessPath)\n}", "func DecryptPKCS1v15SessionKey(rand io.Reader, priv *PrivateKey, ciphertext []byte, key []byte) error {\n\tif err := checkPub(&priv.PublicKey); err != nil {\n\t\treturn err\n\t}\n\tk := (priv.N.BitLen() + 7) / 8\n\tif k-(len(key)+3+8) < 0 {\n\t\treturn rsa.ErrDecryption\n\t}\n\n\tvalid, em, index, err := decryptPKCS1v15(rand, priv, ciphertext)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(em) != k {\n\t\t// This should be impossible because decryptPKCS1v15 always\n\t\t// returns the full slice.\n\t\treturn rsa.ErrDecryption\n\t}\n\n\tvalid &= subtle.ConstantTimeEq(int32(len(em)-index), int32(len(key)))\n\tsubtle.ConstantTimeCopy(valid, key, em[len(em)-len(key):])\n\treturn nil\n}", "func (c *Cache) Del(key string) error {\n\tc.gc.Delete(key)\n\treturn nil\n}", "func DeleteSession(sessionID string) error {\n\tkey := stringutil.Build(\"sessionid:\", sessionID, \":userid\")\n\terr := Delete(key)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot delete key from Redis\")\n\t}\n\treturn nil\n}", "func (sm safeMap) Delete(key string) {\n\tsm <- commandData{action: REMOVE, key: key}\n}", "func (o ProviderOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Provider) pulumi.StringPtrOutput { return v.PrivateKey }).(pulumi.StringPtrOutput)\n}", "func (k Keeper) delValue(ctx sdk.Context, accessPath *vm_grpc.VMAccessPath) {\n\tstore := ctx.KVStore(k.storeKey)\n\tkey := common_vm.GetPathKey(accessPath)\n\n\tstore.Delete(key)\n}", "func (s *MemorySession) Delete(key string) error {\n\tdelete(s.data, key)\n\treturn nil\n}", "func (db *memorydb) Del(key []byte) error {\n\n\tif db.enableBatch {\n\t\tdb.batch.Del(key)\n\t} else {\n\t\tdb.writeLock <- struct{}{}\n\t\tdefer func() {\n\t\t\t<-db.writeLock\n\t\t}()\n\n\t\tdb.sm.Lock()\n\t\tdefer db.sm.Unlock()\n\n\t\tdelete(db.db, string(key))\n\t}\n\n\treturn nil\n}", "func RemKey(argv0 string, args ...string) error {\n\tfs := flag.NewFlagSet(argv0, flag.ContinueOnError)\n\tfs.Usage = func() {\n\t\tfmt.Fprintf(os.Stderr, \"Usage: %s pubkey\\n\", argv0)\n\t\tfmt.Fprintf(os.Stderr, \"Remove existing signer from hashchain.\\n\")\n\t\tfs.PrintDefaults()\n\t}\n\tverbose := fs.Bool(\"v\", false, \"Be verbose\")\n\tif err := fs.Parse(args); err != nil {\n\t\treturn err\n\t}\n\tif *verbose {\n\t\tlog.Std = log.NewStd(os.Stdout)\n\t}\n\tif fs.NArg() != 1 {\n\t\tfs.Usage()\n\t\treturn flag.ErrHelp\n\t}\n\tif err := secpkg.UpToDate(\"codechain\"); err != nil {\n\t\treturn err\n\t}\n\tpubkey := fs.Arg(0)\n\tpub, err := base64.Decode(pubkey, 32)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot decode pubkey: %s\", err)\n\t}\n\tc, err := hashchain.ReadFile(def.HashchainFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.Close()\n\tvar pubKey [32]byte\n\tcopy(pubKey[:], pub)\n\tline, err := c.RemoveKey(pubKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(line)\n\treturn nil\n}", "func DeleteSession(session *Session) {\r\n\tsessionListMutex.Lock()\r\n\tdefer sessionListMutex.Unlock()\r\n\r\n\tdelete(sessionList, session.Key)\r\n\tfmt.Printf(\"Delete session %d\\n\", session.Key)\r\n}", "func (m *RedisStore) Delete(key interface{}) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tdelete(m.sessionData, key)\n\treturn nil\n}", "func (sim *SessionInterestManager) RemoveSession(ses uint64) []cid.Cid {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// The keys that no session is interested in\n\tdeletedKs := make([]cid.Cid, 0)\n\n\t// For each known key\n\tfor c := range sim.wants {\n\t\t// Remove the session from the list of sessions that want the key\n\t\tdelete(sim.wants[c], ses)\n\n\t\t// If there are no more sessions that want the key\n\t\tif len(sim.wants[c]) == 0 {\n\t\t\t// Clean up the list memory\n\t\t\tdelete(sim.wants, c)\n\t\t\t// Add the key to the list of keys that no session is interested in\n\t\t\tdeletedKs = append(deletedKs, c)\n\t\t}\n\t}\n\n\treturn deletedKs\n}", "func (cfg *Config) PrivateKey() hotstuff.PrivateKey {\n\treturn cfg.privKey\n}", "func PrivateKey(p *big.Int) *big.Int {\n\n\t// calculate the max value to ensure the random number generated\n\t// lies in the range 1 < n < p.\n\tmax := big.NewInt(0)\n\tmax = max.Sub(p, big.NewInt(2))\n\n\t// generate the random number and adjust for the offest applied above\n\tprivKey, _ := rand.Int(rand.Reader, max)\n\tprivKey.Add(privKey, big.NewInt(2))\n\n\treturn privKey\n}", "func deleteAuthKey(ctx context.Context, secretName string) error {\n\t// m is a JSON Patch data structure, see https://jsonpatch.com/ or RFC 6902.\n\tm := []struct {\n\t\tOp string `json:\"op\"`\n\t\tPath string `json:\"path\"`\n\t}{\n\t\t{\n\t\t\tOp: \"remove\",\n\t\t\tPath: \"/data/authkey\",\n\t\t},\n\t}\n\tvar b bytes.Buffer\n\tif err := json.NewEncoder(&b).Encode(m); err != nil {\n\t\treturn err\n\t}\n\treq, err := http.NewRequest(\"PATCH\", fmt.Sprintf(\"/api/v1/namespaces/%s/secrets/%s?fieldManager=tailscale-container\", kubeNamespace, secretName), &b)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json-patch+json\")\n\tif resp, err := doKubeRequest(ctx, req); err != nil {\n\t\tif resp != nil && resp.StatusCode == http.StatusUnprocessableEntity {\n\t\t\t// This is kubernetes-ese for \"the field you asked to\n\t\t\t// delete already doesn't exist\", aka no-op.\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "func (x *Ed25519Credentials) PrivateKey() PrivateKey {\n\n\treturn PrivateKey{\n\t\tAlgorithm: AlgorithmEd25519,\n\t\tPrivate: base64.URLEncoding.EncodeToString(x.Private[:]),\n\t}\n\n}", "func (o SslCertificateSelfManagedSslCertificatePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificate) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func (rc *RedisClient) Del(key string) (int64, error) {\n\tconn := rc.pool.Get()\n\tdefer conn.Close()\n\treply, errDo := conn.Do(\"DEL\", key)\n\tif errDo == nil && reply == nil {\n\t\treturn 0, nil\n\t}\n\tval, err := redis.Int64(reply, errDo)\n\treturn val, err\n}", "func (s *Basememcached_protocolListener) ExitKey(ctx *KeyContext) {}", "func (ms *MemStore) CleanupSessionKeys(t uint64) error {\n\tvar oldKeys []string\n\tfor hash, sk := range ms.sessionKeys {\n\t\tif sk.cleanupTime < t {\n\t\t\toldKeys = append(oldKeys, hash)\n\t\t}\n\t}\n\tfor _, hash := range oldKeys {\n\t\tdelete(ms.sessionKeys, hash)\n\t}\n\treturn nil\n}", "func DEL(key string) (err error) {\n\tconn := pool.Get()\n\tdefer conn.Close()\n\n\t_, err = conn.Do(\"DEL\", key)\n\treturn\n}", "func (kb *Keybase) ExportPrivKey(name, decryptPassphrase, encryptPassphrase string) (armor string, err error) {\n\tkb.mx.Lock()\n\tdefer kb.mx.Unlock()\n\treturn kb.kb.ExportPrivKey(name, decryptPassphrase, encryptPassphrase)\n}", "func (ctx *RequestContext) DeleteSession(key string) {\n\tvars := ctx.token.Claims[\"vars\"].(map[string]interface{})\n\tdelete(vars, key)\n}", "func (s *session) Delete(key interface{}) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\tdelete(s.values, key)\n}", "func PrivateKey(p *big.Int) *big.Int {\n\tkey := new(big.Int)\n\tlimit := new(big.Int).Sub(p, big.NewInt(2))\n\tseed := rand.New(rand.NewSource(time.Now().UnixNano()))\n\treturn key.Rand(seed, limit).Add(key, big.NewInt(2))\n}", "func (p *Parser) Del(key string) {\n\tm, err := p.Map()\n\tif err != nil {\n\t\treturn\n\t}\n\tdelete(m, key)\n}", "func (s *Session) Delete(key string) {\n\t// Better safe than sorry\n\tif s.data == nil {\n\t\treturn\n\t}\n\ts.data.Delete(key)\n}", "func removeSession(sessionId string) error {\n\treturn rd.Del(\"session:\" + sessionId).Err()\n}", "func (cd *ColumnDecryptionProperties) WipeOutDecryptionKey() { cd.key = \"\" }", "func (asr *sessionRegistry) deregister(clt *Client) {\n\tasr.lock.Lock()\n\tdelete(asr.registry, clt.Session.Key)\n\tasr.lock.Unlock()\n}", "func (d *Dao) DelCacheOrderUser(c context.Context, orderID string) (err error) {\n\tconn := d.mc.Get(c)\n\tdefer conn.Close()\n\tkey := orderKey(orderID)\n\tif err = conn.Delete(key); err != nil {\n\t\tif err == memcache.ErrNotFound {\n\t\t\terr = nil\n\t\t\treturn\n\t\t}\n\t\tprom.BusinessErrCount.Incr(\"mc:DelCacheOrderUser\")\n\t\tlog.Errorv(c, log.KV(\"DelCacheOrderUser\", fmt.Sprintf(\"%+v\", err)), log.KV(\"key\", key))\n\t\treturn\n\t}\n\treturn\n}", "func (o SslCertificateSelfManagedSslCertificateResponsePtrOutput) PrivateKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificateSelfManagedSslCertificateResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PrivateKey\n\t}).(pulumi.StringPtrOutput)\n}", "func Unsetenv(key string) error", "func (znp *Znp) ZdoRemoveLinkKey(ieeeAddr string) (rsp *StatusResponse, err error) {\n\treq := &ZdoRemoveLinkKey{IEEEAddr: ieeeAddr}\n\terr = znp.ProcessRequest(unp.C_SREQ, unp.S_ZDO, 0x24, req, &rsp)\n\treturn\n}", "func closeCtx(k *http.Request) {\n\tpk := privateKey(k)\n\tif _, has := internalCtx.Get(pk); has {\n\t\tinternalCtx.Remove(pk)\n\t}\n}", "func NewPopulatedProtoPrivKey(_ randyNet) *ProtoPrivKey {\n\tk, _, _ := crypto.GenerateKeyPair(crypto.RSA, 512)\n\treturn &ProtoPrivKey{PrivKey: k}\n}", "func (d *identityManager) PrivateKey() []byte {\n\treturn d.key.PrivateKey\n}", "func (mm Uint64Uint64Map) Remove(k uint64) {\n\tdelete(mm, k)\n}" ]
[ "0.6715381", "0.6082555", "0.5926367", "0.5817727", "0.5523478", "0.551132", "0.54544395", "0.53445286", "0.530673", "0.52464896", "0.5220689", "0.52179104", "0.5181789", "0.51731354", "0.5166579", "0.51601577", "0.51547384", "0.51293325", "0.51090336", "0.51075536", "0.5104838", "0.5074049", "0.50711066", "0.50655556", "0.5053015", "0.5047415", "0.5041782", "0.50250906", "0.5023838", "0.50167286", "0.49967417", "0.4988325", "0.49725068", "0.4966697", "0.49508908", "0.494796", "0.49424967", "0.49167565", "0.49055684", "0.49051198", "0.489387", "0.48699278", "0.4861168", "0.4859998", "0.4846132", "0.48397592", "0.4836021", "0.483517", "0.48315078", "0.48312572", "0.48287177", "0.482567", "0.48110774", "0.48090157", "0.480747", "0.47996354", "0.47972035", "0.47947544", "0.478797", "0.47829452", "0.477999", "0.4776353", "0.47760895", "0.47752506", "0.47742933", "0.47702393", "0.47589365", "0.47559205", "0.4747116", "0.47469044", "0.47448215", "0.47325483", "0.4725974", "0.47208467", "0.47201958", "0.4718788", "0.47186714", "0.47125617", "0.4710377", "0.470968", "0.4709474", "0.47088873", "0.47054276", "0.4702825", "0.46987978", "0.4695994", "0.46955833", "0.4688246", "0.4686615", "0.46801066", "0.4674314", "0.46572384", "0.46570864", "0.46478516", "0.46476874", "0.4647084", "0.46464705", "0.46437952", "0.46418616", "0.46395755" ]
0.81617534
0
CleanupSessionKeys implemented in memory.
CleanupSessionKeys реализован в памяти.
func (ms *MemStore) CleanupSessionKeys(t uint64) error { var oldKeys []string for hash, sk := range ms.sessionKeys { if sk.cleanupTime < t { oldKeys = append(oldKeys, hash) } } for _, hash := range oldKeys { delete(ms.sessionKeys, hash) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SessionCleanup() {\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(SessionManager.SessionCleanupTime * time.Minute):\n\t\t\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t\t\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\t\t\tss := make(map[string]*Session, 0) // here's the new Session list\n\t\t\tn := 0 // total number removed\n\t\t\tfor k, v := range Sessions { // look at every Session\n\t\t\t\tif time.Now().After(v.Expire) { // if it's still active...\n\t\t\t\t\tn++ // removed another\n\t\t\t\t} else {\n\t\t\t\t\tss[k] = v // ...copy it to the new list\n\t\t\t\t}\n\t\t\t}\n\t\t\tSessions = ss // set the new list\n\t\t\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\t\t\t//fmt.Printf(\"SessionCleanup completed. %d removed. Current Session list size = %d\\n\", n, len(Sessions))\n\t\t}\n\t}\n}", "func (b *BaseHandler) CleanSession() {\n\tb.sessionStore.Clean(b)\n}", "func (u *CryptohomeClient) CleanupSession(ctx context.Context, authSessionID string) error {\n\t// Kill the AuthSession.\n\tif _, err := u.binary.invalidateAuthSession(ctx, authSessionID); err != nil {\n\t\treturn errors.Wrap(err, \"failed to invaldiate AuthSession\")\n\t}\n\t// Clean up obsolete state, in case there's any.\n\tif err := u.UnmountAll(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmount vaults for cleanup\")\n\t}\n\treturn nil\n}", "func (sess Session) Clear() {\n\tfor k, _ := range sess {\n\t\tdelete(sess, k)\n\t}\n}", "func (m *MemoryStorer) Clean() {\n\tt := time.Now().UTC()\n\tm.mut.Lock()\n\tfor id, session := range m.sessions {\n\t\tif t.After(session.expires) {\n\t\t\tdelete(m.sessions, id)\n\t\t}\n\t}\n\tm.mut.Unlock()\n}", "func PurgeSessions() {\n\tsessions.Lock()\n\tdefer sessions.Unlock()\n\n\t// Update all sessions in the database.\n\tfor id, session := range sessions.sessions {\n\t\tPersistence.SaveSession(id, session)\n\t\t// We only do this to update the last access time. Errors are not that\n\t\t// bad.\n\t}\n\n\tsessions.sessions = make(map[string]*Session, MaxSessionCacheSize)\n}", "func (this *SessionStorage) StopClearingSessions() {\n this.done<-true\n}", "func (r *Redis) Cleanup() {\n\tos.RemoveAll(\"/tmp/go-harness\")\n}", "func CleanupSessions(path string, age time.Duration) error {\n\tfsMutex.Lock()\n\tdefer fsMutex.Unlock()\n\n\tfiles, err := ioutil.ReadDir(path)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, fi := range files {\n\t\tif age > 0 {\n\t\t\tmin := time.Now().Add(-age).UnixNano()\n\t\t\tif fi.ModTime().UnixNano() >= min {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif err := os.Remove(filepath.Join(path, fi.Name())); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *CacheLastPasswordSent) cleanup() {\n\ttickEvery := time.NewTicker(1 * time.Minute)\n\tdefer tickEvery.Stop()\n\n\tclearOutAfter := time.Duration(10 * time.Minute)\n\nLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-s.stop:\n\t\t\tbreak Loop\n\t\tcase <-tickEvery.C:\n\t\t}\n\n\t\ts.mu.Lock()\n\t\tnow := time.Now().UTC()\n\t\tfor key, t := range s.data {\n\t\t\tif now.Sub(t) >= clearOutAfter {\n\t\t\t\tdelete(s.data, key)\n\t\t\t}\n\t\t}\n\t\ts.mu.Unlock()\n\t}\n}", "func (k *Keys) Clean() {\n\tif k != nil {\n\t\tif k.Admin != nil {\n\t\t\tk.Admin.Clean()\n\t\t\tk.Admin = nil\n\t\t}\n\t\tif k.Server != nil {\n\t\t\tk.Server.Clean()\n\t\t\tk.Server = nil\n\t\t}\n\t\tk.Nonce = nil\n\t}\n}", "func (s *session) Clear() {\n\ts.mu.Lock()\n\tfor key := range s.values {\n\t\tdelete(s.values, key)\n\t}\n\ts.mu.Unlock()\n\ts.provider.update(s.sid)\n}", "func (c *ChallengeProvider) CleanUp(ctx context.Context, _ acme.Challenge) error {\n\tfor _, s := range c.servers {\n\t\ts.PersonalKeyAuth = \"\"\n\t}\n\treturn nil\n}", "func (s *Sessions) CleanExpired() {\n\tsessForKill := []string{}\n\n\ts.RLock()\n\tfor k, v := range s.sessions {\n\t\t// if time.Now().Unix()-v.LastActivity >= int64(cfg.SessionLifeTime) {\n\t\t// \tdelete(s.sessions, k)\n\t\t// }\n\t\tif time.Now().After(time.Unix(v.LastActivity, 0).Add(time.Duration(cfg.SessionLifeTime) * time.Second)) {\n\t\t\tsessForKill = append(sessForKill, k)\n\t\t}\n\t}\n\ts.RUnlock()\n\n\tfor _, sessID := range sessForKill {\n\t\ts.DelByID(sessID)\n\t}\n}", "func (manager *KeysManager) Clear() {\n\tmanager.KeyList = make([]*jose.JSONWebKey, 0)\n\tmanager.KeyMap = make(map[string]*jose.JSONWebKey)\n}", "func (ConsumerGroupHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }", "func (s *s6aProxy) cleanupSession(sid string) chan interface{} {\n\ts.sessionsMu.Lock()\n\toldCh, ok := s.sessions[sid]\n\tif ok {\n\t\tdelete(s.sessions, sid)\n\t\ts.sessionsMu.Unlock()\n\t\tif oldCh != nil {\n\t\t\tclose(oldCh)\n\t\t}\n\t\treturn oldCh\n\t}\n\ts.sessionsMu.Unlock()\n\treturn nil\n}", "func (s *session) DeleteAll() {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\ts.values = SessionValues{}\n}", "func (mp *Provider) GC() {\n\tfor _, kv := range mp.memoryDB.D {\n\t\tstore := kv.Value.(*Store)\n\t\texpiration := store.GetExpiration()\n\t\t// Do not expire the session if expiration is set to 0\n\t\tif expiration == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif time.Now().Unix() >= (store.lastActiveTime + int64(expiration)) {\n\t\t\tmp.Destroy(kv.Key)\n\t\t}\n\t}\n}", "func (p *Kafka) Cleanup(sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func (d *Abstraction) CloseSession() {\n\tfor k, v := range d.Sigmap {\n\t\tdelete(d.Sigmap, k)\n\t\tclose(v)\n\t}\n\td.Conn.RemoveSignal(d.Recv)\n\td.Conn.Close()\n}", "func (pdr *ProviderMySQL) SessionGC() {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\t_, err := c.Exec(\"DELETE from \"+TableName+\" where session_expiry < ?\", time.Now().Unix()-pdr.lifetime)\n\tif err != nil {\n\t\tsession.SLogger.Println(err)\n\t}\n}", "func cleanup() {\n\tserver.Applications = []*types.ApplicationMetadata{}\n}", "func (ks *MemoryStore) RemoveAll() (err error) {\n\n\tfor key := range ks.Keys {\n\t\tdelete(ks.Keys, key)\n\t}\n\n\treturn\n}", "func (pp *Provider) GC() {\n\tpp.sessionDao.deleteSessionByMaxLifeTime(pp.maxLifeTime)\n}", "func (this *SessionStorage) StartClearingSessions() {\n go func() {\n for {\n select {\n case <-this.done:\n break\n default:\n this.cleanUp()\n time.Sleep(this.config.ClearInterval)\n }\n }\n }()\n}", "func (m *SqliteStore) cleanup(sessionName string, interval time.Duration, quit <-chan struct{}, done chan<- struct{}) {\n\tticker := time.NewTicker(interval)\n\n\tdefer func() {\n\t\tticker.Stop()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-quit:\n\t\t\t// Handle the quit signal.\n\t\t\tdone <- struct{}{}\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\t// Delete expired sessions on each tick.\n\t\t\terr := m.deleteExpiredSessions(sessionName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Unable to delete expired sessions: \", err.Error())\n\t\t\t}\n\t\t}\n\t}\n}", "func SessionDeleteAll() (err error) {\n\t_, err = Db.Exec(\"DELETE FROM sessions\")\n\treturn\n}", "func RemoveSessions() {\n\tus := models.UserSession{}\n\tc := dbSession.Find(bson.M{}).Iter()\n\tfor c.Next(&us) {\n\t\tif time.Now().Sub(us.CreatedAt).Seconds() >= 3600 {\n\t\t\tdbSession.Remove(struct{ UUID string }{UUID: string(us.UUID)})\n\t\t\tfmt.Println(\"dropping sessions...\")\n\t\t}\n\t}\n\tif err := c.Close(); err != nil {\n\t\tfmt.Println(\"Iterations completed\")\n\t\treturn\n\t}\n\tfmt.Println(\"Closed successfully\")\n}", "func Cleanup() {\n\tif pkcs11Ctx != nil {\n\t\tcommon.FinalizeAndDestroy(pkcs11Ctx)\n\t\tpkcs11Ctx = nil\n\t}\n}", "func (consumer *KafkaConsumer) Cleanup(sarama.ConsumerGroupSession) error {\n\tlog.Info().Msg(\"new session has been finished\")\n\treturn nil\n}", "func (authSvc *AuthService) clearAllSessions() {\n\tauthSvc.Sessions = make(map[string]*apitypes.Credentials)\n}", "func (hc *httpContext) clearSession() {\n\tsession := hc.getSession()\n\tif session == nil {\n\t\treturn\n\t}\n\n\tsession.Values[sv[\"provider\"]] = nil\n\tsession.Values[sv[\"name\"]] = nil\n\tsession.Values[sv[\"email\"]] = nil\n\tsession.Values[sv[\"user\"]] = nil\n\tsession.Values[sv[\"token\"]] = nil\n\n\thc.saveSession(session)\n}", "func (m *memoryStorage) sessionChecker() {\n\tfor {\n\t\tm.mutex.Lock()\n\t\tfor sessionID, v := range m.sessions {\n\t\t\tif v.expires < time.Now().Unix() {\n\t\t\t\tdelete(m.sessions, sessionID)\n\t\t\t}\n\t\t}\n\t\tfor nonce, expires := range m.nonces {\n\t\t\tif time.Now().After(expires) {\n\t\t\t\tdelete(m.nonces, nonce)\n\t\t\t}\n\t\t}\n\t\tm.mutex.Unlock()\n\t\ttime.Sleep(sessionCheckInterval * time.Second)\n\t}\n}", "func (rndr *Renderer) idleNATSessionCleanup() {\n\t// run only if requested\n\tif !rndr.Config.CleanupIdleNATSessions {\n\t\treturn\n\t}\n\n\ttcpTimeout := time.Duration(rndr.Config.TCPNATSessionTimeout) * time.Minute\n\totherTimeout := time.Duration(rndr.Config.OtherNATSessionTimeout) * time.Minute\n\tif tcpTimeout == 0 {\n\t\ttcpTimeout = defaultIdleTCPTimeout\n\t}\n\tif otherTimeout == 0 {\n\t\totherTimeout = defaultIdleOtherTimeout\n\t}\n\n\trndr.Log.Infof(\"NAT session cleanup enabled, TCP timeout=%v, other timeout=%v.\", tcpTimeout, otherTimeout)\n\n\t// register gauges\n\trndr.Stats.RegisterGaugeFunc(\"tcpNatSessions\", \"Total count of TCP NAT sessions\", tcpNatSessionsGauge)\n\trndr.Stats.RegisterGaugeFunc(\"otherNatSessions\", \"Total count of non-TCP NAT sessions\", otherNatSessionsGauge)\n\trndr.Stats.RegisterGaugeFunc(\"deletedTCPNatSessions\", \"Total count of deleted TCP NAT sessions\", deletedTCPNatSessionsGauge)\n\trndr.Stats.RegisterGaugeFunc(\"deletedOtherNatSessions\", \"Total count of deleted non-TCP NAT sessions\", deletedOtherNatSessionsGauge)\n\trndr.Stats.RegisterGaugeFunc(\"natSessionDeleteErrors\", \"Count of errors by NAT session delete\", natSessionDeleteErrorsGauge)\n\n\t// VPP counts the time from 0 since its start. Let's assume it is now\n\t// (it shouldn't be more than few seconds since its start).\n\tzeroTime := time.Now()\n\n\tfor {\n\t\t<-time.After(otherTimeout)\n\n\t\trndr.Log.Debugf(\"NAT session cleanup started.\")\n\n\t\tnatUsers := make([]*nat_api.Nat44UserDetails, 0)\n\t\tdelRules := make([]*nat_api.Nat44DelSession, 0)\n\t\tvar tcpCount uint64\n\t\tvar otherCount uint64\n\n\t\t// dump NAT users\n\t\treq1 := &nat_api.Nat44UserDump{}\n\t\treqCtx1 := rndr.GoVPPChan.SendMultiRequest(req1)\n\t\tfor {\n\t\t\tmsg := &nat_api.Nat44UserDetails{}\n\t\t\tstop, err := reqCtx1.ReceiveReply(msg)\n\t\t\tif stop {\n\t\t\t\tbreak // break out of the loop\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\trndr.Log.Errorf(\"Error by dumping NAT users: %v\", err)\n\t\t\t}\n\t\t\tnatUsers = append(natUsers, msg)\n\t\t}\n\n\t\t// dump NAT sessions per user\n\t\tfor _, natUser := range natUsers {\n\t\t\treq2 := &nat_api.Nat44UserSessionDump{\n\t\t\t\tIPAddress: natUser.IPAddress,\n\t\t\t\tVrfID: natUser.VrfID,\n\t\t\t}\n\t\t\treqCtx2 := rndr.GoVPPChan.SendMultiRequest(req2)\n\n\t\t\tfor {\n\t\t\t\tmsg := &nat_api.Nat44UserSessionDetails{}\n\t\t\t\tstop, err := reqCtx2.ReceiveReply(msg)\n\t\t\t\tif stop {\n\t\t\t\t\tbreak // break out of the loop\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\trndr.Log.Errorf(\"Error by dumping NAT sessions: %v\", err)\n\t\t\t\t}\n\t\t\t\tif msg.Protocol == 6 {\n\t\t\t\t\ttcpCount++\n\t\t\t\t} else {\n\t\t\t\t\totherCount++\n\t\t\t\t}\n\n\t\t\t\tlastHeard := zeroTime.Add(time.Duration(msg.LastHeard) * time.Second)\n\t\t\t\tif lastHeard.Before(time.Now()) {\n\t\t\t\t\tif (msg.Protocol == 6 && time.Since(lastHeard) > tcpTimeout) ||\n\t\t\t\t\t\t(msg.Protocol != 6 && time.Since(lastHeard) > otherTimeout) {\n\t\t\t\t\t\t// inactive session\n\t\t\t\t\t\tdelRule := &nat_api.Nat44DelSession{\n\t\t\t\t\t\t\tIsIn: 1,\n\t\t\t\t\t\t\tAddress: msg.InsideIPAddress,\n\t\t\t\t\t\t\tPort: msg.InsidePort,\n\t\t\t\t\t\t\tProtocol: uint8(msg.Protocol),\n\t\t\t\t\t\t\tVrfID: natUser.VrfID,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif msg.ExtHostValid > 0 {\n\t\t\t\t\t\t\tdelRule.ExtHostValid = 1\n\n\t\t\t\t\t\t\tif msg.IsTwicenat > 0 {\n\t\t\t\t\t\t\t\tdelRule.ExtHostAddress = msg.ExtHostNatAddress\n\t\t\t\t\t\t\t\tdelRule.ExtHostPort = msg.ExtHostNatPort\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelRule.ExtHostAddress = msg.ExtHostAddress\n\t\t\t\t\t\t\t\tdelRule.ExtHostPort = msg.ExtHostPort\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdelRules = append(delRules, delRule)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\trndr.Log.Debugf(\"There are %d TCP / %d other NAT sessions, %d will be deleted\", tcpCount, otherCount, len(delRules))\n\t\tatomic.StoreUint64(&tcpNatSessionCount, tcpCount)\n\t\tatomic.StoreUint64(&otherNatSessionCount, otherCount)\n\n\t\t// delete the old sessions\n\t\tfor _, r := range delRules {\n\t\t\tmsg := &nat_api.Nat44DelSessionReply{}\n\t\t\terr := rndr.GoVPPChan.SendRequest(r).ReceiveReply(msg)\n\t\t\tif err != nil || msg.Retval != 0 {\n\t\t\t\trndr.Log.Warnf(\"Error by deleting NAT session: %v, retval=%d, req: %v\", err, msg.Retval, r)\n\t\t\t\tatomic.AddUint64(&natSessionDeleteErrorCount, 1)\n\t\t\t} else {\n\t\t\t\tif r.Protocol == 6 {\n\t\t\t\t\tatomic.AddUint64(&deletedTCPNatSessionCount, 1)\n\t\t\t\t\tatomic.StoreUint64(&tcpNatSessionCount, atomic.LoadUint64(&tcpNatSessionCount)-1)\n\t\t\t\t} else {\n\t\t\t\t\tatomic.AddUint64(&deletedOtherNatSessionCount, 1)\n\t\t\t\t\tatomic.StoreUint64(&otherNatSessionCount, atomic.LoadUint64(&otherNatSessionCount)-1)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *SessionManager) UpdateSessionKeys(authKey, cryptKey []byte) {\n\ts.Store = sessions.NewCookieStore(authKey, cryptKey)\n}", "func cleanup() {\n\tlog.Verbose(\"Cleaning up sensitive and temp files\")\n\tif _, err := os.Stat(\"ca.crt\"); err == nil {\n\t\tdeleteFile(\"ca.crt\")\n\t}\n\n\tif _, err := os.Stat(\"ca.key\"); err == nil {\n\t\tdeleteFile(\"ca.key\")\n\t}\n\n\tif _, err := os.Stat(\"client.crt\"); err == nil {\n\t\tdeleteFile(\"client.crt\")\n\t}\n\n\tif _, err := os.Stat(\"bearer.token\"); err == nil {\n\t\tdeleteFile(\"bearer.token\")\n\t}\n\n\tfor _, app := range s.Apps {\n\t\tif _, err := os.Stat(app.SecretsFile + \".dec\"); err == nil {\n\t\t\tdeleteFile(app.SecretsFile + \".dec\")\n\t\t}\n\t\tfor _, secret := range app.SecretsFiles {\n\t\t\tif _, err := os.Stat(secret + \".dec\"); err == nil {\n\t\t\t\tdeleteFile(secret + \".dec\")\n\t\t\t}\n\t\t}\n\t}\n\n}", "func (h *ConsumerGroupHandler) Cleanup(sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func delayUnregister(session *model.Session) {\n\ttime.Sleep(time.Second * 5)\n\t//TODO do something better perhaps a seperate queue for the messages that will be deleted.\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\tdelete(tokenAvailable, session.SessionToken)\n\tdelete(sessionCache, session.SocketID)\n\tdelete(userCache, session.UserID)\n\tmodel.DB().Delete(session) //Remove the session\n\n}", "func (c *Cache) cleanup(ttl time.Duration) {\n\tvalids := map[string]*cacheEntry{}\n\tnow := time.Now()\n\tfor token, entry := range c.entries {\n\t\tif entry.jwt.IsValid(c.leeway) {\n\t\t\tif entry.accessed.Add(ttl).After(now) {\n\t\t\t\t// Everything fine.\n\t\t\t\tvalids[token] = entry\n\t\t\t}\n\t\t}\n\t}\n\tc.entries = valids\n}", "func (rp *Provider) SessionGC(ctx context.Context) {\n}", "func (c *Cache) CleanupExpired() {\n\tgo func() {\n\t\tfor {\n\t\t\tfor k, v := range c.Map {\n\t\t\t\tif v.RegTime.Add(time.Minute * 1).Before(time.Now()) {\n\t\t\t\t\tc.Remove(k)\n\t\t\t\t}\n\t\t\t}\n\t\t\ttime.Sleep(time.Second * 10)\n\t\t}\n\t}()\n}", "func (ch MqtConsumerGroupHandler) Cleanup(session sarama.ConsumerGroupSession) error {\n\tch.logger.With(\n\t\tzap.String(\"trigger\", ch.trigger.ObjectMeta.Name),\n\t\tzap.String(\"topic\", ch.trigger.Spec.Topic),\n\t\tzap.String(\"memberID\", session.MemberID()),\n\t\tzap.Int32(\"generationID\", session.GenerationID()),\n\t\tzap.String(\"claims\", fmt.Sprintf(\"%v\", session.Claims())),\n\t).Info(\"consumer group session cleanup\")\n\treturn nil\n}", "func (sess Session) Del(key string) {\n\tdelete(sess, key)\n}", "func DeleteAllOtherSessionsForUser(ctx context.Context, userID, keepSessionID int64) error {\r\n\tq := datastore.NewQuery(SessionTable).Filter(\"UserID =\", userID).KeysOnly()\r\n\tit := q.Run(ctx)\r\n\tfor {\r\n\t\tkey, err := it.Next(nil)\r\n\t\tif err == datastore.Done {\r\n\t\t\tbreak\r\n\t\t} else if err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\t\tif key.IntID() != keepSessionID {\r\n\t\t\tretrievable.DeleteEntity(ctx, key)\r\n\t\t}\r\n\t}\r\n\treturn nil\r\n}", "func (pm partitionMap) cleanup() {\n\tfor ns, partitions := range pm {\n\t\tfor i := range partitions.Replicas {\n\t\t\tfor j := range partitions.Replicas[i] {\n\t\t\t\tpartitions.Replicas[i][j] = nil\n\t\t\t}\n\t\t\tpartitions.Replicas[i] = nil\n\t\t}\n\n\t\tpartitions.Replicas = nil\n\t\tpartitions.regimes = nil\n\n\t\tdelete(pm, ns)\n\t}\n}", "func (p *PostgresProvider) GC() {\n\tif _, err := p.c.Exec(\"DELETE FROM session WHERE EXTRACT(EPOCH FROM NOW()) - expiry > $1\", p.maxlifetime); err != nil {\n\t\tlog.Printf(\"session/postgres: error garbage collecting: %v\", err)\n\t}\n}", "func (a *LocalKeyAgent) UnloadKeys() error {\n\tagents := []agent.Agent{a.Agent}\n\tif a.sshAgent != nil {\n\t\tagents = append(agents, a.sshAgent)\n\t}\n\n\t// iterate over all agents we have\n\tfor _, agent := range agents {\n\t\t// get a list of all keys in the agent\n\t\tkeyList, err := agent.List()\n\t\tif err != nil {\n\t\t\ta.log.Warnf(\"Unable to communicate with agent and list keys: %v\", err)\n\t\t}\n\n\t\t// remove any teleport keys we currently have loaded in the agent\n\t\tfor _, key := range keyList {\n\t\t\tif strings.HasPrefix(key.Comment, \"teleport:\") {\n\t\t\t\terr = agent.Remove(key)\n\t\t\t\tif err != nil {\n\t\t\t\t\ta.log.Warnf(\"Unable to communicate with agent and remove key: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (session *Session) DestroyAllKeys() error {\n\tif session == nil || session.Ctx == nil {\n\t\treturn fmt.Errorf(\"session not initialized\")\n\t}\n\tdeleteTemplate := []*pkcs11.Attribute{\n\t\t//NewAttribute(CKA_KEY_TYPE, CKK_RSA),\n\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, session.Label),\n\t}\n\tobjects, err := session.FindObject(deleteTemplate)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(objects) > 0 {\n\t\tsession.Log.Printf(\"Keys found. Deleting...\\n\")\n\t\tfoundDeleteTemplate := []*pkcs11.Attribute{\n\t\t\tpkcs11.NewAttribute(pkcs11.CKA_LABEL, nil),\n\t\t\tpkcs11.NewAttribute(pkcs11.CKA_ID, nil),\n\t\t\tpkcs11.NewAttribute(pkcs11.CKA_CLASS, nil),\n\t\t}\n\n\t\tfor _, object := range objects {\n\t\t\tattr, _ := session.Ctx.GetAttributeValue(session.Handle, object, foundDeleteTemplate)\n\t\t\tclass := \"unknown\"\n\t\t\tif uint(attr[2].Value[0]) == pkcs11.CKO_PUBLIC_KEY {\n\t\t\t\tclass = \"public\"\n\t\t\t} else if uint(attr[2].Value[0]) == pkcs11.CKO_PRIVATE_KEY {\n\t\t\t\tclass = \"private\"\n\t\t\t}\n\t\t\tsession.Log.Printf(\"Deleting key with label=%s, id=%s and type=%s\\n\", string(attr[0].Value), string(attr[1].Value), class)\n\n\t\t\tif e := session.Ctx.DestroyObject(session.Handle, object); e != nil {\n\t\t\t\tsession.Log.Printf(\"Destroy Key failed %s\\n\", e)\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn fmt.Errorf(\"no keys found\")\n\t}\n\treturn nil\n}", "func (h *consumerHandlerImpl) Cleanup(sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func ClearSessionAPIKey(session *sessions.Session) {\n\tsessionClear(session, sessionKeyAPIKey)\n}", "func (mgr *MemorySessionManager) GarbageCollection() {\n\tfor k, v := range mgr.sessions {\n\t\tif v.isExpired() {\n\t\t\tdelete(mgr.sessions, k)\n\t\t}\n\t}\n\ttime.AfterFunc(time.Duration(gcTimeInterval)*time.Second, mgr.GarbageCollection)\n}", "func (s ec2sessions) DeleteExpiredInstances() {\n\tfor _, session := range s.sessions {\n\t\tsession.deleteExpiredInstances()\n\t}\n}", "func garbageCleaner() {\n\tfor _ = range time.Tick(1 * time.Minute) {\n\t\tstorage.Cleanup()\n\t}\n}", "func (handlerMapConsumerGroupHandler) Cleanup(_ sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func (*ConsumerGroupHandler) Cleanup(_ sarama.ConsumerGroupSession) error {\n\tlog.Infof(\"ConsumerGroupHandler.Cleanup() - start\")\n\tdefer log.Infof(\"ConsumerGroupHandler.Cleanup() - end\")\n\n\treturn nil\n}", "func (s PgTokenStore) Cleanup() *model.AppErr {\n\tif _, err := s.db.Exec(\"DELETE FROM public.token\"); err != nil {\n\t\treturn model.NewAppErr(\"PgTokenStore.Cleanup\", model.ErrInternal, locale.GetUserLocalizer(\"en\"), msgCleanup, http.StatusInternalServerError, nil)\n\t}\n\treturn nil\n}", "func cleanSessionsHandler(w http.ResponseWriter, req *http.Request, _ httprouter.Params, session *SessionData) {\n\tsessions.CleanSessions()\n\thttp.Redirect(w, req, \"/\", http.StatusSeeOther)\n}", "func (privKey *YubiHsmPrivateKey) UnloadYubiHsmPrivKey() {\n\tif privKey.sessionMgr == nil {\n\t\treturn\n\t}\n\tprivKey.sessionMgr.Destroy()\n}", "func maintainer() {\n\tconst SESSION_TIME_LIMIT = 3600 // seconds\n\n\tfor {\n\t\ttime.Sleep(5 * time.Second)\n\t\tnow := timestamp()\n\n\t\t/* user challenges */\n\t\tfor key, user_challenge := range global_user_challenges {\n\t\t\tif now > user_challenge.expire_timestamp {\n\t\t\t\tdelete(global_user_challenges, key)\n\t\t\t}\n\t\t}\n\n\t\t/* sessions */\n\t\tfor key, user_session := range global_user_sessions {\n\t\t\tif now > user_session.lastcheck_timestamp+SESSION_TIME_LIMIT {\n\t\t\t\tdelete(global_user_sessions, key)\n\t\t\t}\n\t\t}\n\t}\n}", "func SessionGC() {\n\t// Lock and defer unlock of session map\n\tSessionMapLock.Lock()\n\tdefer SessionMapLock.Unlock()\n\n\tlogging.Debug(&map[string]string{\n\t\t\"file\": \"session.go\",\n\t\t\"Function\": \"SessionGC\",\n\t\t\"event\": \"Run garbage collector job\",\n\t})\n\n\t// Destory session if last access older than configured session lifetime\n\tfor SID, value := range SessionMap {\n\t\tif value.TimeAccessed.Add(time.Duration(config.SessionLifetime)*time.Minute).Unix() <= time.Now().Unix() {\n\t\t\tSessionDestroy(SID)\n\t\t}\n\t}\n\n\t// Wait one minute to repeat job\n\ttime.AfterFunc(time.Duration(config.SessionLifetime+1)*time.Minute, func() { SessionGC() })\n}", "func (s *Session) Reset() {\n\n\ts.root.SetAPIKey(\"\")\n\n\tcurrentSession = nil\n}", "func ClearSavedSitemaps() {\n\tsavedSitemaps = []string{}\n}", "func Unsetenv(key string) error", "func (sta StandardAuthenticator) DestroySession(sessionId string) error {\n\treturn nil\n}", "func (dc *dc) Cleanup(session sarama.ConsumerGroupSession) error {\n\treturn nil\n}", "func (*adminCtrl) cleanSessionByID(c *elton.Context) (err error) {\n\tstore := cache.GetRedisSession()\n\terr = store.Destroy(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tc.NoContent()\n\treturn\n}", "func (p *MongodbProvider) GC() {\n\tdiff := time.Now().Unix() - p.expire\n\t_, err := p.c.RemoveAll(bson.M{\"expiry\": bson.M{\"$lt\": diff}})\n\tif err != nil {\n\t\tlog.Printf(\"session/mgoSession: error garbage collecting: %v\", err)\n\t}\n}", "func (t *DRMAATracker) DestroySession() error {\n\treturn t.session.Exit()\n}", "func deleteAllSessions(clientset kubernetes.Interface, namespace string) {\n\tsessionSecret := &corev1.Secret{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"v1\",\n\t\t\tKind: \"Secret\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: util.SessionsSecretName,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: types.GetKotsadmLabels(),\n\t\t},\n\t\tData: map[string][]byte{},\n\t}\n\n\t_, err := clientset.CoreV1().Secrets(namespace).Update(context.TODO(), sessionSecret, metav1.UpdateOptions{})\n\tif err != nil {\n\t\t// as the password is already changed, log the error but don't fail (false positive case)\n\t\tlogger.Errorf(\"failed to delete all sessions: %s\", namespace, util.SessionsSecretName, err)\n\t}\n}", "func (c *Core) teardownPolicyStore() error {\n\tc.policyStore = nil\n\treturn nil\n}", "func (o *VirtualSessionProvider) GC() {\n\to.provider.GC()\n}", "func CleanupMongoSession() {\n\tif mongo == nil {\n\t\treturn\n\t}\n\tmongo.Close()\n\ttime.Sleep(time.Second)\n\n\tmongo = nil\n}", "func ClearSessions(db AutoscopeDB, duration int64) error {\n\t//TODO\n\treturn nil\n}", "func (db *PgDB) initTaskSessions() error {\n\t_, err := db.sql.Exec(\"DELETE FROM task_sessions\")\n\treturn err\n}", "func cleanExit(code int) {\n\tif *verbose {\n\t\tfmt.Println(\"Cleaning up private keys\")\n\t}\n\tfor k := range keys {\n\t\tsys.ClearBuffer(keys[k].Key)\n\t}\n\tif type2_secret != nil {\n\t\tsys.ClearBuffer(type2_secret)\n\t}\n\tos.Exit(code)\n}", "func AppStateCleanup(instanceName string) {\n\tmongo.DeleteInstance(types.M{\n\t\tmongo.NameKey: instanceName,\n\t\tmongo.InstanceTypeKey: mongo.AppInstance,\n\t})\n\tredis.RemoveApp(instanceName)\n}", "func (m *MemoryStorer) Del(key string) error {\n\tm.mut.Lock()\n\tdelete(m.sessions, key)\n\tm.mut.Unlock()\n\n\treturn nil\n}", "func (m *mapper) cleanup() {\n\tlevel.Info(m.logger).Log(\"msg\", \"cleaning up mapped rules directory\", \"path\", m.Path)\n\n\tusers, err := m.users()\n\tif err != nil {\n\t\tlevel.Error(m.logger).Log(\"msg\", \"unable to read rules directory\", \"path\", m.Path, \"err\", err)\n\t\treturn\n\t}\n\n\tfor _, u := range users {\n\t\tm.cleanupUser(u)\n\t}\n}", "func cleanSSHKeyPaths() error {\n\toldKeyExists, err := fileExists(constants.RHCOS8SSHKeyPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !oldKeyExists {\n\t\treturn nil\n\t}\n\n\tif err := os.RemoveAll(constants.RHCOS8SSHKeyPath); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove path '%s': %w\", constants.RHCOS8SSHKeyPath, err)\n\t}\n\n\treturn nil\n}", "func (b *BoltAuthRepository) CleanUp() {\n\tb.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(b.bucket))\n\t\tc := b.Cursor()\n\t\tvar toDelete [][]byte\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\tvar tkn models.Token\n\t\t\tif json.Unmarshal(v, &tkn) != nil {\n\t\t\t\t// Prevents password from being cleaned with tokens.\n\t\t\t\t//\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfmt.Printf(\"key=%s, value=%s\\n\", k, tkn.Expires)\n\t\t\tif tkn.Expires.Before(time.Now()) {\n\t\t\t\ttoDelete = append(toDelete, k)\n\t\t\t}\n\t\t}\n\t\tfor _, key := range toDelete {\n\t\t\tb.Delete(key)\n\t\t}\n\t\treturn nil\n\t})\n}", "func (ms *MemStore) DelPrivSessionKey(hash string) error {\n\tsk, ok := ms.sessionKeys[hash]\n\tif !ok {\n\t\treturn nil\n\t}\n\tsk.privKey = \"\"\n\treturn nil\n}", "func Clean(sessions []session) []session {\n\tlist := make([]session, 0)\n\tfor _, s := range sessions {\n\t\tif s.Alive() {\n\t\t\tlist = append(list, s)\n\t\t}\n\t}\n\treturn list\n}", "func CleanupTestHarness() {\n\tcleanupCerts()\n}", "func (manager *SessionManager) GC() {\n\tmanager.provider.SessionGC()\n\ttime.AfterFunc(time.Duration(manager.config.GcLifetime)*time.Second, func() { manager.GC() })\n}", "func (tk *memSessionTokenKeeper) Clear() {\n\ttk.mutex.Lock()\n\tdefer tk.mutex.Unlock()\n\ttk.userTokens = make(map[string]string)\n}", "func (be *s3) removeKeys(t backend.Type) error {\n\tdone := make(chan struct{})\n\tdefer close(done)\n\tfor key := range be.List(backend.Data, done) {\n\t\terr := be.Remove(backend.Data, key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *SessionStore) Delete() {\n\ts.session.Options.MaxAge = -1\n}", "func RemoveSession(ctxid int64) {\n\tdelete(sessionBuf, ctxid)\n}", "func (d *Daemon) Cleanup() error {\n\tif d.backend != nil {\n\t\td.backend.deleteAllStatus()\n\t}\n\tif err := os.Remove(util.DefaultRSAKeyPath); err != nil {\n\t\tlogrus.Info(\"Delete key failed\")\n\t}\n\td.deleteAllBuilders()\n\td.localStore.CleanContainers()\n\t_, err := d.localStore.Shutdown(false)\n\treturn err\n}", "func (ds *DictService) GC() {\n\tfor _, dict := range ds.dicts {\n\t\tdict.MDXHandler.Destroy()\n\t\tfor _, mdd := range dict.MDDHandler {\n\t\t\tmdd.Destroy()\n\t\t}\n\t}\n}", "func (r *SmscSessionRepository) DeleteAll() error {\n\tids := make([]string, 0)\n\terr := app.BuntDBInMemory.View(func(tx *buntdb.Tx) error {\n\t\treturn tx.Ascend(SMSC_SESSION_PREFIX, func(key, value string) bool {\n\t\t\tids = append(ids, key)\n\t\t\treturn true\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn app.BuntDBInMemory.Update(func(tx *buntdb.Tx) error {\n\t\tfor _, id := range ids {\n\t\t\t_, err := tx.Delete(id)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "func destroy() {\n\tif unique.natsconn != nil {\n\t\tunique.natsconn.Close()\n\t}\n\tfor _, dict := range unique.mdb {\n\t\tdict.Close()\n\t}\n\tunique = nil\n}", "func (ce *ColumnEncryptionProperties) WipeOutEncryptionKey() { ce.key = \"\" }", "func (session *SafeSession) Reset() {\n\tsession.mu.Lock()\n\tdefer session.mu.Unlock()\n\tsession.Session.InTransaction = false\n\tsession.ShardSessions = nil\n}", "func (sim *SessionInterestManager) RemoveSession(ses uint64) []cid.Cid {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// The keys that no session is interested in\n\tdeletedKs := make([]cid.Cid, 0)\n\n\t// For each known key\n\tfor c := range sim.wants {\n\t\t// Remove the session from the list of sessions that want the key\n\t\tdelete(sim.wants[c], ses)\n\n\t\t// If there are no more sessions that want the key\n\t\tif len(sim.wants[c]) == 0 {\n\t\t\t// Clean up the list memory\n\t\t\tdelete(sim.wants, c)\n\t\t\t// Add the key to the list of keys that no session is interested in\n\t\t\tdeletedKs = append(deletedKs, c)\n\t\t}\n\t}\n\n\treturn deletedKs\n}", "func DeleteSession(session *Session) {\r\n\tsessionListMutex.Lock()\r\n\tdefer sessionListMutex.Unlock()\r\n\r\n\tdelete(sessionList, session.Key)\r\n\tfmt.Printf(\"Delete session %d\\n\", session.Key)\r\n}", "func (ctx *RequestContext) DestroySession() {\n\tctx.destroyingSession = true\n}", "func (m *Manager) Shutdown() error {\n\t// shutdown subscribers\n\tm.sessions.Range(func(k, v interface{}) bool {\n\t\twrap := v.(*container)\n\t\tif wrap.sub != nil {\n\t\t\tif err := m.persistSubscriber(wrap.sub); err != nil {\n\t\t\t\tm.log.Error(\"persist subscriber\", zap.Error(err))\n\t\t\t}\n\t\t}\n\n\t\tm.sessions.Delete(k)\n\n\t\treturn true\n\t})\n\n\treturn nil\n}", "func (s *session) garbageCollectStreams() {\n\ts.streamsMap.Iterate(func(str *stream) (bool, error) {\n\t\tid := str.StreamID()\n\t\tif str.finished() {\n\t\t\terr := s.streamsMap.RemoveStream(id)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\ts.flowControlManager.RemoveStream(id)\n\t\t}\n\t\treturn true, nil\n\t})\n}" ]
[ "0.7089904", "0.61599636", "0.58887005", "0.5850469", "0.57533306", "0.56555283", "0.5642214", "0.56363297", "0.5590619", "0.55601865", "0.55595326", "0.5538021", "0.551168", "0.5497634", "0.5470665", "0.544381", "0.54413", "0.5432986", "0.54288346", "0.53801996", "0.53740805", "0.53258777", "0.53130287", "0.53110874", "0.529426", "0.5278169", "0.52781314", "0.52572984", "0.52557045", "0.5254235", "0.52487403", "0.5238355", "0.5232748", "0.5227615", "0.5216114", "0.5213859", "0.521276", "0.52033186", "0.5188516", "0.51693773", "0.51692975", "0.5168888", "0.51677406", "0.5158241", "0.515257", "0.5150471", "0.5137512", "0.51348776", "0.51289994", "0.51205206", "0.5120366", "0.5108638", "0.51044184", "0.5102977", "0.5099875", "0.50935835", "0.5086133", "0.50860476", "0.50818557", "0.5077012", "0.50767", "0.5070421", "0.506289", "0.5054055", "0.5039262", "0.5037982", "0.5037133", "0.50270754", "0.5020278", "0.50201654", "0.5004508", "0.500187", "0.49974045", "0.49962422", "0.49815878", "0.49686915", "0.4966196", "0.495762", "0.49526203", "0.49445137", "0.49428514", "0.49380484", "0.4933382", "0.4926571", "0.4912662", "0.49083543", "0.49057826", "0.48994344", "0.488552", "0.4873043", "0.48723683", "0.4868872", "0.4866841", "0.48668194", "0.4857559", "0.48554885", "0.48534948", "0.48534098", "0.48402005", "0.48327613" ]
0.7981413
0
NewDatapoint creates a new Datapoint, inserts it to the database and returns it
NewDatapoint создает новый Datapoint, вставляет его в базу данных и возвращает его
func NewDatapoint(datasetID int64, imageURL string) (dp *Datapoint, err error) { var id int64 err = DB.QueryRow("INSERT INTO datapoint (dataset_id, image_url) VALUES ($1, $2) RETURNING id", datasetID, imageURL).Scan(&id) if err != nil { return // something went wrong! lets get out of here! } //blank space for readability dp = &Datapoint{ ID: id, DatasetID: datasetID, ImageURL: imageURL, } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (db *PostgresDatapointRepo) CreateDatapoint(dp earthworks.Datapoint) (earthworks.Datapoint, error) {\n\tquery := `INSERT INTO datapoint (location) VALUES ($1) RETURNING id`\n\tcreated := earthworks.Datapoint{}\n\terr := db.Get(&created, query, wkt.MarshalString(dp.Location))\n\tif err != nil {\n\t\treturn earthworks.Datapoint{}, err\n\t}\n\n\treturn created, nil\n}", "func (ctrl *SensorController) CreateDatapoints(res http.ResponseWriter, req *http.Request) {\n\tsensorID := mux.Vars(req)[\"id\"]\n\tdatapoints := make([]model.Datapoint, 0)\n\tdec, _ := ioutil.ReadAll(req.Body)\n\terr := json.Unmarshal(dec, &datapoints)\n\n\t// save datapoints\n\tfor index := range datapoints {\n\t\tdatapoints[index].SensorID = bson.ObjectIdHex(sensorID)\n\t}\n\n\tdatapoints, err = model.BulkSaveDatapoints(ctrl.db, datapoints)\n\tif err != nil {\n\t\tctrl.r.JSON(res, http.StatusInternalServerError, err)\n\t\tlog.Fatal(err)\n\t}\n\n\tctrl.r.JSON(res, http.StatusCreated, datapoints)\n}", "func (a *Adapter) AddNewDataPoint(ma MetricAdapter, name string, tags map[string]string, fields map[string]interface{}, t time.Time) error {\n\tif a.Verbose {\n\t\tdumpDataPoint(name, tags, fields, t)\n\t}\n\treturn ma.AddDataPoint(name, tags, fields, t)\n}", "func NewDatapoint(data interface{}, points []float64) *Datapoint {\n\tif points == nil {\n\t\tpoints = []float64{}\n\t}\n\tf := make([]float64, len(points), len(points))\n\tcopy(f, points)\n\td := Datapoint{\n\t\tdata: data,\n\t\tset: f,\n\t}\n\treturn &d\n}", "func (dal *DataAccessLayer) CreateTimeSeriesDatum(tenantId int64, sensorId int64, value float64, timestamp int64) (*TimeSeriesDatum, error) {\n // Step 1: Generate SQL statement for creating a new `user` in `postgres`.\n statement := `INSERT INTO data (tenant_id, sensor_id, value, timestamp) VALUES ($1, $2, $3, $4)`\n\n // Step 2: Execute our SQL statement and either return our new user or\n // our error.\n _, err := dal.db.Exec(statement, tenantId, sensorId, value, timestamp)\n if err != nil {\n return nil, err\n }\n\n // Step 3:\n return dal.GetTimeSeriesDatumByTenantIdAndCreatedAt(tenantId, timestamp)\n}", "func (ts *Timeseries) AddNewPoint(v float64, x interface{}) error {\n\tts.Lock()\n\tdefer ts.Unlock() // unlocks at the end\n\n\tswitch T := x.(type) {\n\tcase int64:\n\t\tts.XY[T] = v\n\tcase time.Time:\n\t\tts.XY[T.UnixNano()] = v\n\tcase int:\n\t\tts.XY[int64(T)] = v\n\tdefault:\n\t\treturn fmt.Errorf(\"Adding point not possible\")\n\t}\n\n\treturn nil\n}", "func (self *Client) data(dataPoints models.DataPoints) {\n\tlog.WithFields(log.Fields{\n\t\t\"points\": dataPoints,\n\t}).Debug(\"New datapoints\")\n\t// TODO: Send dataPoints to remote\n}", "func AddPoint(db *gorm.DB, item *model.Point, DeviceUUID string) (*model.Point, error) {\n\tdevice := new(model.Device)\n\tif err := db.Where(\"uuid = ? \", DeviceUUID).First(&device).Error; err != nil {\n\t\treturn nil, &NotFoundError{deviceName, DeviceUUID, nil, \"not found\"}\n\t}\n\tif err := db.Create(&item).Error; err != nil {\n\t\treturn item, &NotFoundError{deviceName, \"na\", err, \"not found\"}\n\t}\n\treturn item, nil\n}", "func (ts *TimeSeries) AddPoint(value float64) Record {\n\trecord := newRecord(value)\n\tts.AddRecord(record)\n\treturn *record\n}", "func NewDataPoint(name string, value float64, unit Unit, dimensions ...Dimension) Point {\n\tp := Point{Name: name, Value: value, Unit: unit, Timestamp: time.Now().UTC()}\n\tp.AddDimensions(dimensions...)\n\treturn p\n}", "func NewPoint(latitude float64, longitude float64) *Point {\n return &Point{latitude: latitude, longitude: longitude}\n}", "func create_point(x float64, y float64) Point{\n\tp1 := Point{ x:x, y:y,}\n\treturn p1\n}", "func (dal *DataAccessLayer) CreateTimeSeriesDatumTable(dropExistingTable bool) {\n if dropExistingTable {\n drop_stmt := \"DROP TABLE data;\"\n results, err := dal.db.Exec(drop_stmt)\n if err != nil {\n fmt.Println(\"TimeSeriesDatum table dropped with error:\", results, err)\n } else {\n fmt.Println(\"TimeSeriesDatum table dropped and re-created\")\n }\n }\n\n // Special thanks:\n // * http://www.postgresqltutorial.com/postgresql-create-table/\n // * https://www.postgresql.org/docs/9.5/datatype.html\n\n stmt := `CREATE TABLE data (\n id bigserial PRIMARY KEY,\n tenant_id bigint NOT NULL,\n sensor_id BIGINT NOT NULL,\n value FLOAT NULL,\n timestamp BIGINT NOT NULL,\n unique (tenant_id, sensor_id, timestamp)\n );`\n results, err := dal.db.Exec(stmt)\n if err != nil {\n fmt.Println(\"TimeSeriesDatum Model\", results, err)\n }\n return\n}", "func (s *server) CreateData(ctx context.Context, in *pb.DataRequest) (*pb.DataResponse, error) {\r\n\t//connect to database\r\n\treq := in.Data\r\n\tDB, err := database.Connect()\r\n\t \r\n\tsqlStatement := `\r\n\tINSERT INTO t1 (data)\r\n\tVALUES ($1)\r\n\tON CONFLICT (data)\r\n\tDO NOTHING\r\n\tRETURNING key`\r\n\t \r\n\tvar key int32\r\n\t \r\n\t//insert row into t1 table\r\n\terr = DB.QueryRow(sqlStatement, req).Scan(&key)\r\n\tif err != nil && err != sql.ErrNoRows {\r\n\t panic(err)\r\n\t}\r\n\t\r\n\t//if a row was added to T1 then insert into T2\r\n\tif err != sql.ErrNoRows {\r\n\t\r\n\t\t//create t2 string made up of the data posted & the new key from the inserted t1 record\r\n\t\tt2Str := fmt.Sprintf(\"%s %d\", req, key)\r\n\r\n\t\tt2Key := 0\r\n\r\n\t\t//insert into t2 \r\n\t\tsqlStatement = `\r\n\t\tINSERT INTO t2 (t1key, data)\r\n\t\tVALUES ($1, $2)\r\n\t\tRETURNING key`\r\n\r\n\t\t//insert into t2 \r\n\t\terr = DB.QueryRow(sqlStatement, key, t2Str).Scan(&t2Key)\r\n\t\tif err != nil {\r\n\t\t panic(err)\r\n\t\t} \r\n\t\t\r\n\t\tfmt.Println(\"New key is:\", key)\r\n\t}\r\n\t \r\n\t \r\n\t//close database connection\r\n \tDB.Close()\r\n\t\r\n \r\n\treturn &pb.DataResponse{Data: req, Success: true, Key: key}, nil\r\n}", "func NewPoint(s data.Point) Point {\n\tvar time *time.Time\n\n\tif !s.Time.IsZero() {\n\t\ttime = &s.Time\n\t}\n\n\treturn Point{\n\t\tType: s.Type,\n\t\tKey: s.Key,\n\t\tValue: s.Value,\n\t\tTime: time,\n\t}\n}", "func newPoint(v *view.View, row *view.Row, start, end time.Time) *monitoringpb.Point {\n\tswitch v.Aggregation.Type {\n\tcase view.AggTypeLastValue:\n\t\treturn newGaugePoint(v, row, end)\n\tdefault:\n\t\treturn newCumulativePoint(v, row, start, end)\n\t}\n}", "func InsertRoutePoint(db *sql.DB, routeid string, Lat float64, Lon float64, P int) {\n\tid, err := GenerateRandomString(32)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tquery := fmt.Sprintf(\"INSERT INTO RoutePoints VALUES ('%s', '%s', %.10f, %.10f, %d, %d, %d, %d, %d, %d)\", id, routeid, Lat, Lon, time.Now().Day(), time.Now().Month(), time.Now().Year(), time.Now().Hour(), time.Now().Minute(), P)\n\t_, err = db.Query(query)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to execute SQL command:\", err)\n\t\tlog.Fatalln(\"Failed to execute SQL command:\", err)\n\t}\n\tfmt.Println(\"Point for Route ID - \", routeid, \"successfully inserted.\")\n}", "func CreatePlot(c *fiber.Ctx) error {\n\t/*\n\t * Getting the context\n\t * Fetching the request payload\n\t * Creating the plot in the database\n\t * Returning the response\n\t */\n\t//getting the context\n\tctx, err := config.GetContext(c)\n\tif err != nil {\n\t\t//error while getting the context\n\t\treturn err\n\t}\n\n\t//parsing the request body\n\tplotCtx := c.Context().UserValue(plotKey)\n\tplot, ok := plotCtx.(db.Plot)\n\tif !ok {\n\t\t//error while type converting the db plot instance\n\t\tctx.Log.WithFields(log.Fields{\"error\": err}).Error(\"error while processing the plot info\")\n\t\treturn c.Status(500).JSON(config.Error(\"error while procssing the plot info\"))\n\t}\n\n\t//creating the db entry\n\terr = (&plot).Create(ctx)\n\tif err != nil {\n\t\t//error while creating the database entry\n\t\tctx.Log.WithFields(log.Fields{\"error\": err}).Error(\"error while creating the database entry for the plot\")\n\t\treturn c.Status(500).JSON(config.Error(\"couldn't save the plot into the db\"))\n\t}\n\n\t//returning the response\n\treturn c.JSON(config.Success(dto.FromPlot(plot), \"plot\"))\n}", "func NewPoint(x, y float64, data interface{}) *Point {\n\treturn &Point{x, y, data}\n}", "func NewDatapointRepo(database *db.Datastore) *PostgresDatapointRepo {\n\treturn &PostgresDatapointRepo{\n\t\tdatabase,\n\t}\n}", "func DefaultCreateIntPoint(ctx context.Context, in *IntPoint, db *gorm1.DB) (*IntPoint, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultCreateIntPoint\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (p *Persistence) CreateNewMeasurement(thermometerId int64, porkSessionId int64, temperature int) (id int64) {\n\tvar err error\n\tvar rows *sqlx.Rows\n\n\trows, err = p.db.Queryx(\"INSERT INTO measurement (thermometer, pork_session, temperature) VALUES ($1, $2, $3) RETURNING id\", thermometerId, porkSessionId, temperature)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tmeasurement := Measurement{}\n\tfor rows.Next() {\n\t\terr := rows.StructScan(&measurement)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t\treturn measurement.Id\n\t}\n\n\treturn 0\n}", "func (d Datapoints) Datapoints() []Datapoint { return d }", "func WritePoint(name string, tags map[string]string, fields map[string]interface{}) (*client.Point, error) {\n\tc, err := NewHTTPClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\n\t// Create a new point batch\n\tbp, err := client.NewBatchPoints(client.BatchPointsConfig{\n\t\tDatabase: Settings.Database,\n\t\tPrecision: \"s\",\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpt, err := client.NewPoint(name, tags, fields, time.Now())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbp.AddPoint(pt)\n\n\t// Write the batch and check for an error\n\tif err = c.Write(bp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Debugf(\"WritePoint=%s\", pt.String())\n\treturn pt, nil\n}", "func makePoint(name string, value interface{}) *influxdb.Point {\n\tfields := map[string]interface{}{\n\t\tfieldValue: toSignedIfUnsigned(value),\n\t}\n\n\treturn &influxdb.Point{\n\t\tMeasurement: name,\n\t\tFields: fields,\n\t}\n}", "func InsertData(db *sql.DB, d Data) error {\n\tdataAddedSQL := d.DateAdded.Unix()\n\n\tif _, err := db.Exec(insertSQL, d.ID, d.Location.Lat, d.Location.Long, dataAddedSQL); err != nil {\n\t\t// TODO: Should be handle difference mysql error situations to the client.\n\t\t// Handle Duplicate Entry only for current version\n\t\tif mysqlErr, ok := err.(*mysql.MySQLError); ok {\n\t\t\tif mysqlErr.Number == common.MysqlErrDupEntry {\n\t\t\t\treturn errors.New(\"Duplicated ID\")\n\t\t\t}\n\t\t}\n\n\t\treturn fmt.Errorf(\"Insert Data Error: %w\", err)\n\t}\n\n\treturn nil\n}", "func CreateData(c *gin.Context) {\r\n\tvar predict Models.Predict\r\n\tc.BindJSON(&predict)\r\n\terr := Models.CreateData(&predict)\r\n\tif err != nil {\r\n\t\tfmt.Println(err.Error())\r\n\t\tc.AbortWithStatus(http.StatusNotFound)\r\n\t} else {\r\n\t\tc.JSON(http.StatusOK, predict)\r\n\t}\r\n}", "func SavePoint(db *gorm.DB, point *model.Point) (*model.Point, error) {\n\tif err := db.Save(&point).Error; err != nil {\n\t\treturn point, err\n\t}\n\treturn point, nil\n}", "func (geom Geometry) AddPoint(x, y, z float64) {\n\tC.OGR_G_AddPoint(geom.cval, C.double(x), C.double(y), C.double(z))\n}", "func (s *SerializerTimescaleSql) SerializePoint(w io.Writer, p *Point) (err error) {\n\ttimestampNanos := p.Timestamp.UTC().UnixNano()\n\tbuf := make([]byte, 0, 4096)\n\tbuf = append(buf, []byte(\"INSERT INTO \")...)\n\tbuf = append(buf, []byte(p.MeasurementName)...)\n\tbuf = append(buf, []byte(\" (time\")...)\n\n\tfor i := 0; i < len(p.TagKeys); i++ {\n\t\tbuf = append(buf, \",\"...)\n\t\tbuf = append(buf, p.TagKeys[i]...)\n\t}\n\n\tfor i := 0; i < len(p.FieldKeys); i++ {\n\t\tbuf = append(buf, \",\"...)\n\t\tbuf = append(buf, p.FieldKeys[i]...)\n\t}\n\tbuf = append(buf, []byte(\") VALUES (\")...)\n\tbuf = append(buf, []byte(fmt.Sprintf(\"%d\", timestampNanos))...)\n\n\tfor i := 0; i < len(p.TagValues); i++ {\n\t\tbuf = append(buf, \",'\"...)\n\t\tbuf = append(buf, p.TagValues[i]...)\n\t\tbuf = append(buf, byte('\\''))\n\t}\n\n\tfor i := 0; i < len(p.FieldValues); i++ {\n\t\tbuf = append(buf, \",\"...)\n\t\tv := p.FieldValues[i]\n\t\tbuf = fastFormatAppend(v, buf, true)\n\t}\n\tbuf = append(buf, []byte(\");\\n\")...)\n\n\t_, err = w.Write(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (g *Gauge) DataPoint() *DataPoint {\n\treturn &DataPoint{\n\t\tMetric: g.metric,\n\t\tTimestamp: time.Now(),\n\t\tType: GaugeType,\n\t\tDimensions: g.dimensions,\n\t\tValue: atomic.LoadInt64(&g.value),\n\t}\n}", "func (h *HistoCounter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error {\n\th.DatapointBucket.Add(float64(len(points)))\n\treturn h.sink.AddDatapoints(ctx, points, next)\n}", "func NewNewData() *NewData {\n\tthis := NewData{}\n\treturn &this\n}", "func (d *Datapoint) Data() interface{} {\n\treturn d.data\n}", "func NewPoint(x, y, z float64) *Tuple {\n\treturn &Tuple{x, y, z, 1.0}\n}", "func (c Client) WritePoint(db, measurement string, data interface{}) error {\n\tt, tags, fields, err := encode(data)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn c.WritePointTagsFields(db, measurement, tags, fields, t)\n}", "func NewPoint(lat, lng float64) Location {\r\n\treturn Location{\r\n\t\t\"Point\",\r\n\t\t[]float64{lng, lat},\r\n\t}\r\n}", "func (self *influxdbStorage) newSeries(columns []string, points []interface{}) *influxdb.Series {\n\tout := &influxdb.Series{\n\t\tName: self.tableName,\n\t\tColumns: columns,\n\t\t// There's only one point for each stats\n\t\tPoints: make([][]interface{}, 1),\n\t}\n\tout.Points[0] = points\n\treturn out\n}", "func (c *WrappedGauge) DataPoint() *DataPoint {\n\tgottenValue, err := c.value.Get()\n\tif err != nil {\n\t\treturn nil\n\t}\n\tvalue, err := toInt64(gottenValue)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn &DataPoint{\n\t\tMetric: c.metric,\n\t\tTimestamp: time.Now(),\n\t\tType: GaugeType,\n\t\tDimensions: c.dimensions,\n\t\tValue: value,\n\t}\n}", "func (d *Distribution) AddPoint(timestamp time.Time, value float64) {\n\td.Values = append(d.Values, MetricValue{Timestamp: timestamp, Value: value})\n}", "func (d Datapoints) DatapointAt(n int) Datapoint { return d[n] }", "func NewPoint(x1, y1 int) Point {\n\treturn Point{X: x1, Y: y1}\n}", "func NewPoint() api.IPoint {\n\to := new(point)\n\treturn o\n}", "func NewSendPoints(portalURL, deviceID, authToken string, timeout time.Duration, debug bool) func(data.Points) error {\n\tvar netClient = &http.Client{\n\t\tTimeout: timeout,\n\t}\n\n\treturn func(points data.Points) error {\n\t\tpointURL := portalURL + \"/v1/devices/\" + deviceID + \"/points\"\n\n\t\ttempJSON, err := json.Marshal(NewPoints(points))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif debug {\n\t\t\tlog.Println(\"Sending points: \", string(tempJSON))\n\t\t}\n\n\t\treq, err := http.NewRequest(\"POST\", pointURL, bytes.NewBuffer(tempJSON))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t\treq.Header.Set(\"Authorization\", authToken)\n\t\tresp, err := netClient.Do(req)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer resp.Body.Close()\n\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\terrstring := \"Server error: \" + resp.Status + \" \" + pointURL\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\terrstring += \" \" + string(body)\n\t\t\treturn errors.New(errstring)\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func (b *ServerBackend) AddDPointRecord(server string, user string, record *DPointRecord) bool {\n\t// Validate user and server\n\tuserdata := b.GetUserData(server, user)\n\tif userdata == nil {\n\t\tfmt.Println(\"ADD_DPOINT: Could not get userdata\")\n\t\treturn false\n\t}\n\n\tpoints, err := strconv.ParseInt(record.Points, 10, 32)\n\tif err != nil {\n\t\tfmt.Println(\"ADD_DPOINT: Could not parse int\")\n\t\treturn false\n\t}\n\n\tdata := fromilyclient.DPointRecord{\n\t\tPoints: int32(points),\n\t\tReason: record.Reason,\n\t}\n\n\tif b.Client.CreateDPointRecord(server, user, &data) != nil {\n\t\tfmt.Println(\"ADD_DPOINT: Could not create record\")\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (*SeatDataAccessObject) InsertOne(s *Seat) error {\n\t_, err := orm.InsertOne(s)\n\treturn err\n}", "func (o *SpanTagRemoval) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint) error {\n\treturn o.next.AddDatapoints(ctx, points)\n}", "func (c *Counter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error {\n\tatomic.AddInt64(&c.TotalDatapoints, int64(len(points)))\n\tatomic.AddInt64(&c.TotalProcessCalls, 1)\n\tatomic.AddInt64(&c.CallsInFlight, 1)\n\tstart := time.Now()\n\terr := next.AddDatapoints(ctx, points)\n\tatomic.AddInt64(&c.TotalProcessTimeNs, time.Since(start).Nanoseconds())\n\tatomic.AddInt64(&c.CallsInFlight, -1)\n\tif err != nil {\n\t\tatomic.AddInt64(&c.TotalProcessErrors, 1)\n\t\tatomic.AddInt64(&c.ProcessErrorPoints, int64(len(points)))\n\t\tc.logErrMsg(ctx, err, \"Unable to process datapoints\")\n\t}\n\treturn err\n}", "func NewPoint(x, y float64) *Point {\n\tp := Point{Type: \"point\", Coordinates: []float64{x, y}}\n\treturn &p\n}", "func (d *DBRepository) insertOne(ctx context.Context, travel *Travel) error {\n\ttravel.ObjectID = primitive.NewObjectID()\n\tif _, err := d.Collection.InsertOne(ctx, travel); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func CreateNewPatient(c *gin.Context) {\n\tvar patientRequest PatientRequest\n\tc.ShouldBind(&patientRequest)\n\tpatientResponse := PatientResponse{\n\t\tPatientID: \"2018-0001\",\n\t\tName: patientRequest.Name,\n\t\tLastname: patientRequest.Lastname,\n\t\tAge: patientRequest.Age,\n\t}\n\tc.JSON(201, patientResponse)\n\n}", "func (md *MapData) InsertNewMapData(session *mgo.Session) {\n\tmd.ID = bson.NewObjectId()\n\n\tsession.DB(\"scratch_map\").C(\"map_data\").Insert(md)\n}", "func (b *Bucket) AddData(dataPoint data.Point) error {\n\terr := b.shards[b.index].AddData(dataPoint)\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tif !errors.Is(err, ErrShardMaxReached) {\n\t\treturn err\n\t}\n\n\tvar m metrics.Metric\n\n\t// we have reached max timestamp for the current shard, make a new one\n\tif m, err = metrics.FromDescriptor(b.descriptor); err != nil {\n\t\treturn err\n\t}\n\tif err := m.AddData(dataPoint); err != nil {\n\t\treturn err\n\t}\n\n\tshard := NewShard(m, b.shardDuration)\n\n\tb.shards = append(b.shards, shard)\n\tb.index++\n\n\treturn nil\n}", "func NewPoint(x, y, z float64) Tuple {\n\treturn Tuple{\n\t\tX: x,\n\t\tY: y,\n\t\tZ: z,\n\t\tW: pointW,\n\t}\n}", "func (c *StepLookbackAccumulator) AddPoint(dp ts.Datapoint) {\n\tif dp.TimestampNanos.Before(c.earliestLookback) {\n\t\t// this datapoint is too far in the past, it can be dropped.\n\t\treturn\n\t}\n\n\tc.datapoints = append(c.datapoints, xts.Datapoint{\n\t\tTimestamp: dp.TimestampNanos,\n\t\tValue: dp.Value,\n\t})\n}", "func GetDatapointByID(id int64) (dp *Datapoint, err error) {\n\tvar datasetID int64\n\tvar imageURL string\n\n\terr = DB.QueryRow(\"SELECT id, dataset_id, image_url FROM datapoint WHERE id=$1\", id).Scan(&id, &datasetID, &imageURL)\n\n\tif err != nil {\n\t\treturn // something went wrong! lets get out of here!\n\t}\n\n\tdp = &Datapoint{\n\t\tID: id,\n\t\tDatasetID: datasetID,\n\t\tImageURL: imageURL,\n\t}\n\n\treturn\n}", "func InfluxDBInsert(addr *C.char, port C.int, user *C.char, pass *C.char,\n\tdb *C.char, ccolumns *C.struct_InfluxDBColumnInfo, tablename *C.char,\n\tctypes *C.InfluxDBType, cvalues *C.InfluxDBValue, cparamNum C.int) *C.char {\n\n\t//Create a new HTTPClient\n\tcl, err := client.NewHTTPClient(client.HTTPConfig{\n\t\tAddr: C.GoString(addr) + \":\" + strconv.Itoa(int(port)),\n\t\tUsername: C.GoString(user),\n\t\tPassword: C.GoString(pass),\n\t})\n\tif err != nil {\n\t\treturn C.CString(err.Error())\n\t}\n\tdefer cl.Close()\n\n\t//Create a new point batch\n\tbp, _ := client.NewBatchPoints(client.BatchPointsConfig{\n\t\tDatabase: C.GoString(db),\n\t})\n\n\t//Create tags, fields and time data\n\ttags, fields, timecol, err := makeColumnValue(ccolumns, ctypes, cvalues, cparamNum)\n\tif err != nil {\n\t\treturn C.CString(err.Error())\n\t}\n\n\t//Create a point and add to batch\n\tpt, err := client.NewPoint(C.GoString(tablename), tags, fields, timecol)\n\tif err != nil {\n\t\treturn C.CString(err.Error())\n\t}\n\n\tbp.AddPoint(pt)\n\n\t//Write the batch\n\terr = cl.Write(bp)\n\tif err != nil {\n\t\treturn C.CString(err.Error())\n\t}\n\n\treturn nil\n}", "func (s SmesherService) CreatePostData(context.Context, *pb.CreatePostDataRequest) (*pb.CreatePostDataResponse, error) {\n\tlog.Info(\"GRPC SmesherService.CreatePostData\")\n\treturn nil, status.Errorf(codes.Unimplemented, \"this endpoint is not implemented\")\n}", "func (ds *Datapoints) Import(I Importable) {\n\t*ds = append(*ds, I.ToDatapoint())\n}", "func NewPoint(x, y int) Point {\n\treturn Point{x, y}\n}", "func insertObject(object *remember.DataObject, connection *sql.DB) error {\n\tstatement, err := connection.Prepare(CREATE)\n\tif nil != err {\n\t\treturn err\n\t}\n\tdefer statement.Close()\n\n\tobject.CreatedAt = time.Now()\n\tobject.UpdatedAt = time.Now()\n\n\tresponse, err := statement.Exec(\n\t\tobject.Title,\n\t\tobject.GroupId,\n\t\tobject.Payload,\n\t\tobject.CreatedAt.Unix(),\n\t\tobject.UpdatedAt.Unix(),\n\t)\n\tif nil != err {\n\t\treturn err\n\t}\n\n\tobject.ID, err = response.LastInsertId()\n\treturn err\n}", "func (gdb *GostDatabase) PostDatastream(d *entities.Datastream) (*entities.Datastream, error) {\n\terr := CheckDatastreamRelationsExist(gdb, d)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttID, _ := ToIntID(d.Thing.ID)\n\tsID, _ := ToIntID(d.Sensor.ID)\n\toID, _ := ToIntID(d.ObservedProperty.ID)\n\tvar dsID int\n\n\tunitOfMeasurement, _ := json.Marshal(d.UnitOfMeasurement)\n\tgeom := \"NULL\"\n\tif len(d.ObservedArea) != 0 {\n\t\tobservedAreaBytes, _ := json.Marshal(d.ObservedArea)\n\t\tgeom = fmt.Sprintf(\"ST_SetSRID(ST_GeomFromGeoJSON('%s'),4326)\", string(observedAreaBytes[:]))\n\t}\n\n\tphenomenonTime := \"NULL\"\n\tif len(d.PhenomenonTime) != 0 {\n\t\tphenomenonTime = \"'\" + now.Iso8601ToPostgresPeriod(d.PhenomenonTime) + \"'\"\n\t}\n\n\tresultTime := \"NULL\"\n\tif len(d.ResultTime) != 0 {\n\t\tresultTime = \"'\" + now.Iso8601ToPostgresPeriod(d.ResultTime) + \"'\"\n\t}\n\t// get the ObservationType id in the lookup table\n\tobservationType, err := entities.GetObservationTypeByValue(d.ObservationType)\n\n\tif err != nil {\n\t\treturn nil, gostErrors.NewBadRequestError(errors.New(\"ObservationType does not exist\"))\n\t}\n\n\tsql2 := fmt.Sprintf(\"INSERT INTO %s.datastream (name, description, unitofmeasurement, observedarea, thing_id, sensor_id, observedproperty_id, observationtype, phenomenonTime, resulttime) VALUES ($1, $2, $3, %s, $4, $5, $6, $7, %s, %s) RETURNING id\", gdb.Schema, geom, phenomenonTime, resultTime)\n\terr = gdb.Db.QueryRow(sql2, d.Name, d.Description, unitOfMeasurement, tID, sID, oID, observationType.Code).Scan(&dsID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td.ID = dsID\n\n\t// clear inner entities to serves links upon response\n\td.Thing = nil\n\td.Sensor = nil\n\td.ObservedProperty = nil\n\n\treturn d, nil\n}", "func RandomDatapoint(n uint) *Datapoint {\n\treturn RandomDatapointInRange(n, 0, 1)\n}", "func newDataInstance(repo datastore.Repo, t *testing.T, name dvid.DataString) *Data {\n\tconfig := dvid.NewConfig()\n\tconfig.SetVersioned(true)\n\tdataservice, err := repo.NewData(labelsT, name, config)\n\tif err != nil {\n\t\tt.Errorf(\"Unable to create labels64 instance %q: %s\\n\", name, err.Error())\n\t}\n\tlabels, ok := dataservice.(*Data)\n\tif !ok {\n\t\tt.Errorf(\"Can't cast labels data service into Data\\n\")\n\t}\n\treturn labels\n}", "func createData(client pb.DataClient, data *pb.DataRequest) {\r\n\tresp, err := client.CreateData(context.Background(), data)\r\n\tif err != nil {\r\n\t\tlog.Fatalf(\"Could not create Data: %v\", err)\r\n\t}\r\n\tif resp.Key < 1 {\r\n\t\tlog.Printf(\"%s already exists:\", resp.Data)\r\n\t}\r\n\tif resp.Success {\r\n\t\tlog.Printf(\"A new Data has been added for: %s\", resp.Data)\r\n\t}\r\n}", "func (g *StableGauge) DataPoint() *DataPoint {\n\tdp := g.gauge.DataPoint()\n\tif dp.Value == atomic.LoadInt64(&g.prevValue) {\n\t\t// Value is the same, don't report it\n\t\treturn nil\n\t}\n\tatomic.StoreInt64(&g.prevValue, dp.Value)\n\treturn dp\n}", "func insertIntoTable(ctx context.Context, sd StationData) error {\n\t// Get the current application ID, which is the same as the project ID.\n\t//projectID := appengine.AppID(ctx)\n\t//fmt.Println(projectID)\n\n\t// Create the BigQuery service.\n\tbq, err := bigquery.NewClient(ctx, \"pdxbike\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not create service: %v\", err)\n\t}\n\n\titems := []*Station{}\n\tfor _, st := range sd.Data.Stations {\n\t\tfmt.Println(st)\n\t\titems = append(items, &st)\n\t}\n\tu := bq.Dataset(\"StationData\").Table(\"testing1\").Uploader()\n\tif err := u.Put(ctx, items); err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *MeasurementService) Create(ctx context.Context, body MeasurementRepresentation) (*Measurement, *Response, error) {\n\tdata := new(Measurement)\n\tresp, err := s.client.SendRequest(ctx, RequestOptions{\n\t\tMethod: \"POST\",\n\t\tPath: \"measurement/measurements\",\n\t\tBody: body,\n\t\tResponseData: data,\n\t})\n\treturn data, resp, err\n}", "func (s *ReprTimeSeries) AddPoint(t int64, min float64, max float64, last float64, sum float64, count int64) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.Stats = append(s.Stats, &repr.StatRepr{\n\t\tTime: t,\n\t\tMin: repr.CheckFloat(min),\n\t\tMax: repr.CheckFloat(max),\n\t\tLast: repr.CheckFloat(last),\n\t\tSum: repr.CheckFloat(sum),\n\t\tCount: count,\n\t})\n\tif t > s.curTime {\n\t\ts.curTime = t\n\t}\n\tif t < s.T0 {\n\t\ts.T0 = t\n\t}\n\treturn nil\n}", "func createPerson(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"CREATE HIT\")\n\tstmt, err := db.Prepare(\"INSERT INTO Persons(pAge, pName) VALUES (?,?)\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tvar per Person\n\tjson.Unmarshal(body, &per)\n\tage := per.Age\n\tname := per.Name\n\t_, err = stmt.Exec(age, name)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Fprintf(w, \"New person was created\")\n}", "func newObject(db *DelegateDB, address common.Address, delegate Delegate, onDirty func(addr common.Address)) *delegateObject {\n\tif delegate.Vote == nil {\n\t\tdelegate.Vote = big.NewInt(0)\n\t}\n\tdObject := &delegateObject{\n\t\tdb: db,\n\t\taddress: address,\n\t\taddrHash: crypto.Keccak256Hash(address[:]),\n\t\tdata: delegate,\n\t\tcachedStorage: make(Storage),\n\t\tdirtyStorage: make(Storage),\n\t\tonDirty: onDirty,\n\t}\n\tdObject.tryMarkDirty()\n\treturn dObject\n}", "func (ts *Timeseries) AddNewPointKeepLen(v float64, x interface{}) error {\n\tts.orderIndex()\n\tl := len(ts.XY)\n\tswitch T := x.(type) {\n\tcase int64:\n\t\tts.XY[T] = v\n\tcase time.Time:\n\t\tts.XY[T.UnixNano()] = v\n\tcase int:\n\t\tts.XY[int64(T)] = v\n\tdefault:\n\t\treturn fmt.Errorf(\"Adding point not possible\")\n\t}\n\tnewl := len(ts.XY)\n\n\tkeys := make([]float64, 0, len(ts.XY))\n\tfor k := range ts.XY {\n\t\tkeys = append(keys, float64(k))\n\t}\n\tsort.Float64s(keys)\n\tif newl > l {\n\t\tdelete(ts.XY, int64(keys[0]))\n\t}\n\tts.orderIndex()\n\n\treturn nil\n}", "func NewData(uuid dvid.UUID, id dvid.InstanceID, name dvid.InstanceName, c dvid.Config) (*Data, error) {\n\t// Initialize the Data for this data type\n\tbasedata, err := datastore.NewDataService(dtype, uuid, id, name, c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := &Data{\n\t\tData: basedata,\n\t\tProperties: Properties{},\n\t}\n\treturn data, nil\n}", "func (self *PhysicsP2) CreateParticle(x int, y int, mass int, addToWorld bool, options interface{}, points interface{}) {\n self.Object.Call(\"createParticle\", x, y, mass, addToWorld, options, points)\n}", "func NewPoint(x, y int) Point {\n\treturn Point{\n\t\tX: x,\n\t\tY: y,\n\t}\n}", "func (a *Activity) createActivity() error {\n\n\ttags := map[string]string{\n\t\t\"unit\": a.Unit,\n\t\t\"type\": \"activity\",\n\t}\n\tfields := map[string]interface{}{\n\t\t\"value\": a.Value,\n\t}\n\n\tbps, err := client.NewBatchPoints(client.BatchPointsConfig{\n\t\tDatabase: database.Dbname,\n\t\tPrecision: \"ms\",\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpoint, err := client.NewPoint(\n\t\ta.Name,\n\t\ttags,\n\t\tfields,\n\t\ttime.Now(),\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbps.AddPoint(point)\n\n\terr = database.InfluxDBcon.Write(bps)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (cpb *CachePointBag) Add(point common.Point) (expiredNum int) {\n\t// first delete point expired\n\tnow := time.Now().Unix()\n\tvar index int = 0\n\tfor i, p := range cpb.Data {\n\t\tif p.Timestamp >= now - cpb.duration {\n\t\t\tbreak\n\t\t}\n\t\tindex = i\n\t}\n\tcpb.Lock()\n\t\n\tif index > 0 {\n\t\tcpb.Data = cpb.Data[index:]\n\t}\n\texpiredNum = index\n\tlast := len(cpb.Data) -1\n\t\n\t// push point at right location, maybe some point reach delay\n\tcpb.Data = append(cpb.Data, point)\n\tfor i := last; i >0; i-- {\n\t\tif cpb.Data[i].Timestamp < point.Timestamp {\n\t\t\tbreak\n\t\t}\n\t\tcpb.Data[i+1] = cpb.Data[i]\n\t\tcpb.Data[i] = point\n\t}\n\t\n\tif cpb.PointsToDb == nil {\n\t\tcpb.PointsToDb = make([]common.Point, 0)\n\t}\n\tcpb.PointsToDb = append(cpb.PointsToDb, point)\n\tcpb.Unlock()\n\treturn\n}", "func (b *Blueprint) Point(column string) *ColumnDefinition {\n\treturn b.addColumn(\"point\", column, nil)\n}", "func addPerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\tvar person models.Person\r\n\t_ = json.NewDecoder(r.Body).Decode(&person)\r\n\tperson.UUID = primitive.NewObjectID()\r\n\r\n\tcollection := models.ConnectDB()\r\n\tnewPerson, err := collection.InsertOne(context.TODO(), person)\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tjson.NewEncoder(w).Encode(newPerson.InsertedID.(primitive.ObjectID))\r\n}", "func NewPoint(x, y, z float64) Point {\n\treturn Point{x, y, z, pointW}\n}", "func DeletePoint(db *gorm.DB, id string) error {\n\tpoint := new(model.Point)\n\tif err := db.Where(\"id = ? \", id).Delete(&point).Error; err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\t//tag := new(model.Tag)\n\t//if err := db.Where(\"post_id = ? \", id).Delete(&tag).Error; err != nil {\n\t//\tlog.Println(err)\n\t//}\n\n\treturn nil\n}", "func CreatePDV(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar p *model.PDV\n\tb, _ := ioutil.ReadAll(r.Body)\n\terr := json.Unmarshal(b, &p)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write(jsonError(fmt.Sprintf(\"%s\", err)))\n\t\treturn\n\t}\n\tinput := &database.PDVCreateInput{\n\t\tDatabase: database.GetInstance(),\n\t\tPDV: p,\n\t}\n\t_, err = database.CreatePDV(input)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write(jsonError(fmt.Sprintf(\"%s\", err)))\n\t\treturn\n\t}\n\tjsonResponse(w, &successResponse{\"The PDV was inserted\"}, http.StatusOK)\n}", "func (endpoint *HNSEndpoint) Create() (*HNSEndpoint, error) {\n\toperation := \"Create\"\n\ttitle := \"hcsshim::HNSEndpoint::\" + operation\n\tlogrus.Debugf(title+\" id=%s\", endpoint.Id)\n\n\tjsonString, err := json.Marshal(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn HNSEndpointRequest(\"POST\", \"\", string(jsonString))\n}", "func (o *CurrentChartDataMinutely) Insert(exec boil.Executor, columns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no current_chart_data_minutely provided for insertion\")\n\t}\n\n\tvar err error\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\tif o.UpdatedAt.IsZero() {\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeInsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(currentChartDataMinutelyColumnsWithDefault, o)\n\n\tkey := makeCacheKey(columns, nzDefaults)\n\tcurrentChartDataMinutelyInsertCacheMut.RLock()\n\tcache, cached := currentChartDataMinutelyInsertCache[key]\n\tcurrentChartDataMinutelyInsertCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl, returnColumns := columns.InsertColumnSet(\n\t\t\tcurrentChartDataMinutelyColumns,\n\t\t\tcurrentChartDataMinutelyColumnsWithDefault,\n\t\t\tcurrentChartDataMinutelyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(currentChartDataMinutelyType, currentChartDataMinutelyMapping, wl)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcache.retMapping, err = queries.BindMapping(currentChartDataMinutelyType, currentChartDataMinutelyMapping, returnColumns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(wl) != 0 {\n\t\t\tcache.query = fmt.Sprintf(\"INSERT INTO \\\"current_chart_data_minutely\\\" (\\\"%s\\\") %%sVALUES (%s)%%s\", strings.Join(wl, \"\\\",\\\"\"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))\n\t\t} else {\n\t\t\tcache.query = \"INSERT INTO \\\"current_chart_data_minutely\\\" %sDEFAULT VALUES%s\"\n\t\t}\n\n\t\tvar queryOutput, queryReturning string\n\n\t\tif len(cache.retMapping) != 0 {\n\t\t\tqueryReturning = fmt.Sprintf(\" RETURNING \\\"%s\\\"\", strings.Join(returnColumns, \"\\\",\\\"\"))\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to insert into current_chart_data_minutely\")\n\t}\n\n\tif !cached {\n\t\tcurrentChartDataMinutelyInsertCacheMut.Lock()\n\t\tcurrentChartDataMinutelyInsertCache[key] = cache\n\t\tcurrentChartDataMinutelyInsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterInsertHooks(exec)\n}", "func NewPoint() *Point {\n\tx := rand.Float(-100, 101)\n\ty := rand.Float(-100, 101)\n\n\tlabel := -1\n\tif x > y { // f(x) = x (identity function)\n\t\tlabel = 1\n\t}\n\n\treturn &Point{\n\t\tX: x,\n\t\tY: y,\n\t\tLabel: label,\n\t\tBias: 1,\n\t}\n}", "func (p *Persistence) CreateNewMeatThermometer(thermometerName string) (id int64) {\n\tvar err error\n\tvar rows *sqlx.Rows\n\n\trows, err = p.db.Queryx(\"INSERT INTO thermometer (thermometer_name, thermometer_type) VALUES ($1, $2) RETURNING id\", thermometerName, \"meat\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tthermometer := Thermometer{}\n\tfor rows.Next() {\n\t\terr := rows.StructScan(&thermometer)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t\treturn thermometer.Id\n\t}\n\n\treturn 0\n}", "func NewDatatypeGeoPoint(name string) *DatatypeGeoPoint {\n\treturn &DatatypeGeoPoint{\n\t\tname: name,\n\t}\n}", "func (p *Poet) Create(db *sql.DB) error {\n\tvar (\n\t\terr error\n\t)\n\n\t// assume id is already assigned\n\n\t// set birthday\n\tp.BirthDate = time.Now().Truncate(time.Millisecond)\n\n\t// prepare statement if not already done so.\n\tif poetCreateStmt == nil {\n\t\t// create statement\n\t\tstmt := `INSERT INTO poets (\n id, designer, name, birthDate, deathDate, description, language, programFileName, parameterFileName, parameterFileIncluded, path\n ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)`\n\t\tpoetCreateStmt, err = db.Prepare(stmt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, err = poetCreateStmt.Exec(\n\t\tp.Id,\n\t\tp.Designer.Id,\n\t\tp.Name,\n\t\tp.BirthDate,\n\t\tp.DeathDate,\n\t\tp.Description,\n\t\tp.Language,\n\t\tp.ProgramFileName,\n\t\tp.ParameterFileName,\n\t\tp.ParameterFileIncluded,\n\t\tp.Path,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r *KNNRetriever) Insert(point *embedding.Embedding) error {\n\tif point.Dimensions() != r.vectorsDimension {\n\t\treturn trace.BadParameter(\"point has wrong dimension\")\n\t}\n\tr.tree.Insert(point)\n\tr.mapping[point.GetName()] = point\n\n\treturn nil\n}", "func NewDoubleDataPoint() DoubleDataPoint {\n\torig := (*otlpmetrics.DoubleDataPoint)(nil)\n\treturn newDoubleDataPoint(&orig)\n}", "func NewPoint(group Group) Point {\n\treturn C.EC_POINT_new(group)\n}", "func (gi *Sensor) Create(db *pg.DB) error {\r\n\tlog.Printf(\"===>sensorItem.Create()\")\r\n\tlog.Printf(\" sensorItem.Create():=%v\\n\", gi)\r\n\r\n\tinsertErr := db.Insert(gi)\r\n\tif insertErr != nil {\r\n\t\tlog.Printf(\"Error writing to DB in sensorItem.Create()\\n\")\r\n\t\tlog.Printf(\"Reason:%v\\n\", insertErr)\r\n\t\treturn insertErr\r\n\t}\r\n\tlog.Printf(\"Sensor %s inserted successfully into table\", gi.Sensorname)\r\n\treturn nil\r\n}", "func (self *averageCache) Insert(dataPoints []*whisper.TimeSeriesPoint) {\n\tlog.WithFields(log.Fields{\n\t\t\"cache\": self.name,\n\t}).Debug(\"Insert\")\n\tself.inputChan <- dataPoints\n}", "func (c *Curve) NewPoint(x, y float64) (CurvePoint, error) {\n\n\tvar point CurvePoint\n\n\tif !c.IsPointOnCurve(x, y) {\n\t\terr := fmt.Errorf(\"Point (%f, %f) is not on y^2 = x^3 + %fx + %f\", x, y, c.a, c.b)\n\t\treturn point, err\n\t}\n\n\tpoint.x = x\n\tpoint.y = y\n\tpoint.order = -1\n\tpoint.curve = c\n\n\treturn point, nil\n}", "func (l *GeoLoc) Insert() error {\n\t// Get db instance\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving DB instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Insert\n\tvar row *sql.Row\n\n\t// Check if GeoLoc has been parsed\n\tif l.Located {\n\t\t// Check accuracy value\n\t\tif l.Accuracy == AccuracyErr {\n\t\t\treturn fmt.Errorf(\"invalid accuracy value: %s\",\n\t\t\t\tl.Accuracy)\n\t\t}\n\n\t\t// If so, save all fields\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, gapi_success\"+\n\t\t\t\", lat, long, postal_addr, accuracy, bounds_provided, \"+\n\t\t\t\"bounds_id, viewport_bounds_id, gapi_place_id, raw) \"+\n\t\t\t\"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) \"+\n\t\t\t\"RETURNING id\",\n\t\t\tl.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,\n\t\t\tl.Accuracy, l.BoundsProvided, l.BoundsID,\n\t\t\tl.ViewportBoundsID, l.GAPIPlaceID, l.Raw)\n\t} else {\n\t\t// If not, only save a couple, and leave rest null\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, raw) VALUES\"+\n\t\t\t\" ($1, $2) RETURNING id\",\n\t\t\tl.Located, l.Raw)\n\t}\n\n\t// Get inserted row ID\n\terr = row.Scan(&l.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error inserting row, Located: %t, err: %s\",\n\t\t\tl.Located, err.Error())\n\t}\n\n\treturn nil\n}", "func NewPoints() Points {\n\treturn Points{\n\t\t\"P\": NewAttributes(Vector, 3),\n\t}\n}", "func (t *Table) Point(colNm string) *Table {\n\tt.columns = append(t.columns, &column{Name: colNm, ColumnType: TypePoint})\n\treturn t\n}", "func NewPoint(x, y int) *Point {\n\treturn &Point{\n\t\tX: x,\n\t\tY: y,\n\t}\n}", "func NewPoint(x, y int) *Point {\n\treturn &Point{\n\t\tX: x,\n\t\tY: y,\n\t}\n}", "func CreatePerson(db *sql.DB) {}" ]
[ "0.8000808", "0.6696262", "0.63995373", "0.6313884", "0.59810144", "0.58154607", "0.5605545", "0.5546164", "0.5510137", "0.54992396", "0.54607934", "0.54099196", "0.53961456", "0.53786576", "0.5377734", "0.5367833", "0.5366217", "0.5314214", "0.52989596", "0.5285048", "0.5267355", "0.52488554", "0.52215874", "0.52161396", "0.51843745", "0.51513386", "0.5132509", "0.5112632", "0.51056945", "0.50797504", "0.507138", "0.50458336", "0.5040891", "0.49869955", "0.49819845", "0.49806947", "0.49634108", "0.49607956", "0.49568594", "0.495304", "0.49500728", "0.49378654", "0.49290574", "0.49213684", "0.48999506", "0.48986834", "0.4890495", "0.4875781", "0.48644295", "0.48411977", "0.4822486", "0.48211443", "0.48060906", "0.47867575", "0.47860906", "0.4776399", "0.4760692", "0.4732837", "0.4728945", "0.47273123", "0.47203106", "0.47191814", "0.47172043", "0.4716681", "0.46882087", "0.46874237", "0.4683177", "0.46831584", "0.4682318", "0.46808082", "0.46789664", "0.46784222", "0.4675572", "0.46737212", "0.46588337", "0.46437305", "0.46353775", "0.46322095", "0.46163994", "0.46052074", "0.46011388", "0.45964146", "0.458849", "0.45811844", "0.45798042", "0.45750177", "0.4571821", "0.45709214", "0.4568247", "0.45677736", "0.4555961", "0.45551357", "0.45514542", "0.45494592", "0.45460033", "0.45450288", "0.4531142", "0.45222968", "0.45222968", "0.4513591" ]
0.7536382
1
GetDatapointByID fetches a datapoint from the database and returns it
GetDatapointByID извлекает точку данных из базы данных и возвращает ее
func GetDatapointByID(id int64) (dp *Datapoint, err error) { var datasetID int64 var imageURL string err = DB.QueryRow("SELECT id, dataset_id, image_url FROM datapoint WHERE id=$1", id).Scan(&id, &datasetID, &imageURL) if err != nil { return // something went wrong! lets get out of here! } dp = &Datapoint{ ID: id, DatasetID: datasetID, ImageURL: imageURL, } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetDataByID(c *gin.Context) {\r\n\tid := c.Params.ByName(\"id\")\r\n\tvar predict Models.Predict\r\n\terr := Models.GetDataByID(&predict, id)\r\n\tif err != nil {\r\n\t\tc.AbortWithStatus(http.StatusNotFound)\r\n\t} else {\r\n\t\tc.JSON(http.StatusOK, predict)\r\n\t}\r\n}", "func (c *MainController) getDataByID(PID int) {\n\to := orm.NewOrm()\n\tproduct := models.Product{PID: PID}\n\terr := o.Read(&product)\n\tif err != nil {\n\t\tbeego.Info(\"o.Read err=\", err)\n\t\treturn\n\t}\n\tc.Data[\"product\"] = product\n}", "func (d *DataSource) GetByID(id int64) (Model, bool) {\n\treturn d.GetBy(func(u Model) bool {\n\t\treturn u.ID == id\n\t})\n}", "func (db *PostgresDatapointRepo) CreateDatapoint(dp earthworks.Datapoint) (earthworks.Datapoint, error) {\n\tquery := `INSERT INTO datapoint (location) VALUES ($1) RETURNING id`\n\tcreated := earthworks.Datapoint{}\n\terr := db.Get(&created, query, wkt.MarshalString(dp.Location))\n\tif err != nil {\n\t\treturn earthworks.Datapoint{}, err\n\t}\n\n\treturn created, nil\n}", "func (gi *Sensor) GetByID(db *pg.DB) (Sensor, error) {\r\n\tlog.Printf(\"===>sensorItem.GetByID(SensorID=%d)\", gi.ID)\r\n\r\n\t//getErr := db.Select(gi)\r\n\tgetErr := db.Model(gi).Where(\"id = ?0\", gi.ID).Select()\r\n\tif getErr != nil {\r\n\t\tlog.Printf(\"Error while selecting item, Reason %v\\n\", getErr)\r\n\t\treturn *gi, getErr\r\n\t}\r\n\tlog.Printf(\"Select successful in sensorItem.GetById() sensor=%v\\n\", *gi)\r\n\treturn *gi, nil\r\n}", "func (dao PathProfileDAOPsql) GetByID(id int) (*models.PathProfile, error) {\n\tquery := \"SELECT id, profile_id, path_id, post, put, del, get, created_at, updated_at FROM path_profile WHERE id = $1\"\n\to := &models.PathProfile{}\n\tdb := get()\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trow := stmt.QueryRow(id)\n\terr = dao.rowToPathProfile(row, o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn o, nil\n}", "func DefaultReadIntPoint(ctx context.Context, in *IntPoint, db *gorm1.DB) (*IntPoint, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultReadIntPoint\")\n\t}\n\tdb = db.Set(\"gorm:auto_preload\", true)\n\tormParams, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ormParams.Id == 0 {\n\t\treturn nil, errors.New(\"Read requires a non-zero primary key\")\n\t}\n\tormResponse := IntPointORM{}\n\tif err = db.Where(&ormParams).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (ds *KVStorage) GetByID(ID string) (graph.Graph, bool) {\n\tif val, ok := ds.data[ID]; ok {\n\t\treturn val, ok\n\t}\n\treturn graph.Graph{}, false\n}", "func (e Endpoints) GetByID(ctx context.Context, id string) (d io.Department, error error) {\n\trequest := GetByIDRequest{Id: id}\n\tresponse, err := e.GetByIDEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(GetByIDResponse).D, response.(GetByIDResponse).Error\n}", "func NewDatapoint(datasetID int64, imageURL string) (dp *Datapoint, err error) {\n\tvar id int64\n\n\terr = DB.QueryRow(\"INSERT INTO datapoint (dataset_id, image_url) VALUES ($1, $2) RETURNING id\", datasetID, imageURL).Scan(&id)\n\n\tif err != nil {\n\t\treturn // something went wrong! lets get out of here!\n\t}\n\n\t//blank space for readability\n\n\tdp = &Datapoint{\n\t\tID: id,\n\t\tDatasetID: datasetID,\n\t\tImageURL: imageURL,\n\t}\n\n\treturn\n}", "func (DiseaseUsecase *DiseaseUsecaseImpl) GetByID(id string) (*model.Disease, error) {\n\tDisease, err := DiseaseUsecase.DiseasetRepository.FindByID(id)\n\t//err:=UserUsecase.userRepository.FindByID(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Disease, nil\n}", "func (ds *DataStore) GetByID(id, url string) (todos.Todo, error) {\n\tvar todo todos.Todo\n\trow, err := ds.DB.Get(ds.ctx, id, nil)\n\tif err != nil {\n\t\treturn todo, fmt.Errorf(\"error getting doc with ID %s: %s\", id, err)\n\t}\n\tvar doc todoDoc\n\tif err := row.ScanDoc(&doc); err != nil {\n\t\treturn todo, fmt.Errorf(\"error scanning doc: %s\", err)\n\t}\n\ttodo = convertDocToTodo(doc)\n\ttodo.URL = url\n\n\treturn todo, nil\n}", "func (dp *dataProvider) GetUserByID(user *models.User) error {\n\t//Where(\"id = ?id\")\n\treturn wrapError(dp.db.Select(user))\n}", "func (d Datapoints) DatapointAt(n int) Datapoint { return d[n] }", "func (server *Server) GetUserPointByUserID(c *gin.Context) {\n\tuserID := c.Param(\"id\")\n\tconvertedUserID, err := strconv.ParseUint(userID, 10, 64)\n\tif err != nil {\n\t\tlog.Printf(err.Error())\n\t\terrList[\"invalid_request\"] = \"Invalid request\"\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\": errList,\n\t\t})\n\t\treturn\n\t}\n\n\tuserPoint := models.UserPoint{}\n\tuserPoints, err := userPoint.FindPointHistoryByUserID(server.DB, convertedUserID)\n\tif err != nil {\n\t\tlog.Printf(err.Error())\n\t\terrList[\"no_user\"] = \"No user found\"\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"error\": errList,\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"response\": userPoints,\n\t})\n}", "func (c *Client) DatacenterGetForUserByID(datacenterName string, userID int) (*Datacenter, error) {\n\treturn c.datacenterGetForUser(datacenterName, userID)\n}", "func (p *TodoDAOPersister) GetByID(id string) (Todo, error) {\n\tlog.Printf(\"Getting Todo by ID: %v\", id)\n\t// Initialize return variable\n\tvar todo Todo\n\tvar todoBytes []byte\n\n\t// Get Todo\n\tif p.CacheActive {\n\t\t// Get todo from cache\n\t\tif b, err := p.Cache.Get(id); err == nil {\n\t\t\ttodoBytes = b\n\t\t}\n\t}\n\tif err := retry.Do(3, time.Duration(time.Millisecond*400), func() error {\n\t\t// Get todo from datastore\n\t\tb, err := p.DataStore.Get(id)\n\t\tif err == nil {\n\t\t\ttodoBytes = b\n\t\t}\n\t\treturn err\n\t}); err != nil {\n\t\treturn todo, err\n\t}\n\n\t// Unmarshal Json\n\treturn todo, json.Unmarshal(todoBytes, &todo)\n}", "func (h *JourneyRepository) GetByID(id int) (*models.Journey, error) {\n\tjourney := &models.Journey{}\n\tlog.Println(id)\n\tif err := h.Db.Set(\"gorm:auto_preload\", true).First(&journey, id).Error; err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\treturn journey, nil\n\n}", "func (s *LiftingStorage) GetByID(id int) (*lifting.Repetition, error) {\n\treps, err := s.getCollectionWithStruct(getByID, byID{ID: id})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(reps) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(reps) > 1 {\n\t\treturn nil, fmt.Errorf(\"Multiple return values for SqliteStorage#GetByID, %v\", reps)\n\t}\n\n\treturn &reps[0], nil\n}", "func GetByID(ctx context.Context, client *v1.ServiceClient, domainID int) (*View, *v1.ResponseResult, error) {\n\turl := strings.Join([]string{client.Endpoint, strconv.Itoa(domainID)}, \"/\")\n\tresponseResult, err := client.DoRequest(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif responseResult.Err != nil {\n\t\treturn nil, responseResult, responseResult.Err\n\t}\n\n\t// Extract a domain from the response body.\n\tdomain := &View{}\n\terr = responseResult.ExtractResult(domain)\n\tif err != nil {\n\t\treturn nil, responseResult, err\n\t}\n\n\treturn domain, responseResult, nil\n}", "func (lightingEvent *LightingEvent) GetByID(id int64) error {\n\tdb := database.Open()\n\tdefer database.Close(db)\n\trows, err := db.Query(\"SELECT * FROM lightingEvents WHERE id = ?\", id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tfound := false\n\tfor rows.Next() {\n\t\tfound = true\n\t\terr = lightingEvent.getRow(rows)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif !found {\n\t\treturn errors.New(\"Event not found\")\n\t}\n\n\treturn nil\n}", "func (dao CompanyDAOPsql) GetByID(id int) (*models.Company, error) {\n\tquery := `SELECT id, identification_type_id, identification_number, verification_digit, company, address, phone, departments_id, cities_id, web, email, activity, autorretenedor, person_type_id, regime_type_id, taxpayer_type_id, logo, created_at, updated_at\n\t\t\t\tFROM companies WHERE id = $1`\n\tobj := &models.Company{}\n\tdb := get()\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trow := stmt.QueryRow(id)\n\terr = dao.rowToObject(row, obj)\n\treturn obj, err\n}", "func (conn *Connection) GetByID(id interface{}, i interface{}) error {\n\treturn conn.collection.FindId(id).One(i)\n}", "func (db *DB) GetPerson(id string) (*Person, error) {\n\n\trow := db.QueryRow(\"select * from PERSON where ID=?\", id)\n\n\tperson := new(Person)\n\n\terr := row.Scan(&person.ID, &person.Firstname, &person.Lastname)\n\n\tif err == sql.ErrNoRows {\n\t\treturn nil, errors.New(\"No Person found matching your ID\")\n\t} else if err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn person, nil\n}", "func GetPropiedadByID(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tvar prop Models.Propiedad\n\terr := Models.GetPropiedadByID(&prop, id)\n\tif err != nil {\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"error\" : gin.H { \n\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\"message\": err.Error(),\n\t\t}})\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tc.JSON(http.StatusOK, prop)\n\t}\n}", "func (d *dsCache) getByIdent(ident *cachedIdent) *cachedDs {\n\td.RLock()\n\tdefer d.RUnlock()\n\treturn d.byIdent[ident.String()]\n}", "func (c *DefaultApiController) DataDataIdGet(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tdataId, err := parseInt32Parameter(params[\"dataId\"])\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tresult, err := c.service.DataDataIdGet(r.Context(), dataId)\n\t//If an error occured, encode the error with the status code\n\tif err != nil {\n\t\tEncodeJSONResponse(err.Error(), &result.Code, w)\n\t\treturn\n\t}\n\t//If no error, encode the body and the result code\n\tEncodeJSONResponse(result.Body, &result.Code, w)\n\n}", "func ByID(ds datastore.Datastore, id int) (CPD, error) {\n\treturn cpdByID(ds, id)\n}", "func (s *IdeaStorage) GetByID(ideaID int) (*models.Idea, error) {\n\tfor _, idea := range s.ideas {\n\t\tif idea.ID == ideaID {\n\t\t\treturn idea, nil\n\t\t}\n\t}\n\treturn nil, app.ErrNotFound\n}", "func (dal *DataAccessLayer) GetTimeSeriesDatumByTenantIdAndCreatedAt(tenantId int64, timestamp int64) (*TimeSeriesDatum, error) {\n thing := TimeSeriesDatum{} // The struct which will be populated from the database.\n\n // DEVELOPERS NOTE:\n // (1) Lookup the thing based on the id.\n // (2) PostgreSQL uses an enumerated $1, $2, etc bindvar syntax\n err := dal.db.Get(&thing, \"SELECT * FROM data WHERE timestamp = $1 AND tenant_id = $2\", timestamp, tenantId)\n\n // Handling non existing item\n if err == sql.ErrNoRows {\n return nil, nil\n } else if err != nil {\n return nil, err\n }\n\n return &thing, nil\n}", "func (gdb *GostDatabase) GetDatastreamByObservation(observationID interface{}, qo *odata.QueryOptions) (*entities.Datastream, error) {\n\tintID, ok := ToIntID(observationID)\n\tif !ok {\n\t\treturn nil, gostErrors.NewRequestNotFound(errors.New(\"Datastream does not exist\"))\n\t}\n\n\tquery, qi := gdb.QueryBuilder.CreateQuery(&entities.Datastream{}, &entities.Observation{}, intID, qo)\n\treturn processDatastream(gdb.Db, query, qi)\n}", "func (us *UserService) GetByID(userID int) (*User, error) {\n\tu, err := us.Datasource.Get(userID)\n\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn nil, httperror.NotFound(\"user\", fmt.Errorf(\"the user with id %d was not found\", userID))\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn u, nil\n}", "func (o JobExtractSourceModelPtrOutput) DatasetId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobExtractSourceModel) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.DatasetId\n\t}).(pulumi.StringPtrOutput)\n}", "func (bl *postBusiness) GetByID(id uint64) (*models.Post, *apperror.AppError) {\n\treturn bl.service.GetByID(id)\n}", "func (gi *Sensor) GetByUserID(db *pg.DB) (Sensor, error) {\r\n\tlog.Printf(\"===>sensorItem.GetByUserID(ID=%d)\", gi.ID)\r\n\r\n\t//getErr := db.Select(gi)\r\n\tgetErr := db.Model(gi).Where(\"id = ?0\", gi.ID).Select()\r\n\tif getErr != nil {\r\n\t\tlog.Printf(\"Error in GetByUserID while selecting item\\n\")\r\n\t\tlog.Printf(\"Reason %v\\n\", getErr)\r\n\t\treturn *gi, getErr\r\n\t}\r\n\tlog.Printf(\"Select successful in sensorItem.GetByUserID() sensor=%v\\n\", *gi)\r\n\treturn *gi, nil\r\n}", "func (db *ImageDB) GetMetdataByID(id primitive.ObjectID) (map[string]interface{}, error) {\n\tmetadata := make(map[string]interface{})\n\tif err := db.collection.FindOne(timeoutContext(), bson.M{\"_id\": id}).Decode(&metadata); err != nil {\n\t\treturn metadata, err\n\t}\n\treturn metadata[\"metadata\"].(map[string]interface{}), nil\n}", "func (s *Service) GetByID(param string) (*entity.Pokemon, error) {\n\tr := csv.NewReader(s.csvFile)\n\tdefer s.csvFile.Seek(0, 0)\n\tfor {\n\t\trecord, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif record[0] == param {\n\t\t\tpokemonID, err := strconv.Atoi(record[0])\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tpokemon := entity.Pokemon{\n\t\t\t\tID: pokemonID,\n\t\t\t\tName: record[1],\n\t\t\t\tBaseExperience: record[2],\n\t\t\t}\n\n\t\t\treturn &pokemon, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"Pokemon not found\")\n}", "func (d *Datapoint) Data() interface{} {\n\treturn d.data\n}", "func (es *EventStore) FindByID(id string) (*Event, error) {\n\tstart := time.Now()\n\tdefer func() {\n\t\tmetrics.EventStoreLatency(\"Find\", start)\n\t}()\n\tevt, err := es.ds.FindByID(id, true)\n\tif err != nil {\n\t\tmetrics.DBError(\"read\")\n\t\treturn nil, errors.Wrap(err, \"Error executing find in data source\")\n\t}\n\tif evt == nil {\n\t\treturn nil, errors.New(\"Could not find event matching id \" + id)\n\t}\n\tpropertiesSchema := es.getTopicSchemaProperties(evt.TopicID)\n\tif evt.Data == nil {\n\t\tevt.Data = make(map[string]interface{})\n\t}\n\tes.insertDefaults(propertiesSchema, evt.Data)\n\treturn evt, nil\n}", "func (a *TodoAdapter) GetByID(ctx context.Context, id domain.ID) (todo.Todo, error) {\n\tspan, _ := opentracing.StartSpanFromContext(ctx, \"TodoAdapter-GetByID\")\n\tdefer span.Finish()\n\n\tvar t Todo\n\n\toid, err := primitive.ObjectIDFromHex(string(id))\n\n\tif err != nil {\n\t\treturn todo.DefaultTodo, err\n\t}\n\n\tfilter := bson.M{\"_id\": bson.M{\"$eq\": oid}}\n\n\terr = a.collection.FindOne(ctx, filter).Decode(&t)\n\n\tif err != nil {\n\t\treturn todo.DefaultTodo, err\n\t}\n\n\treturn t.ToModel(), nil\n}", "func (dao AccountPUCDAOPsql) GetByID(id int) (*models.AccountPUC, error) {\n\tquery := \"SELECT id, account, account_name, account_puc_parent_id, account_class_id, account_level_id, created_at, updated_at FROM accounts_puc WHERE id = $1\"\n\tobj := &models.AccountPUC{}\n\tdb := get()\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trow := stmt.QueryRow(id)\n\terr = dao.rowToObject(row, obj)\n\treturn obj, err\n}", "func (c *Controller) GetPatientByID(id string) (*store.Patient, error) {\n\tpnt, err := c.store.GetPatientByID(id)\n\tif err != nil && err == store.ErrSearch {\n\t\tlog.Println(err)\n\t\treturn nil, ErrSearchInput\n\t} else if err != nil && err != store.ErrNotFound {\n\t\t// avoid leaking sensitive info\n\t\tlog.Println(err)\n\t\treturn nil, ErrLookingUpInfo\n\t}\n\n\t// patient not found\n\tif pnt == nil && err == store.ErrNotFound {\n\t\treturn nil, ErrNotFound\n\t}\n\n\treturn pnt, nil\n}", "func GetByID(ctx *routing.Context) error {\n\tlogger := logger.GetLogInstance(\"\", \"\")\n\tdb := ctx.Get(\"db\").(*gorm.DB)\n\n\tcmp := models.CampaingModel{}\n\n\tif err := db.Model(&[]dbmodels.Campaign{}).Where(\"id = ?\", ctx.Param(\"id\")).Scan(&cmp).Error; err != nil {\n\t\tlogger.Error(err)\n\t\tctx.Response.SetStatusCode(404)\n\t\tres := models.NewResponse(false, nil, \"not found\")\n\t\treturn ctx.WriteData(res.MustMarshal())\n\t}\n\tres := models.NewResponse(true, cmp, \"OK\")\n\treturn ctx.WriteData(res.MustMarshal())\n}", "func GetByID(rw http.ResponseWriter, r *http.Request) {\n\tuserID := r.Header.Get(\"userid\")\n\n\turlParams := strings.Replace(r.URL.String(), \"/api/getEvent/\", \"\", 1)\n\teventID := strings.Split(urlParams, \"/\")[0]\n\n\tif strings.TrimSpace(eventID) == \"\" {\n\t\tlog.Printf(\"Missing event id\\n\")\n\t\trw.WriteHeader(http.StatusBadRequest)\n\t\trw.Write([]byte(\"Event ID must be provided\"))\n\t\treturn\n\t}\n\n\tquery := `SELECT * FROM events\n\t\tWHERE owner_id = $1 \n\t\tAND id = $2`\n\n\te := Event{}\n\tloc := sql.NullString{}\n\tnotes := sql.NullString{}\n\n\terr := conn.DB.QueryRow(query, userID, eventID).Scan(&e.EventID, &e.Title, &e.StartTime, &e.EndTime, &loc, &notes, &e.OwnerID)\n\tif err != nil {\n\t\tlog.Printf(\"DB error: %s\\n\", err)\n\t\trw.WriteHeader(http.StatusNoContent)\n\t\trw.Write([]byte(\"Event not found\"))\n\t\treturn\n\t}\n\n\te.Location = loc.String\n\te.Notes = notes.String\n\n\trw.WriteHeader(http.StatusOK)\n\trw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(rw).Encode(e)\n}", "func (st *StressTest) GetPoint(name, precision string) models.Point {\n\tp := st.communes[name].point(precision)\n\n\t// Function needs to return a point. Panic if it doesn't\n\tif p == nil {\n\t\tlog.Fatal(\"Commune not returning point\")\n\t}\n\n\treturn p\n}", "func (s *Service) GetUserByID(userID int) (*Model, error) {\n\treturn s.usersByIDs[userID], nil\n}", "func GetByID(ctx *routing.Context) error {\n\tlogger := logger.GetLogInstance(\"\", \"\")\n\tdb := ctx.Get(\"db\").(*gorm.DB)\n\n\timg := []models.ImageModel{}\n\n\tif err := db.Model(&dbmodels.Image{}).Where(\"id = ?\", ctx.Param(\"id\")).Scan(&img).Error; err != nil {\n\t\tlogger.Error(err)\n\t\tctx.Response.SetStatusCode(404)\n\t\tres := models.NewResponse(false, nil, \"not found\")\n\t\treturn ctx.WriteData(res.MustMarshal())\n\t}\n\tres := models.NewResponse(true, img, \"OK\")\n\treturn ctx.WriteData(res.MustMarshal())\n}", "func (d *DermagaUsecaseProcess) GetByID(id int) (*model.Dermaga, error) {\n\treturn d.dermagaRepo.GetByID(id)\n}", "func (st *Student) GetStudentByID(id string) (Student, error) {\n\n\tdb := database.GetInstance().GetConnection()\n\tdefer db.Close()\n\n\ts := Student{}\n\n\terr := db.Where(\"active <> ?\", false).Select(\"id, name, age\").First(&s, id)\n\n\tif err != nil {\n\t\treturn s, err.Error\n\t}\n\n\treturn s, nil\n}", "func (o DatasetAccessRoutinePtrOutput) DatasetId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatasetAccessRoutine) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.DatasetId\n\t}).(pulumi.StringPtrOutput)\n}", "func (c *Client) GetByID(data *GetByIDParams) (*xendit.Disbursement, *xendit.Error) {\n\treturn c.GetByIDWithContext(context.Background(), data)\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (k *KapalRepoMysql) GetByID(id int) (*model.Kapal, error) {\n\tqry := \"select kapal_id, kode_kapal, muatan, status from kapal where kapal_id = ? and is_delete = 0\"\n\n\tkapal := model.Kapal{}\n\n\terr := k.db.QueryRow(qry, id).Scan(&kapal.ID, &kapal.Kode, &kapal.Muatan, &kapal.Status)\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"[KapalRepoMysql.CreateTableRepoMysqlImpl.GetByID.QueryRow] Error when running query '\"+qry+\"' : %w\", err)\n\t}\n\treturn &kapal, nil\n}", "func GetByID(db *mongo.Client, ID string) (Record, error) {\n\tfilter := bson.D{{Key: \"id\", Value: ID}}\n\tctx, _ := context.WithTimeout(context.Background(), 3*time.Second)\n\tresult := db.Database(\"url-shortener\").Collection(\"urls\").FindOne(ctx, filter)\n\n\tvar record Record\n\tif result.Err() != nil {\n\t\treturn record, result.Err()\n\t}\n\tresult.Decode(&record)\n\treturn record, nil\n}", "func GetByDataUUID(dataUUID dvid.UUID) (*Data, error) {\n\tsource, err := datastore.GetDataByDataUUID(dataUUID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, ok := source.(*Data)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Instance '%s' is not an annotation datatype!\", source.DataName())\n\t}\n\treturn data, nil\n}", "func (c *PatientInfoClient) GetX(ctx context.Context, id int) *PatientInfo {\n\tpi, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pi\n}", "func GetByUUIDName(uuid dvid.UUID, name dvid.InstanceName) (*Data, error) {\n\tsource, err := datastore.GetDataByUUIDName(uuid, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, ok := source.(*Data)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Instance '%s' is not an annotation datatype!\", name)\n\t}\n\treturn data, nil\n}", "func (c Cache) GetHistogramDataPoint(identifier string) (*pmetric.HistogramDataPoint, bool) {\n\tpoint, found := c.histogramCache[identifier]\n\tif found {\n\t\tpoint.used = true\n\t\tc.histogramCache[identifier] = point\n\t}\n\treturn point.point, found\n}", "func (dao *FilingDaoImpl) GetByID(filingID string) (exists bool, filing *model.Filing, err error) {\n\tf := &Filing{ID: filingID}\n\terr = dao.db.Select(f)\n\tif err != nil {\n\t\tif err == pg.ErrNoRows {\n\t\t\treturn false, nil, nil\n\t\t}\n\t\treturn false, nil, err\n\t}\n\treturn true, f.export(), nil\n}", "func GetUserByID(person *Person, id string) (err error) {\n\tif err = Config.DB.Where(\"id = ?\", id).First(person).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func GetByID(session *mgo.Session, collection *mgo.Collection, id interface{}, i interface{}) {\n\tsession.Refresh()\n\tcollection.FindId(id).One(i)\n}", "func (c *WrappedGauge) DataPoint() *DataPoint {\n\tgottenValue, err := c.value.Get()\n\tif err != nil {\n\t\treturn nil\n\t}\n\tvalue, err := toInt64(gottenValue)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn &DataPoint{\n\t\tMetric: c.metric,\n\t\tTimestamp: time.Now(),\n\t\tType: GaugeType,\n\t\tDimensions: c.dimensions,\n\t\tValue: value,\n\t}\n}", "func (mdb *MockDynamo) GetArticleByID(id int) (models.Article, error) {\n\tarticle := mdb.ArticlesTable[id]\n\t//Check to see if key contains non-zero value\n\tif article == (models.Article{}) {\n\t\treturn models.Article{}, ErrResourceNotFound\n\t}\n\treturn article, nil\n}", "func (t *Datastore) GetTracepoint(tracepointID uuid.UUID) (*storepb.TracepointInfo, error) {\n\tresp, err := t.ds.Get(getTracepointKey(tracepointID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp == nil {\n\t\treturn nil, nil\n\t}\n\n\ttracepointPb := &storepb.TracepointInfo{}\n\terr = proto.Unmarshal(resp, tracepointPb)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn tracepointPb, nil\n}", "func (e *Entity) GetElementByID(string) Object { return nil }", "func GetHNSEndpointByID(endpointID string) (*HNSEndpoint, error) {\n\treturn HNSEndpointRequest(\"GET\", endpointID, \"\")\n}", "func GetAwardByID(data, id interface{}) error {\n\tdb := common.GetDB()\n\terr := db.Where(\"id = ?\", id).First(data).Error\n\treturn err\n}", "func (r *PackageAggRow) GetID() string { return *r.Data.ID }", "func (db *ImageDB) DownloadByID(id primitive.ObjectID) (bytes.Buffer, error) {\n\tbucket, _ := gridfs.NewBucket(\n\t\tdb.database,\n\t)\n\tbuf := bytes.Buffer{}\n\t_, err := bucket.DownloadToStream(id, &buf)\n\treturn buf, err\n}", "func SeriesByID(id string, embeds string) (*Series, *Error) {\n\treturn fetchOneSeries(request{\"GET\", \"/series/\" + id, nil, nil, nil, embeds})\n}", "func (g *StableGauge) DataPoint() *DataPoint {\n\tdp := g.gauge.DataPoint()\n\tif dp.Value == atomic.LoadInt64(&g.prevValue) {\n\t\t// Value is the same, don't report it\n\t\treturn nil\n\t}\n\tatomic.StoreInt64(&g.prevValue, dp.Value)\n\treturn dp\n}", "func (*SeatDataAccessObject) FindByID(seatID int) *Seat {\n\tvar seat Seat\n\thas, err := orm.Table(seat).ID(seatID).Get(&seat)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif !has {\n\t\treturn nil\n\t}\n\treturn &seat\n}", "func GetByID(id string, doc interface{}) {\n\tif err := DB.GetDocument(id, doc, nil); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "func (ds Dataset) ID() string {\n\treturn ds.id\n}", "func (s *PersonFieldsService) GetByID(ctx context.Context, id int) (*PersonFieldResponse, *Response, error) {\n\turi := fmt.Sprintf(\"/personFields/%v\", id)\n\treq, err := s.client.NewRequest(http.MethodGet, uri, nil, nil)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar record *PersonFieldResponse\n\n\tresp, err := s.client.Do(ctx, req, &record)\n\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn record, resp, nil\n}", "func (s *Service) GetPatientByID(id string) (*models.Patient, error) {\n\tpatient, err := s.db.GetPatientByID(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn patient, nil\n}", "func GetEventByID(id string) (EventCacheResponse, error) {\n\tdb, err := getDatabase()\n\tvar r EventCacheResponse\n\n\tif err != nil {\n\t\treturn r, err\n\t}\n\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(\"select id, json, transport, event from events where id = ?\")\n\tif err != nil {\n\t\treturn r, err\n\t}\n\tdefer stmt.Close()\n\n\terr = stmt.QueryRow(id).Scan(&r.ID, &r.JSON, &r.Transport, &r.Event)\n\tif err != nil {\n\t\treturn r, err\n\t}\n\n\treturn r, err\n}", "func (c *PatientofphysicianClient) GetX(ctx context.Context, id int) *Patientofphysician {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c Cache) GetSummaryDataPoint(identifier string) (*pmetric.SummaryDataPoint, bool) {\n\tpoint, found := c.summaryCache[identifier]\n\tif found {\n\t\tpoint.used = true\n\t\tc.summaryCache[identifier] = point\n\t}\n\treturn point.point, found\n}", "func (g *Gauge) DataPoint() *DataPoint {\n\treturn &DataPoint{\n\t\tMetric: g.metric,\n\t\tTimestamp: time.Now(),\n\t\tType: GaugeType,\n\t\tDimensions: g.dimensions,\n\t\tValue: atomic.LoadInt64(&g.value),\n\t}\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func GetByUUID(uuid dvid.UUID, name dvid.InstanceName) (*Data, error) {\n\tsource, err := datastore.GetDataByUUID(uuid, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, ok := source.(*Data)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Instance '%s' is not a labelsurf datatype!\", name)\n\t}\n\treturn data, nil\n}", "func (d *Data) GetLabelAtPoint(v dvid.VersionID, pt dvid.Point) (uint64, error) {\n\t/*\n\t\tuuid, err := datastore.UUIDFromVersion(v)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// Get the associated labelvol\n\t\tlabelvolData, err := labelvol.GetByUUID(uuid, d.SparseVol)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// Then see if we have an associated labelblk to this labelvol. If not we can't do point query.\n\t\tlabelblkName := labelvolData.Link\n\n\t\t// Get the associated labelblk data instance to do the point query\n\t\tlabelblkData, err := labelblk.GetByUUID(uuid, labelblkName)\n\n\t\t// Do the point query\n\t\tlabelBytes, err := labelblkData.GetLabelBytesAtPoint(v, pt)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\treturn binary.LittleEndian.Uint64(labelBytes), nil\n\t*/\n\treturn 0, nil\n}", "func (s *Instance) GetByID(instanceID string) (*internal.Instance, error) {\n\tsess := s.NewReadSession()\n\tinstanceDTO := dbmodel.InstanceDTO{}\n\tvar lastErr dberr.Error\n\terr := wait.PollImmediate(defaultRetryInterval, defaultRetryTimeout, func() (bool, error) {\n\t\tinstanceDTO, lastErr = sess.GetInstanceByID(instanceID)\n\t\tif lastErr != nil {\n\t\t\tif dberr.IsNotFound(lastErr) {\n\t\t\t\treturn false, dberr.NotFound(\"Instance with id %s not exist\", instanceID)\n\t\t\t}\n\t\t\tlog.Errorf(\"while getting instanceDTO by ID %s: %v\", instanceID, lastErr)\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn nil, lastErr\n\t}\n\tinstance, err := s.toInstance(instanceDTO)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlastOp, err := s.operations.GetLastOperation(instanceID)\n\tif err != nil {\n\t\tif dberr.IsNotFound(err) {\n\t\t\treturn &instance, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tinstance.InstanceDetails = lastOp.InstanceDetails\n\treturn &instance, nil\n}", "func (o JobExtractSourceTablePtrOutput) DatasetId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobExtractSourceTable) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DatasetId\n\t}).(pulumi.StringPtrOutput)\n}", "func (c *Client) SeriesByID(id int) (*Series, error) {\n\tvar data SeriesData\n\tfullURL := c.URL(fmt.Sprintf(\"/series/%d\", id))\n\tif err := c.get(fullURL, &data, withLanguage(c.options.Language)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn data.Data, nil\n}", "func (c *DentistClient) GetX(ctx context.Context, id int) *Dentist {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (ec *EventController) GetByID(ctx context.Context, id primitive.ObjectID) (*Event, error) {\n\tvar event Event\n\teventResult := ec.collection.FindOne(ctx, bson.M{\"_id\": id})\n\tif eventResult.Err() != nil {\n\t\tif eventResult.Err() == mongo.ErrNoDocuments {\n\t\t\treturn nil, errors.NewServerError(\"No events found\", http.StatusNotFound)\n\t\t}\n\t\treturn nil, eventResult.Err()\n\t}\n\n\teventResult.Decode(&event)\n\n\treturn &event, nil\n}", "func (gdb *GostDatabase) GetDatastream(id interface{}, qo *odata.QueryOptions) (*entities.Datastream, error) {\n\tintID, ok := ToIntID(id)\n\tif !ok {\n\t\treturn nil, gostErrors.NewRequestNotFound(errors.New(\"Datastream does not exist\"))\n\t}\n\n\tquery, qi := gdb.QueryBuilder.CreateQuery(&entities.Datastream{}, nil, intID, qo)\n\tdatastream, err := processDatastream(gdb.Db, query, qi)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif qo != nil {\n\t\thasSelectQuery := (qo.Select != nil)\n\t\tvar containsObservedArea = true\n\t\tif hasSelectQuery {\n\t\t\tcontainsObservedArea = ContainsToLower(qo.Select.SelectItems, \"observedArea\")\n\t\t}\n\n\t\t// calculate observedArea on the fly when not present in database\n\t\tif containsObservedArea {\n\t\t\tif datastream.ObservedArea == nil {\n\t\t\t\tobservedArea, _ := gdb.GetObservedArea(intID)\n\t\t\t\tdatastream.ObservedArea = observedArea\n\t\t\t}\n\t\t}\n\t}\n\n\treturn datastream, nil\n}", "func (s *InstanceBindData) Get(iID internal.InstanceID) (*internal.InstanceBindData, error) {\n\tif iID.IsZero() {\n\t\treturn nil, errors.New(\"both instance and operation id must be set\")\n\t}\n\n\tresp, err := s.kv.Get(context.TODO(), s.key(iID))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"while calling database\")\n\t}\n\n\tswitch resp.Count {\n\tcase 1:\n\tcase 0:\n\t\treturn nil, notFoundError{}\n\tdefault:\n\t\treturn nil, errors.New(\"more than one element matching requested id, should never happen\")\n\t}\n\n\treturn s.decodeDSOToDM(resp.Kvs[0].Value)\n}", "func (a *paymentUsecase) GetByID(c context.Context, id int64) (*models.Payment, error) {\n\tctx, cancel := context.WithTimeout(c, a.contextTimeout)\n\tdefer cancel()\n\n\tres, err := a.repo.GetByID(ctx, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "func (r *CampaignRow) GetID() string { return r.Data.ID }", "func (r *CampaignRow) GetID() string { return r.Data.ID }", "func (s *ArticlesService) GetByID(id uint) (models.Article, error) {\n\tvar article models.Article\n\terr := s.db.First(&article, id).Error\n\treturn article, err\n}", "func GetPerson(id string) (*Person, error) {\n\tfor _, p := range all() {\n\t\tif p.ID == id {\n\t\t\treturn &p, nil\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"Person not found\")\n}", "func (c *DoctorClient) GetX(ctx context.Context, id int) *Doctor {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (a *ArticleHandler) GetByID(c *gin.Context) {\n\ti, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusNotFound, domain.ErrNotFound.Error())\n\t\treturn\n\t}\n\n\tid := int64(i)\n\tctx, cancel := context.WithCancel(c)\n\tdefer cancel()\n\n\tar, err := a.ArticleUsecase.GetByID(ctx, id)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(getStatusCode(err), ResponseError{Message: err.Error()})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, ar)\n}" ]
[ "0.6412124", "0.6151225", "0.61227614", "0.5906473", "0.5903145", "0.5848986", "0.58184546", "0.57869554", "0.5733625", "0.5729925", "0.5715823", "0.56466913", "0.5554012", "0.55272156", "0.540155", "0.53998554", "0.5389559", "0.53856915", "0.5385416", "0.53666097", "0.53664446", "0.5357778", "0.53557104", "0.5354468", "0.5351102", "0.5321917", "0.5280269", "0.52787167", "0.5277667", "0.52768105", "0.5276115", "0.5249028", "0.52489144", "0.5247462", "0.5239536", "0.5235913", "0.52326685", "0.52287245", "0.52279675", "0.52256054", "0.5217893", "0.52172893", "0.52042365", "0.52030975", "0.5194718", "0.51902795", "0.5186559", "0.51857716", "0.51783276", "0.5166861", "0.5166772", "0.5159472", "0.5159472", "0.5159472", "0.51568264", "0.5154256", "0.51538914", "0.51483625", "0.5146537", "0.5144201", "0.5143684", "0.51423657", "0.5140925", "0.5132991", "0.51325834", "0.5124562", "0.5110759", "0.51035637", "0.5097755", "0.5095137", "0.5092811", "0.50818163", "0.5081", "0.50782907", "0.50710356", "0.5070677", "0.5063597", "0.5060149", "0.5060097", "0.50551534", "0.5054314", "0.50530165", "0.50470483", "0.50470483", "0.50468904", "0.5045355", "0.5042563", "0.50362605", "0.5036048", "0.503342", "0.50306934", "0.5028101", "0.50176674", "0.50091213", "0.50056714", "0.50056714", "0.5003974", "0.49998277", "0.49990124", "0.49973777" ]
0.81728685
0
NewDeleteCoreV1NamespacedPodOK creates DeleteCoreV1NamespacedPodOK with default headers values
NewDeleteCoreV1NamespacedPodOK создает DeleteCoreV1NamespacedPodOK с значениями заголовков по умолчанию
func NewDeleteCoreV1NamespacedPodOK() *DeleteCoreV1NamespacedPodOK { return &DeleteCoreV1NamespacedPodOK{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewDeleteCoreV1NamespacedServiceOK() *DeleteCoreV1NamespacedServiceOK {\n\treturn &DeleteCoreV1NamespacedServiceOK{}\n}", "func NewCreateCoreV1NamespacedPodOK() *CreateCoreV1NamespacedPodOK {\n\treturn &CreateCoreV1NamespacedPodOK{}\n}", "func NewDeleteCoreV1NamespacedPodUnauthorized() *DeleteCoreV1NamespacedPodUnauthorized {\n\n\treturn &DeleteCoreV1NamespacedPodUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedEventOK() *DeleteCoreV1NamespacedEventOK {\n\treturn &DeleteCoreV1NamespacedEventOK{}\n}", "func NewDeleteCoreV1NamespacedConfigMapOK() *DeleteCoreV1NamespacedConfigMapOK {\n\n\treturn &DeleteCoreV1NamespacedConfigMapOK{}\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func NewCreateCoreV1NamespacedPodUnauthorized() *CreateCoreV1NamespacedPodUnauthorized {\n\treturn &CreateCoreV1NamespacedPodUnauthorized{}\n}", "func NewReadCoreV1NamespacedPodOK() *ReadCoreV1NamespacedPodOK {\n\treturn &ReadCoreV1NamespacedPodOK{}\n}", "func NewDeleteCoreV1NamespacedPodAccepted() *DeleteCoreV1NamespacedPodAccepted {\n\n\treturn &DeleteCoreV1NamespacedPodAccepted{}\n}", "func NewDeleteCoreV1NamespacedServiceUnauthorized() *DeleteCoreV1NamespacedServiceUnauthorized {\n\treturn &DeleteCoreV1NamespacedServiceUnauthorized{}\n}", "func Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func NewCreateCoreV1NamespacedPodBindingOK() *CreateCoreV1NamespacedPodBindingOK {\n\n\treturn &CreateCoreV1NamespacedPodBindingOK{}\n}", "func NewDeleteCoreV1NamespacedServiceAccount(ctx *middleware.Context, handler DeleteCoreV1NamespacedServiceAccountHandler) *DeleteCoreV1NamespacedServiceAccount {\n\treturn &DeleteCoreV1NamespacedServiceAccount{Context: ctx, Handler: handler}\n}", "func NewDeleteCoreV1NamespacedConfigMapUnauthorized() *DeleteCoreV1NamespacedConfigMapUnauthorized {\n\n\treturn &DeleteCoreV1NamespacedConfigMapUnauthorized{}\n}", "func NewWatchCoreV1NamespacedEndpointsOK() *WatchCoreV1NamespacedEndpointsOK {\n\n\treturn &WatchCoreV1NamespacedEndpointsOK{}\n}", "func NewDeleteCoreV1NamespacedEventUnauthorized() *DeleteCoreV1NamespacedEventUnauthorized {\n\treturn &DeleteCoreV1NamespacedEventUnauthorized{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenOK() *CreateCoreV1NamespacedServiceAccountTokenOK {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenOK{}\n}", "func newPod(ctx context.Context, cl client.Client, ns, name, image string, cmd []string) (*corev1.Pod, error) {\n\tc := corev1.Container{\n\t\tName: name,\n\t\tImage: image,\n\t\tCommand: cmd,\n\t}\n\tp := &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: ns,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{c},\n\t\t\t// Kill the pod immediately so it exits quickly on deletion.\n\t\t\tTerminationGracePeriodSeconds: pointer.Int64Ptr(0),\n\t\t},\n\t}\n\tif err := cl.Create(ctx, p); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create pod %s/%s: %v\", p.Namespace, p.Name, err)\n\t}\n\treturn p, nil\n}", "func NewDeleteCommand() *cobra.Command {\n\tvar (\n\t\tall bool\n\t\tcompleted bool\n\t)\n\n\tvar command = &cobra.Command{\n\t\tUse: \"delete WORKFLOW\",\n\t\tShort: \"delete a managed and its associated pods\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\twfClient = InitManagedClient()\n\t\t\tif all {\n\t\t\t\tdeleteManageds(metav1.ListOptions{})\n\t\t\t\treturn\n\t\t\t} else if completed {\n\t\t\t\toptions := metav1.ListOptions{\n\t\t\t\t\tLabelSelector: fmt.Sprintf(\"%s=true\", common.LabelKeyCompleted),\n\t\t\t\t}\n\t\t\t\tdeleteManageds(options)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(args) == 0 {\n\t\t\t\tcmd.HelpFunc()(cmd, args)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tfor _, wfName := range args {\n\t\t\t\tdeleteManaged(wfName)\n\t\t\t}\n\t\t},\n\t}\n\n\tcommand.Flags().BoolVar(&all, \"all\", false, \"Delete all manageds\")\n\tcommand.Flags().BoolVar(&completed, \"completed\", false, \"Delete completed manageds\")\n\treturn command\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenOK() *CreateCoreV1NamespacedServiceAccountTokenOK {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenOK{}\n}", "func NewPatchCoreV1NamespacedServiceAccountOK() *PatchCoreV1NamespacedServiceAccountOK {\n\treturn &PatchCoreV1NamespacedServiceAccountOK{}\n}", "func NewWatchCoreV1NamespacedPodTemplateListOK() *WatchCoreV1NamespacedPodTemplateListOK {\n\treturn &WatchCoreV1NamespacedPodTemplateListOK{}\n}", "func genericPodDelete(label, namespace string, clientset *kubernetes.Clientset) error {\n\n\tvar name string\n\t//Getting all pods in litmus Namespace\n\tpods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to get pods in %v namespace, err: %v\", err)\n\t}\n\n\tklog.Infof(\"[Info]: Selecting pod with label %v for reboot\", label)\n\tfor i := range pods.Items {\n\t\tif pods.Items[i].Labels[\"component\"] == label {\n\t\t\tname = pods.Items[i].Name\n\t\t}\n\t}\n\tklog.Infof(\"[Info]: Deleting the Pod : %v\", name)\n\terr = clientset.CoreV1().Pods(\"litmus\").Delete(context.TODO(), name, metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to delete %v pod, err: %v\", name, err)\n\t}\n\tklog.Infof(\"[Info]: %v pod deleted successfully \\n\", name)\n\treturn nil\n}", "func NewCreateCoreV1NamespacedPodBindingUnauthorized() *CreateCoreV1NamespacedPodBindingUnauthorized {\n\n\treturn &CreateCoreV1NamespacedPodBindingUnauthorized{}\n}", "func NewDeleteCoreV1PersistentVolumeOK() *DeleteCoreV1PersistentVolumeOK {\n\treturn &DeleteCoreV1PersistentVolumeOK{}\n}", "func NewCreateCoreV1NamespacedPodCreated() *CreateCoreV1NamespacedPodCreated {\n\treturn &CreateCoreV1NamespacedPodCreated{}\n}", "func NewReadCoreV1NamespacedEndpointsOK() *ReadCoreV1NamespacedEndpointsOK {\n\treturn &ReadCoreV1NamespacedEndpointsOK{}\n}", "func deletePod(clientset kubernetes.Interface, namespace string, name string) error {\n\treturn clientset.CoreV1().Pods(namespace).Delete(name, &metav1.DeleteOptions{GracePeriodSeconds: &immediate})\n}", "func TestDeletePod(t *testing.T) {\n\tcluster := NewClusterState()\n\tvpa := addTestVpa(cluster)\n\tpod := addTestPod(cluster)\n\tassert.NoError(t, cluster.DeletePod(pod.ID))\n\tassert.Empty(t, vpa.Pods)\n}", "func NewCreateCoreV1NamespacedPodAccepted() *CreateCoreV1NamespacedPodAccepted {\n\treturn &CreateCoreV1NamespacedPodAccepted{}\n}", "func NewGcpKmsDeleteOK() *GcpKmsDeleteOK {\n\treturn &GcpKmsDeleteOK{}\n}", "func NewDelSubDeviceWithCoreRequestWithoutParam() *DelSubDeviceWithCoreRequest {\n\n return &DelSubDeviceWithCoreRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}/products/{productKey}/edges/{edgeName}:delSubDevice\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "func DeletePod(ctx cli.Context) error {\n\tif len(ctx.Args) == 0 {\n\t\treturn fmt.Errorf(\"Usage: puctl infra delete-pod [patterns]\")\n\t}\n\n\twf := cli.NewWorkFlowEngine(\n\t\tcli.NewWorkflowStep(\"\", findPods),\n\t\tcli.NewWorkflowStep(\"Deleting pods\", deletePods),\n\t)\n\n\terr := wf.Run(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"Finished!\")\n\n\treturn nil\n}", "func (o *DeleteCoreV1NamespacedPodOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func NewDeleteAPIKeyDefault(code int) *DeleteAPIKeyDefault {\n\treturn &DeleteAPIKeyDefault{\n\t\t_statusCode: code,\n\t}\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 NewCreateCoreV1NamespacedServiceAccountTokenUnauthorized() *CreateCoreV1NamespacedServiceAccountTokenUnauthorized {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenUnauthorized{}\n}", "func Delete(k8sClient client.Client, obj client.Object) error {\n\treturn k8sClient.Delete(context.TODO(), obj)\n}", "func NewDeleteRegistryOK() *DeleteRegistryOK {\n\treturn &DeleteRegistryOK{}\n}", "func (client *PacketCoreDataPlanesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, packetCoreDataPlaneName string, options *PacketCoreDataPlanesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}\"\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 packetCoreControlPlaneName == \"\" {\n\t\treturn nil, errors.New(\"parameter packetCoreControlPlaneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{packetCoreControlPlaneName}\", url.PathEscape(packetCoreControlPlaneName))\n\tif packetCoreDataPlaneName == \"\" {\n\t\treturn nil, errors.New(\"parameter packetCoreDataPlaneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{packetCoreDataPlaneName}\", url.PathEscape(packetCoreDataPlaneName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewPod(namespace, name, nodeName string, opts *NewPodOptions) *corev1.Pod {\n\tpod := &corev1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: map[string]string{},\n\t\t\tAnnotations: map[string]string{},\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tNodeName: nodeName,\n\t\t\tAffinity: &corev1.Affinity{},\n\t\t\tContainers: []corev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: name,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tif opts != nil {\n\t\tpod.CreationTimestamp = opts.CreationTimestamp\n\n\t\tpod.Spec.Containers[0].Resources = opts.Resources\n\n\t\tif opts.Annotations != nil {\n\t\t\tfor key, value := range opts.Annotations {\n\t\t\t\tpod.Annotations[key] = value\n\t\t\t}\n\t\t}\n\t\tif opts.Labels != nil {\n\t\t\tfor key, value := range opts.Labels {\n\t\t\t\tpod.Labels[key] = value\n\t\t\t}\n\t\t}\n\t\tif opts.NodeSelector != nil {\n\t\t\tpod.Spec.NodeSelector = map[string]string{}\n\t\t\tfor key, value := range opts.NodeSelector {\n\t\t\t\tpod.Spec.NodeSelector[key] = value\n\t\t\t}\n\t\t}\n\t\tpod.Status.Phase = opts.Phase\n\t\tpod.Status.Reason = opts.Reason\n\t\tpod.Status.ContainerStatuses = opts.ContainerStatuses\n\t\tpod.Spec.Tolerations = append(pod.Spec.Tolerations, opts.Tolerations...)\n\t\tpod.Spec.Affinity = &opts.Affinity\n\t}\n\n\tif nodeName != \"\" {\n\t\tutilaffinity.ReplaceNodeNameNodeAffinity(pod.Spec.Affinity, nodeName)\n\t}\n\n\treturn pod\n}", "func NewDeleteCoreV1CollectionNamespacedLimitRangeOK() *DeleteCoreV1CollectionNamespacedLimitRangeOK {\n\n\treturn &DeleteCoreV1CollectionNamespacedLimitRangeOK{}\n}", "func NewDeleteRuntimeContainerOK() *DeleteRuntimeContainerOK {\n\n\treturn &DeleteRuntimeContainerOK{}\n}", "func NewDeleteZoneDefault(code int) *DeleteZoneDefault {\n\treturn &DeleteZoneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenUnauthorized() *CreateCoreV1NamespacedServiceAccountTokenUnauthorized {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenUnauthorized{}\n}", "func NewGcpKmsDeleteDefault(code int) *GcpKmsDeleteDefault {\n\treturn &GcpKmsDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewS3GroupDeleteDefault(code int) *S3GroupDeleteDefault {\n\treturn &S3GroupDeleteDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewPatchCoreV1NamespacedServiceAccountUnauthorized() *PatchCoreV1NamespacedServiceAccountUnauthorized {\n\treturn &PatchCoreV1NamespacedServiceAccountUnauthorized{}\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 NewDeleteCrossConnectDefault(code int) *DeleteCrossConnectDefault {\n\treturn &DeleteCrossConnectDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *PrivateDNSZoneGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}\"\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 privateEndpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointName}\", url.PathEscape(privateEndpointName))\n\tif privateDNSZoneGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateDNSZoneGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateDnsZoneGroupName}\", url.PathEscape(privateDNSZoneGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func DeleteOperator(namespace string) error {\n\tif namespace == \"\" {\n\t\tnamespace = DEFAULT_NAMESPACE\n\t}\n\tif err := sh.RunV(\"helm\", \"delete\", \"-n\", namespace, \"kedahttp\"); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewIpspaceDeleteOK() *IpspaceDeleteOK {\n\treturn &IpspaceDeleteOK{}\n}", "func DeletePod(repoName, namespace string, clientset *kubernetes.Clientset) error {\n\n\t//Setting the label for deleting a Pod\n\tswitch repoName {\n\tcase \"litmusportal-frontend\":\n\t\tif err := genericPodDelete(\"litmusportal-frontend\", namespace, clientset); err != nil {\n\t\t\treturn errors.Errorf(\"Failed to delete pod for repo %v, err: %v\", repoName, err)\n\t\t}\n\tcase \"litmusportal-server\", \"litmusportal-auth-server\":\n\t\tif err := genericPodDelete(\"litmusportal-server\", namespace, clientset); err != nil {\n\t\t\treturn errors.Errorf(\"Failed to delete pod for repo %v, err: %v\", repoName, err)\n\t\t}\n\tdefault:\n\t\treturn errors.Errorf(\"No Appropriate Operation Found!\")\n\t}\n\treturn nil\n}", "func NewDeleteCoreV1NamespacedServiceAccepted() *DeleteCoreV1NamespacedServiceAccepted {\n\treturn &DeleteCoreV1NamespacedServiceAccepted{}\n}", "func NewGroupDeletesOK() *GroupDeletesOK {\n\treturn &GroupDeletesOK{}\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapOK {\n\to.Payload = payload\n\treturn o\n}", "func (k *kubectlContext) Delete(args ...string) error {\n\tout, err := k.do(append([]string{\"delete\"}, args...)...)\n\tk.t.Log(string(out))\n\treturn err\n}", "func NewIPServicePolicyDeleteOK() *IPServicePolicyDeleteOK {\n\treturn &IPServicePolicyDeleteOK{}\n}", "func (s *Server) DeletePods(ctx context.Context, in *datahub_v1alpha1.DeletePodsRequest) (*status.Status, error) {\n\tscope.Debug(\"Request received from DeletePods grpc function: \" + utils.InterfaceToString(in))\n\n\tvar containerDAO cluster_status_dao.ContainerOperation = &cluster_status_dao_impl.Container{\n\t\tInfluxDBConfig: *s.Config.InfluxDB,\n\t}\n\tif err := containerDAO.DeletePods(in.GetPods()); err != nil {\n\t\tscope.Errorf(\"DeletePods failed: %+v\", err)\n\t\treturn &status.Status{\n\t\t\tCode: int32(code.Code_INTERNAL),\n\t\t\tMessage: err.Error(),\n\t\t}, nil\n\t}\n\treturn &status.Status{\n\t\tCode: int32(code.Code_OK),\n\t}, nil\n}", "func DeletePod(ci coreclient.CoreV1Interface, pod *corev1.Pod, timeout time.Duration) error {\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\terr := ci.Pods(pod.Namespace).Delete(ctx, pod.Name, metav1.DeleteOptions{})\n\treturn err\n}", "func (g genericPlugin) Delete(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) error {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\tdynClient := client.GetDynamicClient()\n\tmapper := client.GetMapper()\n\n\tmapping, err := mapper.RESTMapping(schema.GroupKind{\n\t\tGroup: resource.GVK.Group,\n\t\tKind: resource.GVK.Kind,\n\t}, resource.GVK.Version)\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Mapping kind to resource error\")\n\t}\n\n\tgvr := mapping.Resource\n\tdeletePolicy := metav1.DeletePropagationForeground\n\topts := &metav1.DeleteOptions{\n\t\tPropagationPolicy: &deletePolicy,\n\t}\n\n\tswitch mapping.Scope.Name() {\n\tcase meta.RESTScopeNameNamespace:\n\t\terr = dynClient.Resource(gvr).Namespace(namespace).Delete(resource.Name, opts)\n\tcase meta.RESTScopeNameRoot:\n\t\terr = dynClient.Resource(gvr).Delete(resource.Name, opts)\n\tdefault:\n\t\treturn pkgerrors.New(\"Got an unknown RESTSCopeName for mapping: \" + resource.GVK.String())\n\t}\n\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Delete object error\")\n\t}\n\treturn nil\n}", "func NewS3GroupDeleteOK() *S3GroupDeleteOK {\n\treturn &S3GroupDeleteOK{}\n}", "func TestDeleteWithRetry(t *testing.T) {\n\tscheme, codecs := testScheme(t)\n\tcodec := apitesting.TestCodec(codecs, examplev1.SchemeGroupVersion)\n\tserver := etcdtesting.NewEtcdTestClientServer(t)\n\tdefer server.Terminate(t)\n\tprefix := path.Join(\"/\", etcdtest.PathPrefix())\n\n\tobj := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: \"foo\", UID: \"A\"}}\n\t// fakeGet returns a large ModifiedIndex to emulate the case that another\n\t// party has updated the object.\n\tfakeGet := func(ctx context.Context, key string, opts *etcd.GetOptions) (*etcd.Response, error) {\n\t\tdata, _ := runtime.Encode(codec, obj)\n\t\treturn &etcd.Response{Node: &etcd.Node{Value: defaultPrefixValue(data), ModifiedIndex: 99}}, nil\n\t}\n\texpectedRetries := 3\n\thelper := newEtcdHelper(server.Client, scheme, codec, prefix)\n\tfake := &fakeDeleteKeysAPI{KeysAPI: helper.etcdKeysAPI, fakeGetCap: expectedRetries, fakeGetFunc: fakeGet}\n\thelper.etcdKeysAPI = fake\n\n\treturnedObj := &example.Pod{}\n\terr := helper.Create(context.TODO(), \"/some/key\", obj, returnedObj, 0)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error %#v\", err)\n\t}\n\n\terr = helper.Delete(context.TODO(), \"/some/key\", obj, storage.NewUIDPreconditions(\"A\"))\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error %#v\", err)\n\t}\n\tif fake.getCount != expectedRetries {\n\t\tt.Errorf(\"Expect %d retries, got %d\", expectedRetries, fake.getCount)\n\t}\n\terr = helper.Get(context.TODO(), \"/some/key\", \"\", obj, false)\n\tif !storage.IsNotFound(err) {\n\t\tt.Errorf(\"Expect an NotFound error, got %v\", err)\n\t}\n}", "func (client *ManagedClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif resourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceName}\", url.PathEscape(resourceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (factory *Factory) DeletePod(pod *corev1.Pod) {\n\tgomega.Expect(factory.GetControllerRuntimeClient().Delete(ctx.TODO(), pod)).NotTo(gomega.HaveOccurred())\n}", "func NewReadCoreV1NamespacedPodUnauthorized() *ReadCoreV1NamespacedPodUnauthorized {\n\treturn &ReadCoreV1NamespacedPodUnauthorized{}\n}", "func KubeDelete(object string, name string) string {\n\tvar outputstring string\n\tif object == \"\" || name == \"\" {\n\t\toutputstring = \"\"\n\t} else {\n\t\toutputstring = fmt.Sprintf(\"delete %s %s\", object, name)\n\t}\n\treturn KubeCommand(outputstring)\n}", "func (client *DicomServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dicomServiceName string, workspaceName string, options *DicomServicesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}\"\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 dicomServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter dicomServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{dicomServiceName}\", url.PathEscape(dicomServiceName))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewDeleteOneDefault(code int) *DeleteOneDefault {\n\treturn &DeleteOneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteUsingDELETE8OK() *DeleteUsingDELETE8OK {\n\treturn &DeleteUsingDELETE8OK{}\n}", "func createPod(clientset kubernetes.Interface, namespace string, image string, name string,\n\tlabels map[string]string, command []string, args []string) (*v1.Pod, error) {\n\tenv := []v1.EnvVar{\n\t\t{\n\t\t\tName: \"NAMESPACE\",\n\t\t\tValueFrom: &v1.EnvVarSource{\n\t\t\t\tFieldRef: &v1.ObjectFieldSelector{\n\t\t\t\t\tAPIVersion: \"v1\",\n\t\t\t\t\tFieldPath: \"metadata.namespace\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tspec := v1.PodSpec{\n\t\tContainers: []v1.Container{\n\t\t\t{\n\t\t\t\tEnv: env,\n\t\t\t\tName: fmt.Sprintf(\"%v-pod-container\", name),\n\t\t\t\tImage: image,\n\t\t\t},\n\t\t},\n\t}\n\n\tif len(command) > 0 {\n\t\tspec.Containers[0].Command = command\n\t\tif len(args) > 0 {\n\t\t\tspec.Containers[0].Args = args\n\t\t}\n\t}\n\n\tpod := &v1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tLabels: labels,\n\t\t\tName: name,\n\t\t},\n\t\tSpec: spec,\n\t}\n\n\tif _, err := clientset.CoreV1().Pods(namespace).Create(pod); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn clientset.CoreV1().Pods(namespace).Get(name, metav1.GetOptions{})\n}", "func NewDeleteCmd(globalCfg *config.GlobalImpl) *cobra.Command {\n\tdeleteOptions := config.NewDeleteOptions()\n\n\tcmd := &cobra.Command{\n\t\tUse: \"delete\",\n\t\tShort: \"DEPRECATED: delete releases from state file (helm delete)\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tdeleteImpl := config.NewDeleteImpl(globalCfg, deleteOptions)\n\t\t\terr := config.NewCLIConfigImpl(deleteImpl.GlobalImpl)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := deleteImpl.ValidateConfig(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ta := app.New(deleteImpl)\n\t\t\treturn toCLIError(deleteImpl.GlobalImpl, a.Delete(deleteImpl))\n\t\t},\n\t}\n\n\tf := cmd.Flags()\n\tf.StringVar(&globalCfg.GlobalOptions.Args, \"args\", \"\", \"pass args to helm exec\")\n\tf.StringVar(&deleteOptions.Cascade, \"cascade\", \"\", \"pass cascade to helm exec, default: background\")\n\tf.IntVar(&deleteOptions.Concurrency, \"concurrency\", 0, \"maximum number of concurrent helm processes to run, 0 is unlimited\")\n\tf.BoolVar(&deleteOptions.Purge, \"purge\", false, \"purge releases i.e. free release names and histories\")\n\tf.BoolVar(&deleteOptions.SkipCharts, \"skip-charts\", false, \"don't prepare charts when deleting releases\")\n\n\treturn cmd\n}", "func Delete(input DeleteInput) {\n\tExpect(input.Deleter).NotTo(BeNil(), \"input.Deleter is required for Pod.Delete\")\n\tExpect(input.Pod).NotTo(BeNil(), \"input.Pod is required for Pod.Delete\")\n\n\tBy(fmt.Sprintf(\"Deleting Pod \\\"%s\\\"\", input.Pod.Name))\n\tExpect(input.Deleter.Delete(context.TODO(), input.Pod)).Should(Succeed())\n}", "func NewWatchCoreV1NamespacedEndpointsUnauthorized() *WatchCoreV1NamespacedEndpointsUnauthorized {\n\n\treturn &WatchCoreV1NamespacedEndpointsUnauthorized{}\n}", "func NewDeleteScopeDefault(code int) *DeleteScopeDefault {\n\treturn &DeleteScopeDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func NewDelete(appName string) *commander.CommandWrapper {\n\treturn &commander.CommandWrapper{\n\t\tHandler: &Delete{},\n\t\tHelp: &commander.CommandDescriptor{\n\t\t\tName: \"delete\",\n\t\t\tShortDescription: \"Delete a server.\",\n\t\t\tLongDescription: `Delete a server will destroy the world and container and the version file.`,\n\t\t\tArguments: \"name\",\n\t\t\tExamples: []string{\"\", \"my_server\"},\n\t\t},\n\t}\n}", "func NewWeaviateSchemaActionsDeleteOK() *WeaviateSchemaActionsDeleteOK {\n\n\treturn &WeaviateSchemaActionsDeleteOK{}\n}", "func NewNvmeServiceDeleteOK() *NvmeServiceDeleteOK {\n\treturn &NvmeServiceDeleteOK{}\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 NewDeleteNamespaceParams() *DeleteNamespaceParams {\n\tvar ()\n\treturn &DeleteNamespaceParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewDeleteSecurityGroupOK() *DeleteSecurityGroupOK {\n\treturn &DeleteSecurityGroupOK{}\n}", "func Delete(ctx context.Context) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"delete <name>\",\n\t\tShort: \"Delete a namespace\",\n\t\tArgs: utils.MaximumNArgsAccepted(1, \"\"),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := contextCMD.NewContextCommand().Run(ctx, &contextCMD.ContextOptions{}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tnsToDelete := okteto.Context().Namespace\n\t\t\tif len(args) > 0 {\n\t\t\t\tnsToDelete = args[0]\n\t\t\t}\n\n\t\t\tif !okteto.IsOkteto() {\n\t\t\t\treturn oktetoErrors.ErrContextIsNotOktetoCluster\n\t\t\t}\n\n\t\t\tnsCmd, err := NewCommand()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = nsCmd.ExecuteDeleteNamespace(ctx, nsToDelete)\n\t\t\tanalytics.TrackDeleteNamespace(err == nil)\n\t\t\treturn err\n\t\t},\n\t}\n\treturn cmd\n}", "func (r PodTestRunner) deletePods(ctx context.Context, configMapName string) error {\n\tdo := metav1.DeleteOptions{}\n\tselector := fmt.Sprintf(\"testrun=%s\", configMapName)\n\tlo := metav1.ListOptions{LabelSelector: selector}\n\terr := r.Client.CoreV1().Pods(r.Namespace).DeleteCollection(ctx, do, lo)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error deleting pods (label selector %q): %w\", selector, err)\n\t}\n\treturn nil\n}", "func NewSystemDeleteOK() *SystemDeleteOK {\n\treturn &SystemDeleteOK{}\n}", "func newPod(name string) *corev1.Pod {\n\treturn &corev1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{},\n\t\tObjectMeta: metav1.ObjectMeta{Name: name},\n\t\tSpec: corev1.PodSpec{},\n\t\tStatus: corev1.PodStatus{},\n\t}\n}", "func NewQtreeDeleteDefault(code int) *QtreeDeleteDefault {\n\treturn &QtreeDeleteDefault{\n\t\t_statusCode: code,\n\t}\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 NewDeleteClientByNamespaceNotFound() *DeleteClientByNamespaceNotFound {\n\treturn &DeleteClientByNamespaceNotFound{}\n}", "func NewConnectCoreV1PutNamespacedPodProxy(ctx *middleware.Context, handler ConnectCoreV1PutNamespacedPodProxyHandler) *ConnectCoreV1PutNamespacedPodProxy {\n\treturn &ConnectCoreV1PutNamespacedPodProxy{Context: ctx, Handler: handler}\n}", "func NewPostFirmwaresDeleteOK() *PostFirmwaresDeleteOK {\n\treturn &PostFirmwaresDeleteOK{}\n}", "func NewDeleteInstancesOK() *DeleteInstancesOK {\n\treturn &DeleteInstancesOK{}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpnConnectionInput, error) {\n\tres := &svcsdk.DeleteVpnConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPNConnectionID != nil {\n\t\tres.SetVpnConnectionId(*r.ko.Status.VPNConnectionID)\n\t}\n\n\treturn res, nil\n}", "func NewPcloudPvminstancesDeleteOK() *PcloudPvminstancesDeleteOK {\n\treturn &PcloudPvminstancesDeleteOK{}\n}", "func ExampleServiceDiscovery_DeleteNamespace_shared00() {\n\tsvc := servicediscovery.New(session.New())\n\tinput := &servicediscovery.DeleteNamespaceInput{\n\t\tId: aws.String(\"ns-ylexjili4cdxy3xm\"),\n\t}\n\n\tresult, err := svc.DeleteNamespace(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase servicediscovery.ErrCodeInvalidInput:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeInvalidInput, aerr.Error())\n\t\t\tcase servicediscovery.ErrCodeNamespaceNotFound:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeNamespaceNotFound, aerr.Error())\n\t\t\tcase servicediscovery.ErrCodeResourceInUse:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeResourceInUse, aerr.Error())\n\t\t\tcase servicediscovery.ErrCodeDuplicateRequest:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeDuplicateRequest, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "func (client Client) DeletePod(name string) error {\n\t_, err := client.rawRequest(\"DELETE\", \"pods/\"+name, nil, nil)\n\treturn err\n}" ]
[ "0.68976986", "0.68763286", "0.6668603", "0.66465414", "0.6645578", "0.6539118", "0.62248933", "0.61037683", "0.6061472", "0.5951946", "0.5913124", "0.5850097", "0.5843914", "0.5727536", "0.5688485", "0.5683131", "0.5660715", "0.5644126", "0.55773365", "0.5564169", "0.55473536", "0.5520597", "0.54743516", "0.537867", "0.53759956", "0.5366322", "0.53568673", "0.53510725", "0.53417015", "0.5341409", "0.53372633", "0.5332943", "0.5307109", "0.5305641", "0.53034425", "0.52667505", "0.5266526", "0.52553105", "0.5243223", "0.52405083", "0.5237857", "0.5229002", "0.52201414", "0.52074003", "0.5205936", "0.5204101", "0.5202935", "0.5201343", "0.5197907", "0.5197907", "0.5195699", "0.5189226", "0.5179698", "0.5165402", "0.5164645", "0.51646423", "0.5147279", "0.5137836", "0.51311034", "0.51283294", "0.5119111", "0.51157385", "0.5110725", "0.5100524", "0.5097958", "0.5096054", "0.50653946", "0.50599813", "0.5055961", "0.5053598", "0.50525856", "0.5039531", "0.5039094", "0.5036859", "0.5036831", "0.5035343", "0.50300163", "0.5026073", "0.5017665", "0.50142705", "0.50113523", "0.49970233", "0.4992421", "0.4992079", "0.49887317", "0.4979772", "0.4977303", "0.49403873", "0.49398056", "0.49386925", "0.49330506", "0.49330506", "0.49287277", "0.49267483", "0.49209198", "0.49200594", "0.49200282", "0.4916354", "0.49087057", "0.49055016" ]
0.7737533
0
WithPayload adds the payload to the delete core v1 namespaced pod o k response
WithPayload добавляет payload в ответ delete core v1 namespaced pod o k
func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK { o.Payload = payload return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteCoreV1NamespacedPodOK) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDOK) WithPayload(payload *models.Response) *DeletePostbyIDOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDInternalServerError) WithPayload(payload *models.Response) *DeletePostbyIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteRuntimeContainerInternalServerError) WithPayload(payload string) *DeleteRuntimeContainerInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) WithPayload(payload *models.ErrorResponse) *WeaviateSchemaActionsDeleteBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserOK) WithPayload(payload *models.DeletedResponse) *DeleteUserOK {\n\to.Payload = payload\n\treturn o\n}", "func DeleteOperator(namespace string) error {\n\tif namespace == \"\" {\n\t\tnamespace = DEFAULT_NAMESPACE\n\t}\n\tif err := sh.RunV(\"helm\", \"delete\", \"-n\", namespace, \"kedahttp\"); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *DeleteOrganizationOK) WithPayload(payload *models.DeletedResponse) *DeleteOrganizationOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *ThingsDeleteInternalServerError) WithPayload(payload *models.ErrorResponse) *ThingsDeleteInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDUnauthorized) WithPayload(payload *models.Response) *DeletePostbyIDUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *ThingsDeleteForbidden) WithPayload(payload *models.ErrorResponse) *ThingsDeleteForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *PostOperationsDeleteP2PPathOK) WithPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) *PostOperationsDeleteP2PPathOK {\n\to.Payload = payload\n\treturn o\n}", "func Delete(objectName string, payload interface{}) *Writer {\n\treturn &Writer{\n\t\tCmd: \"delete\",\n\t\tObjectName: objectName,\n\t\tPayload: payload,\n\t}\n}", "func (o *DeleteOrganizationForbidden) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteConsulDefault) WithPayload(payload *models.Error) *DeleteConsulDefault {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDNotFound) WithPayload(payload *models.Response) *DeletePostbyIDNotFound {\n\to.Payload = payload\n\treturn o\n}", "func (k *kubectlContext) Delete(args ...string) error {\n\tout, err := k.do(append([]string{\"delete\"}, args...)...)\n\tk.t.Log(string(out))\n\treturn err\n}", "func (o *DeleteProjectUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserForbidden) WithPayload(payload *models.ErrorResponse) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) *WatchCoreV1NamespacedEndpointsOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func NewDeletePayload(body *DeleteRequestBody, token string) *warehouse.DeletePayload {\n\tv := &warehouse.DeletePayload{}\n\tv.Ids = make([]string, len(body.Ids))\n\tfor i, val := range body.Ids {\n\t\tv.Ids[i] = val\n\t}\n\tv.Token = token\n\n\treturn v\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpnConnectionInput, error) {\n\tres := &svcsdk.DeleteVpnConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPNConnectionID != nil {\n\t\tres.SetVpnConnectionId(*r.ko.Status.VPNConnectionID)\n\t}\n\n\treturn res, nil\n}", "func (m *kubePackage) kubeDelete(_ context.Context, r *apiResource, foreground bool) error {\n\tvar c dynamic.ResourceInterface = m.dynClient.Resource(r.GroupVersionResource())\n\tif r.Namespace != \"\" {\n\t\tc = c.(dynamic.NamespaceableResourceInterface).Namespace(r.Namespace)\n\t}\n\n\tdelPolicy := metav1.DeletePropagationBackground\n\tif foreground {\n\t\tdelPolicy = metav1.DeletePropagationForeground\n\t}\n\n\tlog.V(1).Infof(\"DELETE to %s\", m.Master+r.PathWithName())\n\n\tif m.dryRun {\n\t\treturn nil\n\t}\n\n\tif err := c.Delete(context.TODO(), r.Name, metav1.DeleteOptions{\n\t\tPropagationPolicy: &delPolicy,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"%v deleted\", r)\n\n\treturn nil\n}", "func (o *DeleteOrganizationOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrgOK) WithPayload(payload *DeleteOrgOKBody) *DeleteOrgOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteProjectUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (c *Controller) delete(d *appsv1.Deployment) error {\n\tep := RegisteelEndpoint + \"/\" + string(d.UID)\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(http.MethodDelete, ep, nil)\n\treq.Header.Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.logger.Infof(\"removed deployment from api: %v\", d.Name)\n\n\treturn nil\n}", "func RunKubeDelete(log *LoggingConfig, args []string, dryrun bool) (string, error) {\n\tlog.Info.log(\"Attempting to delete resource from Kubernetes ...\")\n\tkargs := []string{\"delete\"}\n\tkargs = append(kargs, args...)\n\treturn RunKube(log, kargs, dryrun)\n}", "func (o *DeleteRuntimeContainerNotFound) WithPayload(payload string) *DeleteRuntimeContainerNotFound {\n\to.Payload = payload\n\treturn o\n}", "func RunDelete(cmd *cobra.Command, args []string) {\n\n\tlog := util.Logger()\n\n\tif len(args) != 1 || args[0] == \"\" {\n\t\tlog.Fatalf(`❌ Missing expected arguments: <namespace-store-name> %s`, cmd.UsageString())\n\t}\n\n\to := util.KubeObject(bundle.File_deploy_crds_noobaa_io_v1alpha1_namespacestore_cr_yaml)\n\tnamespaceStore := o.(*nbv1.NamespaceStore)\n\tnamespaceStore.Name = args[0]\n\tnamespaceStore.Namespace = options.Namespace\n\tnamespaceStore.Spec = nbv1.NamespaceStoreSpec{}\n\n\tnbClient := system.GetNBClient()\n\n\tnamespaceResourceinfo, err := nbClient.ReadNamespaceResourceAPI(nb.ReadNamespaceResourceParams{Name: namespaceStore.Name})\n\tif err != nil {\n\t\trpcErr, isRPCErr := err.(*nb.RPCError)\n\t\tif !isRPCErr || rpcErr.RPCCode != \"NO_SUCH_NAMESPACE_RESOURCE\" {\n\t\t\tlog.Fatalf(`❌ Failed to read NamespaceStore info: %s`, err)\n\t\t}\n\t} else if namespaceResourceinfo.Undeletable != \"\" && namespaceResourceinfo.Undeletable != \"IS_NAMESPACESTORE\" {\n\t\tswitch namespaceResourceinfo.Undeletable {\n\t\tcase \"CONNECTED_BUCKET_DELETING\":\n\t\t\tfallthrough\n\t\tcase \"IN_USE\":\n\t\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q as it is being used by one or more buckets`,\n\t\t\t\tnamespaceStore.Name, namespaceStore.Namespace)\n\t\tdefault:\n\t\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q, undeletable due to %q`,\n\t\t\t\tnamespaceStore.Name, namespaceStore.Namespace, namespaceResourceinfo.Undeletable)\n\t\t}\n\t}\n\tif !util.KubeDelete(namespaceStore) {\n\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q`,\n\t\t\tnamespaceStore.Name, namespaceStore.Namespace)\n\t}\n}", "func (o *DeleteUserInternalServerError) WithPayload(payload string) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func KubeDelete(object string, name string) string {\n\tvar outputstring string\n\tif object == \"\" || name == \"\" {\n\t\toutputstring = \"\"\n\t} else {\n\t\toutputstring = fmt.Sprintf(\"delete %s %s\", object, name)\n\t}\n\treturn KubeCommand(outputstring)\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) WithPayload(payload *models.IoK8sAPICoreV1Binding) *CreateCoreV1NamespacedPodBindingOK {\n\to.Payload = payload\n\treturn o\n}", "func Delete(k8sClient client.Client, obj client.Object) error {\n\treturn k8sClient.Delete(context.TODO(), obj)\n}", "func (o *DeleteImageDefault) WithPayload(payload *models.Error) *DeleteImageDefault {\n\to.Payload = payload\n\treturn o\n}", "func NewDeleteCoreV1NamespacedPodOK() *DeleteCoreV1NamespacedPodOK {\n\n\treturn &DeleteCoreV1NamespacedPodOK{}\n}", "func genericPodDelete(label, namespace string, clientset *kubernetes.Clientset) error {\n\n\tvar name string\n\t//Getting all pods in litmus Namespace\n\tpods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to get pods in %v namespace, err: %v\", err)\n\t}\n\n\tklog.Infof(\"[Info]: Selecting pod with label %v for reboot\", label)\n\tfor i := range pods.Items {\n\t\tif pods.Items[i].Labels[\"component\"] == label {\n\t\t\tname = pods.Items[i].Name\n\t\t}\n\t}\n\tklog.Infof(\"[Info]: Deleting the Pod : %v\", name)\n\terr = clientset.CoreV1().Pods(\"litmus\").Delete(context.TODO(), name, metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to delete %v pod, err: %v\", name, err)\n\t}\n\tklog.Infof(\"[Info]: %v pod deleted successfully \\n\", name)\n\treturn nil\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteConsulNotFound) WithPayload(payload *models.Error) *DeleteConsulNotFound {\n\to.Payload = payload\n\treturn o\n}", "func (m *PayloadResponseItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *PayloadResponseItemRequestBuilderDeleteRequestConfiguration)(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 (client IdentityClient) deleteTagNamespace(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/tagNamespaces/{tagNamespaceId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteTagNamespaceResponse\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 (r *MacOSTrustedRootCertificateRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\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 (g genericPlugin) Delete(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) error {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\tdynClient := client.GetDynamicClient()\n\tmapper := client.GetMapper()\n\n\tmapping, err := mapper.RESTMapping(schema.GroupKind{\n\t\tGroup: resource.GVK.Group,\n\t\tKind: resource.GVK.Kind,\n\t}, resource.GVK.Version)\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Mapping kind to resource error\")\n\t}\n\n\tgvr := mapping.Resource\n\tdeletePolicy := metav1.DeletePropagationForeground\n\topts := &metav1.DeleteOptions{\n\t\tPropagationPolicy: &deletePolicy,\n\t}\n\n\tswitch mapping.Scope.Name() {\n\tcase meta.RESTScopeNameNamespace:\n\t\terr = dynClient.Resource(gvr).Namespace(namespace).Delete(resource.Name, opts)\n\tcase meta.RESTScopeNameRoot:\n\t\terr = dynClient.Resource(gvr).Delete(resource.Name, opts)\n\tdefault:\n\t\treturn pkgerrors.New(\"Got an unknown RESTSCopeName for mapping: \" + resource.GVK.String())\n\t}\n\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Delete object error\")\n\t}\n\treturn nil\n}", "func (c *Client) NamespaceDelete(org string) (models.Response, error) {\n\tresp := models.Response{}\n\n\tdata, err := c.delete(api.Routes.Path(\"NamespaceDelete\", org))\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\tif err := json.Unmarshal(data, &resp); err != nil {\n\t\treturn resp, err\n\t}\n\n\treturn resp, nil\n}", "func deletePod(clientset kubernetes.Interface, namespace string, name string) error {\n\treturn clientset.CoreV1().Pods(namespace).Delete(name, &metav1.DeleteOptions{GracePeriodSeconds: &immediate})\n}", "func DeleteWithPrefix(config *EtcdConfig, key string) (int, error) {\n\tindex, client, err := getClient(config)\n\tif err != nil {\n\t\tfmt.Println(\"put action failed\")\n\t\treturn 0, err\n\t}\n\tKV := client.KV\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\tdefer cancel()\n\tr, err := KV.Delete(ctx, key, clientv3.WithPrefix())\n\tif err != nil {\n\t\t_ = closeClient(index)\n\t\treturn 0, err\n\t}\n\tfmt.Println(\"delete action succeed\")\n\tres := int(r.Deleted)\n\treturn res, nil\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteUserOK) WithPayload(payload *DeleteUserOKBody) *DeleteUserOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteServiceIDFailure) WithPayload(payload models.Error) *DeleteServiceIDFailure {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteRuntimeContainerBadRequest) WithPayload(payload string) *DeleteRuntimeContainerBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserUnauthorized) WithPayload(payload *DeleteUserUnauthorizedBody) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserForbidden) WithPayload(payload *DeleteUserForbiddenBody) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "func DeletePod(ctx cli.Context) error {\n\tif len(ctx.Args) == 0 {\n\t\treturn fmt.Errorf(\"Usage: puctl infra delete-pod [patterns]\")\n\t}\n\n\twf := cli.NewWorkFlowEngine(\n\t\tcli.NewWorkflowStep(\"\", findPods),\n\t\tcli.NewWorkflowStep(\"Deleting pods\", deletePods),\n\t)\n\n\terr := wf.Run(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"Finished!\")\n\n\treturn nil\n}", "func TestObjectDeleted(t *testing.T) {\n\texpectedCard := TeamsMessageCard{\n\t\tType: messageType,\n\t\tContext: context,\n\t\tThemeColor: msTeamsColors[\"Danger\"],\n\t\tSummary: \"kubewatch notification received\",\n\t\tTitle: \"kubewatch\",\n\t\tText: \"\",\n\t\tSections: []TeamsMessageCardSection{\n\t\t\t{\n\t\t\t\tActivityTitle: \"A `pod` in namespace `new` has been `deleted`:\\n`foo`\",\n\t\t\t\tMarkdown: true,\n\t\t\t},\n\t\t},\n\t}\n\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tif r.Method != \"POST\" {\n\t\t\tt.Errorf(\"expected a POST request for ObjectDeleted()\")\n\t\t}\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tvar c TeamsMessageCard\n\t\tif err := decoder.Decode(&c); err != nil {\n\t\t\tt.Errorf(\"%v\", err)\n\t\t}\n\t\tif !reflect.DeepEqual(c, expectedCard) {\n\t\t\tt.Errorf(\"expected %v, got %v\", expectedCard, c)\n\t\t}\n\t}))\n\n\tms := &MSTeams{TeamsWebhookURL: ts.URL}\n\tp := &v1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tUID: \"12345678\",\n\t\t\tName: \"foo\",\n\t\t\tNamespace: \"new\",\n\t\t},\n\t}\n\tms.ObjectDeleted(p)\n}", "func (s *server) Delete(ctx context.Context, body *pb.NameHolder) (*pb.DeletionResponse, error) {\n\tappName := body.GetName()\n\tfilter := types.M{\n\t\tmongo.NameKey: appName,\n\t\tmongo.InstanceTypeKey: mongo.AppInstance,\n\t}\n\n\tnode, _ := redis.FetchAppNode(appName)\n\tgo redis.DecrementServiceLoad(ServiceName, node)\n\tgo redis.RemoveApp(appName)\n\tgo diskCleanup(appName)\n\n\tif configs.CloudflareConfig.PlugIn {\n\t\tgo cloudflare.DeleteRecord(appName, mongo.AppInstance)\n\t}\n\n\t_, err := mongo.DeleteInstance(filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.DeletionResponse{Success: true}, nil\n}", "func TestDeletePod(t *testing.T) {\n\tcluster := NewClusterState()\n\tvpa := addTestVpa(cluster)\n\tpod := addTestPod(cluster)\n\tassert.NoError(t, cluster.DeletePod(pod.ID))\n\tassert.Empty(t, vpa.Pods)\n}", "func (o *DeleteGroupByIDUnauthorized) WithPayload(payload *models.Error) *DeleteGroupByIDUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (c *Controller) Delete(typ, name, namespace string) error {\n\treturn errUnsupported\n}", "func (c *SubresourceClient) Delete(namespace, name string) (e error) {\n\tif c.Error != \"\" {\n\t\te = fmt.Errorf(c.Error)\n\t}\n\treturn\n}", "func (n *namespaceClient) Delete(namespace string) error {\n\turl := fmt.Sprintf(\"%s%s/%s\", n.url, nsh.AddURL, namespace)\n\t_, err := n.client.DoHTTPRequest(\"DELETE\", url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn.logger.Info(\"successfully deleted namespace\")\n\treturn nil\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteCertificatesV1CollectionCertificateSigningRequestOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCertificatesV1CollectionCertificateSigningRequestOK {\n\to.Payload = payload\n\treturn o\n}", "func (kvclient *MockResKVClient) DeleteWithPrefix(ctx context.Context, prefix string) error {\n\treturn nil\n}", "func RunUninstall(cmd *cobra.Command, args []string) {\n\tc := LoadOperatorConf(cmd)\n\tLoadAdmissionConf(c)\n\tnoDeploy, _ := cmd.Flags().GetBool(\"no-deploy\")\n\tif !noDeploy {\n\t\tutil.KubeDelete(c.Deployment)\n\t\twaitForOperatorPodExit()\n\t\tutil.KubeDelete(c.ClusterRoleBinding)\n\t\tutil.KubeDelete(c.ClusterRole)\n\t\tutil.KubeDelete(c.RoleBindingEndpoint)\n\t\tutil.KubeDelete(c.RoleBinding)\n\t\tutil.KubeDelete(c.RoleEndpoint)\n\t\tutil.KubeDelete(c.Role)\n\t\tutil.KubeDelete(c.SAEndpoint)\n\t\tutil.KubeDelete(c.SA)\n\t} else {\n\t\tlog.Printf(\"Operator Delete: currently disabled with \\\"--no-deploy\\\" flag\")\n\t\tlog.Printf(\"Operator Deployment Status:\")\n\t\tutil.KubeCheck(c.Deployment)\n\t}\n\n\tutil.KubeDelete(c.WebhookConfiguration)\n\tutil.KubeDelete(c.WebhookSecret)\n\tutil.KubeDelete(c.WebhookService)\n\n\tcleanup, _ := cmd.Flags().GetBool(\"cleanup\")\n\treservedNS := c.NS.Name == \"default\" ||\n\t\tstrings.HasPrefix(c.NS.Name, \"openshift-\") ||\n\t\tstrings.HasPrefix(c.NS.Name, \"kubernetes-\") ||\n\t\tstrings.HasPrefix(c.NS.Name, \"kube-\")\n\tif reservedNS {\n\t\tlog.Printf(\"Namespace Delete: disabled for reserved namespace\")\n\t\tlog.Printf(\"Namespace Status:\")\n\t\tutil.KubeCheck(c.NS)\n\t} else if !cleanup {\n\t\tlog.Printf(\"Namespace Delete: currently disabled (enable with \\\"--cleanup\\\")\")\n\t\tlog.Printf(\"Namespace Status:\")\n\t\tutil.KubeCheck(c.NS)\n\t} else {\n\t\tlog.Printf(\"Namespace Delete:\")\n\t\tutil.KubeDelete(c.NS)\n\t}\n}", "func (c *client) Delete(_ context.Context, request *blobstore.DeleteRequest) (*blobstore.DeleteResponse, error) {\n\tif err := os.Remove(c.bodyPath(request.Key)); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := os.Remove(c.tagsPath(request.Key)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &blobstore.DeleteResponse{}, nil\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenCreated) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (a *Agent) LabelDelete(labelId string) (err error) {\n\tif labelId == \"\" {\n\t\treturn\n\t}\n\tspec := (&api.LabelDeleteSpec{}).Init(labelId)\n\treturn a.pc.ExecuteApi(spec)\n}", "func (c *Client) Delete(ctx context.Context, obj runtime.Object) error {\n\tlocal, err := c.convert(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsecret := &corev1.Secret{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: local.Spec.Name,\n\t\t\tNamespace: local.ObjectMeta.Namespace,\n\t\t},\n\t}\n\treturn client.IgnoreNotFound((*c.kubeclient).Delete(ctx, secret))\n}", "func (o *DeleteUserOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDBadRequest) WithPayload(payload *models.Response) *DeletePostbyIDBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (n *NodeClient) Delete(twin, deployment uint32) (err error) {\n\turl := n.url(\"deployment\", fmt.Sprint(twin), fmt.Sprint(deployment))\n\n\trequest, err := http.NewRequest(http.MethodDelete, url, nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to build request\")\n\t}\n\n\tif err := n.client.authorize(request); err != nil {\n\t\treturn errors.Wrap(err, \"failed to sign request\")\n\t}\n\n\tresponse, err := http.DefaultClient.Do(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := n.response(response, nil, http.StatusAccepted); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *FederationSyncController) delete(obj pkgruntime.Object, kind string, namespacedName types.NamespacedName) error {\n\tglog.V(3).Infof(\"Handling deletion of %s %q\", kind, namespacedName)\n\t_, err := s.deletionHelper.HandleObjectInUnderlyingClusters(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = s.adapter.FedDelete(namespacedName, nil)\n\tif err != nil {\n\t\t// Its all good if the error is not found error. That means it is deleted already and we do not have to do anything.\n\t\t// This is expected when we are processing an update as a result of finalizer deletion.\n\t\t// The process that deleted the last finalizer is also going to delete the resource and we do not have to do anything.\n\t\tif !errors.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (ssc *StatefulSetController) deletePod(obj interface{}) {\n\tpod, ok := obj.(*v1.Pod)\n\n\t// When a delete is dropped, the relist will notice a pod in the store not\n\t// in the list, leading to the insertion of a tombstone object which contains\n\t// the deleted key/value. Note that this value might be stale. If the pod\n\t// changed labels the new StatefulSet will not be woken up till the periodic resync.\n\tif !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"couldn't get object from tombstone %+v\", obj))\n\t\t\treturn\n\t\t}\n\t\tpod, ok = tombstone.Obj.(*v1.Pod)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"tombstone contained object that is not a pod %+v\", obj))\n\t\t\treturn\n\t\t}\n\t}\n\n\tcontrollerRef := metav1.GetControllerOf(pod)\n\tif controllerRef == nil {\n\t\t// No controller should care about orphans being deleted.\n\t\treturn\n\t}\n\tset := ssc.resolveControllerRef(pod.Namespace, controllerRef)\n\tif set == nil {\n\t\treturn\n\t}\n\tklog.V(4).Infof(\"Pod %s/%s deleted through %v.\", pod.Namespace, pod.Name, utilruntime.GetCaller())\n\tssc.enqueueStatefulSet(set)\n}", "func (r *PolicyRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) WithPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) *CreateCoreV1NamespacedServiceAccountTokenOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteAllRevisionsOK) WithPayload(payload string) *DeleteAllRevisionsOK {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteModelPackageInput, error) {\n\tres := &svcsdk.DeleteModelPackageInput{}\n\n\tif r.ko.Spec.ModelPackageName != nil {\n\t\tres.SetModelPackageName(*r.ko.Spec.ModelPackageName)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteCoreV1NamespacedPodOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *DeleteAddressesOK) WithPayload(payload models.AddressConfigMap) *DeleteAddressesOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteProjectUserBadRequest) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOfferingByIDInternalServerError) WithPayload(payload *models.ErrorModel) *DeleteOfferingByIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\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 (o *DeleteShipmentInternalServerError) WithPayload(payload *ghcmessages.Error) *DeleteShipmentInternalServerError {\n\to.Payload = payload\n\treturn o\n}" ]
[ "0.6468498", "0.64082247", "0.63500136", "0.61151206", "0.59689397", "0.5954123", "0.58461696", "0.58247715", "0.5803609", "0.5773006", "0.5763528", "0.5742729", "0.5729572", "0.57046115", "0.5686261", "0.5660893", "0.55726016", "0.55641377", "0.5547944", "0.5534036", "0.5494152", "0.5490391", "0.5467938", "0.5464655", "0.5461159", "0.54469866", "0.54461074", "0.5435707", "0.54117274", "0.5384202", "0.53668576", "0.5365109", "0.5363933", "0.53571236", "0.5336586", "0.5329413", "0.5323209", "0.5322713", "0.5306229", "0.5298607", "0.52888906", "0.528751", "0.5270989", "0.52696437", "0.526785", "0.52558196", "0.5244905", "0.52396166", "0.5231185", "0.5222776", "0.5197455", "0.51965153", "0.51922566", "0.518963", "0.51833063", "0.5181798", "0.5180584", "0.5132403", "0.5128007", "0.5123749", "0.5114589", "0.51087356", "0.50962394", "0.50892985", "0.50878835", "0.5084302", "0.5083175", "0.50794786", "0.50708807", "0.5070206", "0.50604033", "0.50584364", "0.5057387", "0.50573194", "0.5055191", "0.50542676", "0.5047997", "0.5041256", "0.5038569", "0.5031317", "0.5030641", "0.5029707", "0.5028462", "0.5019033", "0.50152445", "0.5012106", "0.5010823", "0.5001876", "0.5000478", "0.49987435", "0.49965855", "0.49936968", "0.49877268", "0.4984821", "0.49714684", "0.49625134", "0.49578208", "0.49427986", "0.49247983", "0.49198934" ]
0.7650072
0
SetPayload sets the payload to the delete core v1 namespaced pod o k response
SetPayload устанавливает полезную нагрузку для ответа delete core v1 namespaced pod o k
func (o *DeleteCoreV1NamespacedPodOK) SetPayload(payload *models.IoK8sAPICoreV1Pod) { o.Payload = payload }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteCoreV1NamespacedPodAccepted) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDInternalServerError) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDUnauthorized) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteUserOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDNotFound) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *PostOperationsDeleteP2PPathOK) SetPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) {\n\to.Payload = payload\n}", "func (o *DeleteConsulDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1CollectionNamespacedLimitRangeOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteOrgOK) SetPayload(payload *DeleteOrgOKBody) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDOK) SetPayload(payload *models.Storage) {\n\to.Payload = payload\n}", "func (o *DeleteCertificatesV1CollectionCertificateSigningRequestOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingCreated) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteAllRevisionsOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDBadRequest) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteConsulNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteUserForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PatchCoreV1PersistentVolumeOK) SetPayload(payload *models.IoK8sAPICoreV1PersistentVolume) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDInternalServerError) SetPayload(payload *models.ErrorModel) {\n\to.Payload = payload\n}", "func (o *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenCreated) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteAddressesDefault) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *UpdateClusterUnauthorized) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteOrgNotFound) SetPayload(payload *DeleteOrgNotFoundBody) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDForbidden) SetPayload(payload *models.ErrorModel) {\n\to.Payload = payload\n}", "func (o *DeleteServiceIDFailure) SetPayload(payload models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteImageDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationNotFound) SetPayload(payload *models.MissingResponse) {\n\to.Payload = payload\n}", "func (o *CreateClusterCreated) SetPayload(payload *models.Kluster) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerBadRequest) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserBadGateway) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *GetNamespacedNotebooksUnauthorized) SetPayload(payload *models.Error) {\r\n\to.Payload = payload\r\n}", "func (o *DeleteProjectUserConflict) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *GetCoreAPIVersionsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1APIVersions) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *UpdateClusterNotFound) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *GetDataContextTopologyUUIDNodeNodeUUIDOK) SetPayload(payload *models.TapiTopologyTopologyNode) {\n\to.Payload = payload\n}", "func (o *ReplacePolicyV1beta1NamespacedPodDisruptionBudgetOK) SetPayload(payload *models.IoK8sAPIPolicyV1beta1PodDisruptionBudget) {\n\to.Payload = payload\n}", "func (o *WeaviateActionsPatchOK) SetPayload(payload *models.ActionGetResponse) {\n\to.Payload = payload\n}", "func (o *UpdateClusterInternalServerError) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *GetClusterMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetNamespacedNotebooksOK) SetPayload(payload *models.GetNotebooksResponse) {\r\n\to.Payload = payload\r\n}", "func (o *ReplaceExtensionsV1beta1NamespacedIngressCreated) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *PutWorkpaceByIDOK) SetPayload(payload *models.Workspace) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDOK) SetPayload(payload *models.Group) {\n\to.Payload = payload\n}", "func (o *ReplaceExtensionsV1beta1NamespacedIngressOK) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PostFriendsUpdatesListUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDBadRequest) SetPayload(payload *models.InvalidParameterInput) {\n\to.Payload = payload\n}", "func (o *RemoveOneDefault) SetPayload(payload *rest_model.RestError) {\n\to.Payload = payload\n}", "func (o *CreateDiscoveryV1beta1NamespacedEndpointSliceOK) SetPayload(payload *models.IoK8sAPIDiscoveryV1beta1EndpointSlice) {\n\to.Payload = payload\n}", "func (o *GetNFTContractTokenOK) SetPayload(payload *models.NFTTokenRow) {\n\to.Payload = payload\n}", "func (o *DeleteAddressesOK) SetPayload(payload models.AddressConfigMap) {\n\to.Payload = payload\n}", "func (o *ObjectsPatchForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressOK) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressCreated) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *ListAppsV1NamespacedDeploymentOK) SetPayload(payload *models.IoK8sAPIAppsV1DeploymentList) {\n\to.Payload = payload\n}", "func (o *ConnectCoreV1OptionsNodeProxyOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *ObjectsClassPutForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoordinationV1NamespacedLeaseOK) SetPayload(payload *models.IoK8sAPICoordinationV1Lease) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDOK) WithPayload(payload *models.Response) *DeletePostbyIDOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *WatchPolicyV1beta1PodSecurityPolicyOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (o *CreateNetworkingV1beta1NamespacedIngressCreated) SetPayload(payload *models.IoK8sAPINetworkingV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *ReplicateUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDUnauthorized) WithPayload(payload *models.Response) *DeletePostbyIDUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *AddNamespaceToGroupOK) SetPayload(payload *models.GroupNamespace) {\n\to.Payload = payload\n}", "func (o *ObjectsPatchInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *AddNamespaceToGroupUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetServicesHaproxyRuntimeAclsIDOK) SetPayload(payload *models.ACLFile) {\n\to.Payload = payload\n}", "func (o *PutWorkpaceByIDInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *GetClusterOK) SetPayload(payload *models.Cluster) {\n\to.Payload = payload\n}", "func (o *CreateRbacAuthorizationV1NamespacedRoleOK) SetPayload(payload *models.IoK8sAPIRbacV1Role) {\n\to.Payload = payload\n}", "func (o *PatchApiextensionsV1beta1CustomResourceDefinitionStatusOK) SetPayload(payload *models.IoK8sApiextensionsApiserverPkgApisApiextensionsV1beta1CustomResourceDefinition) {\n\to.Payload = payload\n}", "func (o *CreateHPCResourceUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}" ]
[ "0.73235345", "0.72438246", "0.7051416", "0.6964047", "0.67757857", "0.67754436", "0.6732913", "0.6657868", "0.6622713", "0.66210383", "0.6610833", "0.66014844", "0.65748113", "0.6540989", "0.6538674", "0.651376", "0.64942646", "0.6494105", "0.64776886", "0.64722115", "0.6457593", "0.6439711", "0.64336145", "0.6426071", "0.6420199", "0.6411984", "0.63631123", "0.63530844", "0.6344169", "0.6335957", "0.6333833", "0.63127965", "0.6260124", "0.62447745", "0.623714", "0.6236347", "0.6233496", "0.62263876", "0.62238306", "0.6211648", "0.6205968", "0.6198745", "0.6188893", "0.6165388", "0.6138117", "0.6137934", "0.6132594", "0.61272615", "0.61261857", "0.611947", "0.61149925", "0.6114952", "0.6105722", "0.60809827", "0.6077365", "0.6074932", "0.6073105", "0.6058764", "0.60454327", "0.6042046", "0.60401016", "0.6032232", "0.60192144", "0.60158795", "0.6012889", "0.6003131", "0.60001785", "0.59795976", "0.59760827", "0.5972015", "0.5969316", "0.5966095", "0.59653413", "0.5956718", "0.59558713", "0.5954815", "0.5953798", "0.59495324", "0.5949207", "0.5946517", "0.59293795", "0.5928929", "0.5927538", "0.5924853", "0.5919707", "0.5911592", "0.59113777", "0.59107", "0.5908711", "0.5903506", "0.5902604", "0.59018296", "0.58959633", "0.5895442", "0.5895259", "0.5890942", "0.5883707", "0.58825094", "0.5875471", "0.5873537" ]
0.78772104
0
NewDeleteCoreV1NamespacedPodAccepted creates DeleteCoreV1NamespacedPodAccepted with default headers values
NewDeleteCoreV1NamespacedPodAccepted создает DeleteCoreV1NamespacedPodAccepted с значениями заголовков по умолчанию
func NewDeleteCoreV1NamespacedPodAccepted() *DeleteCoreV1NamespacedPodAccepted { return &DeleteCoreV1NamespacedPodAccepted{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCreateCoreV1NamespacedPodAccepted() *CreateCoreV1NamespacedPodAccepted {\n\treturn &CreateCoreV1NamespacedPodAccepted{}\n}", "func NewDeleteCoreV1NamespacedEventAccepted() *DeleteCoreV1NamespacedEventAccepted {\n\treturn &DeleteCoreV1NamespacedEventAccepted{}\n}", "func NewDeleteCoreV1NamespacedServiceAccepted() *DeleteCoreV1NamespacedServiceAccepted {\n\treturn &DeleteCoreV1NamespacedServiceAccepted{}\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewDeleteCoreV1NamespacedConfigMapAccepted() *DeleteCoreV1NamespacedConfigMapAccepted {\n\n\treturn &DeleteCoreV1NamespacedConfigMapAccepted{}\n}", "func NewCreateCoreV1NamespacedPodBindingAccepted() *CreateCoreV1NamespacedPodBindingAccepted {\n\n\treturn &CreateCoreV1NamespacedPodBindingAccepted{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenAccepted() *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenAccepted{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenAccepted() *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenAccepted{}\n}", "func NewDeleteCoreV1PersistentVolumeAccepted() *DeleteCoreV1PersistentVolumeAccepted {\n\treturn &DeleteCoreV1PersistentVolumeAccepted{}\n}", "func NewDeleteCoreV1NamespacedPodOK() *DeleteCoreV1NamespacedPodOK {\n\n\treturn &DeleteCoreV1NamespacedPodOK{}\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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 NewCreateNetworkingV1beta1NamespacedIngressAccepted() *CreateNetworkingV1beta1NamespacedIngressAccepted {\n\n\treturn &CreateNetworkingV1beta1NamespacedIngressAccepted{}\n}", "func NewQtreeDeleteAccepted() *QtreeDeleteAccepted {\n\treturn &QtreeDeleteAccepted{}\n}", "func NewCreateExtensionsV1beta1NamespacedIngressAccepted() *CreateExtensionsV1beta1NamespacedIngressAccepted {\n\n\treturn &CreateExtensionsV1beta1NamespacedIngressAccepted{}\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) WithPayload(payload *models.IoK8sAPICoreV1Binding) *CreateCoreV1NamespacedPodBindingAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) WithPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewPcloudCloudconnectionsDeleteAccepted() *PcloudCloudconnectionsDeleteAccepted {\n\treturn &PcloudCloudconnectionsDeleteAccepted{}\n}", "func NewDeleteCertificatesV1beta1CertificateSigningRequestAccepted() *DeleteCertificatesV1beta1CertificateSigningRequestAccepted {\n\treturn &DeleteCertificatesV1beta1CertificateSigningRequestAccepted{}\n}", "func NewDeleteCoreV1NamespacedEventOK() *DeleteCoreV1NamespacedEventOK {\n\treturn &DeleteCoreV1NamespacedEventOK{}\n}", "func NewCreateRbacAuthorizationV1NamespacedRoleAccepted() *CreateRbacAuthorizationV1NamespacedRoleAccepted {\n\n\treturn &CreateRbacAuthorizationV1NamespacedRoleAccepted{}\n}", "func NewPcloudPvminstancesVolumesDeleteAccepted() *PcloudPvminstancesVolumesDeleteAccepted {\n\treturn &PcloudPvminstancesVolumesDeleteAccepted{}\n}", "func NewCreateCoreV1NamespacedPodOK() *CreateCoreV1NamespacedPodOK {\n\treturn &CreateCoreV1NamespacedPodOK{}\n}", "func NewDeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationAccepted() *DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationAccepted {\n\treturn &DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationAccepted{}\n}", "func NewCreateDiscoveryV1beta1NamespacedEndpointSliceAccepted() *CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted {\n\n\treturn &CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted{}\n}", "func NewDeleteCoreV1NamespacedServiceOK() *DeleteCoreV1NamespacedServiceOK {\n\treturn &DeleteCoreV1NamespacedServiceOK{}\n}", "func NewPcloudCloudinstancesSnapshotsDeleteAccepted() *PcloudCloudinstancesSnapshotsDeleteAccepted {\n\treturn &PcloudCloudinstancesSnapshotsDeleteAccepted{}\n}", "func NewCreateRbacAuthorizationV1alpha1NamespacedRoleAccepted() *CreateRbacAuthorizationV1alpha1NamespacedRoleAccepted {\n\n\treturn &CreateRbacAuthorizationV1alpha1NamespacedRoleAccepted{}\n}", "func NewDeleteNodeV1alpha1RuntimeClassAccepted() *DeleteNodeV1alpha1RuntimeClassAccepted {\n\treturn &DeleteNodeV1alpha1RuntimeClassAccepted{}\n}", "func NewCreateCoreV1NamespacedPodBindingOK() *CreateCoreV1NamespacedPodBindingOK {\n\n\treturn &CreateCoreV1NamespacedPodBindingOK{}\n}", "func NewDeleteCoreV1NamespacedConfigMapOK() *DeleteCoreV1NamespacedConfigMapOK {\n\n\treturn &DeleteCoreV1NamespacedConfigMapOK{}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpcPeeringConnectionInput, error) {\n\tres := &svcsdk.DeleteVpcPeeringConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPCPeeringConnectionID != nil {\n\t\tres.SetVpcPeeringConnectionId(*r.ko.Status.VPCPeeringConnectionID)\n\t}\n\n\treturn res, nil\n}", "func NewCreateAutoscalingV2beta2NamespacedHorizontalPodAutoscalerAccepted() *CreateAutoscalingV2beta2NamespacedHorizontalPodAutoscalerAccepted {\n\treturn &CreateAutoscalingV2beta2NamespacedHorizontalPodAutoscalerAccepted{}\n}", "func NewCreateAppsV1NamespacedControllerRevisionAccepted() *CreateAppsV1NamespacedControllerRevisionAccepted {\n\treturn &CreateAppsV1NamespacedControllerRevisionAccepted{}\n}", "func NewCreateBatchV1NamespacedJobAccepted() *CreateBatchV1NamespacedJobAccepted {\n\n\treturn &CreateBatchV1NamespacedJobAccepted{}\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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 NewCreateCoreV1PersistentVolumeAccepted() *CreateCoreV1PersistentVolumeAccepted {\n\treturn &CreateCoreV1PersistentVolumeAccepted{}\n}", "func (o *CreateNetworkingV1beta1NamespacedIngressAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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 NewDeleteCoreV1NamespacedPodUnauthorized() *DeleteCoreV1NamespacedPodUnauthorized {\n\n\treturn &DeleteCoreV1NamespacedPodUnauthorized{}\n}", "func (o *DeleteCoreV1NamespacedPodOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func NewDeleteStorageV1VolumeAttachmentAccepted() *DeleteStorageV1VolumeAttachmentAccepted {\n\treturn &DeleteStorageV1VolumeAttachmentAccepted{}\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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 NewDeleteRuntimeContainerOK() *DeleteRuntimeContainerOK {\n\n\treturn &DeleteRuntimeContainerOK{}\n}", "func NewCreateCoordinationV1NamespacedLeaseAccepted() *CreateCoordinationV1NamespacedLeaseAccepted {\n\n\treturn &CreateCoordinationV1NamespacedLeaseAccepted{}\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateNetworkingV1beta1NamespacedIngressAccepted) WithPayload(payload *models.IoK8sAPINetworkingV1beta1Ingress) *CreateNetworkingV1beta1NamespacedIngressAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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 (o *CreateExtensionsV1beta1NamespacedIngressAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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 NewCreateCoreV1NamespacedPodUnauthorized() *CreateCoreV1NamespacedPodUnauthorized {\n\treturn &CreateCoreV1NamespacedPodUnauthorized{}\n}", "func (o *CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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 Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressAccepted) WithPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) *CreateExtensionsV1beta1NamespacedIngressAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewWatchCoreV1NamespacedEndpointsOK() *WatchCoreV1NamespacedEndpointsOK {\n\n\treturn &WatchCoreV1NamespacedEndpointsOK{}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpnConnectionInput, error) {\n\tres := &svcsdk.DeleteVpnConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPNConnectionID != nil {\n\t\tres.SetVpnConnectionId(*r.ko.Status.VPNConnectionID)\n\t}\n\n\treturn res, nil\n}", "func (a *Client) CreatePolicyV1beta1NamespacedPodDisruptionBudget(params *CreatePolicyV1beta1NamespacedPodDisruptionBudgetParams) (*CreatePolicyV1beta1NamespacedPodDisruptionBudgetOK, *CreatePolicyV1beta1NamespacedPodDisruptionBudgetCreated, *CreatePolicyV1beta1NamespacedPodDisruptionBudgetAccepted, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreatePolicyV1beta1NamespacedPodDisruptionBudgetParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createPolicyV1beta1NamespacedPodDisruptionBudget\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/apis/policy/v1beta1/namespaces/{namespace}/poddisruptionbudgets\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/vnd.kubernetes.protobuf\", \"application/yaml\"},\n\t\tConsumesMediaTypes: []string{\"*/*\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &CreatePolicyV1beta1NamespacedPodDisruptionBudgetReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *CreatePolicyV1beta1NamespacedPodDisruptionBudgetOK:\n\t\treturn value, nil, nil, nil\n\tcase *CreatePolicyV1beta1NamespacedPodDisruptionBudgetCreated:\n\t\treturn nil, value, nil, nil\n\tcase *CreatePolicyV1beta1NamespacedPodDisruptionBudgetAccepted:\n\t\treturn nil, nil, value, nil\n\t}\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 policy_v1beta1: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func NewDeleteSecurityGroupOK() *DeleteSecurityGroupOK {\n\treturn &DeleteSecurityGroupOK{}\n}", "func NewCreateCoreV1NamespacedPodBindingUnauthorized() *CreateCoreV1NamespacedPodBindingUnauthorized {\n\n\treturn &CreateCoreV1NamespacedPodBindingUnauthorized{}\n}", "func NewReadCoreV1NamespacedPodOK() *ReadCoreV1NamespacedPodOK {\n\treturn &ReadCoreV1NamespacedPodOK{}\n}", "func NewWeaviateActionsPatchAccepted() *WeaviateActionsPatchAccepted {\n\n\treturn &WeaviateActionsPatchAccepted{}\n}", "func (client *PacketCoreDataPlanesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, packetCoreControlPlaneName string, packetCoreDataPlaneName string, options *PacketCoreDataPlanesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}\"\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 packetCoreControlPlaneName == \"\" {\n\t\treturn nil, errors.New(\"parameter packetCoreControlPlaneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{packetCoreControlPlaneName}\", url.PathEscape(packetCoreControlPlaneName))\n\tif packetCoreDataPlaneName == \"\" {\n\t\treturn nil, errors.New(\"parameter packetCoreDataPlaneName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{packetCoreDataPlaneName}\", url.PathEscape(packetCoreDataPlaneName))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (o *CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted) WithPayload(payload *models.IoK8sAPIDiscoveryV1beta1EndpointSlice) *CreateDiscoveryV1beta1NamespacedEndpointSliceAccepted {\n\to.Payload = payload\n\treturn o\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 (o *CreateRbacAuthorizationV1NamespacedRoleAccepted) WithPayload(payload *models.IoK8sAPIRbacV1Role) *CreateRbacAuthorizationV1NamespacedRoleAccepted {\n\to.Payload = payload\n\treturn o\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 NewDeleteCallsCallLogAccepted() *DeleteCallsCallLogAccepted {\n\treturn &DeleteCallsCallLogAccepted{}\n}", "func NewDeleteCoreV1NamespacedServiceUnauthorized() *DeleteCoreV1NamespacedServiceUnauthorized {\n\treturn &DeleteCoreV1NamespacedServiceUnauthorized{}\n}", "func (o *CreateCoordinationV1NamespacedLeaseAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(202)\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 (client *LongTermRetentionManagedInstanceBackupsClient) deleteCreateRequest(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string, options *LongTermRetentionManagedInstanceBackupsBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}\"\n\tif locationName == \"\" {\n\t\treturn nil, errors.New(\"parameter locationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{locationName}\", url.PathEscape(locationName))\n\tif managedInstanceName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedInstanceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedInstanceName}\", url.PathEscape(managedInstanceName))\n\tif databaseName == \"\" {\n\t\treturn nil, errors.New(\"parameter databaseName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{databaseName}\", url.PathEscape(databaseName))\n\tif backupName == \"\" {\n\t\treturn nil, errors.New(\"parameter backupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{backupName}\", url.PathEscape(backupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, 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-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treturn req, nil\n}", "func NewDelSubDeviceWithCoreRequestWithoutParam() *DelSubDeviceWithCoreRequest {\n\n return &DelSubDeviceWithCoreRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}/products/{productKey}/edges/{edgeName}:delSubDevice\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\n}", "func (o *CreateRbacAuthorizationV1alpha1NamespacedRoleAccepted) WithPayload(payload *models.IoK8sAPIRbacV1alpha1Role) *CreateRbacAuthorizationV1alpha1NamespacedRoleAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewDeleteAPIKeyDefault(code int) *DeleteAPIKeyDefault {\n\treturn &DeleteAPIKeyDefault{\n\t\t_statusCode: code,\n\t}\n}", "func CreateDeleteDegradeControlResponse() (response *DeleteDegradeControlResponse) {\n\tresponse = &DeleteDegradeControlResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (client *PrivateDNSZoneGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, options *PrivateDNSZoneGroupsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}\"\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 privateEndpointName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateEndpointName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateEndpointName}\", url.PathEscape(privateEndpointName))\n\tif privateDNSZoneGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter privateDNSZoneGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{privateDnsZoneGroupName}\", url.PathEscape(privateDNSZoneGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewDeleteCoreV1NamespacedEventUnauthorized() *DeleteCoreV1NamespacedEventUnauthorized {\n\treturn &DeleteCoreV1NamespacedEventUnauthorized{}\n}", "func NewReadCoreV1NamespacedEndpointsOK() *ReadCoreV1NamespacedEndpointsOK {\n\treturn &ReadCoreV1NamespacedEndpointsOK{}\n}", "func (client *SourceControlConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, options *SourceControlConfigurationsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}\"\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 clusterRp == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterRp cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterRp}\", url.PathEscape(clusterRp))\n\tif clusterResourceName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterResourceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterResourceName}\", url.PathEscape(clusterResourceName))\n\tif clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\tif sourceControlConfigurationName == \"\" {\n\t\treturn nil, errors.New(\"parameter sourceControlConfigurationName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{sourceControlConfigurationName}\", url.PathEscape(sourceControlConfigurationName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-11-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (o *PostManagementKubernetesIoV1NodesAccepted) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(202)\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenOK() *CreateCoreV1NamespacedServiceAccountTokenOK {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenOK{}\n}", "func NewCreateTCPCheckAccepted() *CreateTCPCheckAccepted {\n\n\treturn &CreateTCPCheckAccepted{}\n}", "func (client *PeeringPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, managedNetworkName string, managedNetworkPeeringPolicyName string, options *PeeringPoliciesClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName}\"\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 managedNetworkName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedNetworkName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedNetworkName}\", url.PathEscape(managedNetworkName))\n\tif managedNetworkPeeringPolicyName == \"\" {\n\t\treturn nil, errors.New(\"parameter managedNetworkPeeringPolicyName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{managedNetworkPeeringPolicyName}\", url.PathEscape(managedNetworkPeeringPolicyName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2019-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (a *Client) CreateNetworkingV1beta1NamespacedIngress(params *CreateNetworkingV1beta1NamespacedIngressParams) (*CreateNetworkingV1beta1NamespacedIngressOK, *CreateNetworkingV1beta1NamespacedIngressCreated, *CreateNetworkingV1beta1NamespacedIngressAccepted, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateNetworkingV1beta1NamespacedIngressParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"createNetworkingV1beta1NamespacedIngress\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/apis/networking.k8s.io/v1beta1/namespaces/{namespace}/ingresses\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/vnd.kubernetes.protobuf\", \"application/yaml\"},\n\t\tConsumesMediaTypes: []string{\"*/*\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &CreateNetworkingV1beta1NamespacedIngressReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *CreateNetworkingV1beta1NamespacedIngressOK:\n\t\treturn value, nil, nil, nil\n\tcase *CreateNetworkingV1beta1NamespacedIngressCreated:\n\t\treturn nil, value, nil, nil\n\tcase *CreateNetworkingV1beta1NamespacedIngressAccepted:\n\t\treturn nil, nil, value, nil\n\t}\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 networking_v1beta1: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (o *CreateCoordinationV1NamespacedLeaseAccepted) WithPayload(payload *models.IoK8sAPICoordinationV1Lease) *CreateCoordinationV1NamespacedLeaseAccepted {\n\to.Payload = payload\n\treturn o\n}", "func NewIPServicePolicyDeleteOK() *IPServicePolicyDeleteOK {\n\treturn &IPServicePolicyDeleteOK{}\n}", "func NewCreateCoreV1NamespacedPodBindingCreated() *CreateCoreV1NamespacedPodBindingCreated {\n\n\treturn &CreateCoreV1NamespacedPodBindingCreated{}\n}", "func NewDeleteCapabilityDefault(code int) *DeleteCapabilityDefault {\n\treturn &DeleteCapabilityDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewDeleteScopeDefault(code int) *DeleteScopeDefault {\n\treturn &DeleteScopeDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *KeyVaultClient) purgeDeletedSecretCreateRequest(ctx context.Context, vaultBaseURL string, secretName string, options *KeyVaultClientPurgeDeletedSecretOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/deletedsecrets/{secret-name}\"\n\tif secretName == \"\" {\n\t\treturn nil, errors.New(\"parameter secretName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{secret-name}\", url.PathEscape(secretName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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 addDelete(topLevel *cobra.Command) {\n\ttopLevel.AddCommand(&cobra.Command{\n\t\tUse: \"delete\",\n\t\tShort: `See \"kubectl help delete\" for detailed usage.`,\n\t\tRunE: passthru(\"kubectl\"),\n\t\t// We ignore unknown flags to avoid importing everything Go exposes\n\t\t// from our commands.\n\t\tFParseErrWhitelist: cobra.FParseErrWhitelist{\n\t\t\tUnknownFlags: true,\n\t\t},\n\t})\n}", "func TestCreatesAllowedDuringNamespaceDeletion(t *testing.T) {\n\tconfig := &origin.MasterConfig{\n\t\tKubeletClientConfig: &kclient.KubeletConfig{},\n\t\tEtcdHelper: etcdstorage.NewEtcdStorage(nil, nil, \"\"),\n\t}\n\tstorageMap := config.GetRestStorage()\n\tresources := sets.String{}\n\n\tfor resource := range storageMap {\n\t\tresources.Insert(strings.ToLower(resource))\n\t}\n\n\tfor resource := range recommendedCreatableResources {\n\t\tif !resources.Has(resource) {\n\t\t\tt.Errorf(\"recommendedCreatableResources has resource %v, but that resource isn't registered.\", resource)\n\t\t}\n\t}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func (client *LiveOutputsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, options *LiveOutputsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\tif liveEventName == \"\" {\n\t\treturn nil, errors.New(\"parameter liveEventName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{liveEventName}\", url.PathEscape(liveEventName))\n\tif liveOutputName == \"\" {\n\t\treturn nil, errors.New(\"parameter liveOutputName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{liveOutputName}\", url.PathEscape(liveOutputName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateDeleteApDeviceResponse() (response *DeleteApDeviceResponse) {\n\tresponse = &DeleteApDeviceResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func NewDeleteSharedDashboardResponseWithDefaults() *DeleteSharedDashboardResponse {\n\tthis := DeleteSharedDashboardResponse{}\n\treturn &this\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenOK() *CreateCoreV1NamespacedServiceAccountTokenOK {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenOK{}\n}", "func NewCreateCoreV1NamespacedPodCreated() *CreateCoreV1NamespacedPodCreated {\n\treturn &CreateCoreV1NamespacedPodCreated{}\n}", "func (client *ConnectedEnvironmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, connectedEnvironmentName string, options *ConnectedEnvironmentsClientBeginDeleteOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}\"\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 connectedEnvironmentName == \"\" {\n\t\treturn nil, errors.New(\"parameter connectedEnvironmentName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{connectedEnvironmentName}\", url.PathEscape(connectedEnvironmentName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func ExampleBackupVaultsClient_BeginDelete() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armdataprotection.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewBackupVaultsClient().BeginDelete(ctx, \"SampleResourceGroup\", \"swaggerExample\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t_, err = poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n}", "func NewCreateApiregistrationV1beta1APIServiceAccepted() *CreateApiregistrationV1beta1APIServiceAccepted {\n\treturn &CreateApiregistrationV1beta1APIServiceAccepted{}\n}", "func NewPatchCoreV1NamespacedServiceAccountOK() *PatchCoreV1NamespacedServiceAccountOK {\n\treturn &PatchCoreV1NamespacedServiceAccountOK{}\n}" ]
[ "0.7400152", "0.71234435", "0.7122447", "0.70157105", "0.6747055", "0.6736624", "0.62136", "0.61368066", "0.6057876", "0.59432584", "0.58190614", "0.57760686", "0.5772118", "0.5759336", "0.5682018", "0.5618317", "0.55684346", "0.5558717", "0.5553073", "0.54162437", "0.5408024", "0.5396327", "0.5394652", "0.53666204", "0.5364611", "0.5354838", "0.5296893", "0.5277718", "0.52437615", "0.51370096", "0.5103567", "0.50722533", "0.5071671", "0.5026147", "0.50029737", "0.49972066", "0.49763402", "0.4958775", "0.4949994", "0.49382302", "0.4924234", "0.49182594", "0.4900659", "0.4894008", "0.4885936", "0.48424286", "0.48088828", "0.47826785", "0.47764865", "0.47370437", "0.47053152", "0.46964833", "0.46949172", "0.46855623", "0.46189505", "0.4615868", "0.4610079", "0.46050462", "0.45919243", "0.45779395", "0.456709", "0.45568916", "0.45568916", "0.4550069", "0.45426825", "0.4541487", "0.4540688", "0.4532757", "0.4531756", "0.45282584", "0.4519519", "0.4510085", "0.45058155", "0.448703", "0.44843236", "0.44781607", "0.44777822", "0.44753197", "0.44748136", "0.4471171", "0.44609386", "0.4456756", "0.44531837", "0.44531685", "0.44468257", "0.44372264", "0.44289443", "0.44227412", "0.441717", "0.44157746", "0.4398757", "0.4396786", "0.4393708", "0.4388897", "0.43831635", "0.43799326", "0.43742672", "0.43612987", "0.435349", "0.4353056" ]
0.7965179
0
WithPayload adds the payload to the delete core v1 namespaced pod accepted response
WithPayload добавляет payload в ответ на удаление core v1 namespaced pod, который был принят
func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted { o.Payload = payload return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedPodOK) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) WithPayload(payload *models.ErrorResponse) *WeaviateSchemaActionsDeleteBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDOK) WithPayload(payload *models.Response) *DeletePostbyIDOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteCoreV1NamespacedConfigMapOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteUserOK) WithPayload(payload *models.DeletedResponse) *DeleteUserOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteForbidden) WithPayload(payload *models.ErrorResponse) *ThingsDeleteForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDInternalServerError) WithPayload(payload *models.Response) *DeletePostbyIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserForbidden) WithPayload(payload *models.ErrorResponse) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *ThingsDeleteInternalServerError) WithPayload(payload *models.ErrorResponse) *ThingsDeleteInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteRuntimeContainerInternalServerError) WithPayload(payload string) *DeleteRuntimeContainerInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationForbidden) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDUnauthorized) WithPayload(payload *models.Response) *DeletePostbyIDUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpnConnectionInput, error) {\n\tres := &svcsdk.DeleteVpnConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPNConnectionID != nil {\n\t\tres.SetVpnConnectionId(*r.ko.Status.VPNConnectionID)\n\t}\n\n\treturn res, nil\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationOK) WithPayload(payload *models.DeletedResponse) *DeleteOrganizationOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (m *PayloadResponseItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *PayloadResponseItemRequestBuilderDeleteRequestConfiguration)(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 (o *PostOperationsDeleteP2PPathOK) WithPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) *PostOperationsDeleteP2PPathOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteConsulDefault) WithPayload(payload *models.Error) *DeleteConsulDefault {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) WithPayload(payload *models.IoK8sAPICoreV1Binding) *CreateCoreV1NamespacedPodBindingAccepted {\n\to.Payload = payload\n\treturn o\n}", "func Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func NewDeletePayload(body *DeleteRequestBody, token string) *warehouse.DeletePayload {\n\tv := &warehouse.DeletePayload{}\n\tv.Ids = make([]string, len(body.Ids))\n\tfor i, val := range body.Ids {\n\t\tv.Ids[i] = val\n\t}\n\tv.Token = token\n\n\treturn v\n}", "func (o *DeleteUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) WithPayload(payload *models.IoK8sAPICoreV1Binding) *CreateCoreV1NamespacedPodBindingOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteOrganizationUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteOrganizationUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func Delete(objectName string, payload interface{}) *Writer {\n\treturn &Writer{\n\t\tCmd: \"delete\",\n\t\tObjectName: objectName,\n\t\tPayload: payload,\n\t}\n}", "func (o *DeletePostbyIDBadRequest) WithPayload(payload *models.Response) *DeletePostbyIDBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeletePostbyIDNotFound) WithPayload(payload *models.Response) *DeletePostbyIDNotFound {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteProjectUserUnauthorized) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteRuntimeContainerBadRequest) WithPayload(payload string) *DeleteRuntimeContainerBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) WithPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) *WatchCoreV1NamespacedEndpointsOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserForbidden) WithPayload(payload *DeleteUserForbiddenBody) *DeleteUserForbidden {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) WithPayload(payload string) *DeleteUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteVpcPeeringConnectionInput, error) {\n\tres := &svcsdk.DeleteVpcPeeringConnectionInput{}\n\n\tif r.ko.Spec.DryRun != nil {\n\t\tres.SetDryRun(*r.ko.Spec.DryRun)\n\t}\n\tif r.ko.Status.VPCPeeringConnectionID != nil {\n\t\tres.SetVpcPeeringConnectionId(*r.ko.Status.VPCPeeringConnectionID)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteProjectUserInternalServerError) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) WithPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) *CreateCoreV1NamespacedServiceAccountTokenAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteOrgOK) WithPayload(payload *DeleteOrgOKBody) *DeleteOrgOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *ReplacePolicyV1beta1NamespacedPodDisruptionBudgetOK) WithPayload(payload *models.IoK8sAPIPolicyV1beta1PodDisruptionBudget) *ReplacePolicyV1beta1NamespacedPodDisruptionBudgetOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteUserOK) WithPayload(payload *DeleteUserOKBody) *DeleteUserOK {\n\to.Payload = payload\n\treturn o\n}", "func (r *PolicyRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\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 (o *DeleteOrgOK) SetPayload(payload *DeleteOrgOKBody) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func (c *Controller) delete(d *appsv1.Deployment) error {\n\tep := RegisteelEndpoint + \"/\" + string(d.UID)\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(http.MethodDelete, ep, nil)\n\treq.Header.Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.logger.Infof(\"removed deployment from api: %v\", d.Name)\n\n\treturn nil\n}", "func (r *MacOSTrustedRootCertificateRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *DeleteCoreV1NamespacedPodOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (o *DeletePostbyIDOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDInternalServerError) WithPayload(payload *models.ErrorModel) *DeleteOfferingByIDInternalServerError {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteProjectUserBadRequest) WithPayload(payload *models.ErrorResponse) *DeleteProjectUserBadRequest {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteAllRevisionsOK) WithPayload(payload string) *DeleteAllRevisionsOK {\n\to.Payload = payload\n\treturn o\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteModelPackageInput, error) {\n\tres := &svcsdk.DeleteModelPackageInput{}\n\n\tif r.ko.Spec.ModelPackageName != nil {\n\t\tres.SetModelPackageName(*r.ko.Spec.ModelPackageName)\n\t}\n\n\treturn res, nil\n}", "func (o *DeleteAddressesOK) WithPayload(payload models.AddressConfigMap) *DeleteAddressesOK {\n\to.Payload = payload\n\treturn o\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 (n *NodeClient) Delete(twin, deployment uint32) (err error) {\n\turl := n.url(\"deployment\", fmt.Sprint(twin), fmt.Sprint(deployment))\n\n\trequest, err := http.NewRequest(http.MethodDelete, url, nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to build request\")\n\t}\n\n\tif err := n.client.authorize(request); err != nil {\n\t\treturn errors.Wrap(err, \"failed to sign request\")\n\t}\n\n\tresponse, err := http.DefaultClient.Do(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := n.response(response, nil, http.StatusAccepted); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenCreated) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func DeleteOperator(namespace string) error {\n\tif namespace == \"\" {\n\t\tnamespace = DEFAULT_NAMESPACE\n\t}\n\tif err := sh.RunV(\"helm\", \"delete\", \"-n\", namespace, \"kedahttp\"); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *DeleteConsulNotFound) WithPayload(payload *models.Error) *DeleteConsulNotFound {\n\to.Payload = payload\n\treturn o\n}", "func (o *ThingsDeleteForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (r *DeviceCompliancePolicyRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressAccepted) WithPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) *CreateExtensionsV1beta1NamespacedIngressAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *ReplaceExtensionsV1beta1NamespacedIngressOK) WithPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) *ReplaceExtensionsV1beta1NamespacedIngressOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteCertificatesV1CollectionCertificateSigningRequestOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1CollectionNamespacedLimitRangeOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (o *PostOperationsDeleteP2PPathOK) SetPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerNotFound) WithPayload(payload string) *DeleteRuntimeContainerNotFound {\n\to.Payload = payload\n\treturn o\n}", "func TestObjectDeleted(t *testing.T) {\n\texpectedCard := TeamsMessageCard{\n\t\tType: messageType,\n\t\tContext: context,\n\t\tThemeColor: msTeamsColors[\"Danger\"],\n\t\tSummary: \"kubewatch notification received\",\n\t\tTitle: \"kubewatch\",\n\t\tText: \"\",\n\t\tSections: []TeamsMessageCardSection{\n\t\t\t{\n\t\t\t\tActivityTitle: \"A `pod` in namespace `new` has been `deleted`:\\n`foo`\",\n\t\t\t\tMarkdown: true,\n\t\t\t},\n\t\t},\n\t}\n\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tif r.Method != \"POST\" {\n\t\t\tt.Errorf(\"expected a POST request for ObjectDeleted()\")\n\t\t}\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tvar c TeamsMessageCard\n\t\tif err := decoder.Decode(&c); err != nil {\n\t\t\tt.Errorf(\"%v\", err)\n\t\t}\n\t\tif !reflect.DeepEqual(c, expectedCard) {\n\t\t\tt.Errorf(\"expected %v, got %v\", expectedCard, c)\n\t\t}\n\t}))\n\n\tms := &MSTeams{TeamsWebhookURL: ts.URL}\n\tp := &v1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tUID: \"12345678\",\n\t\t\tName: \"foo\",\n\t\t\tNamespace: \"new\",\n\t\t},\n\t}\n\tms.ObjectDeleted(p)\n}", "func (o *DeleteVendorOK) WithPayload(payload *DeleteVendorOKBody) *DeleteVendorOK {\n\to.Payload = payload\n\treturn o\n}", "func (r *ExtensionRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (c *Controller) Delete(typ, name, namespace string) error {\n\treturn errUnsupported\n}", "func RunDelete(cmd *cobra.Command, args []string) {\n\n\tlog := util.Logger()\n\n\tif len(args) != 1 || args[0] == \"\" {\n\t\tlog.Fatalf(`❌ Missing expected arguments: <namespace-store-name> %s`, cmd.UsageString())\n\t}\n\n\to := util.KubeObject(bundle.File_deploy_crds_noobaa_io_v1alpha1_namespacestore_cr_yaml)\n\tnamespaceStore := o.(*nbv1.NamespaceStore)\n\tnamespaceStore.Name = args[0]\n\tnamespaceStore.Namespace = options.Namespace\n\tnamespaceStore.Spec = nbv1.NamespaceStoreSpec{}\n\n\tnbClient := system.GetNBClient()\n\n\tnamespaceResourceinfo, err := nbClient.ReadNamespaceResourceAPI(nb.ReadNamespaceResourceParams{Name: namespaceStore.Name})\n\tif err != nil {\n\t\trpcErr, isRPCErr := err.(*nb.RPCError)\n\t\tif !isRPCErr || rpcErr.RPCCode != \"NO_SUCH_NAMESPACE_RESOURCE\" {\n\t\t\tlog.Fatalf(`❌ Failed to read NamespaceStore info: %s`, err)\n\t\t}\n\t} else if namespaceResourceinfo.Undeletable != \"\" && namespaceResourceinfo.Undeletable != \"IS_NAMESPACESTORE\" {\n\t\tswitch namespaceResourceinfo.Undeletable {\n\t\tcase \"CONNECTED_BUCKET_DELETING\":\n\t\t\tfallthrough\n\t\tcase \"IN_USE\":\n\t\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q as it is being used by one or more buckets`,\n\t\t\t\tnamespaceStore.Name, namespaceStore.Namespace)\n\t\tdefault:\n\t\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q, undeletable due to %q`,\n\t\t\t\tnamespaceStore.Name, namespaceStore.Namespace, namespaceResourceinfo.Undeletable)\n\t\t}\n\t}\n\tif !util.KubeDelete(namespaceStore) {\n\t\tlog.Fatalf(`❌ Could not delete NamespaceStore %q in namespace %q`,\n\t\t\tnamespaceStore.Name, namespaceStore.Namespace)\n\t}\n}", "func (o *DeletePostbyIDInternalServerError) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (s *server) Delete(ctx context.Context, body *pb.NameHolder) (*pb.DeletionResponse, error) {\n\tappName := body.GetName()\n\tfilter := types.M{\n\t\tmongo.NameKey: appName,\n\t\tmongo.InstanceTypeKey: mongo.AppInstance,\n\t}\n\n\tnode, _ := redis.FetchAppNode(appName)\n\tgo redis.DecrementServiceLoad(ServiceName, node)\n\tgo redis.RemoveApp(appName)\n\tgo diskCleanup(appName)\n\n\tif configs.CloudflareConfig.PlugIn {\n\t\tgo cloudflare.DeleteRecord(appName, mongo.AppInstance)\n\t}\n\n\t_, err := mongo.DeleteInstance(filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.DeletionResponse{Success: true}, nil\n}", "func BuildDeletePayload(groupDeleteBody string, groupDeleteToken string) (*group.DeletePayload, error) {\n\tvar err error\n\tvar body DeleteRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(groupDeleteBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"ids\\\": [\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\",\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\",\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\"\\n ]\\n }'\")\n\t\t}\n\t\tif body.Ids == nil {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ids\", \"body\"))\n\t\t}\n\t\tif len(body.Ids) > 100 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.ids\", body.Ids, len(body.Ids), 100, false))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar token string\n\t{\n\t\ttoken = groupDeleteToken\n\t}\n\tv := &group.DeletePayload{}\n\tif body.Ids != nil {\n\t\tv.Ids = make([]string, len(body.Ids))\n\t\tfor i, val := range body.Ids {\n\t\t\tv.Ids[i] = val\n\t\t}\n\t}\n\tv.Token = token\n\n\treturn v, nil\n}", "func EncodeDeleteRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*warehouse.DeletePayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"Warehouse\", \"Delete\", \"*warehouse.DeletePayload\", v)\n\t\t}\n\t\t{\n\t\t\thead := p.Token\n\t\t\tif !strings.Contains(head, \" \") {\n\t\t\t\treq.Header.Set(\"Authorization\", \"Bearer \"+head)\n\t\t\t} else {\n\t\t\t\treq.Header.Set(\"Authorization\", head)\n\t\t\t}\n\t\t}\n\t\tbody := NewDeleteRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"Warehouse\", \"Delete\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func (drc *DummyRectificationClient) DeleteRequest(\n\tcluster, reqid, message string) error {\n\tdrc.logf(\"Deleting application %s %s %s\", cluster, reqid, message)\n\tdrc.Deleted = append(drc.Deleted, dummyDelete{cluster, reqid, message})\n\treturn nil\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressAccepted) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *DeleteImageDefault) WithPayload(payload *models.Error) *DeleteImageDefault {\n\to.Payload = payload\n\treturn o\n}", "func BuildDeletePayload(productDeleteBody string, productDeleteToken string) (*product.DeletePayload, error) {\n\tvar err error\n\tvar body DeleteRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(productDeleteBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"ids\\\": [\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\",\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\",\\n \\\"91cc3eb9-ddc0-4cf7-a62b-c85df1a9166f\\\"\\n ]\\n }'\")\n\t\t}\n\t\tif body.Ids == nil {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ids\", \"body\"))\n\t\t}\n\t\tif len(body.Ids) > 100 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(\"body.ids\", body.Ids, len(body.Ids), 100, false))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar token string\n\t{\n\t\ttoken = productDeleteToken\n\t}\n\tv := &product.DeletePayload{}\n\tif body.Ids != nil {\n\t\tv.Ids = make([]string, len(body.Ids))\n\t\tfor i, val := range body.Ids {\n\t\t\tv.Ids[i] = val\n\t\t}\n\t}\n\tv.Token = token\n\n\treturn v, nil\n}", "func (o *DeleteOrganizationForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (r *ExternalRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *DeleteUserUnauthorized) WithPayload(payload *DeleteUserUnauthorizedBody) *DeleteUserUnauthorized {\n\to.Payload = payload\n\treturn o\n}", "func decodeDeleteIndustryRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.DeleteIndustryRequest)\n\treturn endpoints.DeleteIndustryRequest{ID: req.Id}, nil\n}", "func (r *GroupPolicyPresentationRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteShipmentInternalServerError) WithPayload(payload *ghcmessages.Error) *DeleteShipmentInternalServerError {\n\to.Payload = payload\n\treturn o\n}" ]
[ "0.71526045", "0.6462131", "0.6293177", "0.6276558", "0.61928785", "0.61641407", "0.6049591", "0.5963603", "0.58372116", "0.5814466", "0.5764856", "0.5737774", "0.56375915", "0.5615515", "0.5608715", "0.55636376", "0.55465573", "0.55429196", "0.5533813", "0.5521526", "0.5514231", "0.5501474", "0.54870665", "0.54719496", "0.5445806", "0.54051584", "0.5398762", "0.5385443", "0.5365867", "0.5350192", "0.5348473", "0.53198695", "0.5306343", "0.5304485", "0.5296885", "0.52897567", "0.52847844", "0.5272254", "0.5267981", "0.52485025", "0.5243748", "0.5241057", "0.52385384", "0.5221787", "0.52195287", "0.52032256", "0.52031606", "0.51906806", "0.5190247", "0.5179708", "0.5172667", "0.5169775", "0.5161905", "0.5161535", "0.5159125", "0.5155578", "0.515359", "0.5153357", "0.5152124", "0.51503897", "0.51221293", "0.5115532", "0.51124823", "0.5103594", "0.5099423", "0.50978166", "0.50895584", "0.5081613", "0.5081361", "0.50762117", "0.5063243", "0.50490856", "0.5045816", "0.50422513", "0.5040137", "0.50372875", "0.5035934", "0.5034285", "0.5033678", "0.50318974", "0.50283676", "0.5027458", "0.50192124", "0.50149655", "0.50085074", "0.50082004", "0.5000017", "0.49945724", "0.49878612", "0.49831462", "0.4969048", "0.49676257", "0.49636304", "0.4962196", "0.49560332", "0.4955556", "0.49514022", "0.49509525", "0.49484116", "0.4947682" ]
0.7290295
0
SetPayload sets the payload to the delete core v1 namespaced pod accepted response
SetPayload устанавливает полезную нагрузку для ответа на удаление вспомогательного объекта v1 в пространстве имен пода, принятого
func (o *DeleteCoreV1NamespacedPodAccepted) SetPayload(payload *models.IoK8sAPICoreV1Pod) { o.Payload = payload }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *DeleteCoreV1NamespacedPodOK) SetPayload(payload *models.IoK8sAPICoreV1Pod) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedConfigMapOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedConfigMapAccepted) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *WeaviateSchemaActionsDeleteBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDInternalServerError) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteApiextensionsV1CollectionCustomResourceDefinitionOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserOK) SetPayload(payload *models.DeletedResponse) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDUnauthorized) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingOK) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingAccepted) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1CollectionNamespacedLimitRangeOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *ThingsDeleteInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *WatchCoreV1NamespacedEndpointsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1WatchEvent) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDNotFound) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenAccepted) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteUserForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteAllRevisionsOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteConsulDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteOrgOK) SetPayload(payload *DeleteOrgOKBody) {\n\to.Payload = payload\n}", "func (o *PostOperationsDeleteP2PPathOK) SetPayload(payload *models.TapiPathComputationDeleteP2PPathOutput) {\n\to.Payload = payload\n}", "func (o *DeletePostbyIDBadRequest) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenOK) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *DeleteCertificatesV1CollectionCertificateSigningRequestOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteAdmissionregistrationV1beta1CollectionMutatingWebhookConfigurationOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1Status) {\n\to.Payload = payload\n}", "func (o *DeleteCoreV1NamespacedPodAccepted) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodAccepted {\n\to.Payload = payload\n\treturn o\n}", "func (o *DeleteStorageByIDOK) SetPayload(payload *models.Storage) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDForbidden) SetPayload(payload *models.ErrorModel) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDBadRequest) SetPayload(payload *models.InvalidParameterInput) {\n\to.Payload = payload\n}", "func (o *DeleteOfferingByIDInternalServerError) SetPayload(payload *models.ErrorModel) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedPodBindingCreated) SetPayload(payload *models.IoK8sAPICoreV1Binding) {\n\to.Payload = payload\n}", "func (o *DeleteRuntimeContainerBadRequest) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *UpdateClusterUnauthorized) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *WeaviateActionsPatchOK) SetPayload(payload *models.ActionGetResponse) {\n\to.Payload = payload\n}", "func (o *DeleteConsulNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteAddressesDefault) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PostFriendsUpdatesListUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *ObjectsPatchForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserBadGateway) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *WeaviateActionsPatchAccepted) SetPayload(payload *models.ActionGetResponse) {\n\to.Payload = payload\n}", "func (o *ReplacePolicyV1beta1NamespacedPodDisruptionBudgetOK) SetPayload(payload *models.IoK8sAPIPolicyV1beta1PodDisruptionBudget) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserConflict) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *ObjectsClassPutForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateHPCResourceForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *GetClusterMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteProjectUserBadRequest) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *CreateExtensionsV1beta1NamespacedIngressAccepted) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *CreateCoreV1NamespacedServiceAccountTokenCreated) SetPayload(payload *models.IoK8sAPIAuthenticationV1TokenRequest) {\n\to.Payload = payload\n}", "func (o *PatchCoreV1PersistentVolumeOK) SetPayload(payload *models.IoK8sAPICoreV1PersistentVolume) {\n\to.Payload = payload\n}", "func (o *GetDataContextTopologyUUIDNodeNodeUUIDOK) SetPayload(payload *models.TapiTopologyTopologyNode) {\n\to.Payload = payload\n}", "func (o *GetCoreAPIVersionsOK) SetPayload(payload *models.IoK8sApimachineryPkgApisMetaV1APIVersions) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetNFTContractTokenOK) SetPayload(payload *models.NFTTokenRow) {\n\to.Payload = payload\n}", "func (o *DeleteOrganizationNotFound) SetPayload(payload *models.MissingResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *DeleteStorageByIDNotFound) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *ReplicateForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PatchApiextensionsV1beta1CustomResourceDefinitionStatusOK) SetPayload(payload *models.IoK8sApiextensionsApiserverPkgApisApiextensionsV1beta1CustomResourceDefinition) {\n\to.Payload = payload\n}", "func (o *UpdateClusterInternalServerError) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *WeaviateActionsPatchUnprocessableEntity) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *GetClusterInstallConfigMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *CreateClusterCreated) SetPayload(payload *models.Kluster) {\n\to.Payload = payload\n}", "func (o *ConnectCoreV1OptionsNodeProxyOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "func (o *GetNamespacedNotebooksUnauthorized) SetPayload(payload *models.Error) {\r\n\to.Payload = payload\r\n}", "func (o *DeleteAddressesOK) SetPayload(payload models.AddressConfigMap) {\n\to.Payload = payload\n}", "func (o *DeleteServiceIDFailure) SetPayload(payload models.Error) {\n\to.Payload = payload\n}", "func (o *DeleteOrgNotFound) SetPayload(payload *DeleteOrgNotFoundBody) {\n\to.Payload = payload\n}", "func (o *CreateCoordinationV1NamespacedLeaseAccepted) SetPayload(payload *models.IoK8sAPICoordinationV1Lease) {\n\to.Payload = payload\n}", "func (o *PutWorkpaceByIDOK) SetPayload(payload *models.Workspace) {\n\to.Payload = payload\n}", "func (o *CreateHPCResourceUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *UpdateClusterNotFound) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *AddKeypairMethodNotAllowed) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "func (o *AddConsumptionForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *RemoveOneDefault) SetPayload(payload *rest_model.RestError) {\n\to.Payload = payload\n}", "func (o *DeleteGroupByIDOK) SetPayload(payload *models.Group) {\n\to.Payload = payload\n}", "func (o *PutQuestionForbidden) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *GetServicesHaproxyRuntimeAclsIDOK) SetPayload(payload *models.ACLFile) {\n\to.Payload = payload\n}", "func (o *DeleteShipmentForbidden) SetPayload(payload *ghcmessages.Error) {\n\to.Payload = payload\n}", "func (o *DeregisterInfraEnvMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *ReplaceExtensionsV1beta1NamespacedIngressOK) SetPayload(payload *models.IoK8sAPIExtensionsV1beta1Ingress) {\n\to.Payload = payload\n}", "func (o *GetPresignedForClusterFilesMethodNotAllowed) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "func (o *AddConsumptionUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *ReplicateUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *PartialUpdateAppForbidden) SetPayload(payload *models.Unauthorized) {\n\to.Payload = payload\n}", "func (o *ObjectsPatchInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "func (o *DeleteUserForbidden) SetPayload(payload *DeleteUserForbiddenBody) {\n\to.Payload = payload\n}" ]
[ "0.7707723", "0.7229816", "0.7217126", "0.71624154", "0.70172673", "0.69015056", "0.6838018", "0.67712045", "0.67628366", "0.67597437", "0.6754284", "0.6739403", "0.6705884", "0.6703655", "0.6668181", "0.66570735", "0.6654698", "0.66288686", "0.6608131", "0.65916646", "0.6590983", "0.6583476", "0.65585834", "0.65584284", "0.6558037", "0.6557092", "0.6555027", "0.65507716", "0.65342325", "0.6520585", "0.6515472", "0.65127116", "0.65074706", "0.65015924", "0.6496061", "0.6449174", "0.6440961", "0.6436528", "0.6426169", "0.6421038", "0.6398054", "0.63856906", "0.6363252", "0.63631296", "0.6362682", "0.63611376", "0.6355598", "0.6340934", "0.6334285", "0.6333019", "0.6331794", "0.63218933", "0.6310079", "0.6297415", "0.6293528", "0.62668765", "0.62656796", "0.62625915", "0.6255375", "0.6249628", "0.6245283", "0.6233272", "0.62206876", "0.6220461", "0.62153256", "0.6214831", "0.62141776", "0.62116545", "0.6210977", "0.6201147", "0.6198578", "0.6195039", "0.61888874", "0.61860204", "0.6185245", "0.61810625", "0.6175035", "0.6171095", "0.61678845", "0.6164326", "0.61604977", "0.61604893", "0.6156963", "0.6154757", "0.61504763", "0.61496073", "0.6147231", "0.61471057", "0.6144817", "0.61422205", "0.61389196", "0.6132785", "0.6132132", "0.6123971", "0.6120298", "0.6117999", "0.611655", "0.61063355", "0.61034226", "0.61011463" ]
0.77040833
1
NewDeleteCoreV1NamespacedPodUnauthorized creates DeleteCoreV1NamespacedPodUnauthorized with default headers values
NewDeleteCoreV1NamespacedPodUnauthorized создает DeleteCoreV1NamespacedPodUnauthorized с значениями заголовков по умолчанию
func NewDeleteCoreV1NamespacedPodUnauthorized() *DeleteCoreV1NamespacedPodUnauthorized { return &DeleteCoreV1NamespacedPodUnauthorized{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCreateCoreV1NamespacedPodUnauthorized() *CreateCoreV1NamespacedPodUnauthorized {\n\treturn &CreateCoreV1NamespacedPodUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedServiceUnauthorized() *DeleteCoreV1NamespacedServiceUnauthorized {\n\treturn &DeleteCoreV1NamespacedServiceUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedEventUnauthorized() *DeleteCoreV1NamespacedEventUnauthorized {\n\treturn &DeleteCoreV1NamespacedEventUnauthorized{}\n}", "func NewReadCoreV1NamespacedPodUnauthorized() *ReadCoreV1NamespacedPodUnauthorized {\n\treturn &ReadCoreV1NamespacedPodUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedConfigMapUnauthorized() *DeleteCoreV1NamespacedConfigMapUnauthorized {\n\n\treturn &DeleteCoreV1NamespacedConfigMapUnauthorized{}\n}", "func NewCreateCoreV1NamespacedPodBindingUnauthorized() *CreateCoreV1NamespacedPodBindingUnauthorized {\n\n\treturn &CreateCoreV1NamespacedPodBindingUnauthorized{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenUnauthorized() *CreateCoreV1NamespacedServiceAccountTokenUnauthorized {\n\n\treturn &CreateCoreV1NamespacedServiceAccountTokenUnauthorized{}\n}", "func NewCreateCoreV1NamespacedServiceAccountTokenUnauthorized() *CreateCoreV1NamespacedServiceAccountTokenUnauthorized {\n\treturn &CreateCoreV1NamespacedServiceAccountTokenUnauthorized{}\n}", "func NewPatchCoreV1NamespacedServiceAccountUnauthorized() *PatchCoreV1NamespacedServiceAccountUnauthorized {\n\treturn &PatchCoreV1NamespacedServiceAccountUnauthorized{}\n}", "func NewWatchCoreV1NamespacedPodTemplateListUnauthorized() *WatchCoreV1NamespacedPodTemplateListUnauthorized {\n\treturn &WatchCoreV1NamespacedPodTemplateListUnauthorized{}\n}", "func NewWatchCoreV1NamespacedEndpointsUnauthorized() *WatchCoreV1NamespacedEndpointsUnauthorized {\n\n\treturn &WatchCoreV1NamespacedEndpointsUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedPodOK() *DeleteCoreV1NamespacedPodOK {\n\n\treturn &DeleteCoreV1NamespacedPodOK{}\n}", "func NewReadCoreV1NamespacedEndpointsUnauthorized() *ReadCoreV1NamespacedEndpointsUnauthorized {\n\treturn &ReadCoreV1NamespacedEndpointsUnauthorized{}\n}", "func NewDeleteCrossConnectUnauthorized() *DeleteCrossConnectUnauthorized {\n\treturn &DeleteCrossConnectUnauthorized{}\n}", "func NewDeleteVersionControlRequestUnauthorized() *DeleteVersionControlRequestUnauthorized {\n\treturn &DeleteVersionControlRequestUnauthorized{}\n}", "func NewThingsDeleteUnauthorized() *ThingsDeleteUnauthorized {\n\n\treturn &ThingsDeleteUnauthorized{}\n}", "func NewDeleteAPIUnauthorized() *DeleteAPIUnauthorized {\n\treturn &DeleteAPIUnauthorized{}\n}", "func NewCreateNetworkingV1beta1NamespacedIngressUnauthorized() *CreateNetworkingV1beta1NamespacedIngressUnauthorized {\n\n\treturn &CreateNetworkingV1beta1NamespacedIngressUnauthorized{}\n}", "func NewDeleteCoreV1CollectionNamespacedLimitRangeUnauthorized() *DeleteCoreV1CollectionNamespacedLimitRangeUnauthorized {\n\n\treturn &DeleteCoreV1CollectionNamespacedLimitRangeUnauthorized{}\n}", "func NewDeleteCoreV1PersistentVolumeUnauthorized() *DeleteCoreV1PersistentVolumeUnauthorized {\n\treturn &DeleteCoreV1PersistentVolumeUnauthorized{}\n}", "func NewDeleteUsingDELETE8Unauthorized() *DeleteUsingDELETE8Unauthorized {\n\treturn &DeleteUsingDELETE8Unauthorized{}\n}", "func NewConnectCoreV1PutNamespacedPodProxyUnauthorized() *ConnectCoreV1PutNamespacedPodProxyUnauthorized {\n\treturn &ConnectCoreV1PutNamespacedPodProxyUnauthorized{}\n}", "func NewDeleteScopeUnauthorized() *DeleteScopeUnauthorized {\n\treturn &DeleteScopeUnauthorized{}\n}", "func NewConnectCoreV1PatchNamespacedServiceProxyUnauthorized() *ConnectCoreV1PatchNamespacedServiceProxyUnauthorized {\n\treturn &ConnectCoreV1PatchNamespacedServiceProxyUnauthorized{}\n}", "func (o *DeleteCoreV1NamespacedPodUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses\n\n\trw.WriteHeader(401)\n}", "func NewDeleteLibraryAPIVersionUnauthorized() *DeleteLibraryAPIVersionUnauthorized {\n\treturn &DeleteLibraryAPIVersionUnauthorized{}\n}", "func NewDeleteMediaUnauthorized(body *DeleteMediaUnauthorizedResponseBody) *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 NewDeleteLibraryUnauthorized() *DeleteLibraryUnauthorized {\n\treturn &DeleteLibraryUnauthorized{}\n}", "func (suite *TenantTestSuite) TestDeleteUnauthorized() {\n\trequest, _ := http.NewRequest(\"DELETE\", \"/api/v2/admin/tenants/id\", strings.NewReader(\"\"))\n\trequest.Header.Set(\"x-api-key\", \"FOO\")\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(401, code, \"Internal Server Error\")\n\tsuite.Equal(suite.respUnauthorized, output, \"Response body mismatch\")\n}", "func NewListCoreV1NamespacedConfigMapUnauthorized() *ListCoreV1NamespacedConfigMapUnauthorized {\n\treturn &ListCoreV1NamespacedConfigMapUnauthorized{}\n}", "func NewDeleteCapabilityUnauthorized() *DeleteCapabilityUnauthorized {\n\treturn &DeleteCapabilityUnauthorized{}\n}", "func NewDeleteCompanyUnauthorized(body *DeleteCompanyUnauthorizedResponseBody) *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 NewDeleteDatasetUnauthorized() *DeleteDatasetUnauthorized {\n\treturn &DeleteDatasetUnauthorized{}\n}", "func (o *DeleteCoreV1NamespacedPodOK) WithPayload(payload *models.IoK8sAPICoreV1Pod) *DeleteCoreV1NamespacedPodOK {\n\to.Payload = payload\n\treturn o\n}", "func NewDeleteClientByNamespaceUnauthorized() *DeleteClientByNamespaceUnauthorized {\n\treturn &DeleteClientByNamespaceUnauthorized{}\n}", "func NewDeleteChannelHandlerUnauthorized() *DeleteChannelHandlerUnauthorized {\n\treturn &DeleteChannelHandlerUnauthorized{}\n}", "func NewDeleteVirtualCircuitUnauthorized() *DeleteVirtualCircuitUnauthorized {\n\treturn &DeleteVirtualCircuitUnauthorized{}\n}", "func NewCreateExtensionsV1beta1NamespacedIngressUnauthorized() *CreateExtensionsV1beta1NamespacedIngressUnauthorized {\n\n\treturn &CreateExtensionsV1beta1NamespacedIngressUnauthorized{}\n}", "func NewDeleteRegistryClientUnauthorized() *DeleteRegistryClientUnauthorized {\n\treturn &DeleteRegistryClientUnauthorized{}\n}", "func NewReplaceCoreV1NamespacedConfigMapUnauthorized() *ReplaceCoreV1NamespacedConfigMapUnauthorized {\n\treturn &ReplaceCoreV1NamespacedConfigMapUnauthorized{}\n}", "func NewConnectCoreV1OptionsNamespacedPodProxyWithPathUnauthorized() *ConnectCoreV1OptionsNamespacedPodProxyWithPathUnauthorized {\n\treturn &ConnectCoreV1OptionsNamespacedPodProxyWithPathUnauthorized{}\n}", "func NewWeaviateSchemaActionsDeleteUnauthorized() *WeaviateSchemaActionsDeleteUnauthorized {\n\n\treturn &WeaviateSchemaActionsDeleteUnauthorized{}\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 NewPostFirmwaresDeleteUnauthorized() *PostFirmwaresDeleteUnauthorized {\n\treturn &PostFirmwaresDeleteUnauthorized{}\n}", "func NewPcloudPvminstancesDeleteUnauthorized() *PcloudPvminstancesDeleteUnauthorized {\n\treturn &PcloudPvminstancesDeleteUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedServiceOK() *DeleteCoreV1NamespacedServiceOK {\n\treturn &DeleteCoreV1NamespacedServiceOK{}\n}", "func NewPatchEventsV1NamespacedEventUnauthorized() *PatchEventsV1NamespacedEventUnauthorized {\n\treturn &PatchEventsV1NamespacedEventUnauthorized{}\n}", "func NewDeleteArtifactUnauthorized() *DeleteArtifactUnauthorized {\n\treturn &DeleteArtifactUnauthorized{}\n}", "func NewDeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationUnauthorized() *DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationUnauthorized {\n\treturn &DeleteFlowcontrolApiserverV1alpha1PriorityLevelConfigurationUnauthorized{}\n}", "func NewCreateCoreV1NamespacedPodOK() *CreateCoreV1NamespacedPodOK {\n\treturn &CreateCoreV1NamespacedPodOK{}\n}", "func newPod(ctx context.Context, cl client.Client, ns, name, image string, cmd []string) (*corev1.Pod, error) {\n\tc := corev1.Container{\n\t\tName: name,\n\t\tImage: image,\n\t\tCommand: cmd,\n\t}\n\tp := &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: ns,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{c},\n\t\t\t// Kill the pod immediately so it exits quickly on deletion.\n\t\t\tTerminationGracePeriodSeconds: pointer.Int64Ptr(0),\n\t\t},\n\t}\n\tif err := cl.Create(ctx, p); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create pod %s/%s: %v\", p.Namespace, p.Name, err)\n\t}\n\treturn p, nil\n}", "func NewCreateDiscoveryV1beta1NamespacedEndpointSliceUnauthorized() *CreateDiscoveryV1beta1NamespacedEndpointSliceUnauthorized {\n\n\treturn &CreateDiscoveryV1beta1NamespacedEndpointSliceUnauthorized{}\n}", "func NewDeleteACLUnauthorized() *DeleteACLUnauthorized {\n\treturn &DeleteACLUnauthorized{}\n}", "func TestDeletePod(t *testing.T) {\n\tcluster := NewClusterState()\n\tvpa := addTestVpa(cluster)\n\tpod := addTestPod(cluster)\n\tassert.NoError(t, cluster.DeletePod(pod.ID))\n\tassert.Empty(t, vpa.Pods)\n}", "func NewDeleteNodeUsingDELETEUnauthorized() *DeleteNodeUsingDELETEUnauthorized {\n\treturn &DeleteNodeUsingDELETEUnauthorized{}\n}", "func NewDeleteVariableByNameUsingDELETEUnauthorized() *DeleteVariableByNameUsingDELETEUnauthorized {\n\treturn &DeleteVariableByNameUsingDELETEUnauthorized{}\n}", "func NewDeleteProjectUnauthorized() *DeleteProjectUnauthorized {\n\treturn &DeleteProjectUnauthorized{}\n}", "func NewDeleteOrgUnauthorized() *DeleteOrgUnauthorized {\n\n\treturn &DeleteOrgUnauthorized{}\n}", "func NewDeletePartmodelsUnauthorized() *DeletePartmodelsUnauthorized {\n\treturn &DeletePartmodelsUnauthorized{}\n}", "func NewConnectCoreV1GetNamespacedServiceProxyWithPathUnauthorized() *ConnectCoreV1GetNamespacedServiceProxyWithPathUnauthorized {\n\treturn &ConnectCoreV1GetNamespacedServiceProxyWithPathUnauthorized{}\n}", "func NewPcloudCloudconnectionsDeleteUnauthorized() *PcloudCloudconnectionsDeleteUnauthorized {\n\treturn &PcloudCloudconnectionsDeleteUnauthorized{}\n}", "func NewDeleteApiextensionsV1CollectionCustomResourceDefinitionUnauthorized() *DeleteApiextensionsV1CollectionCustomResourceDefinitionUnauthorized {\n\n\treturn &DeleteApiextensionsV1CollectionCustomResourceDefinitionUnauthorized{}\n}", "func NewUnauthorized(cause error) Unauthorized { return Unauthorized(cause.Error()) }", "func NewDeleteCommand() *cobra.Command {\n\tvar (\n\t\tall bool\n\t\tcompleted bool\n\t)\n\n\tvar command = &cobra.Command{\n\t\tUse: \"delete WORKFLOW\",\n\t\tShort: \"delete a managed and its associated pods\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\twfClient = InitManagedClient()\n\t\t\tif all {\n\t\t\t\tdeleteManageds(metav1.ListOptions{})\n\t\t\t\treturn\n\t\t\t} else if completed {\n\t\t\t\toptions := metav1.ListOptions{\n\t\t\t\t\tLabelSelector: fmt.Sprintf(\"%s=true\", common.LabelKeyCompleted),\n\t\t\t\t}\n\t\t\t\tdeleteManageds(options)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif len(args) == 0 {\n\t\t\t\tcmd.HelpFunc()(cmd, args)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tfor _, wfName := range args {\n\t\t\t\tdeleteManaged(wfName)\n\t\t\t}\n\t\t},\n\t}\n\n\tcommand.Flags().BoolVar(&all, \"all\", false, \"Delete all manageds\")\n\tcommand.Flags().BoolVar(&completed, \"completed\", false, \"Delete completed manageds\")\n\treturn command\n}", "func NewDelSubDeviceWithCoreRequestWithoutParam() *DelSubDeviceWithCoreRequest {\n\n return &DelSubDeviceWithCoreRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/instances/{instanceId}/products/{productKey}/edges/{edgeName}:delSubDevice\",\n Method: \"POST\",\n Header: nil,\n Version: \"v2\",\n },\n }\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 NewDeleteMatchPoolUnauthorized() *DeleteMatchPoolUnauthorized {\n\treturn &DeleteMatchPoolUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedPodAccepted() *DeleteCoreV1NamespacedPodAccepted {\n\n\treturn &DeleteCoreV1NamespacedPodAccepted{}\n}", "func NewDeleteBacsIDUnauthorized() *DeleteBacsIDUnauthorized {\n\treturn &DeleteBacsIDUnauthorized{}\n}", "func NewDeleteUserUnauthorized() *DeleteUserUnauthorized {\n\n\treturn &DeleteUserUnauthorized{}\n}", "func NewDeleteUserUnauthorized() *DeleteUserUnauthorized {\n\n\treturn &DeleteUserUnauthorized{}\n}", "func (rm *resourceManager) newDeleteRequestPayload(\n\tr *resource,\n) (*svcsdk.DeleteReplicationGroupInput, error) {\n\tres := &svcsdk.DeleteReplicationGroupInput{}\n\n\tif r.ko.Spec.ReplicationGroupID != nil {\n\t\tres.SetReplicationGroupId(*r.ko.Spec.ReplicationGroupID)\n\t}\n\n\treturn res, nil\n}", "func NewDeleteDirectoryUsingPOSTUnauthorized() *DeleteDirectoryUsingPOSTUnauthorized {\n\treturn &DeleteDirectoryUsingPOSTUnauthorized{}\n}", "func NewWatchSettingsV1alpha1NamespacedPodPresetUnauthorized() *WatchSettingsV1alpha1NamespacedPodPresetUnauthorized {\n\treturn &WatchSettingsV1alpha1NamespacedPodPresetUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedConfigMapOK() *DeleteCoreV1NamespacedConfigMapOK {\n\n\treturn &DeleteCoreV1NamespacedConfigMapOK{}\n}", "func NewDeleteProjectUserUnauthorized() *DeleteProjectUserUnauthorized {\n\n\treturn &DeleteProjectUserUnauthorized{}\n}", "func genericPodDelete(label, namespace string, clientset *kubernetes.Clientset) error {\n\n\tvar name string\n\t//Getting all pods in litmus Namespace\n\tpods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to get pods in %v namespace, err: %v\", err)\n\t}\n\n\tklog.Infof(\"[Info]: Selecting pod with label %v for reboot\", label)\n\tfor i := range pods.Items {\n\t\tif pods.Items[i].Labels[\"component\"] == label {\n\t\t\tname = pods.Items[i].Name\n\t\t}\n\t}\n\tklog.Infof(\"[Info]: Deleting the Pod : %v\", name)\n\terr = clientset.CoreV1().Pods(\"litmus\").Delete(context.TODO(), name, metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to delete %v pod, err: %v\", name, err)\n\t}\n\tklog.Infof(\"[Info]: %v pod deleted successfully \\n\", name)\n\treturn nil\n}", "func NewDeleteUserUnauthorized() *DeleteUserUnauthorized {\n\treturn &DeleteUserUnauthorized{}\n}", "func NewCreateCoreV1PersistentVolumeUnauthorized() *CreateCoreV1PersistentVolumeUnauthorized {\n\treturn &CreateCoreV1PersistentVolumeUnauthorized{}\n}", "func NewPcloudSppplacementgroupsDeleteUnauthorized() *PcloudSppplacementgroupsDeleteUnauthorized {\n\treturn &PcloudSppplacementgroupsDeleteUnauthorized{}\n}", "func NewReplaceExtensionsV1beta1NamespacedIngressUnauthorized() *ReplaceExtensionsV1beta1NamespacedIngressUnauthorized {\n\n\treturn &ReplaceExtensionsV1beta1NamespacedIngressUnauthorized{}\n}", "func NewDeleteGroupByIDUnauthorized() *DeleteGroupByIDUnauthorized {\n\n\treturn &DeleteGroupByIDUnauthorized{}\n}", "func NewDeleteVendorUnauthorized() *DeleteVendorUnauthorized {\n\n\treturn &DeleteVendorUnauthorized{}\n}", "func NewDeleteNodeV1alpha1RuntimeClassUnauthorized() *DeleteNodeV1alpha1RuntimeClassUnauthorized {\n\treturn &DeleteNodeV1alpha1RuntimeClassUnauthorized{}\n}", "func NewUnauthorized(res calcsvc.Unauthorized) Unauthorized {\n\tbody := Unauthorized(res)\n\treturn body\n}", "func NewDeleteCertificatesV1beta1CertificateSigningRequestUnauthorized() *DeleteCertificatesV1beta1CertificateSigningRequestUnauthorized {\n\treturn &DeleteCertificatesV1beta1CertificateSigningRequestUnauthorized{}\n}", "func NewCreateBatchV1NamespacedJobUnauthorized() *CreateBatchV1NamespacedJobUnauthorized {\n\n\treturn &CreateBatchV1NamespacedJobUnauthorized{}\n}", "func NewDeleteCoreV1NamespacedServiceAccount(ctx *middleware.Context, handler DeleteCoreV1NamespacedServiceAccountHandler) *DeleteCoreV1NamespacedServiceAccount {\n\treturn &DeleteCoreV1NamespacedServiceAccount{Context: ctx, Handler: handler}\n}", "func NewUnauthorized(err error, msg string) error {\n\treturn &unauthorized{wrap(err, msg, \"\")}\n}", "func NewDeleteAPIKeyDefault(code int) *DeleteAPIKeyDefault {\n\treturn &DeleteAPIKeyDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *KeyVaultClient) purgeDeletedSecretCreateRequest(ctx context.Context, vaultBaseURL string, secretName string, options *KeyVaultClientPurgeDeletedSecretOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/deletedsecrets/{secret-name}\"\n\tif secretName == \"\" {\n\t\treturn nil, errors.New(\"parameter secretName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{secret-name}\", url.PathEscape(secretName))\n\treq, err := runtime.NewRequest(ctx, http.MethodDelete, 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 (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 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 NewReadCoreV1NamespacedPodOK() *ReadCoreV1NamespacedPodOK {\n\treturn &ReadCoreV1NamespacedPodOK{}\n}", "func NewDeleteTokenDefault(code int) *DeleteTokenDefault {\n\treturn &DeleteTokenDefault{\n\t\t_statusCode: code,\n\t}\n}", "func Delete(kind string, name string, namespace string, args ...string) (err error) {\n\tdeleteArgs := []string{\"delete\", kind, name, \"-n\", namespace}\n\t_, err = kubectl(append(deleteArgs, args...)...)\n\treturn\n}", "func NewDeleteInstancesUnauthorized() *DeleteInstancesUnauthorized {\n\treturn &DeleteInstancesUnauthorized{}\n}", "func NewDeleteComponentForbidden() *DeleteComponentForbidden {\n\treturn &DeleteComponentForbidden{}\n}", "func (client *KeyVaultClient) purgeDeletedCertificateCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, options *KeyVaultClientPurgeDeletedCertificateOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/deletedcertificates/{certificate-name}\"\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.MethodDelete, 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}" ]
[ "0.740951", "0.6979649", "0.6803902", "0.67638403", "0.674884", "0.6690887", "0.6411087", "0.6345015", "0.62293595", "0.6227683", "0.6223361", "0.6140357", "0.60931987", "0.59411067", "0.59172565", "0.58970165", "0.58314055", "0.5726889", "0.57166153", "0.5705346", "0.5610533", "0.56045127", "0.5577667", "0.55506796", "0.5549633", "0.55434716", "0.5541593", "0.552961", "0.5524539", "0.55150187", "0.55049086", "0.5435711", "0.542774", "0.5426802", "0.54182994", "0.5411556", "0.539857", "0.53832483", "0.5375574", "0.5373131", "0.5367538", "0.5364443", "0.5359473", "0.53421134", "0.53267056", "0.53187335", "0.5313805", "0.53021914", "0.52982324", "0.529166", "0.5275319", "0.5244022", "0.524047", "0.522477", "0.52162004", "0.51947474", "0.5192106", "0.51913303", "0.5188557", "0.51510775", "0.51497066", "0.5138248", "0.5129325", "0.5119434", "0.50989383", "0.50786436", "0.507472", "0.5072627", "0.5059543", "0.5054817", "0.5054817", "0.5045154", "0.5043862", "0.5041565", "0.50405824", "0.5029146", "0.50139725", "0.5011698", "0.5009971", "0.5003165", "0.49975425", "0.4995782", "0.49892536", "0.49811625", "0.49768955", "0.49762967", "0.49742734", "0.4972614", "0.4972346", "0.49623084", "0.49611747", "0.49581328", "0.49554732", "0.49554732", "0.49403644", "0.49356982", "0.49304762", "0.49196276", "0.4916876", "0.49078754" ]
0.7787556
0
ID returns the unique name of the driver.
ID возвращает уникальное имя драйвера.
func (*Driver) ID() string { return DriverID }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *driver) Name() string {\n\treturn driverName\n}", "func (d *driver) Name() string {\n\treturn driverName\n}", "func (d *driver) Name() string {\n\treturn driverName\n}", "func (d *hdbDriver) Name() string { return DriverName }", "func ID() (string, error) {\n\tid, err := hardwareId()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"hardwareid: %v\", err)\n\t}\n\treturn id, nil\n}", "func (v VirtualSwitch) ID() (string, error) {\n\tid, err := v.virtualSwitch.GetProperty(\"Name\")\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"GetProperty(Name)\")\n\t}\n\treturn id.Value().(string), nil\n}", "func Name() string {\n\treturn driver.AppName()\n}", "func (d *Driver) DriverName() string {\n\treturn DriverName\n}", "func (drv StorageDriver) Driver() string {\n\treturn string(drv)\n}", "func (d *Driver) DriverName() string {\n\treturn driverName\n}", "func (db *DB) DriverName() string {\n return db.driverName\n}", "func DriverName() string {\n\tdriver, err := DriverNameByKey(DefaultConnectionName)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn driver\n}", "func (s *Server) ID() string {\n\treturn s.Config().GetUuid()\n}", "func (db *DB) Driver() string {\n\treturn driver\n}", "func (db *DB) Driver() string {\n\treturn driver\n}", "func (d *Driver) Name() string { return d.name }", "func (cc *Client) ID() (string, error) {\n\ts, err := cc.sshSession()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer s.Close()\n\tid, err := s.Output(\"id\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(id), nil\n}", "func (dev *SDRDevice) GetDriverKey() (driverKey string) {\n\n\tval := (*C.char)(C.SoapySDRDevice_getDriverKey(dev.device))\n\tdefer C.free(unsafe.Pointer(val))\n\n\treturn C.GoString(val)\n}", "func (h *Host) ID() string {\n\tif h.id == \"\" {\n\t\thash := md5.New()\n\t\t_, _ = io.WriteString(hash, h.IP+h.MAC)\n\t\th.id = fmt.Sprintf(\"%x\", hash.Sum(nil))\n\t}\n\n\treturn h.id\n}", "func (d *Driver) DriverName() string {\n\treturn \"vmwarevsphere\"\n}", "func (db *DB) DriverName() string {\n\treturn db.DB.DriverName()\n}", "func (s *DbRecorder) Driver() string {\n\treturn s.flavor\n}", "func (d *Driver) DriverName() string {\n\treturn \"bytemark\"\n}", "func (s *VirtualStore) ID() string {\n\treturn s.sid\n}", "func (decryptor *PgDecryptor) ID() string {\n\treturn \"PgDecryptor\"\n}", "func GetNameID() (nameID string) {\n\treturn\n}", "func (conn *Connection) ID() string {\n\treturn conn.id\n}", "func (d *Driver) DriverName() string {\n\treturn \"exoscale\"\n}", "func (c *ConnectionMock) ID() string {\n\targs := c.Called()\n\treturn args.String(0)\n}", "func (b *base) ID() string { return b.IDx }", "func getDockerID() (string){\n\tid, _ := os.Hostname()\n\treturn id\n}", "func ID() string {\n\treturn appid\n}", "func GetDriverName(driver driver.Driver) string {\n\tif driver == nil {\n\t\treturn \"\"\n\t}\n\tdriverType := fmt.Sprintf(\"%s\", reflect.TypeOf(driver))\n\tswitch driverType {\n\tcase \"*mysql.MySQLDriver\":\n\t\treturn \"mysql\"\n\tcase \"*pq.Driver\":\n\t\treturn \"postgres\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "func (us *UserStorage) IDByName(name string) (string, error) {\n\treturn randomdata.StringNumber(2, \"-\"), nil\n}", "func (v *Volume) Driver() string {\n\treturn v.config.Driver\n}", "func (r *regulator) Name() string {\n\tr.enter()\n\tdefer r.exit()\n\n\treturn r.StorageDriver.Name()\n}", "func (c *Connection) ID() string {\n\treturn fmt.Sprintf(\"[%s@%d_%d]\", c.url, c.id, c.cc)\n}", "func (c Client) GetIdentifier() network.Identifier { return c.identify }", "func getInstanceID(providerID string) string {\n\tproviderTokens := strings.Split(providerID, \"/\")\n\treturn providerTokens[len(providerTokens)-1]\n}", "func getInstanceID(providerID string) string {\n\tproviderTokens := strings.Split(providerID, \"/\")\n\treturn providerTokens[len(providerTokens)-1]\n}", "func (d Display) GetDriver() string {\n\treturn C.GoString(C.caca_get_display_driver(d.Dp))\n}", "func (w *deviceWrapper) GetID() string {\n\tif w.ID == \"\" {\n\t\tw.ID = fmt.Sprintf(\"%s.%s.%s\", utils.NormalizeDeviceName(w.Ctor.DeviceConfigName),\n\t\t\tutils.NormalizeDeviceName(w.Ctor.DeviceType.String()),\n\t\t\tutils.NormalizeDeviceName(w.Ctor.DeviceInterface.(device.IDevice).GetName()))\n\t}\n\treturn w.ID\n}", "func (r *RDBDriver) Name() string {\n\treturn r.name\n}", "func (pe *ProgramExt) UUID() string {\n\treturn fmt.Sprintf(\"%s_%s\", pe.Manager, pe.Config)\n}", "func (client *BaseClient) ID() string {\n\treturn client.id\n}", "func (bv *BaseVSphere) ID() string {\n\treturn fmt.Sprintf(\"%s[%s@%s]\", bv.Type, bv.Name, bv.Endpoint)\n}", "func (s *PostgresStore) ID() string {\n\treturn s.sid\n}", "func (r *Network) Driver() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"driver\"])\n}", "func (cons *VgaTextConsole) DriverName() string {\n\treturn \"vga_text_console\"\n}", "func (c *Chip) Identifier() string { return c.identifier }", "func (p *ResourcePool) ID() string {\n\treturn fmt.Sprintf(\"resourcepool(%s)\", p.manager.Name())\n}", "func (c *localComponent) ID() dependency.Instance {\n\treturn dependency.PolicyBackend\n}", "func (ph PackageHash) ID() string {\n\treturn hex.EncodeToString(ph[:16])\n}", "func (c *Component) ID() string {\n\tc.Cmu.Lock()\n\tdefer c.Cmu.Unlock()\n\treturn c.Id\n}", "func (h *Harness) UUID(id string) string { return h.uuidG.Get(id) }", "func (s *Server) Id() string {\n\treturn s.ID()\n}", "func (d *Driver) DriverName() string {\n\treturn \"proxmoxve\"\n}", "func (wlt Wallet) GetID() string {\n\treturn wlt.Meta[\"filename\"]\n}", "func (gpu *Device) UUID() (string, error) {\n\treturn gpu.textProperty(\"UUID\")\n}", "func ID(namespace, name string) string {\n\treturn fmt.Sprintf(\"%s/%s\", namespace, name)\n}", "func (o IopingSpecVolumeVolumeSourceCsiOutput) Driver() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceCsi) string { return v.Driver }).(pulumi.StringOutput)\n}", "func (w *W) ID() string {\n\treturn w.Config.URL\n}", "func (p *Peer) ID() string {\n\treturn fmt.Sprintf(\"%s.%s\", p.Organization, p.Name)\n}", "func (o *os) GetUniqueId() gdnative.String {\n\to.ensureSingleton()\n\t//log.Println(\"Calling _OS.GetUniqueId()\")\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_unique_id\")\n\n\t// Call the parent method.\n\t// String\n\tretPtr := gdnative.NewEmptyString()\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.NewStringFromPointer(retPtr)\n\treturn ret\n}", "func (ca *NullClientAdapter) ID() string {\n\treturn ca.ClientID\n}", "func (inst *Instance) ID() string {\n\tif inst == nil || inst.inst == nil {\n\t\treturn \"\"\n\t}\n\treturn inst.inst.ID()\n}", "func (i *Instance) ID() string {\n\treturn i.MachineID\n}", "func (s *session) ID() string {\n\treturn s.sid\n}", "func (na *NetAdapter) ID() *id.ID {\n\treturn na.id\n}", "func getHardwareID() string {\n\tif hardwareID != \"\" {\n\t\treturn hardwareID\n\t}\n\taddress := \"\"\n\tinters, err := net.Interfaces()\n\tif err == nil {\n\t\tfor _, inter := range inters {\n\t\t\tif inter.HardwareAddr.String() != \"\" {\n\t\t\t\taddress = inter.HardwareAddr.String()\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif address == \"\" {\n\t\taddress = \"0\"\n\t}\n\tcheck32 := crc32.ChecksumIEEE([]byte(address))\n\tid58 := base58.EncodeBig(nil, big.NewInt(int64(check32)))\n\thardwareID = string(id58)\n\treturn hardwareID\n}", "func (c *WSClient) ID() string {\n\treturn c.id.String()\n}", "func (c *Config) Identifier(globals integrations_v2.Globals) (string, error) {\n\tif c.Common.InstanceKey != nil {\n\t\treturn *c.Common.InstanceKey, nil\n\t}\n\treturn c.Name(), nil\n}", "func (spec *MachineSpec) ID() string {\n\treturn spec.Machine.ObjectId.Hex()\n}", "func NameID(name string) (nm string, err error) {\n\ts, err := binary.Blake2bHash([]byte(name))\n\tif err != nil {\n\t\treturn\n\t}\n\treturn binary.Encode(binary.PrefixName, s), nil\n}", "func (o FioSpecVolumeVolumeSourceCsiOutput) Driver() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceCsi) string { return v.Driver }).(pulumi.StringOutput)\n}", "func (e *Etcd) BackendID() (result string) {\n\treturn e.etcd.Server.ID().String()\n}", "func (db *DB) GetDriverById(id int) (*Driver, error) {\n\tdb, err := GetPgConnection()\n\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tdefer db.Close()\n\n\trow, err := db.Query(\"SELECT * FROM users WHERE id = $1\", id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer row.Close()\n\n\tdriver := new(Driver)\n\n\tfor row.Next() {\n\t\terr = row.Scan(&driver.Id, &driver.Username)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn driver, nil\n}", "func (n *DesktopNotificator) ID() string {\n\treturn \"DesktopNotificator\"\n}", "func (d *Directory) ID() string {\n\treturn d.id\n}", "func (d *Module) ID() string {\n\treturn ModuleID\n}", "func (a *Agent) ID() string {\n\n\tresult, err := a.sentry.PublicKeyBase64()\n\tif err != nil {\n\t\terr = stacktrace.Propagate(err, \"could not get node ID\")\n\t\tpanic(err)\n\t}\n\treturn result\n}", "func (d Disk) GetID() string {\n\treturn d.Serial\n}", "func (cracker *Firecracker) ID() (string, error) {\n\t_, err := cracker.State()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn cracker.id, nil\n}", "func (c *container) ID() string {\n\treturn c.name\n}", "func (u User) ID() string {\n\tif u.IsAnonymous() {\n\t\treturn \"user/anonymous\"\n\t}\n\treturn \"user/\" + string(u)\n}", "func (id ClientEncryptionKeyId) ID() string {\n\tfmtString := \"/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/sqlDatabases/%s/clientEncryptionKeys/%s\"\n\treturn fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DatabaseAccountName, id.SqlDatabaseName, id.ClientEncryptionKeyName)\n}", "func (d *APA102Driver) Name() string { return d.name }", "func DriverNameByKey(key string) (string, error) {\n\n\tconn, err := GetConnectionWithKey(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn conn.DriverName(), nil\n}", "func (p ObjectID) ID() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\",\n\t\tp.SpaceType(),\n\t\tp.ObjectType(),\n\t\tp.Instance(),\n\t)\n}", "func (f *FFS) ID(ctx context.Context) (ffs.APIID, error) {\n\tresp, err := f.client.ID(ctx, &rpc.IDRequest{})\n\tif err != nil {\n\t\treturn ffs.EmptyInstanceID, err\n\t}\n\treturn ffs.APIID(resp.Id), nil\n}", "func (l *RelayDriver) Name() string { return l.name }", "func (w *blobWriter) ID() string {\n\treturn w.BlobWriter.ID()\n}", "func (e *Exec) GetNameID() string { return e.nameID }", "func (s *Session) ID() string {\n\treturn s.id\n}", "func (c *Connector) ID() string {\n\tc.cmu.Lock()\n\tdefer c.cmu.Unlock()\n\treturn c.id\n}", "func (s *SOC) ID() []byte {\n\treturn s.id\n}", "func (llrb *LLRB) ID() string {\n\treturn llrb.name\n}", "func (d *Device) Id() uint32 { return d.DevId }", "func (m *Machine) Id() string {\n\treturn m.tag.Id()\n}" ]
[ "0.7027706", "0.7010078", "0.7010078", "0.69331926", "0.67615914", "0.6571657", "0.65653706", "0.65030783", "0.6484946", "0.6479828", "0.62847674", "0.62813586", "0.62324375", "0.6207377", "0.6207377", "0.61767435", "0.60884994", "0.60639834", "0.6063588", "0.60591555", "0.60532415", "0.6034294", "0.602093", "0.60125667", "0.59922236", "0.59848106", "0.5946331", "0.59421825", "0.59419423", "0.5940304", "0.5918061", "0.59162825", "0.59140384", "0.5910121", "0.58944225", "0.587069", "0.5858404", "0.58433473", "0.5835246", "0.5835246", "0.58332855", "0.5830521", "0.58301127", "0.58245915", "0.5803061", "0.5796447", "0.57886684", "0.57855296", "0.57838905", "0.5759296", "0.57591003", "0.5758986", "0.5755055", "0.5746744", "0.57435447", "0.574054", "0.5735592", "0.5716223", "0.5715785", "0.5707389", "0.5702112", "0.570105", "0.5662691", "0.5659358", "0.5650701", "0.5643778", "0.5643472", "0.56395054", "0.5624399", "0.5623376", "0.56205606", "0.5618645", "0.56147015", "0.560479", "0.5599722", "0.5591939", "0.55715543", "0.55693924", "0.5569361", "0.55688345", "0.5567512", "0.55668205", "0.55636394", "0.556332", "0.55632925", "0.55608964", "0.5558555", "0.5556648", "0.5554038", "0.55463535", "0.5545302", "0.5544668", "0.554362", "0.55383873", "0.55279607", "0.55279106", "0.55271804", "0.55236477", "0.55210865" ]
0.83944076
1
LoadAll loads all indexes for given db and table
LoadAll загружает все индексы для заданной базы данных и таблицы
func (d *Driver) LoadAll(db, table string) ([]sql.Index, error) { var ( indexes []sql.Index errors []string root = filepath.Join(d.root, db, table) ) dirs, err := ioutil.ReadDir(root) if err != nil { if os.IsNotExist(err) { return indexes, nil } return nil, err } for _, info := range dirs { if info.IsDir() && !strings.HasPrefix(info.Name(), ".") { idx, err := d.loadIndex(db, table, info.Name()) if err != nil { if !errCorruptedIndex.Is(err) { errors = append(errors, err.Error()) } continue } indexes = append(indexes, idx) } } if len(errors) > 0 { return nil, fmt.Errorf(strings.Join(errors, "\n")) } return indexes, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *Driver) LoadAll(db, table string) ([]sql.Index, error) {\n\tvar (\n\t\tindexes []sql.Index\n\t\terrors []string\n\t\troot = filepath.Join(d.root, db, table)\n\t)\n\n\tdirs, err := ioutil.ReadDir(root)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn indexes, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tfor _, info := range dirs {\n\t\tif info.IsDir() && !strings.HasPrefix(info.Name(), \".\") {\n\t\t\tidx, err := d.loadIndex(db, table, info.Name())\n\t\t\tif err != nil {\n\t\t\t\tif !errCorruptedIndex.Is(err) {\n\t\t\t\t\terrors = append(errors, err.Error())\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tindexes = append(indexes, idx)\n\t\t}\n\t}\n\n\tif len(errors) > 0 {\n\t\treturn nil, fmt.Errorf(strings.Join(errors, \"\\n\"))\n\t}\n\n\treturn indexes, nil\n}", "func loadIndexs() {\n\tdb := open()\n\tindexs = make(map[string][]*Index)\n\tdb.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(INDEX_BUCKET))\n\t\tif b == nil {\n\t\t\tlogger.Infof(\"bucket[%s] not exist\", INDEX_BUCKET)\n\t\t\treturn nil\n\t\t}\n\t\tc := b.Cursor()\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\tkey := string(k)\n\t\t\tvar _indexs []string\n\t\t\terr := json.Unmarshal(v, &_indexs)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"parse index[%s] error -> %v\", k, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t__indexs := make([]*Index, len(_indexs)) \n\t\t\t// parse index\n\t\t\tfor i, _index := range _indexs {\n\t\t\t\tsps :=strings.Split(_index, INDEX_SPLIT) \n\t\t\t\tindex := &Index {\n\t\t\t\t\tbucket: key,\n\t\t\t\t\tindexs: sps,\n\t\t\t\t}\n\t\t\t\t__indexs[i] = index\n\t\t\t}\n\t\t\tindexs[key] = __indexs\n\t\t}\n\t\treturn nil\n\t})\n}", "func LoadDatabase() {\n\tdb.load()\n\tfor host := range db.Hosts {\n\t\tindex.Put(host)\n\t}\n}", "func TestSQLSmith_LoadIndexes(t *testing.T) {\n\te := Executor{\n\t\tconn: nil,\n\t\tdb: dbname,\n\t\ttables: make(map[string]*types.Table),\n\t}\n\tindexes[\"users\"] = []types.CIStr{\"idx1\", \"idx2\"}\n\te.loadSchema(schema, indexes)\n\n\tassert.Equal(t, len(e.tables), 6)\n\tassert.Equal(t, len(e.tables[\"users\"].Indexes), 2)\n}", "func ReloadAllTableInfo(ctx context.Context, filePath string) error {\n\tconf, err := getConfig(ctx, filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, db := range conf.Databases {\n\t\tfor _, h := range conf.Hosts {\n\t\t\tif db.HostKey != h.Key {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\terr := openAdditional(ctx, h.User, h.Password, h.Address, db.Name, h.Port, h.Protocol)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ttables, err := showtables(db.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdb.Tables = tables\n\t\t}\n\t}\n\n\treturn setConfig(ctx, conf, filePath)\n}", "func LoadAll(args ...interface{}) error {\n\treturn doAll(Load, args...)\n}", "func (o *PublisherSearchIdxSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := PublisherSearchIdxSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), publisherSearchIdxPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"publisher_search_idx\\\".* FROM \\\"publisher_search_idx\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, publisherSearchIdxPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in PublisherSearchIdxSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (DBM *DBManager) loadAllDatabases(path string) (err error) {\n\tdatabasesFiles, err := listDatabases(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, databaseFile := range databasesFiles {\n\t\tdb, err := data.LoadDatabase(filepath.Join(path, databaseFile.Name()))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tDBM.databases.Store(databaseFile.Name(), db)\n\t}\n\treturn nil\n}", "func (st *Store) LoadAll(aa []string) error {\n\tlogins := make(map[string]*Login, 0)\n\n\tfor _, a := range aa {\n\t\tregistry, login, err := loadOne(strings.TrimSpace(a))\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlogins[registry] = login\n\t}\n\n\tst.logins = logins\n\n\treturn nil\n}", "func (s *Store) loadAll() error {\n\tfiles, err := s.ListFiles(s.Dir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to list %s: %v\", s.Dir, err)\n\t}\n\n\tfor _, file := range files {\n\t\tfilepath := path.Join(s.Dir, file)\n\t\terr := s.loadPath(filepath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to load %s: %v\", filepath, err)\n\t\t}\n\t}\n\treturn nil\n}", "func InitDB(db *mgo.Database) {\n\tfor i := range workIndexes {\n\t\terr := db.C(workIndexes[i].Name).EnsureIndex(workIndexes[i].Index)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t}\n}", "func OrTableIndexes(db models.XODB, schema string, table string) ([]*models.Index, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT ` +\n\t\t`LOWER(i.index_name) AS index_name, ` +\n\t\t`CASE WHEN i.uniqueness = 'UNIQUE' THEN '1' ELSE '0' END AS is_unique, ` +\n\t\t`CASE WHEN c.constraint_type = 'P' THEN '1' ELSE '0' END AS is_primary ` +\n\t\t`FROM user_indexes i ` +\n\t\t`LEFT JOIN user_constraints c on i.INDEX_NAME = c.constraint_name ` +\n\t\t`WHERE i.TABLE_OWNER = UPPER(:1) AND i.TABLE_NAME = :2`\n\n\t// run query\n\tmodels.XOLog(sqlstr, schema, table)\n\tq, err := db.Query(sqlstr, schema, table)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer q.Close()\n\n\t// load results\n\tres := []*models.Index{}\n\tfor q.Next() {\n\t\ti := models.Index{}\n\n\t\t// scan\n\t\terr = q.Scan(&i.IndexName, &i.IsUnique, &i.IsPrimary)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tres = append(res, &i)\n\t}\n\n\treturn res, nil\n}", "func (o *TenantSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := TenantSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), tenantPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `tenants`.* FROM `tenants` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, tenantPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"dbmodel: unable to reload all in TenantSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (mi *MasterIndex) All() []*Index {\n\tmi.idxMutex.Lock()\n\tdefer mi.idxMutex.Unlock()\n\n\treturn mi.idx\n}", "func (o *KvstoreSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := KvstoreSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), kvstorePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"kvstore\\\".* FROM \\\"kvstore\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, kvstorePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in KvstoreSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *StoreSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := StoreSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), storePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"stores\\\".* FROM \\\"stores\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, storePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in StoreSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (e *engine) load() error {\n\tdatabaseNames, err := listDir(e.cfg.Dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, databaseName := range databaseNames {\n\t\t_, err := e.CreateDatabase(databaseName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func loadAll(bi *Bi) (*Bi, error) {\n\n\tvar err error\n\n\tbi.allstops, err = bi.gtfs.AllStops()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbi.allroutes, err = bi.gtfs.Routes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn bi, nil\n}", "func (ifile *Indexfile) Load() (lfindex *Index, err error) {\n\tlfindex = new(Index)\n\tf := func(rec *GenericRecord) error {\n\t\tif rec.ksz > 0 {\n\t\t\tirec := rec.ToIndexRecord(ifile.debug)\n\t\t\tlfindex.List = append(lfindex.List, irec)\n\t\t}\n\t\treturn nil\n\t}\n\terr = ifile.Process(f, INDEX_RECORD, false)\n\treturn\n}", "func (o *StorestateSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := StorestateSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), storestatePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"storestate\\\".* FROM \\\"storestate\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, storestatePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"stellarcore: unable to reload all in StorestateSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *SegmentSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := SegmentSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), segmentPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"segment\\\".* FROM \\\"segment\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, segmentPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"boiler: unable to reload all in SegmentSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func ForAllIndexes(ctx context.Context, repo restic.Repository,\n\tfn func(id restic.ID, index *Index, oldFormat bool, err error) error) error {\n\n\tdebug.Log(\"Start\")\n\n\ttype FileInfo struct {\n\t\trestic.ID\n\t\tSize int64\n\t}\n\n\tvar m sync.Mutex\n\n\t// track spawned goroutines using wg, create a new context which is\n\t// cancelled as soon as an error occurs.\n\twg, ctx := errgroup.WithContext(ctx)\n\n\tch := make(chan FileInfo)\n\t// send list of index files through ch, which is closed afterwards\n\twg.Go(func() error {\n\t\tdefer close(ch)\n\t\treturn repo.List(ctx, restic.IndexFile, func(id restic.ID, size int64) error {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn nil\n\t\t\tcase ch <- FileInfo{id, size}:\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t})\n\n\t// a worker receives an index ID from ch, loads the index, and sends it to indexCh\n\tworker := func() error {\n\t\tvar buf []byte\n\t\tfor fi := range ch {\n\t\t\tdebug.Log(\"worker got file %v\", fi.ID.Str())\n\t\t\tvar err error\n\t\t\tvar idx *Index\n\t\t\toldFormat := false\n\n\t\t\tbuf, err = repo.LoadAndDecrypt(ctx, buf[:0], restic.IndexFile, fi.ID)\n\t\t\tif err == nil {\n\t\t\t\tidx, oldFormat, err = DecodeIndex(buf, fi.ID)\n\t\t\t}\n\n\t\t\tm.Lock()\n\t\t\terr = fn(fi.ID, idx, oldFormat, err)\n\t\t\tm.Unlock()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\t// run workers on ch\n\twg.Go(func() error {\n\t\treturn RunWorkers(loadIndexParallelism, worker)\n\t})\n\n\treturn wg.Wait()\n}", "func (d *DBV0) load(db *DB) error {\n\tfn := func(tx *sql.Tx) error {\n\t\tvar err error\n\t\td.aciinfos, err = getAllACIInfosV0_1(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\td.remotes, err = getAllRemoteV0_1(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\tif err := db.Do(fn); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (db *ldb) loadAll() {\n\tf, err := os.Open(game_data_file)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\trd := bufio.NewReader(f)\n\n\tvar l = 0\n\tvar matrix = make([]string, 0)\n\tfor {\n\t\tline, err := rd.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tdb.data = append(db.data, matrix)\n\t\t\t\tdb.maxLevel = len(db.data)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpanic(err)\n\t\t}\n\t\tline = strings.TrimRight(line, \"\\t\\n\\f\\r\")\n\t\tif len(line) == 0 {\n\t\t\tdb.data = append(db.data, matrix)\n\t\t\tl = l + 1\n\t\t\tmatrix = make([]string, 0)\n\t\t} else {\n\t\t\tmatrix = append(matrix, line)\n\t\t}\n\t}\n}", "func (s *InMemoryHandler) Load() ([]*model.FunctionConfig, error) {\n\tresults := []*model.FunctionConfig{}\n\tfor _, v := range s.functions {\n\t\tresults = append(results, &v)\n\t}\n\tlog.Infof(\"load database table size %d\", len(results))\n\treturn results, nil\n}", "func initTableIndices(t *tableCommon) error {\n\ttrace_util_0.Count(_tables_00000, 29)\n\ttblInfo := t.meta\n\tfor _, idxInfo := range tblInfo.Indices {\n\t\ttrace_util_0.Count(_tables_00000, 31)\n\t\tif idxInfo.State == model.StateNone {\n\t\t\ttrace_util_0.Count(_tables_00000, 33)\n\t\t\treturn table.ErrIndexStateCantNone.GenWithStack(\"index %s can't be in none state\", idxInfo.Name)\n\t\t}\n\n\t\t// Use partition ID for index, because tableCommon may be table or partition.\n\t\ttrace_util_0.Count(_tables_00000, 32)\n\t\tidx := NewIndex(t.physicalTableID, tblInfo, idxInfo)\n\t\tt.indices = append(t.indices, idx)\n\t}\n\ttrace_util_0.Count(_tables_00000, 30)\n\treturn nil\n}", "func (o *SkinSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tskins := SkinSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), skinPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `skin`.* FROM `skin` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, skinPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&skins)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in SkinSlice\")\n\t}\n\n\t*o = skins\n\n\treturn nil\n}", "func (rcv *databaseReader) ReadAll() ([]*model.Database, error) {\n\tdatabaseNames, err := rcv.db.ListDatabaseNames(context.Background(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := make([]*model.Database, len(databaseNames))\n\n\tfor i, name := range databaseNames {\n\t\tdbStats, err := rcv.db.Database(name).RunCommand(\n\t\t\tcontext.Background(),\n\t\t\tbson.NewDocument(bson.EC.Int32(\"dbStats\", 1)),\n\t\t)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar collections, indexesNumber, storageSize int\n\n\t\tif collectionsRaw, _ := dbStats.Lookup(\"collections\"); collectionsRaw != nil {\n\t\t\tcollections = int(collectionsRaw.Value().Int32())\n\t\t}\n\n\t\tif indexes, _ := dbStats.Lookup(\"indexes\"); indexes != nil {\n\t\t\tindexesNumber = int(indexes.Value().Int32())\n\t\t}\n\n\t\tif storageSizeRaw, _ := dbStats.Lookup(\"storageSize\"); storageSizeRaw != nil {\n\t\t\tstorageSize = int(storageSizeRaw.Value().Double())\n\t\t}\n\n\t\tresult[i] = model.NewDatabase(name, storageSize, indexesNumber, collections)\n\t}\n\n\treturn result, nil\n}", "func (c *Client) LoadAll() ([]*eskip.Route, error) {\n\trouteInfo, err := c.LoadAndParseAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn infoToRoutesLogged(routeInfo), nil\n}", "func (o *IllnessSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := IllnessSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), illnessPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"illness\\\".* FROM \\\"illness\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, illnessPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in IllnessSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *SourceSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := SourceSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), sourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"sources\\\".* FROM \\\"sources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, sourcePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmodels: unable to reload all in SourceSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (db *Database) Indexes(label string) ([]*Index, error) {\n\turi := join(db.Url, \"schema/index\", label)\n\tresult := []*Index{}\n\tne := NeoError{}\n\tresp, err := db.Session.Get(uri, nil, &result, &ne)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tif resp.Status() == 404 {\n\t\treturn result, NotFound\n\t}\n\tif resp.Status() != 200 {\n\t\treturn result, ne\n\t}\n\tfor _, idx := range result {\n\t\tidx.db = db\n\t}\n\treturn result, nil\n}", "func DbLoadAllTickets(dbTx database.Tx, ticketBucket []byte) (*tickettreap.Immutable, error) {\n\tmeta := dbTx.Metadata()\n\tbucket := meta.Bucket(ticketBucket)\n\n\ttreap := tickettreap.NewImmutable()\n\terr := bucket.ForEach(func(k []byte, v []byte) error {\n\t\tif len(v) < 5 {\n\t\t\treturn ticketDBError(ErrLoadAllTickets, fmt.Sprintf(\"short \"+\n\t\t\t\t\"read for ticket key %x when loading tickets\", k))\n\t\t}\n\n\t\th, err := chainhash.NewHash(k)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttreapKey := tickettreap.Key(*h)\n\t\tmissed, revoked, spent, expired := undoBitFlagsFromByte(v[4])\n\t\ttreapValue := &tickettreap.Value{\n\t\t\tHeight: dbnamespace.ByteOrder.Uint32(v[0:4]),\n\t\t\tMissed: missed,\n\t\t\tRevoked: revoked,\n\t\t\tSpent: spent,\n\t\t\tExpired: expired,\n\t\t}\n\n\t\ttreap = treap.Put(treapKey, treapValue)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, ticketDBError(ErrLoadAllTickets, fmt.Sprintf(\"failed to \"+\n\t\t\t\"load all tickets for the bucket %s\", string(ticketBucket)))\n\t}\n\n\treturn treap, nil\n}", "func (o *FilesStorageSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := FilesStorageSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), filesStoragePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `files_storages`.* FROM `files_storages` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, filesStoragePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in FilesStorageSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *TransactionSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\ttransactions := TransactionSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), transactionPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `transaction`.* FROM `transaction` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, transactionPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&transactions)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"model: unable to reload all in TransactionSlice\")\n\t}\n\n\t*o = transactions\n\n\treturn nil\n}", "func (o *TransactionSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\ttransactions := TransactionSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), transactionPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `transactions`.* FROM `transactions` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, transactionPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&transactions)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in TransactionSlice\")\n\t}\n\n\t*o = transactions\n\n\treturn nil\n}", "func (o *ShelfSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tshelves := ShelfSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), shelfPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT `shelf`.* FROM `shelf` WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, shelfPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(shelfPrimaryKeyColumns), 1, len(shelfPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&shelves)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in ShelfSlice\")\n\t}\n\n\t*o = shelves\n\n\treturn nil\n}", "func (client *Client) LoadIndexersList() error {\n var result Indexers\n response, err := client.sendGetRequest(&result, \"indexers\", \"\", nil, nil)\n if err != nil {\n return errors.JackettUnableToLoadIndexers.ToError(err)\n }\n client.indexers = response.(*Indexers)\n configuredIndexers := make([]Indexer, 0)\n for _, indexer := range result {\n if indexer.Configured {\n configuredIndexers = append(configuredIndexers, indexer)\n }\n }\n client.configuredIndexers = configuredIndexers\n return nil\n}", "func (mt *MetaTable) reloadWithNonDatabase() error {\n\tcollectionNum := int64(0)\n\tpartitionNum := int64(0)\n\toldCollections, err := mt.catalog.ListCollections(mt.ctx, util.NonDBID, typeutil.MaxTimestamp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, collection := range oldCollections {\n\t\tmt.collID2Meta[collection.CollectionID] = collection\n\t\tif collection.Available() {\n\t\t\tmt.names.insert(util.DefaultDBName, collection.Name, collection.CollectionID)\n\t\t\tcollectionNum++\n\t\t\tpartitionNum += int64(collection.GetPartitionNum(true))\n\t\t}\n\t}\n\n\tif collectionNum > 0 {\n\t\tlog.Info(\"recover collections without db\", zap.Int64(\"collection_num\", collectionNum), zap.Int64(\"partition_num\", partitionNum))\n\t}\n\n\taliases, err := mt.catalog.ListAliases(mt.ctx, util.NonDBID, typeutil.MaxTimestamp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, alias := range aliases {\n\t\tmt.aliases.insert(util.DefaultDBName, alias.Name, alias.CollectionID)\n\t}\n\n\tmetrics.RootCoordNumOfCollections.Add(float64(collectionNum))\n\tmetrics.RootCoordNumOfPartitions.WithLabelValues().Add(float64(partitionNum))\n\treturn nil\n}", "func (ec *ElasticClient) InitAllMappings() {\n\tec.DeleteIndex(string(\"collectd_*\"))\n\tec.DeleteIndex(string(\"ceilometer_*\"))\n\tec.DeleteIndex(string(\"generic_*\"))\n}", "func (o *DocSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := DocSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), docPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `doc`.* FROM `doc` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, docPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in DocSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *SmallblogSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := SmallblogSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), smallblogPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `smallblog`.* FROM `smallblog` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, smallblogPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in SmallblogSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *AuthSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tauths := AuthSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"auths\\\".* FROM \\\"auths\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&auths)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in AuthSlice\")\n\t}\n\n\t*o = auths\n\n\treturn nil\n}", "func (b *QueryBuilder) Load() []map[string]interface{} {\n\treturn nil\n}", "func (o *SourceSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tsources := SourceSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), sourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"sources\\\".* FROM \\\"sources\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, sourcePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&sources)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mdbmdbmodels: unable to reload all in SourceSlice\")\n\t}\n\n\t*o = sources\n\n\treturn nil\n}", "func (o *CvtermsynonymSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tcvtermsynonyms := CvtermsynonymSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cvtermsynonymPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT \\\"cvtermsynonym\\\".* FROM \\\"cvtermsynonym\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, cvtermsynonymPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(cvtermsynonymPrimaryKeyColumns), 1, len(cvtermsynonymPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&cvtermsynonyms)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to reload all in CvtermsynonymSlice\")\n\t}\n\n\t*o = cvtermsynonyms\n\n\treturn nil\n}", "func (o *LatencySlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := LatencySlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), latencyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"latencies\\\".* FROM \\\"latencies\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, latencyPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in LatencySlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *VendorSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := VendorSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), vendorPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `vendors`.* FROM `vendors` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, vendorPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in VendorSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (p *ThriftHiveMetastoreClient) GetIndexes(ctx context.Context, db_name string, tbl_name string, max_indexes int16) (r []*Index, err error) {\n var _args114 ThriftHiveMetastoreGetIndexesArgs\n _args114.DbName = db_name\n _args114.TblName = tbl_name\n _args114.MaxIndexes = max_indexes\n var _result115 ThriftHiveMetastoreGetIndexesResult\n if err = p.Client_().Call(ctx, \"get_indexes\", &_args114, &_result115); err != nil {\n return\n }\n switch {\n case _result115.O1!= nil:\n return r, _result115.O1\n case _result115.O2!= nil:\n return r, _result115.O2\n }\n\n return _result115.GetSuccess(), nil\n}", "func spansForAllRestoreTableIndexes(\n\tcodec keys.SQLCodec, tables []catalog.TableDescriptor, revs []BackupManifest_DescriptorRevision,\n) []roachpb.Span {\n\n\tadded := make(map[tableAndIndex]bool, len(tables))\n\tsstIntervalTree := interval.NewTree(interval.ExclusiveOverlapper)\n\tfor _, table := range tables {\n\t\t// We only import spans for physical tables.\n\t\tif !table.IsPhysicalTable() {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, index := range table.ActiveIndexes() {\n\t\t\tif err := sstIntervalTree.Insert(intervalSpan(table.IndexSpan(codec, index.GetID())), false); err != nil {\n\t\t\t\tpanic(errors.NewAssertionErrorWithWrappedErrf(err, \"IndexSpan\"))\n\t\t\t}\n\t\t\tadded[tableAndIndex{tableID: table.GetID(), indexID: index.GetID()}] = true\n\t\t}\n\t}\n\t// If there are desc revisions, ensure that we also add any index spans\n\t// in them that we didn't already get above e.g. indexes or tables that are\n\t// not in latest because they were dropped during the time window in question.\n\tfor _, rev := range revs {\n\t\t// If the table was dropped during the last interval, it will have\n\t\t// at least 2 revisions, and the first one should have the table in a PUBLIC\n\t\t// state. We want (and do) ignore tables that have been dropped for the\n\t\t// entire interval. DROPPED tables should never later become PUBLIC.\n\t\t// TODO(pbardea): Consider and test the interaction between revision_history\n\t\t// backups and OFFLINE tables.\n\t\trawTbl, _, _, _ := descpb.FromDescriptor(rev.Desc)\n\t\tif rawTbl != nil && rawTbl.State != descpb.DescriptorState_DROP {\n\t\t\ttbl := tabledesc.NewBuilder(rawTbl).BuildImmutableTable()\n\t\t\t// We only import spans for physical tables.\n\t\t\tif !tbl.IsPhysicalTable() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, idx := range tbl.ActiveIndexes() {\n\t\t\t\tkey := tableAndIndex{tableID: tbl.GetID(), indexID: idx.GetID()}\n\t\t\t\tif !added[key] {\n\t\t\t\t\tif err := sstIntervalTree.Insert(intervalSpan(tbl.IndexSpan(codec, idx.GetID())), false); err != nil {\n\t\t\t\t\t\tpanic(errors.NewAssertionErrorWithWrappedErrf(err, \"IndexSpan\"))\n\t\t\t\t\t}\n\t\t\t\t\tadded[key] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tvar spans []roachpb.Span\n\t_ = sstIntervalTree.Do(func(r interval.Interface) bool {\n\t\tspans = append(spans, roachpb.Span{\n\t\t\tKey: roachpb.Key(r.Range().Start),\n\t\t\tEndKey: roachpb.Key(r.Range().End),\n\t\t})\n\t\treturn false\n\t})\n\treturn spans\n}", "func (t *TableStruct) All(limit ...int) (data map[int]map[string]string, err error) {\n\tif t == nil {\n\t\terr = fmt.Errorf(\"%s\", \"Requested table does not exist\")\n\t\treturn\n\t}\n\n\tvar doc map[string]string\n\tdata = make(map[int]map[string]string)\n\tl := t.IndexNum\n\tif len(limit) != 0 && limit[0] <= t.IndexNum {\n\t\tl = limit[0]\n\t}\n\n\tfor id := 0; id < l; id++ {\n\t\tdoc, err = t.Read(id)\n\t\tif empty(doc) {\n\t\t\tcontinue\n\t\t}\n\t\tdata[id] = doc\n\t}\n\treturn\n}", "func (o *HoldenAtSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := HoldenAtSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), holdenAtPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"HoldenAt\\\".* FROM \\\"HoldenAt\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, holdenAtPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in HoldenAtSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (c *Client) LoadAndParseAll() ([]*RouteInfo, error) {\n\tresponse, err := c.etcd.Get(c.routesRoot, false, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, etcdIndex := c.iterateDefs(response.Node, 0)\n\tif response.EtcdIndex > etcdIndex {\n\t\tetcdIndex = response.EtcdIndex\n\t}\n\n\tc.etcdIndex = etcdIndex\n\treturn parseRoutes(data), nil\n}", "func (indexStore *IndexStore) InitIndex() {\n\tdocs := indexStore.db.getAllDocs()\n\tuniqueIndexes := make(map[string]int)\n\ti := 0\n\tfor _, doc := range docs {\n\t\tif _, present := indexStore.store[doc.Index]; !present {\n\t\t\tindexStore.NewIndex(doc.Index)\n\t\t}\n\t\tindexStore.AddDocument(doc.Index, doc.Title, doc.Contents, doc.Id)\n\t\tuniqueIndexes[doc.Index] = 1\n\n\t\tif i%50 == 0 {\n\t\t\tfmt.Printf(\"%v documents indexed\\n\", i)\n\t\t}\n\t\ti++\n\t}\n\n\tfor index := range uniqueIndexes {\n\t\tindexStore.UpdateIndex(index)\n\t}\n}", "func LoadAll(ctx context.Context, cfg Config) ([]*Person, error) {\n\tdb, err := getDB(cfg)\n\tif err != nil {\n\t\tcfg.Logger().Error(\"failed to get DB connection. err: %s\", err)\n\t\treturn nil, err\n\t}\n\n\t// set latency budget for the database call\n\tsubCtx, cancel := context.WithTimeout(ctx, 1*time.Second)\n\tdefer cancel()\n\n\t// perform DB select\n\trows, err := db.QueryContext(subCtx, sqlLoadAll)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\t_ = rows.Close()\n\t}()\n\n\tvar out []*Person\n\n\tfor rows.Next() {\n\t\t// retrieve columns and populate the person object\n\t\trecord, err := populatePerson(rows.Scan)\n\t\tif err != nil {\n\t\t\tcfg.Logger().Error(\"failed to convert query result. err: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tout = append(out, record)\n\t}\n\n\tif len(out) == 0 {\n\t\tcfg.Logger().Warn(\"no people found in the database.\")\n\t\treturn nil, ErrNotFound\n\t}\n\n\treturn out, nil\n}", "func CreateAllIndexes() error {\n\terr := questionAnswerDAO.CreateIndexes()\n\n\treturn err\n}", "func (o *FeatureCvtermDbxrefSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tfeatureCvtermDbxrefs := FeatureCvtermDbxrefSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featureCvtermDbxrefPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT \\\"feature_cvterm_dbxref\\\".* FROM \\\"feature_cvterm_dbxref\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featureCvtermDbxrefPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(featureCvtermDbxrefPrimaryKeyColumns), 1, len(featureCvtermDbxrefPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&featureCvtermDbxrefs)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to reload all in FeatureCvtermDbxrefSlice\")\n\t}\n\n\t*o = featureCvtermDbxrefs\n\n\treturn nil\n}", "func (b *Bolt) LoadAll(data interface{}) error {\n\n\tbuf := &bytes.Buffer{}\n\terr := b.client.View(func(tx *bolt.Tx) error {\n\t\tbkt := tx.Bucket([]byte(b.bucket))\n\t\tbuf.WriteByte('[')\n\t\tif bkt != nil {\n\t\t\tfirst := true\n\t\t\tif err := bkt.ForEach(func(_, v []byte) error {\n\t\t\t\tif len(v) > 0 {\n\t\t\t\t\tif first {\n\t\t\t\t\t\tfirst = false\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuf.WriteByte(',')\n\t\t\t\t\t}\n\n\t\t\t\t\tbuf.Write(v)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\t\tbuf.WriteByte(']')\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"Buffer: %s\\n\", buf.Bytes())\n\tif err = json.Unmarshal(buf.Bytes(), data); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *UtxoSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := UtxoSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), utxoPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"utxo\\\".* FROM \\\"utxo\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, utxoPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in UtxoSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (s *shard) initIndexDatabase() error {\n\tvar err error\n\tstoreOption := kv.DefaultStoreOption(filepath.Join(s.path, indexParentDir))\n\ts.indexStore, err = newKVStoreFunc(storeOption.Path, storeOption)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.forwardFamily, err = s.indexStore.CreateFamily(\n\t\tforwardIndexDir,\n\t\tkv.FamilyOption{\n\t\t\tCompactThreshold: 0,\n\t\t\tMerger: string(invertedindex.SeriesForwardMerger)})\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.invertedFamily, err = s.indexStore.CreateFamily(\n\t\tinvertedIndexDir,\n\t\tkv.FamilyOption{\n\t\t\tCompactThreshold: 0,\n\t\t\tMerger: string(invertedindex.SeriesInvertedMerger)})\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.indexDB, err = newIndexDBFunc(\n\t\tcontext.TODO(),\n\t\tfilepath.Join(s.path, metaDir),\n\t\ts.metadata, s.forwardFamily,\n\t\ts.invertedFamily)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (d *Dataset) Indexes() []string {\n\t//grab indexes\n\tvar indexes []string\n\n\tindexFiles, err := ioutil.ReadDir(filepath.Join(path.Dir(d.path), \".gitdb/index/\", d.Name()))\n\tif err != nil {\n\t\treturn indexes\n\t}\n\n\tfor _, indexFile := range indexFiles {\n\t\tindexes = append(indexes, strings.TrimSuffix(indexFile.Name(), \".json\"))\n\t}\n\n\treturn indexes\n}", "func Initialize(db *sql.DB, Schema schema.DBSchema) {\n\tfor table, schema := range Schema {\n\t\t// fmt.Println(db.QueryRow(`DROP TABLE pages cascade;`))\n\t\tfor _, scheme := range schema {\n\t\t\tif debugging {\n\t\t\t\tfmt.Printf(\"\\ndb.QueryRow: %s:\\n%s\\n\", table, scheme)\n\t\t\t}\n\t\t\t_, err := db.Exec(scheme)\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Sprintf(\"%v\", err))\n\t\t\t}\n\t\t}\n\t}\n}", "func (o *NodeSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := NodeSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), nodePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"node\\\".* FROM \\\"node\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, nodePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in NodeSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (s *shard) initIndexDatabase() error {\n\tvar err error\n\tstoreOption := kv.DefaultStoreOption(filepath.Join(s.path, indexParentDir))\n\ts.indexStore, err = newKVStoreFunc(storeOption.Path, storeOption)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.forwardFamily, err = s.indexStore.CreateFamily(\n\t\tforwardIndexDir,\n\t\tkv.FamilyOption{\n\t\t\tCompactThreshold: 0,\n\t\t\tMerger: string(tagindex.SeriesForwardMerger)})\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.invertedFamily, err = s.indexStore.CreateFamily(\n\t\tinvertedIndexDir,\n\t\tkv.FamilyOption{\n\t\t\tCompactThreshold: 0,\n\t\t\tMerger: string(tagindex.SeriesInvertedMerger)})\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.indexDB, err = newIndexDBFunc(\n\t\tcontext.TODO(),\n\t\tfilepath.Join(s.path, metaDir),\n\t\ts.metadata, s.forwardFamily,\n\t\ts.invertedFamily)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func LoadShards(dataDir string, walDir string, database string, retentionPolicy string, shardFilter string) ([]ShardInfo, error) {\n\tdbDirs, err := ioutil.ReadDir(dataDir)\n\tvar shards []ShardInfo\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, db := range dbDirs {\n\t\tdbPath := filepath.Join(dataDir, db.Name())\n\t\tif !db.IsDir() {\n\t\t\tlog.Println(\"Skipping database directory\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif database != \"\" && database != db.Name() {\n\t\t\tcontinue\n\t\t}\n\n\t\trpDirs, err := ioutil.ReadDir(dbPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, rp := range rpDirs {\n\t\t\trpPath := filepath.Join(dataDir, db.Name(), rp.Name())\n\t\t\tif !rp.IsDir() {\n\t\t\t\tlog.Println(\"Skipping retention policy directory\")\n\t\t\t}\n\n\t\t\tif rp.Name() == _seriesFileDirectory {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif retentionPolicy != \"\" && retentionPolicy != rp.Name() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tshardDirs, err := ioutil.ReadDir(rpPath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tfor _, sh := range shardDirs {\n\t\t\t\tif sh.Name() == _seriesFileDirectory {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif shardFilter != \"\" && shardFilter != sh.Name() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tshPath := filepath.Join(dataDir, db.Name(), rp.Name(), sh.Name())\n\t\t\t\twalPath := filepath.Join(walDir, db.Name(), rp.Name(), sh.Name())\n\n\t\t\t\tshardID, err := strconv.ParseUint(sh.Name(), 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"invalid shard ID found at path '%s'\", shPath)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tlog.Printf(\"Found shard '%s' (%d) with WAL '%s'\\n\", shPath, shardID, walPath)\n\n\t\t\t\tfieldsIndexPath := filepath.Join(shPath, _fieldIndexFileName)\n\t\t\t\tfieldsIndex, err := tsdb.NewMeasurementFieldSet(fieldsIndexPath)\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\ttsmFiles, err := filepath.Glob(filepath.Join(shPath, fmt.Sprintf(\"*.%s\", tsm1.TSMFileExtension)))\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\twalFiles, err := filepath.Glob(filepath.Join(walPath, fmt.Sprintf(\"%s*.%s\", tsm1.WALFilePrefix, tsm1.WALFileExtension)))\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\tshardInfo := ShardInfo{\n\t\t\t\t\tPath: shPath,\n\t\t\t\t\tID: shardID,\n\t\t\t\t\tDatabase: db.Name(),\n\t\t\t\t\tRetentionPolicy: rp.Name(),\n\t\t\t\t\tTsmFiles: tsmFiles,\n\t\t\t\t\tFieldsIndex: fieldsIndex,\n\t\t\t\t\tWalFiles: walFiles,\n\t\t\t\t}\n\n\t\t\t\tshards = append(shards, shardInfo)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn shards, nil\n}", "func createIndexes(db *sql.DB, table string) error {\n\tindexes := []string{}\n\n\tswitch table {\n\tcase \"dfp\":\n\t\tindexes = []string{\n\t\t\t\"CREATE INDEX IF NOT EXISTS dfp_metrics ON dfp (CODE, ID_CIA, YEAR, VL_CONTA);\",\n\t\t\t\"CREATE INDEX IF NOT EXISTS dfp_year_ver ON dfp (ID_CIA, YEAR, VERSAO);\",\n\t\t}\n\tcase \"itr\":\n\t\tindexes = []string{\n\t\t\t\"CREATE INDEX IF NOT EXISTS itr_metrics ON itr (CODE, ID_CIA, YEAR, VL_CONTA);\",\n\t\t\t\"CREATE INDEX IF NOT EXISTS itr_quarter_ver ON itr (ID_CIA, DT_FIM_EXERC, VERSAO);\",\n\t\t}\n\tcase \"stock_quotes\":\n\t\tindexes = []string{\n\t\t\t\"CREATE UNIQUE INDEX IF NOT EXISTS stock_quotes_stockdate ON stock_quotes (stock, date);\",\n\t\t}\n\tcase \"fii_dividends\":\n\t\tindexes = []string{\n\t\t\t\"CREATE UNIQUE INDEX IF NOT EXISTS fii_dividends_pk ON fii_dividends (trading_code, base_date);\",\n\t\t}\n\t}\n\n\tfor _, idx := range indexes {\n\t\t_, err := db.Exec(idx)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"erro ao criar índice\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func (w *WorkflowInstances) LoadAll(opt *db.Options) error {\n\tif err := db.SelectStruct(constants.TableCoreBPMInstances, w, opt); err != nil {\n\t\treturn customerror.New(http.StatusInternalServerError, \"workflow instances load\", err.Error())\n\t}\n\treturn nil\n}", "func (osm *ObjectStoreMapper) Load(src io.Reader) (*types.Database, error) {\n\t// XXX needs refactor\n\traw, err := osm.store.Read(src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tschemata, ok := raw[schemataTableName]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"missing schema table\")\n\t}\n\t// field index is non deterministic which will lead to random output\n\t// we could have another attribute for \"_presentation\" which contains\n\t// column order and widths\n\tfieldsByTable := map[string][]string{}\n\tprimariesByTable := map[string]string{}\n\tconstructorsByTable := map[string](map[string]types.FieldValueConstructor){}\n\tfeaturesByColumnByTable := map[string](map[string](map[string]interface{})){}\n\tfor name, schema := range schemata {\n\t\tparts := strings.Split(name, \".\")\n\t\tif len(parts) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"invalid column name: %s\", name)\n\t\t}\n\t\ttable := parts[0]\n\t\tcolumn := parts[1]\n\t\t// TODO schema validation outside of loop -- this is inefficient\n\t\tfieldTypeRaw, ok := schema[\"type\"]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"missing type for %s.%s\", table, column)\n\t\t}\n\t\tfieldType, ok := fieldTypeRaw.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid type %#v\", fieldTypeRaw)\n\t\t}\n\t\tif strings.HasPrefix(fieldType, \"dynamic.\") {\n\t\t\t// TODO implement dymanic columns\n\t\t\t// ignoring for now\n\t\t\tcontinue\n\t\t}\n\t\tif primary, ok := schema[\"primary\"]; ok {\n\t\t\tif primaryB, ok := primary.(bool); ok && primaryB {\n\t\t\t\tif currentPrimary, ok := primariesByTable[table]; ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Duplicate primary keys for %s: %s %s\", table, currentPrimary, column)\n\t\t\t\t}\n\t\t\t\tprimariesByTable[table] = column\n\t\t\t}\n\t\t}\n\t\tvar constructor types.FieldValueConstructor\n\t\tif strings.HasPrefix(fieldType, \"foreign.\") {\n\t\t\t// TODO(rabrams) double check scoping of this variable\n\t\t\t// also would be good to validate foriegn values\n\t\t\ttable := fieldType[len(\"foreign.\"):]\n\t\t\tconstructor = func(i interface{}, features map[string]interface{}) (types.Entry, error) {\n\t\t\t\tif features == nil {\n\t\t\t\t\tfeatures = map[string]interface{}{}\n\t\t\t\t}\n\t\t\t\tfeatures[\"table\"] = table\n\t\t\t\treturn types.NewForeignKey(i, features)\n\t\t\t}\n\t\t} else if strings.HasPrefix(fieldType, \"foreigns.\") {\n\t\t\t// TODO(rabrams) double check scoping of this variable\n\t\t\t// also would be good to validate foriegn values\n\t\t\ttable := fieldType[len(\"foreigns.\"):]\n\t\t\tconstructor = func(i interface{}, features map[string]interface{}) (types.Entry, error) {\n\t\t\t\tif features == nil {\n\t\t\t\t\tfeatures = map[string]interface{}{}\n\t\t\t\t}\n\t\t\t\tfeatures[\"table\"] = table\n\t\t\t\treturn types.NewForeignList(i, features)\n\t\t\t}\n\t\t} else {\n\t\t\tconstructor, ok = constructors[fieldType]\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid type '%s'\", fieldType)\n\t\t\t}\n\t\t}\n\t\tbyTable, ok := fieldsByTable[table]\n\t\tif !ok {\n\t\t\tfieldsByTable[table] = []string{column}\n\t\t\tconstructorsByTable[table] = map[string]types.FieldValueConstructor{\n\t\t\t\tcolumn: constructor,\n\t\t\t}\n\t\t\tfeaturesByColumnByTable[table] = map[string](map[string]interface{}){}\n\t\t} else {\n\t\t\tfieldsByTable[table] = append(byTable, column)\n\t\t\tconstructorsByTable[table][column] = constructor\n\t\t}\n\t\tfeatures := map[string]interface{}{}\n\t\tfeaturesUncast, ok := schema[\"features\"]\n\t\tif ok {\n\t\t\tfeatures, ok = featuresUncast.(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid type for `features`\")\n\t\t\t}\n\t\t}\n\t\tfeaturesByColumnByTable[table][column] = features\n\t}\n\n\tindexMap := map[string]int{}\n\tfor table, byTable := range fieldsByTable {\n\t\tsort.Slice(byTable, func(i, j int) bool { return byTable[i] < byTable[j] })\n\t\tfor index, column := range byTable {\n\t\t\tindexMap[fmt.Sprintf(\"%s.%s\", table, column)] = index\n\t\t}\n\t\tif _, ok := primariesByTable[table]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"No primary key for table: %s\", table)\n\t\t}\n\t}\n\n\tdelete(raw, schemataTableName)\n\tdb := &types.Database{\n\t\tSchemata: schemata,\n\t\tTables: map[string]*types.Table{},\n\t}\n\tfor name, encoded := range raw {\n\t\tprimary, ok := primariesByTable[name]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Unknown table: %s\", name)\n\t\t}\n\t\t// TODO use a constructor and Inserts -- that way the able can map\n\t\t// columns by name\n\t\ttable := types.NewTable(fieldsByTable[name], map[string][]types.Entry{}, primary, constructorsByTable[name], featuresByColumnByTable[name])\n\t\tallFields := fieldsByTable[name]\n\n\t\tdb.Tables[name] = table\n\t\tfor pk, fields := range encoded {\n\t\t\trow := make([]types.Entry, len(fieldsByTable[name]))\n\t\t\ttable.Entries[pk] = row\n\t\t\tfields[primary] = pk\n\t\t\tfor _, column := range allFields {\n\t\t\t\tvalue := fields[column]\n\t\t\t\tfullName := fmt.Sprintf(\"%s.%s\", name, column)\n\t\t\t\tindex, ok := indexMap[fullName]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unknown column: %s\", fullName)\n\t\t\t\t}\n\t\t\t\tconstructor := constructorsByTable[name][column]\n\n\t\t\t\ttypedVal, err := constructor(value, featuresByColumnByTable[name][column])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"failed to init %s.%s for %s: %s\", name, column, pk, err)\n\t\t\t\t}\n\t\t\t\trow[index] = typedVal\n\t\t\t}\n\t\t}\n\t}\n\treturn db, nil\n}", "func (o *CMFTurntableSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := CMFTurntableSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfTurntablePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `cmf_turntable`.* FROM `cmf_turntable` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfTurntablePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in CMFTurntableSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *AuthUserSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tauthUsers := AuthUserSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authUserPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT `auth_user`.* FROM `auth_user` WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, authUserPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(authUserPrimaryKeyColumns), 1, len(authUserPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&authUsers)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in AuthUserSlice\")\n\t}\n\n\t*o = authUsers\n\n\treturn nil\n}", "func addAllFieldIndexes(ctx context.Context, indexer client.FieldIndexer) error {\n\tif err := indexer.IndexField(ctx, &gardencorev1beta1.Project{}, gardencore.ProjectNamespace, func(obj client.Object) []string {\n\t\tproject, ok := obj.(*gardencorev1beta1.Project)\n\t\tif !ok {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\tif project.Spec.Namespace == nil {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\treturn []string{*project.Spec.Namespace}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to add indexer to Project Informer: %w\", err)\n\t}\n\n\tif err := indexer.IndexField(ctx, &gardencorev1beta1.Shoot{}, gardencore.ShootSeedName, func(obj client.Object) []string {\n\t\tshoot, ok := obj.(*gardencorev1beta1.Shoot)\n\t\tif !ok {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\tif shoot.Spec.SeedName == nil {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\treturn []string{*shoot.Spec.SeedName}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to add indexer to Shoot Informer: %w\", err)\n\t}\n\n\tif err := indexer.IndexField(ctx, &seedmanagementv1alpha1.ManagedSeed{}, seedmanagement.ManagedSeedShootName, func(obj client.Object) []string {\n\t\tms, ok := obj.(*seedmanagementv1alpha1.ManagedSeed)\n\t\tif !ok {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\tif ms.Spec.Shoot == nil {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\treturn []string{ms.Spec.Shoot.Name}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to add indexer to ManagedSeed Informer: %w\", err)\n\t}\n\n\treturn nil\n}", "func GetIndexesFromDB(client *mongo.Client, dbName string) string {\n\tvar err error\n\tvar cur *mongo.Cursor\n\tvar icur *mongo.Cursor\n\tvar scur *mongo.Cursor\n\tvar buffer bytes.Buffer\n\tvar ctx = context.Background()\n\t// var pipeline = mongo.Pipeline{{{Key: \"$indexStats\", Value: bson.M{}}}}\n\tvar pipeline = MongoPipeline(`{\"$indexStats\": {}}`)\n\tif cur, err = client.Database(dbName).ListCollections(ctx, bson.M{}); err != nil {\n\t\treturn err.Error()\n\t}\n\tdefer cur.Close(ctx)\n\n\tfor cur.Next(ctx) {\n\t\tvar elem = bson.M{}\n\t\tif err = cur.Decode(&elem); err != nil {\n\t\t\tfmt.Println(\"0.1\", err)\n\t\t\tcontinue\n\t\t}\n\t\tcoll := fmt.Sprintf(\"%v\", elem[\"name\"])\n\t\tcollType := fmt.Sprintf(\"%v\", elem[\"type\"])\n\t\tif strings.Index(coll, \"system.\") == 0 || (elem[\"type\"] != nil && collType != \"collection\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tbuffer.WriteString(\"\\n\")\n\t\tbuffer.WriteString(dbName)\n\t\tbuffer.WriteString(\".\")\n\t\tbuffer.WriteString(coll)\n\t\tbuffer.WriteString(\":\\n\")\n\n\t\tif scur, err = client.Database(dbName).Collection(coll).Aggregate(ctx, pipeline); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tvar indexStats = []bson.M{}\n\t\tfor scur.Next(ctx) {\n\t\t\tvar result = bson.M{}\n\t\t\tif err = scur.Decode(&result); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tindexStats = append(indexStats, result)\n\t\t}\n\t\tscur.Close(ctx)\n\t\tindexView := client.Database(dbName).Collection(coll).Indexes()\n\t\tif icur, err = indexView.List(ctx); err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tdefer icur.Close(ctx)\n\t\tvar list []IndexStatsDoc\n\n\t\tfor icur.Next(ctx) {\n\t\t\tvar idx = bson.D{}\n\t\t\tif err = icur.Decode(&idx); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar keys bson.D\n\t\t\tvar indexName string\n\t\t\tfor _, v := range idx {\n\t\t\t\tif v.Key == \"name\" {\n\t\t\t\t\tindexName = v.Value.(string)\n\t\t\t\t} else if v.Key == \"key\" {\n\t\t\t\t\tkeys = v.Value.(bson.D)\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar strbuf bytes.Buffer\n\t\t\tfor n, value := range keys {\n\t\t\t\tif n == 0 {\n\t\t\t\t\tstrbuf.WriteString(\"{ \")\n\t\t\t\t}\n\t\t\t\tstrbuf.WriteString(value.Key + \": \" + fmt.Sprint(value.Value))\n\t\t\t\tif n == len(keys)-1 {\n\t\t\t\t\tstrbuf.WriteString(\" }\")\n\t\t\t\t} else {\n\t\t\t\t\tstrbuf.WriteString(\", \")\n\t\t\t\t}\n\t\t\t}\n\t\t\to := IndexStatsDoc{Key: strbuf.String()}\n\t\t\to.EffectiveKey = strings.Replace(o.Key[:len(o.Key)-2], \": -1\", \": 1\", -1)\n\t\t\to.Usage = []UsageDoc{}\n\t\t\tfor _, result := range indexStats {\n\t\t\t\tif result[\"name\"].(string) == indexName {\n\t\t\t\t\tdoc := result[\"accesses\"].(bson.M)\n\t\t\t\t\thost := result[\"host\"].(string)\n\t\t\t\t\tb, _ := bson.Marshal(doc)\n\t\t\t\t\tvar accesses UsageDoc\n\t\t\t\t\tbson.Unmarshal(b, &accesses)\n\t\t\t\t\taccesses.Hostname = host\n\t\t\t\t\to.Usage = append(o.Usage, accesses)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlist = append(list, o)\n\t\t}\n\t\ticur.Close(ctx)\n\t\tsort.Slice(list, func(i, j int) bool { return (list[i].EffectiveKey <= list[j].EffectiveKey) })\n\t\tfor i, o := range list {\n\t\t\tfont := \"\\x1b[0m \"\n\t\t\tif o.Key != \"{ _id: 1 }\" {\n\t\t\t\tif i < len(list)-1 && strings.Index(list[i+1].EffectiveKey, o.EffectiveKey) == 0 {\n\t\t\t\t\tfont = \"\\x1b[31;1mx \" // red\n\t\t\t\t} else {\n\t\t\t\t\tsum := 0\n\t\t\t\t\tfor _, u := range o.Usage {\n\t\t\t\t\t\tsum += u.Ops\n\t\t\t\t\t}\n\t\t\t\t\tif sum == 0 {\n\t\t\t\t\t\tfont = \"\\x1b[34;1m? \" // blue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuffer.WriteString(font + o.Key + \"\\x1b[0m\")\n\t\t\tfor _, u := range o.Usage {\n\t\t\t\tbuffer.Write([]byte(\"\\n\\thost: \" + u.Hostname + \", ops: \" + fmt.Sprintf(\"%v\", u.Ops) + \", since: \" + fmt.Sprintf(\"%v\", u.Since)))\n\t\t\t}\n\t\t\tbuffer.WriteString(\"\\n\")\n\t\t}\n\t}\n\treturn buffer.String()\n}", "func (o *InventorySlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tinventories := InventorySlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), inventoryPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `inventory`.* FROM `inventory` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, inventoryPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&inventories)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in InventorySlice\")\n\t}\n\n\t*o = inventories\n\n\treturn nil\n}", "func spansForAllTableIndexes(\n\ttables []*sqlbase.TableDescriptor, revs []BackupDescriptor_DescriptorRevision,\n) []roachpb.Span {\n\n\tadded := make(map[tableAndIndex]bool, len(tables))\n\tsstIntervalTree := interval.NewTree(interval.ExclusiveOverlapper)\n\tfor _, table := range tables {\n\t\tfor _, index := range table.AllNonDropIndexes() {\n\t\t\tif err := sstIntervalTree.Insert(intervalSpan(table.IndexSpan(index.ID)), false); err != nil {\n\t\t\t\tpanic(errors.Wrap(err, \"IndexSpan\"))\n\t\t\t}\n\t\t\tadded[tableAndIndex{tableID: table.ID, indexID: index.ID}] = true\n\t\t}\n\t}\n\t// If there are desc revisions, ensure that we also add any index spans\n\t// in them that we didn't already get above e.g. indexes or tables that are\n\t// not in latest because they were dropped during the time window in question.\n\tfor _, rev := range revs {\n\t\tif tbl := rev.Desc.GetTable(); tbl != nil {\n\t\t\tfor _, idx := range tbl.AllNonDropIndexes() {\n\t\t\t\tkey := tableAndIndex{tableID: tbl.ID, indexID: idx.ID}\n\t\t\t\tif !added[key] {\n\t\t\t\t\tif err := sstIntervalTree.Insert(intervalSpan(tbl.IndexSpan(idx.ID)), false); err != nil {\n\t\t\t\t\t\tpanic(errors.Wrap(err, \"IndexSpan\"))\n\t\t\t\t\t}\n\t\t\t\t\tadded[key] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tvar spans []roachpb.Span\n\t_ = sstIntervalTree.Do(func(r interval.Interface) bool {\n\t\tspans = append(spans, roachpb.Span{\n\t\t\tKey: roachpb.Key(r.Range().Start),\n\t\t\tEndKey: roachpb.Key(r.Range().End),\n\t\t})\n\t\treturn false\n\t})\n\treturn spans\n}", "func (d *Dao) All(ctx context.Context) ([]*region.Region, error) {\n\trows, err := d.get.Query(ctx)\n\tif err != nil {\n\t\tlog.Error(\"mysqlDB.Query error(%v)\", err)\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tapps := []*region.Region{}\n\tfor rows.Next() {\n\t\ta := &region.Region{}\n\t\tif err = rows.Scan(&a.Rid, &a.Reid, &a.Name, &a.Logo, &a.Rank, &a.Goto, &a.Param, &a.Plat, &a.Area, &a.Build, &a.Condition, &a.URI, &a.Islogo, &a.Language); err != nil {\n\t\t\tlog.Error(\"row.Scan error(%v)\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tapps = append(apps, a)\n\t}\n\treturn apps, err\n}", "func (o *BlockSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := BlockSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), blockPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"block\\\".* FROM \\\"block\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, blockPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in BlockSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *EmailSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := EmailSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), emailPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `email`.* FROM `email` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, emailPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"mysql: unable to reload all in EmailSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (this *AppCollection) loadAll(items []storage.Item) error {\n var err error\n\n for _, item := range items {\n this.load(item.(*storage.AppItem))\n }\n\n return err\n}", "func (o *APIKeySlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tapiKeys := APIKeySlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), apiKeyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"api_keys\\\".* FROM \\\"api_keys\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, apiKeyPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&apiKeys)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in APIKeySlice\")\n\t}\n\n\t*o = apiKeys\n\n\treturn nil\n}", "func (o *OauthClientSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := OauthClientSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), oauthClientPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `oauth_clients`.* FROM `oauth_clients` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, oauthClientPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(nil, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in OauthClientSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *RepositorySlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := RepositorySlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), repositoryPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `repositories`.* FROM `repositories` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, repositoryPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in RepositorySlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (o *TreeSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := TreeSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), treePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"trees\\\".* FROM \\\"trees\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, treePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in TreeSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (i *Index) readEntireIndex(ctx context.Context, store Store) (map[string]map[string]struct{}, error) {\n\tkvs, err := consumeBucket(ctx, store, i.indexBucket)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tindex := map[string]map[string]struct{}{}\n\tfor _, kv := range kvs {\n\t\tfk, pk, err := indexKeyParts(kv[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif fkm, ok := index[string(fk)]; ok {\n\t\t\tfkm[string(pk)] = struct{}{}\n\t\t\tcontinue\n\t\t}\n\n\t\tindex[string(fk)] = map[string]struct{}{string(pk): {}}\n\t}\n\n\treturn index, nil\n}", "func (s *Storage) LoadAndIterate(file string, fn storage.IterationFunc) error {\n\tnewDB, err := openDB(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = iterate(newDB, s.bucket, fn)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.mux.Lock()\n\tdefer s.mux.Unlock()\n\n\toldDB := s.getDB()\n\ts.db.Store(newDB)\n\tif oldDB != nil {\n\t\toldDB.Close()\n\t}\n\treturn nil\n}", "func LoadAll(loader ValuesLoader) (Values, error) {\n\treturn nil, nil\n}", "func LoadAllEndpoints(endpoints []string) {\n\tfor _, ep := range endpoints {\n\t\tloadEndpoint(ep)\n\t}\n}", "func (s *SQLiteStore) loadAllResourcesForStack(stackname string) ([]Resource, error) {\n\tresources := make([]Resource, 0)\n\treturn resources, nil\n}", "func (o *VoteSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := VoteSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"vote\\\".* FROM \\\"vote\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, votePrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in VoteSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func IndexOptionsAll() IndexOptions {\n\tresult := IndexOptions{\n\t\tPath: \"/\",\n\t\tRescan: true,\n\t\tConvert: true,\n\t}\n\n\treturn result\n}", "func LoadMany(db *sql.DB, query string, Kind interface{}, args ...interface{}) (interface{}, error) {\n\tt := reflect.TypeOf(Kind)\n\ts2 := reflect.Zero(reflect.SliceOf(t))\n\trows, err := db.Query(query, args...)\n\tif err == nil {\n\t\tfor rows.Next() {\n\t\t\tv := reflect.New(t)\n\t\t\tdest := sPtrs(v.Interface())\n\t\t\terr = rows.Scan(dest...)\n\t\t\ts2 = reflect.Append(s2, v.Elem())\n\t\t}\n\t}\n\trows.Close()\n\treturn s2.Interface(), err\n}", "func (o *StockCvtermSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tstockCvterms := StockCvtermSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), stockCvtermPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"SELECT \\\"stock_cvterm\\\".* FROM \\\"stock_cvterm\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, stockCvtermPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(stockCvtermPrimaryKeyColumns), 1, len(stockCvtermPrimaryKeyColumns)),\n\t)\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&stockCvterms)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to reload all in StockCvtermSlice\")\n\t}\n\n\t*o = stockCvterms\n\n\treturn nil\n}", "func (o *TaskSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := TaskSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), taskPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"tasks\\\".* FROM \\\"tasks\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, taskPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in TaskSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (g *GLTF) loadIndices(ai int) (math32.ArrayU32, error) {\n\n\treturn g.loadAccessorU32(ai, \"indices\", []string{SCALAR}, []int{UNSIGNED_BYTE, UNSIGNED_SHORT, UNSIGNED_INT}) // TODO verify that it's ELEMENT_ARRAY_BUFFER\n}", "func (o *OriginSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := OriginSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), originPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"origins\\\".* FROM \\\"origins\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, originPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in OriginSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}", "func (a *AmbientIndex) All() []*model.WorkloadInfo {\n\ta.mu.RLock()\n\tdefer a.mu.RUnlock()\n\tres := make([]*model.WorkloadInfo, 0, len(a.byPod))\n\t// byPod will not have any duplicates, so we can just iterate over that.\n\tfor _, wl := range a.byPod {\n\t\tres = append(res, wl)\n\t}\n\treturn res\n}", "func (o *AddressSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\taddresses := AddressSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), addressPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT `address`.* FROM `address` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, addressPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&addresses)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to reload all in AddressSlice\")\n\t}\n\n\t*o = addresses\n\n\treturn nil\n}", "func (o *InstrumentClassSlice) ReloadAll(exec boil.Executor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tinstrumentClasses := InstrumentClassSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), instrumentClassPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"instruments\\\".\\\"instrument_class\\\".* FROM \\\"instruments\\\".\\\"instrument_class\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, instrumentClassPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(exec, sql, args...)\n\n\terr := q.Bind(&instrumentClasses)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in InstrumentClassSlice\")\n\t}\n\n\t*o = instrumentClasses\n\n\treturn nil\n}", "func updateDBIndexes(mi *modelInfo) {\n\tadapter := adapters[db.DriverName()]\n\t// update column indexes\n\tfor colName, fi := range mi.fields.registryByJSON {\n\t\tif !fi.index {\n\t\t\tcontinue\n\t\t}\n\t\tif !adapter.indexExists(mi.tableName, fmt.Sprintf(\"%s_%s_index\", mi.tableName, colName)) {\n\t\t\tcreateColumnIndex(mi.tableName, colName)\n\t\t}\n\t}\n}", "func DBIndexer(db *sql.DB, dbPipe <-chan RollupState) {\n\n\tdbInsertMap := make(map[string]*bulkinsert.BulkInsert)\n\tfor data := range dbPipe {\n\t\ttableName := fmt.Sprintf(\"monitor_metrics_%s_%s\", data.granularity.windowName, data.msg.PluginName)\n\t\tcolumnNames, err := plugins.GetColumnsForTable(tableName, db)\n\t\tif len(columnNames) == 0 || err != nil {\n\t\t\tlog.Error().Err(err).Msgf(\"Table %s does not exist \", tableName)\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, ok := dbInsertMap[tableName]; !ok { //New DB Bulk inserter\n\t\t\tdbInsertMap[tableName] = bulkinsert.NewBulkInsert(\n\t\t\t\tdb,\n\t\t\t\ttableName,\n\t\t\t\tdbConfigMap[data.granularity.windowName].maxBatchSize,\n\t\t\t\tdbConfigMap[data.granularity.windowName].maxBatchAge,\n\t\t\t\tcolumnNames)\n\t\t}\n\t\tmetricNames := []string{\n\t\t\t\"ConnectTimeAvg\",\n\t\t\t\"Es\",\n\t\t\t\"EsResponse\",\n\t\t\t\"EsTimeout\",\n\t\t\t\"FirstByteTimeAvg\",\n\t\t\t\"ResponseTimeAvg\",\n\t\t\t\"ResponseTimeMax\",\n\t\t\t\"ResponseTimeMin\",\n\t\t\t\"SizeAvg\",\n\t\t\t\"SpeedAvg\",\n\t\t}\n\t\tcolumnValues := metricsToString(metricNames,data.msg)\n\t\tif err := dbInsertMap[tableName].Insert(columnValues); err != nil {\n\t\t\tlog.Error().Err(err).Msgf(\"Error Inserting column values to table %s \", tableName)\n\t\t}\n\t}\n}", "func (o *TrainingCostSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error {\n\tif o == nil || len(*o) == 0 {\n\t\treturn nil\n\t}\n\n\tslice := TrainingCostSlice{}\n\tvar args []interface{}\n\tfor _, obj := range *o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), trainingCostPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"SELECT \\\"training_costs\\\".* FROM \\\"training_costs\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, trainingCostPrimaryKeyColumns, len(*o))\n\n\tq := queries.Raw(sql, args...)\n\n\terr := q.Bind(ctx, exec, &slice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to reload all in TrainingCostSlice\")\n\t}\n\n\t*o = slice\n\n\treturn nil\n}" ]
[ "0.78944623", "0.68740505", "0.6471731", "0.603011", "0.59038955", "0.5777211", "0.57490975", "0.57390857", "0.56201786", "0.5588074", "0.54888165", "0.5481768", "0.5458776", "0.544559", "0.54259926", "0.5420168", "0.53962743", "0.5382967", "0.533865", "0.5331422", "0.53273255", "0.5322979", "0.529983", "0.5280305", "0.52790624", "0.52644837", "0.52631783", "0.5259709", "0.5248272", "0.5238153", "0.5237168", "0.52310604", "0.52144855", "0.520933", "0.52056783", "0.5202071", "0.5194381", "0.51941574", "0.51931417", "0.5186737", "0.51804566", "0.5173678", "0.51721865", "0.517038", "0.51567155", "0.5136257", "0.51208246", "0.5116519", "0.5107146", "0.5105347", "0.5104091", "0.50887483", "0.5087225", "0.507713", "0.5073162", "0.5058347", "0.5055203", "0.5049494", "0.50478387", "0.5029008", "0.50239205", "0.50235873", "0.5013463", "0.5010287", "0.50078034", "0.50019383", "0.500115", "0.499527", "0.49945933", "0.49900734", "0.49850315", "0.49719864", "0.4966477", "0.49553236", "0.49541983", "0.49518862", "0.49476272", "0.4938052", "0.49366733", "0.49346927", "0.49284276", "0.492005", "0.4912443", "0.49117893", "0.491178", "0.49095535", "0.49034396", "0.48996928", "0.48979133", "0.48929256", "0.48880675", "0.48809245", "0.48783833", "0.4875026", "0.4872441", "0.48722517", "0.48715737", "0.4869427", "0.48687625", "0.4866827" ]
0.790122
0
dedupLiveResources handles removes live resource duplicates with the same UID. Duplicates are created in a separate resource groups. E.g. apps/Deployment produces duplicate in extensions/Deployment, authorization.openshift.io/ClusterRole produces duplicate in rbac.authorization.k8s.io/ClusterRole etc. The method removes such duplicates unless it was defined in git ( exists in target resources list ). At least one duplicate stays. If non of duplicates are in git at random one stays
dedupLiveResources удаляет дубликаты живых ресурсов с одинаковым UID. Дубликаты создаются в отдельных группах ресурсов. Например, apps/Deployment создаёт дубликат в extensions/Deployment, authorization.openshift.io/ClusterRole создаёт дубликат в rbac.authorization.k8s.io/ClusterRole и т.д. Метод удаляет такие дубликаты, если они не определены в git (не находятся в списке целевых ресурсов). Остаётся как минимум один дубликат. Если ни один из дубликатов не находится в git, остаётся случайный один.
func dedupLiveResources(targetObjs []*unstructured.Unstructured, liveObjsByKey map[kubeutil.ResourceKey]*unstructured.Unstructured) { targetObjByKey := make(map[kubeutil.ResourceKey]*unstructured.Unstructured) for i := range targetObjs { targetObjByKey[kubeutil.GetResourceKey(targetObjs[i])] = targetObjs[i] } liveObjsById := make(map[types.UID][]*unstructured.Unstructured) for k := range liveObjsByKey { obj := liveObjsByKey[k] if obj != nil { liveObjsById[obj.GetUID()] = append(liveObjsById[obj.GetUID()], obj) } } for id := range liveObjsById { objs := liveObjsById[id] if len(objs) > 1 { duplicatesLeft := len(objs) for i := range objs { obj := objs[i] resourceKey := kubeutil.GetResourceKey(obj) if _, ok := targetObjByKey[resourceKey]; !ok { delete(liveObjsByKey, resourceKey) duplicatesLeft-- if duplicatesLeft == 1 { break } } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *ContainerizedWorkloadReconciler) cleanupResources(ctx context.Context,\n\tworkload *oamv1alpha2.ContainerizedWorkload, deployUID, serviceUID *types.UID) error {\n\tlog := r.Log.WithValues(\"gc deployment\", workload.Name)\n\tvar deploy appsv1.Deployment\n\tvar service corev1.Service\n\tfor _, res := range workload.Status.Resources {\n\t\tuid := res.UID\n\t\tif res.Kind == KindDeployment {\n\t\t\tif uid != *deployUID {\n\t\t\t\tlog.Info(\"Found an orphaned deployment\", \"deployment UID\", *deployUID, \"orphaned UID\", uid)\n\t\t\t\tdn := client.ObjectKey{Name: res.Name, Namespace: workload.Namespace}\n\t\t\t\tif err := r.Get(ctx, dn, &deploy); err != nil {\n\t\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := r.Delete(ctx, &deploy); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tlog.Info(\"Removed an orphaned deployment\", \"deployment UID\", *deployUID, \"orphaned UID\", uid)\n\t\t\t}\n\t\t} else if res.Kind == KindService {\n\t\t\tif uid != *serviceUID {\n\t\t\t\tlog.Info(\"Found an orphaned service\", \"orphaned UID\", uid)\n\t\t\t\tsn := client.ObjectKey{Name: res.Name, Namespace: workload.Namespace}\n\t\t\t\tif err := r.Get(ctx, sn, &service); err != nil {\n\t\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := r.Delete(ctx, &service); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tlog.Info(\"Removed an orphaned service\", \"orphaned UID\", uid)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func removeDuplicateResources(resources []puppetquery.Resource) []puppetquery.Resource {\n\t// no duplicates possible\n\tif len(resources) < 2 {\n\t\treturn resources\n\t}\n\n\tseen := make(map[string]bool, len(resources))\n\tuniq := make([]puppetquery.Resource, 0, len(resources))\n\n\tseen[resources[0].Title] = true\n\tuniq = append(uniq, resources[0])\n\tfor _, r := range resources[1:] {\n\t\tif seen[r.Title] {\n\t\t\tcontinue\n\t\t}\n\t\tseen[r.Title] = true\n\t\tuniq = append(uniq, r)\n\t}\n\treturn uniq\n}", "func (r *FooReconciler) cleanupOwnedResources(ctx context.Context, log logr.Logger, foo *batchv1.Foo) error {\n\tlog.Info(\"finding existing Deployments for MyKind resource\")\n\n\t// List all deployment resources owned by this MyKind\n\tvar deployments apps.DeploymentList\n\t//if err := r.List(ctx, &deployments, client.InNamespace(foo.Namespace), client.MatchingField(deploymentOwnerKey, foo.Name)); err != nil {\n\t//\treturn err\n\t//}\n\n\tdeleted := 0\n\tfor _, depl := range deployments.Items {\n\t\tif depl.Name == foo.Spec.Name {\n\t\t\t// If this deployment's name matches the one on the MyKind resource\n\t\t\t// then do not delete it.\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := r.Client.Delete(ctx, &depl); err != nil {\n\t\t\tlog.Error(err, \"failed to delete Deployment resource\")\n\t\t\treturn err\n\t\t}\n\n\t\tr.Recorder.Eventf(foo, core.EventTypeNormal, \"Deleted\", \"Deleted deployment %q\", depl.Name)\n\t\tdeleted++\n\t}\n\n\tlog.Info(\"finished cleaning up old Deployment resources\", \"number_deleted\", deleted)\n\n\treturn nil\n}", "func uniqResources(resources []metav1.APIResource) []metav1.APIResource {\n\tseen := make(map[string]struct{}, len(resources))\n\ti := 0\n\tfor _, k := range resources {\n\t\tif _, ok := seen[k.Name]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tseen[k.Name] = struct{}{}\n\t\tresources[i] = k\n\n\t\ti++\n\t}\n\treturn resources[:i]\n}", "func TestListResources_DuplicateResourceFilterByLabel(t *testing.T) {\n\tt.Parallel()\n\tctx := context.Background()\n\n\tbackend, err := lite.NewWithConfig(ctx, lite.Config{\n\t\tPath: t.TempDir(),\n\t\tClock: clockwork.NewFakeClock(),\n\t})\n\trequire.NoError(t, err)\n\n\tpresence := NewPresenceService(backend)\n\n\t// Same resource name, but have different labels.\n\tnames := []string{\"a\", \"a\", \"a\", \"a\"}\n\tlabels := []map[string]string{\n\t\t{\"env\": \"prod\"},\n\t\t{\"env\": \"dev\"},\n\t\t{\"env\": \"qa\"},\n\t\t{\"env\": \"dev\"},\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\tkind string\n\t\tinsertResources func()\n\t\twantNames []string\n\t}{\n\t\t{\n\t\t\tname: \"KindDatabaseServer\",\n\t\t\tkind: types.KindDatabaseServer,\n\t\t\tinsertResources: func() {\n\t\t\t\tfor i := 0; i < len(names); i++ {\n\t\t\t\t\tdb, err := types.NewDatabaseServerV3(types.Metadata{\n\t\t\t\t\t\tName: fmt.Sprintf(\"name-%v\", i),\n\t\t\t\t\t}, types.DatabaseServerSpecV3{\n\t\t\t\t\t\tHostID: \"_\",\n\t\t\t\t\t\tHostname: \"_\",\n\t\t\t\t\t\tDatabase: &types.DatabaseV3{\n\t\t\t\t\t\t\tMetadata: types.Metadata{\n\t\t\t\t\t\t\t\tName: names[i],\n\t\t\t\t\t\t\t\tLabels: labels[i],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tSpec: types.DatabaseSpecV3{\n\t\t\t\t\t\t\t\tProtocol: \"_\",\n\t\t\t\t\t\t\t\tURI: \"_\",\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\trequire.NoError(t, err)\n\t\t\t\t\t_, err = presence.UpsertDatabaseServer(ctx, db)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"KindAppServer\",\n\t\t\tkind: types.KindAppServer,\n\t\t\tinsertResources: func() {\n\t\t\t\tfor i := 0; i < len(names); i++ {\n\t\t\t\t\tserver, err := types.NewAppServerV3(types.Metadata{\n\t\t\t\t\t\tName: fmt.Sprintf(\"name-%v\", i),\n\t\t\t\t\t}, types.AppServerSpecV3{\n\t\t\t\t\t\tHostID: \"_\",\n\t\t\t\t\t\tApp: &types.AppV3{\n\t\t\t\t\t\t\tMetadata: types.Metadata{\n\t\t\t\t\t\t\t\tName: names[i],\n\t\t\t\t\t\t\t\tLabels: labels[i],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tSpec: types.AppSpecV3{URI: \"_\"},\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\t_, err = presence.UpsertApplicationServer(ctx, server)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"KindKubernetesCluster\",\n\t\t\tkind: types.KindKubernetesCluster,\n\t\t\tinsertResources: func() {\n\t\t\t\tfor i := 0; i < len(names); i++ {\n\n\t\t\t\t\tkube, err := types.NewKubernetesClusterV3(\n\t\t\t\t\t\ttypes.Metadata{\n\t\t\t\t\t\t\tName: names[i],\n\t\t\t\t\t\t\tLabels: labels[i],\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttypes.KubernetesClusterSpecV3{},\n\t\t\t\t\t)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\tkubeServer, err := types.NewKubernetesServerV3FromCluster(\n\t\t\t\t\t\tkube,\n\t\t\t\t\t\tfmt.Sprintf(\"host-%v\", i),\n\t\t\t\t\t\tfmt.Sprintf(\"hostID-%v\", i),\n\t\t\t\t\t)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\t// Upsert server.\n\t\t\t\t\t_, err = presence.UpsertKubernetesServer(ctx, kubeServer)\n\t\t\t\t\trequire.NoError(t, err)\n\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\ttc.insertResources()\n\n\t\t\t// Look among the duplicated resource by label\n\t\t\tresp, err := presence.ListResources(ctx, proto.ListResourcesRequest{\n\t\t\t\tResourceType: tc.kind,\n\t\t\t\tNeedTotalCount: true,\n\t\t\t\tLimit: 5,\n\t\t\t\tSearchKeywords: []string{\"dev\"},\n\t\t\t})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Len(t, resp.Resources, 1)\n\t\t\trequire.Equal(t, 1, resp.TotalCount)\n\t\t\trequire.Equal(t, map[string]string{\"env\": \"dev\"}, resp.Resources[0].GetAllLabels())\n\t\t})\n\t}\n}", "func (c *Canary) CleanPreviousCanaryResources(region schemas.RegionConfig, completeCanary bool) error {\n\tclient, err := selectClientFromList(c.AWSClients, region.Region)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprefix := tool.BuildPrefixName(c.AwsConfig.Name, c.Stack.Env, region.Region)\n\n\tasgList, err := client.EC2Service.GetAllMatchingAutoscalingGroupsWithPrefix(prefix)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, asg := range asgList {\n\t\tif (completeCanary && *asg.AutoScalingGroupName == c.LatestAsg[region.Region]) || !tool.IsStringInArray(*asg.AutoScalingGroupName, c.PrevAsgs[region.Region]) {\n\t\t\tcontinue\n\t\t}\n\n\t\tc.Logger.Debugf(\"[Resizing] target autoscaling group : %s\", *asg.AutoScalingGroupName)\n\t\tif err := c.ResizingAutoScalingGroupCount(client, *asg.AutoScalingGroupName, 0); err != nil {\n\t\t\tc.Logger.Errorf(err.Error())\n\t\t}\n\t\tc.Logger.Debugf(\"Resizing autoscaling group finished: %s\", *asg.AutoScalingGroupName)\n\n\t\tfor _, tg := range asg.TargetGroupARNs {\n\t\t\tif tool.IsCanaryTargetGroupArn(*tg, region.Region) {\n\t\t\t\tc.Logger.Debugf(\"Try to delete target group: %s\", *tg)\n\t\t\t\tif err := client.ELBV2Service.DeleteTargetGroup(tg); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tc.Logger.Debugf(\"Deleted target group: %s\", *tg)\n\t\t\t}\n\t\t}\n\t}\n\n\tc.Logger.Debugf(\"Start to delete load balancer and security group for canary\")\n\tif completeCanary {\n\t\tif err := c.DeleteLoadBalancer(region); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := c.LoadBalancerDeletionChecking(region); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := c.DeleteEC2IngressRules(region); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := c.DeleteEC2SecurityGroup(region); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := c.DeleteLBSecurityGroup(region); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func FixupDepends(subscriptionID, resourceGroup string, template map[string]interface{}, ignoreMap map[string]struct{}) {\n\tmyResources := map[string]struct{}{}\n\tfor _, resource := range jsonpath.MustCompile(\"$.resources.*\").Get(template) {\n\t\ttyp := jsonpath.MustCompile(\"$.type\").MustGetString(resource)\n\t\tname := jsonpath.MustCompile(\"$.name\").MustGetString(resource)\n\t\tmyResources[resourceid.ResourceID(subscriptionID, resourceGroup, typ, name)] = struct{}{}\n\t}\n\n\tvar recurse func(myResourceID string, i interface{}, dependsMap map[string]struct{})\n\n\t// walk the data structure collecting \"id\" fields whose values look like\n\t// Azure resource IDs. Trim sub-resources from IDs. Ignore IDs that are\n\t// self-referent\n\trecurse = func(myResourceID string, i interface{}, dependsMap map[string]struct{}) {\n\t\tswitch i := i.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tif id, ok := i[\"id\"]; ok {\n\t\t\t\tif id, ok := id.(string); ok {\n\t\t\t\t\tparts := strings.Split(id, \"/\")\n\t\t\t\t\tif len(parts) > 9 {\n\t\t\t\t\t\tparts = parts[:9]\n\t\t\t\t\t}\n\t\t\t\t\tif len(parts) == 9 {\n\t\t\t\t\t\tid = strings.Join(parts, \"/\")\n\t\t\t\t\t\t_, ignoreIt := ignoreMap[id]\n\t\t\t\t\t\tif id != myResourceID && !ignoreIt {\n\t\t\t\t\t\t\tdependsMap[id] = struct{}{}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, v := range i {\n\t\t\t\trecurse(myResourceID, v, dependsMap)\n\t\t\t}\n\t\tcase []interface{}:\n\t\t\tfor _, v := range i {\n\t\t\t\trecurse(myResourceID, v, dependsMap)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, resource := range jsonpath.MustCompile(\"$.resources.*\").Get(template) {\n\t\ttyp := jsonpath.MustCompile(\"$.type\").MustGetString(resource)\n\t\tname := jsonpath.MustCompile(\"$.name\").MustGetString(resource)\n\n\t\tdependsMap := map[string]struct{}{}\n\n\t\t// if we're a child resource, depend on our parent\n\t\tif strings.Count(typ, \"/\") == 2 {\n\t\t\tid := resourceid.ResourceID(subscriptionID, resourceGroup, typ[:strings.LastIndexByte(typ, '/')], name[:strings.LastIndexByte(name, '/')])\n\t\t\tdependsMap[id] = struct{}{}\n\t\t}\n\n\t\trecurse(resourceid.ResourceID(subscriptionID, resourceGroup, typ, name), resource, dependsMap)\n\n\t\tdepends := make([]string, 0, len(dependsMap))\n\t\tfor k := range dependsMap {\n\t\t\tif _, found := myResources[k]; found {\n\t\t\t\tdepends = append(depends, k)\n\t\t\t}\n\t\t}\n\n\t\tif len(depends) > 0 {\n\t\t\tsort.Strings(depends)\n\n\t\t\tjsonpath.MustCompile(\"$.dependsOn\").Set(resource, depends)\n\t\t}\n\t}\n}", "func (c *Client) Push(resources []APIResource) error {\n\tfor _, res := range resources {\n\t\t// REVISIT: maybe we should save updates (and thus zk and\n\t\t// midolman loads) by performing GET and compare first.\n\t\t// Or we can make the MidoNet API detect and ignore no-op updates.\n\t\tresp, body, err := c.post(res)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif resp.StatusCode == 404 || resp.StatusCode == 400 {\n\t\t\t// There are a few cases we can see 404 here.\n\t\t\t// - The resource is HasParent and the parent has not been\n\t\t\t// created yet\n\t\t\t// - The resource has a reference to the other resources (e.g.\n\t\t\t// filter chains for a Bridge) and they have not been created\n\t\t\t// yet\n\t\t\t// Also, MidoNet API returns 400 in a similar cases.\n\t\t\t// - When the port referenced by Route.nextHopPort doesn't exist.\n\t\t\t// (ROUTE_NEXT_HOP_PORT_NOT_NULL)\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"resource\": res,\n\t\t\t}).Info(\"Referent doesn't exist yet?\")\n\t\t\treturn fmt.Errorf(\"Referent doesn't exist yet?\")\n\t\t}\n\t\tif resp.StatusCode == 409 || (resp.StatusCode == 500 && mna1315(res)) {\n\t\t\tif res.Path(\"PUT\") != \"\" {\n\t\t\t\tresp, body, err = c.put(res)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif resp.StatusCode == 409 {\n\t\t\t\t\tif _, ok := res.(*TunnelZone); ok {\n\t\t\t\t\t\t// Workaound for UNIQUE_TUNNEL_ZONE_NAME_TYPE issue.\n\t\t\t\t\t\t// https://midonet.atlassian.net/browse/MNA-1293\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif res.Path(\"GET\") != \"\" {\n\t\t\t\t\texists, err := c.exists(res)\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\tif !exists {\n\t\t\t\t\t\t// assume a transient error\n\t\t\t\t\t\treturn fmt.Errorf(\"Unexpected 409\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// assume 409 meant ok\n\t\t\t\t// REVISIT: confirm that the existing resource is\n\t\t\t\t// same enough as what we want.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif resp.StatusCode/100 != 2 {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"statusCode\": resp.StatusCode,\n\t\t\t\t\"body\": body,\n\t\t\t}).Fatal(\"Unexpected status code\")\n\t\t}\n\t}\n\treturn nil\n}", "func (r *ReconcileGitTrack) deleteResources(leftovers map[string]farosv1alpha1.GitTrackObjectInterface) error {\n\tif len(leftovers) > 0 {\n\t\tr.log.V(0).Info(\"Found leftover resources to clean up\", \"leftover resources\", string(len(leftovers)))\n\t}\n\tfor name, obj := range leftovers {\n\t\tif err := r.Delete(context.TODO(), obj); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to delete child for '%s': '%s'\", name, err)\n\t\t}\n\t\tr.log.V(0).Info(\"Child deleted\", \"child name\", name)\n\t}\n\treturn nil\n}", "func (client *Client) UntagResources(request *UntagResourcesRequest) (_result *UntagResourcesResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &UntagResourcesResponse{}\n\t_body, _err := client.UntagResourcesWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (client *Client) UntagResources(request *UntagResourcesRequest) (_result *UntagResourcesResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &UntagResourcesResponse{}\n\t_body, _err := client.UntagResourcesWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (sc *syncContext) getSyncTasks() (_ syncTasks, successful bool) {\n\tresourceTasks := syncTasks{}\n\tsuccessful = true\n\n\tfor _, resource := range sc.compareResult.managedResources {\n\t\tif !sc.containsResource(resource) {\n\t\t\tlog.WithFields(log.Fields{\"group\": resource.Group, \"kind\": resource.Kind, \"name\": resource.Name}).\n\t\t\t\tDebug(\"skipping\")\n\t\t\tcontinue\n\t\t}\n\n\t\tobj := obj(resource.Target, resource.Live)\n\n\t\t// this creates garbage tasks\n\t\tif hook.IsHook(obj) {\n\t\t\tlog.WithFields(log.Fields{\"group\": obj.GroupVersionKind().Group, \"kind\": obj.GetKind(), \"namespace\": obj.GetNamespace(), \"name\": obj.GetName()}).\n\t\t\t\tDebug(\"skipping hook\")\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, phase := range syncPhases(obj) {\n\t\t\tresourceTasks = append(resourceTasks, &syncTask{phase: phase, targetObj: resource.Target, liveObj: resource.Live})\n\t\t}\n\t}\n\n\tsc.log.WithFields(log.Fields{\"resourceTasks\": resourceTasks}).Debug(\"tasks from managed resources\")\n\n\thookTasks := syncTasks{}\n\tif !sc.skipHooks() {\n\t\tfor _, obj := range sc.compareResult.hooks {\n\t\t\tfor _, phase := range syncPhases(obj) {\n\t\t\t\t// Hook resources names are deterministic, whether they are defined by the user (metadata.name),\n\t\t\t\t// or formulated at the time of the operation (metadata.generateName). If user specifies\n\t\t\t\t// metadata.generateName, then we will generate a formulated metadata.name before submission.\n\t\t\t\ttargetObj := obj.DeepCopy()\n\t\t\t\tif targetObj.GetName() == \"\" {\n\t\t\t\t\tpostfix := strings.ToLower(fmt.Sprintf(\"%s-%s-%d\", sc.syncRes.Revision[0:7], phase, sc.opState.StartedAt.UTC().Unix()))\n\t\t\t\t\tgenerateName := obj.GetGenerateName()\n\t\t\t\t\ttargetObj.SetName(fmt.Sprintf(\"%s%s\", generateName, postfix))\n\t\t\t\t}\n\n\t\t\t\thookTasks = append(hookTasks, &syncTask{phase: phase, targetObj: targetObj})\n\t\t\t}\n\t\t}\n\t}\n\n\tsc.log.WithFields(log.Fields{\"hookTasks\": hookTasks}).Debug(\"tasks from hooks\")\n\n\ttasks := resourceTasks\n\ttasks = append(tasks, hookTasks...)\n\n\t// enrich target objects with the namespace\n\tfor _, task := range tasks {\n\t\tif task.targetObj == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif task.targetObj.GetNamespace() == \"\" {\n\t\t\t// If target object's namespace is empty, we set namespace in the object. We do\n\t\t\t// this even though it might be a cluster-scoped resource. This prevents any\n\t\t\t// possibility of the resource from unintentionally becoming created in the\n\t\t\t// namespace during the `kubectl apply`\n\t\t\ttask.targetObj = task.targetObj.DeepCopy()\n\t\t\ttask.targetObj.SetNamespace(sc.namespace)\n\t\t}\n\t}\n\n\t// enrich task with live obj\n\tfor _, task := range tasks {\n\t\tif task.targetObj == nil || task.liveObj != nil {\n\t\t\tcontinue\n\t\t}\n\t\ttask.liveObj = sc.liveObj(task.targetObj)\n\t}\n\n\t// enrich tasks with the result\n\tfor _, task := range tasks {\n\t\t_, result := sc.syncRes.Resources.Find(task.group(), task.kind(), task.namespace(), task.name(), task.phase)\n\t\tif result != nil {\n\t\t\ttask.syncStatus = result.Status\n\t\t\ttask.operationState = result.HookPhase\n\t\t\ttask.message = result.Message\n\t\t}\n\t}\n\n\t// check permissions\n\tfor _, task := range tasks {\n\t\tserverRes, err := kube.ServerResourceForGroupVersionKind(sc.disco, task.groupVersionKind())\n\t\tif err != nil {\n\t\t\t// Special case for custom resources: if CRD is not yet known by the K8s API server,\n\t\t\t// skip verification during `kubectl apply --dry-run` since we expect the CRD\n\t\t\t// to be created during app synchronization.\n\t\t\tif apierr.IsNotFound(err) && sc.hasCRDOfGroupKind(task.group(), task.kind()) {\n\t\t\t\tsc.log.WithFields(log.Fields{\"task\": task}).Debug(\"skip dry-run for custom resource\")\n\t\t\t\ttask.skipDryRun = true\n\t\t\t} else {\n\t\t\t\tsc.setResourceResult(task, v1alpha1.ResultCodeSyncFailed, \"\", err.Error())\n\t\t\t\tsuccessful = false\n\t\t\t}\n\t\t} else {\n\t\t\tif !sc.proj.IsResourcePermitted(metav1.GroupKind{Group: task.group(), Kind: task.kind()}, serverRes.Namespaced) {\n\t\t\t\tsc.setResourceResult(task, v1alpha1.ResultCodeSyncFailed, \"\", fmt.Sprintf(\"Resource %s:%s is not permitted in project %s.\", task.group(), task.kind(), sc.proj.Name))\n\t\t\t\tsuccessful = false\n\t\t\t}\n\t\t\tif serverRes.Namespaced && !sc.proj.IsDestinationPermitted(v1alpha1.ApplicationDestination{Namespace: task.namespace(), Server: sc.server}) {\n\t\t\t\tsc.setResourceResult(task, v1alpha1.ResultCodeSyncFailed, \"\", fmt.Sprintf(\"namespace %v is not permitted in project '%s'\", task.namespace(), sc.proj.Name))\n\t\t\t\tsuccessful = false\n\t\t\t}\n\t\t}\n\t}\n\n\tsort.Sort(tasks)\n\n\treturn tasks, successful\n}", "func (m manager) CleanupRelease(ctx context.Context, manifest string) (bool, error) {\n\tdc, err := m.actionConfig.RESTClientGetter.ToDiscoveryClient()\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to get Kubernetes discovery client: %w\", err)\n\t}\n\tapiVersions, err := action.GetVersionSet(dc)\n\tif err != nil && !discovery.IsGroupDiscoveryFailedError(err) {\n\t\treturn false, fmt.Errorf(\"failed to get apiVersions from Kubernetes: %w\", err)\n\t}\n\tmanifests := releaseutil.SplitManifests(manifest)\n\t_, files, err := releaseutil.SortManifests(manifests, apiVersions, releaseutil.UninstallOrder)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to sort manifests: %w\", err)\n\t}\n\t// do not delete resources that are annotated with the Helm resource policy 'keep'\n\t_, filesToDelete := manifestutil.FilterManifestsToKeep(files)\n\tvar builder strings.Builder\n\tfor _, file := range filesToDelete {\n\t\tbuilder.WriteString(\"\\n---\\n\" + file.Content)\n\t}\n\tresources, err := m.kubeClient.Build(strings.NewReader(builder.String()), false)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to build resources from manifests: %w\", err)\n\t}\n\tif resources == nil || len(resources) <= 0 {\n\t\treturn true, nil\n\t}\n\tfor _, resource := range resources {\n\t\terr = resource.Get()\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tcontinue // resource is already delete, check the next one.\n\t\t\t}\n\t\t\treturn false, fmt.Errorf(\"failed to get resource: %w\", err)\n\t\t}\n\t\t// found at least one resource that is not deleted so just delete everything again.\n\t\t_, errs := m.kubeClient.Delete(resources)\n\t\tif len(errs) > 0 {\n\t\t\treturn false, fmt.Errorf(\"failed to delete resources: %v\", apiutilerrors.NewAggregate(errs))\n\t\t}\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "func mergeResource(res *Resource, resources map[Version][]*Resource, version *Version) *Resource {\n\tresourceAcrossVersions := make(map[Version]*Resource)\n\tfor v, resList := range resources {\n\t\tfor _, r := range resList {\n\t\t\t// Name is not unique, TerraformName must be\n\t\t\tif r.TerraformName() == res.TerraformName() {\n\t\t\t\tresourceAcrossVersions[v] = r\n\t\t\t}\n\t\t}\n\t}\n\tga, gaExists := resourceAcrossVersions[GA_VERSION]\n\tbeta, betaExists := resourceAcrossVersions[BETA_VERSION]\n\talpha, alphaExists := resourceAcrossVersions[ALPHA_VERSION]\n\tif alphaExists {\n\t\treturn alpha\n\t}\n\tif gaExists {\n\t\tif betaExists {\n\t\t\treturn mergeResources(ga, beta)\n\t\t}\n\t\treturn ga\n\t}\n\tbeta.Description = fmt.Sprintf(\"Beta only: %s\", beta.Description)\n\treturn beta\n}", "func DeployResources(testRunner base.ClusterTestRunner) error {\n\t// Deploys a static set of resources\n\tlog.Printf(\"Deploying resources\")\n\n\tpub, _ := testRunner.GetPublicContext(1)\n\tprv, _ := testRunner.GetPrivateContext(1)\n\n\t// Deploys the same set of resources against both clusters\n\t// resources will have index (1 or 2), depending on the\n\t// cluster they are being deployed to\n\tfor i, cluster := range []*client.VanClient{pub.VanClient, prv.VanClient} {\n\t\tclusterIdx := i + 1\n\n\t\t// Annotations (optional) to deployment and services\n\t\tdepAnnotations := map[string]string{}\n\t\tstatefulSetAnnotations := map[string]string{}\n\t\tdaemonSetAnnotations := map[string]string{}\n\t\tsvcNoTargetAnnotations := map[string]string{}\n\t\tsvcTargetAnnotations := map[string]string{}\n\t\tpopulateAnnotations(clusterIdx, depAnnotations, svcNoTargetAnnotations, svcTargetAnnotations,\n\t\t\tstatefulSetAnnotations, daemonSetAnnotations)\n\n\t\t// Create a service without annotations to be taken by Skupper as a deployment will be annotated with this service address\n\t\tif _, err := createService(cluster, fmt.Sprintf(\"nginx-%d-dep-not-owned\", clusterIdx), map[string]string{}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// One single deployment will be created (for the nginx http server)\n\t\tif _, err := createDeployment(cluster, depAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := createStatefulSet(cluster, statefulSetAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := createDaemonSet(cluster, daemonSetAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Now create two services. One that does not have a target address,\n\t\t// and another that provides a target address.\n\t\tif _, err := createService(cluster, fmt.Sprintf(\"nginx-%d-svc-exp-notarget\", clusterIdx), svcNoTargetAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// This service with the target should not be exposed (only the target service will be)\n\t\tif _, err := createService(cluster, fmt.Sprintf(\"nginx-%d-svc-target\", clusterIdx), svcTargetAnnotations); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Wait for pods to be running\n\tfor _, cluster := range []*client.VanClient{pub.VanClient, prv.VanClient} {\n\t\tlog.Printf(\"waiting on pods to be running on %s\", cluster.Namespace)\n\t\t// Get all pod names\n\t\tpodList, err := cluster.KubeClient.CoreV1().Pods(cluster.Namespace).List(context.TODO(), metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(podList.Items) == 0 {\n\t\t\treturn fmt.Errorf(\"no pods running\")\n\t\t}\n\n\t\tfor _, pod := range podList.Items {\n\t\t\t_, err := kube.WaitForPodStatus(cluster.Namespace, cluster.KubeClient, pod.Name, corev1.PodRunning, timeout, interval)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func DeleteResources(f *os.File, cfg *rest.Config, dynamicClient dynamic.Interface, waitForDeletion bool) error {\n\tdeletionPropagation := metav1.DeletePropagationForeground\n\tgracePeriodSeconds := int64(0)\n\n\tdecoder, mapper, err := parseObjects(f, cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor {\n\t\tresource, unstructuredObj, err := getResource(decoder, mapper, dynamicClient)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := resource.Delete(context.Background(), unstructuredObj.GetName(),\n\t\t\tmetav1.DeleteOptions{GracePeriodSeconds: &gracePeriodSeconds,\n\t\t\t\tPropagationPolicy: &deletionPropagation}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif waitForDeletion {\n\t\t// verify deleted\n\t\tdecoder, mapper, err := parseObjects(f, cfg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor {\n\t\t\tresource, unstructuredObj, err := getResource(decoder, mapper, dynamicClient)\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfmt.Fprintln(ginkgo.GinkgoWriter, \"wait for deletion\", unstructuredObj.GetName())\n\t\t\tif err := wait.Poll(time.Second*5, time.Second*10, func() (done bool, err error) {\n\t\t\t\tobj, err := resource.Get(context.Background(), unstructuredObj.GetName(), metav1.GetOptions{})\n\n\t\t\t\tif err == nil {\n\t\t\t\t\tfmt.Fprintln(ginkgo.GinkgoWriter, \"remove finalizers\", obj.GetFinalizers(), unstructuredObj.GetName())\n\t\t\t\t\tobj.SetFinalizers(nil)\n\t\t\t\t\t_, err = resource.Update(context.Background(), obj, metav1.UpdateOptions{})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn false, err\n\t\t\t\t\t}\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\t\treturn false, err\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (h *HelmReconciler) PruneResources(gvks []schema.GroupVersionKind, all bool, namespace string) error {\n\tallErrors := []error{}\n\townerLabels := h.customizer.PruningDetails().GetOwnerLabels()\n\townerAnnotations := h.customizer.PruningDetails().GetOwnerAnnotations()\n\tfor _, gvk := range gvks {\n\t\tobjects := &unstructured.UnstructuredList{}\n\t\tobjects.SetGroupVersionKind(gvk)\n\t\terr := h.client.List(context.TODO(), objects, client.MatchingLabels(ownerLabels), client.InNamespace(namespace))\n\t\tif err != nil {\n\t\t\t// we only want to retrieve resources clusters\n\t\t\tlog.Warnf(\"retrieving resources to prune type %s: %s not found\", gvk.String(), err)\n\t\t\tcontinue\n\t\t}\n\tobjectLoop:\n\t\tfor _, object := range objects.Items {\n\t\t\tannotations := object.GetAnnotations()\n\t\t\tfor ownerKey, ownerValue := range ownerAnnotations {\n\t\t\t\t// we only want to delete objects that contain the annotations\n\t\t\t\t// if we're not pruning all objects, we only want to prune those whose annotation value does not match what is expected\n\t\t\t\tif value, ok := annotations[ownerKey]; !ok || (!all && value == ownerValue) {\n\t\t\t\t\tcontinue objectLoop\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = h.client.Delete(context.TODO(), &object, client.PropagationPolicy(metav1.DeletePropagationBackground))\n\t\t\tif err == nil {\n\t\t\t\tif listenerErr := h.customizer.Listener().ResourceDeleted(&object); listenerErr != nil {\n\t\t\t\t\tlog.Errorf(\"error calling listener: %s\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif listenerErr := h.customizer.Listener().ResourceError(&object, err); listenerErr != nil {\n\t\t\t\t\tlog.Errorf(\"error calling listener: %s\", err)\n\t\t\t\t}\n\t\t\t\tallErrors = append(allErrors, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn utilerrors.NewAggregate(allErrors)\n}", "func CheckDupe(domain, instance, class, id string) error {\n\n\tfileName := strings.ToLower(fileName(domain, instance, class, id))\n\n\tmux.Lock()\n\tdefer mux.Unlock()\n\n\t_, found := sources[fileName]\n\tif found {\n\t\treturn ErrDup\n\t}\n\n\tsources[fileName] = true\n\n\treturn nil\n}", "func (c *resourceCache) UpdateResources(resources []NamedProtoMessage) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tfor _, res := range resources {\n\t\tname := GetResourceName(res)\n\t\tc.cache[name] = res\n\t}\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 TestActiveReplicatorPullPurgeOnRemoval(t *testing.T) {\n\n\tbase.RequireNumTestBuckets(t, 2)\n\n\tbase.SetUpTestLogging(t, logger.LevelInfo, logger.KeyHTTP, logger.KeySync, logger.KeyReplicate)\n\n\t// Passive\n\ttb2 := base.GetTestBucket(t)\n\n\trt2 := NewRestTester(t, &RestTesterConfig{\n\t\tTestBucket: tb2,\n\t\tDatabaseConfig: &DatabaseConfig{DbConfig: DbConfig{\n\t\t\tUsers: map[string]*db.PrincipalConfig{\n\t\t\t\t\"alice\": {\n\t\t\t\t\tPassword: base.StringPtr(\"pass\"),\n\t\t\t\t\tExplicitChannels: utils.SetOf(\"alice\"),\n\t\t\t\t},\n\t\t\t},\n\t\t}},\n\t})\n\tdefer rt2.Close()\n\n\tdocID := t.Name() + \"rt2doc1\"\n\tresp := rt2.SendAdminRequest(http.MethodPut, \"/db/\"+docID, `{\"source\":\"rt2\",\"channels\":[\"alice\"]}`)\n\tassertStatus(t, resp, http.StatusCreated)\n\trevID := respRevID(t, resp)\n\n\t// Make rt2 listen on an actual HTTP port, so it can receive the blipsync request from rt1.\n\tsrv := httptest.NewServer(rt2.TestPublicHandler())\n\tdefer srv.Close()\n\n\tpassiveDBURL, err := url.Parse(srv.URL + \"/db\")\n\trequire.NoError(t, err)\n\n\t// Add basic auth creds to target db URL\n\tpassiveDBURL.User = url.UserPassword(\"alice\", \"pass\")\n\n\t// Active\n\ttb1 := base.GetTestBucket(t)\n\n\trt1 := NewRestTester(t, &RestTesterConfig{\n\t\tTestBucket: tb1,\n\t})\n\tdefer rt1.Close()\n\n\tar := db.NewActiveReplicator(&db.ActiveReplicatorConfig{\n\t\tID: t.Name(),\n\t\tDirection: db.ActiveReplicatorTypePull,\n\t\tRemoteDBURL: passiveDBURL,\n\t\tActiveDB: &db.Database{\n\t\t\tDatabaseContext: rt1.GetDatabase(),\n\t\t},\n\t\tChangesBatchSize: 200,\n\t\tContinuous: true,\n\t\tPurgeOnRemoval: true,\n\t\tReplicationStatsMap: base.SyncGatewayStats.NewDBStats(t.Name(), false, false, false).DBReplicatorStats(t.Name()),\n\t})\n\tdefer func() { assert.NoError(t, ar.Stop()) }()\n\n\t// Start the replicator (implicit connect)\n\tassert.NoError(t, ar.Start())\n\n\t// wait for the document originally written to rt2 to arrive at rt1\n\tchangesResults, err := rt1.WaitForChanges(1, \"/db/_changes?since=0\", \"\", true)\n\trequire.NoError(t, err)\n\trequire.Len(t, changesResults.Results, 1)\n\tassert.Equal(t, docID, changesResults.Results[0].ID)\n\n\tdoc, err := rt1.GetDatabase().GetDocument(logger.TestCtx(t), docID, db.DocUnmarshalAll)\n\tassert.NoError(t, err)\n\n\tassert.Equal(t, revID, doc.SyncData.CurrentRev)\n\n\tbody, err := doc.GetDeepMutableBody()\n\trequire.NoError(t, err)\n\tassert.Equal(t, \"rt2\", body[\"source\"])\n\n\tresp = rt2.SendAdminRequest(http.MethodPut, \"/db/\"+docID+\"?rev=\"+revID, `{\"source\":\"rt2\",\"channels\":[\"bob\"]}`)\n\tassertStatus(t, resp, http.StatusCreated)\n\n\t// wait for the channel removal written to rt2 to arrive at rt1 - we can't monitor _changes, because we've purged, not removed. But we can monitor the associated stat.\n\tbase.WaitForStat(func() int64 {\n\t\tstats := ar.GetStatus()\n\t\treturn stats.DocsPurged\n\t}, 1)\n\n\tdoc, err = rt1.GetDatabase().GetDocument(logger.TestCtx(t), docID, db.DocUnmarshalAll)\n\tassert.Error(t, err)\n\tassert.True(t, base.IsDocNotFoundError(err), \"Error returned wasn't a DocNotFound error\")\n\tassert.Nil(t, doc)\n}", "func TestDeleteResource(t *testing.T) {\n\ttestName := \"TestDeleteResource\"\n\tbeforeTest()\n\t// kinds to check for status\n\tvar kindsToCheckStatus = map[string]bool{\n\t\tAPPLICATION: true,\n\t\t\"Ingress\": true,\n\t\t\"Service\": true,\n\t\t\"Deployment\": true,\n\t\t\"StatefulSet\": true,\n\t\t\"NetworkPolicy\": true,\n\t}\n\n\t// resources to pre-populate\n\tvar files = []string{\n\t\t/* 0 */ KappnavConfigFile,\n\t\t/* 1 */ CrdApplication,\n\t\t/* 4 */ appBookinfo,\n\t\t/* 5 */ appProductpage,\n\t\t/* 6 */ appDetails,\n\t\t/* 7 */ appRatings,\n\t\t/* 8 */ deploymentDetailsV1,\n\t\t/* 9 */ deploymentProcuctpageV1,\n\t\t/* 10 */ deploymentRatingsV1,\n\t\t/* 11 */ ingressBookinfo,\n\t\t/* 12 */ networkpolicyProductpage,\n\t\t/* 13 */ networkpolicyReviews,\n\t\t/* 14 */ serviceDetails,\n\t\t/* 15 */ serviceProductpage,\n\t\t/* 16 */ serviceRatings,\n\t\t/* 17 */ serviceReview,\n\t\t/* 18 */ deploymentReviewsV1,\n\t\t/* 19 */ appReviews,\n\t\t/* 20 */ deploymentReviewsV2,\n\t\t/* 21 */ deploymentReviewsV3,\n\t}\n\titeration0IDs, err := readResourceIDs(files)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttestActions := newTestActions(testName, kindsToCheckStatus)\n\n\t/* Iteration 0 */\n\titeration0IDs[2].expectedStatus = problem // bookinfo problem due to review app\n\titeration0IDs[17].expectedStatus = problem // review app problem due to deploymentReviewsV3\n\titeration0IDs[18].expectedStatus = warning // deploymentReviewsV2 is WARING\n\titeration0IDs[19].expectedStatus = problem // deploymentReviewsV3 is problem\n\tvar emptyIDs = []resourceID{}\n\ttestActions.addIteration(iteration0IDs, emptyIDs)\n\n\t/* iteration 1: delete deploymentReviewsV3 */\n\tarrayLength := len(iteration0IDs) - 1\n\tvar iteration1IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration1IDs, iteration0IDs)\n\titeration1IDs[2].expectedStatus = warning // bookfino now warning\n\titeration1IDs[17].expectedStatus = warning // review app now warning deu to deploymentReviewsV3 being deleted\n\ttestActions.addIteration(iteration1IDs, emptyIDs)\n\n\t/* iteration 2: delete deploymentReviewsV2 */\n\tarrayLength = len(iteration1IDs) - 1\n\tvar iteration2IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration2IDs, iteration1IDs)\n\titeration2IDs[2].expectedStatus = Normal // bookfino now Normal\n\titeration2IDs[17].expectedStatus = Normal // reviews now Normal deu to deploymentReviewsV2 being deleted\n\ttestActions.addIteration(iteration2IDs, emptyIDs)\n\n\t/* iteration 3: set deploymentReviewsV1 to warning */\n\tarrayLength = len(iteration2IDs)\n\tvar iteration3IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration3IDs, iteration2IDs)\n\titeration3IDs[2].expectedStatus = warning // bookfino now Normal\n\titeration3IDs[16].expectedStatus = warning // deploymentReviewsV1 now warning\n\titeration3IDs[17].expectedStatus = warning // reviews now Normal deu to deploymentReviewsV1 being warning\n\ttestActions.addIteration(iteration3IDs, emptyIDs)\n\n\t/* iteration 4: delet review app */\n\tarrayLength = len(iteration3IDs) - 1\n\tvar iteration4IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration4IDs, iteration3IDs)\n\titeration4IDs[2].expectedStatus = Normal // bookfino now Normal due to review app being deleted\n\ttestActions.addIteration(iteration4IDs, emptyIDs)\n\n\t/* iteration 5: clean up */\n\ttestActions.addIteration(emptyIDs, emptyIDs)\n\n\tclusterWatcher, err := createClusterWatcher(iteration0IDs, testActions, StatusFailureRate)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer clusterWatcher.shutDown()\n\n\t// make all trasition of testAction\n\terr = testActions.transitionAll()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func RemovePreUnifiedResources(kube kubernetes.Interface, oldName string) error {\n\tif err := kube.AppsV1().Deployments(system.Namespace()).Delete(oldName, &metav1.DeleteOptions{}); err != nil && !apierrs.IsNotFound(err) {\n\t\treturn fmt.Errorf(\"failed to remove old deployment %s: %w\", oldName, err)\n\t}\n\tif err := kube.CoreV1().ServiceAccounts(system.Namespace()).Delete(oldName, &metav1.DeleteOptions{}); err != nil && !apierrs.IsNotFound(err) {\n\t\treturn fmt.Errorf(\"failed to remove old serviceaccount %s: %w\", oldName, err)\n\t}\n\n\treturn nil\n}", "func KeepResources() bool {\n\treturn keepResources\n}", "func KeepResources() bool {\n\treturn keepResources\n}", "func applyTags(data *schema.ResourceData, apiClient *compute.Client, assetType string, providerSettings ProviderSettings) error {\n\tvar (\n\t\tresponse *compute.APIResponseV2\n\t\terr error\n\t)\n\n\tresourceID := data.Id()\n\n\tlog.Printf(\"Configuring tags for resource '%s'...\", resourceID)\n\n\tpropertyHelper := propertyHelper(data)\n\tconfiguredTags := propertyHelper.GetTags(resourceKeyTag)\n\n\ttags, err := getTags(apiClient, resourceID, assetType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Capture any tags that are no-longer needed.\n\tunusedTags := &schema.Set{\n\t\tF: schema.HashString,\n\t}\n\tfor _, tag := range tags {\n\t\tunusedTags.Add(tag.Name)\n\t}\n\tfor _, tag := range configuredTags {\n\t\tunusedTags.Remove(tag.Name)\n\t}\n\n\tif len(configuredTags) > 0 {\n\t\tlog.Printf(\"Applying %d tags to resource '%s'...\", len(configuredTags), resourceID)\n\n\t\tresponse, err = apiClient.ApplyAssetTags(resourceID, assetType, configuredTags...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif response.ResponseCode != compute.ResponseCodeOK {\n\t\t\treturn response.ToError(\"Failed to apply %d tags to resource:'%s' asset_type:'%s' (response code '%s'): %s\", len(configuredTags), resourceID, assetType, response.ResponseCode, response.Message)\n\t\t}\n\t} else {\n\t\tlog.Printf(\"No tags need to be added to resource '%s'.\", resourceID)\n\t}\n\n\t// Trim unused tags (currently-configured tags will overwrite any existing values).\n\tif unusedTags.Len() > 0 {\n\t\tunusedTagNames := make([]string, unusedTags.Len())\n\t\tfor index, unusedTagName := range unusedTags.List() {\n\t\t\tunusedTagNames[index] = unusedTagName.(string)\n\t\t}\n\n\t\tlog.Printf(\"Removing %d unused tags from resource '%s'...\", len(unusedTagNames), resourceID)\n\n\t\tresponse, err = apiClient.RemoveAssetTags(resourceID, assetType, unusedTagNames...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif response.ResponseCode != compute.ResponseCodeOK {\n\t\t\treturn response.ToError(\"Failed to remove %d tags from resource '%s' (response code '%s'): %s\", len(configuredTags), resourceID, response.ResponseCode, response.Message)\n\t\t}\n\t}\n\n\treturn nil\n}", "func unsetExistingResources(existingStack *gjson.Result, clusterConfig *api.ClusterConfig) {\n\tcontrolPlaneSG := existingStack.Get(cfnControlPlaneSGResource)\n\tif controlPlaneSG.Exists() {\n\t\tclusterConfig.VPC.SecurityGroup = \"\"\n\t}\n\tsharedNodeSG := existingStack.Get(cfnSharedNodeSGResource)\n\tif sharedNodeSG.Exists() {\n\t\tclusterConfig.VPC.SharedNodeSecurityGroup = \"\"\n\t}\n}", "func (res *ruleMatchResults) unique() *ruleMatchResults {\n\tif len(res.pipelines) == 0 {\n\t\treturn res\n\t}\n\n\t// Otherwise merge as per usual\n\tcurr := 0\n\tfor i := 1; i < len(res.pipelines); i++ {\n\t\tfoundDup := false\n\t\tfor j := 0; j <= curr; j++ {\n\t\t\tif res.pipelines[j].Equal(res.pipelines[i]) {\n\t\t\t\tfoundDup = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif foundDup {\n\t\t\tcontinue\n\t\t}\n\t\tcurr++\n\t\tres.pipelines[curr] = res.pipelines[i]\n\t}\n\tfor i := curr + 1; i < len(res.pipelines); i++ {\n\t\tres.pipelines[i] = metadata.PipelineMetadata{}\n\t}\n\tres.pipelines = res.pipelines[:curr+1]\n\treturn res\n}", "func (pv *PixView) CleanDupes(dryRun bool) {\n\tpv.UpdtMu.Lock()\n\tdefer pv.UpdtMu.Unlock()\n\n\t// adir := filepath.Join(pv.ImageDir, \"All\")\n\tpv.UpdateFolders()\n\n\tsmap := make(map[int64]picinfo.Pics, len(pv.AllInfo))\n\n\tsmax := int64(0)\n\tfor _, pi := range pv.AllInfo {\n\t\tfi, err := os.Stat(pi.Thumb)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tsz := fi.Size()\n\t\tif sz > smax {\n\t\t\tsmax = sz\n\t\t}\n\t\tpis, has := smap[sz]\n\t\tif has {\n\t\t\tpis = append(pis, pi)\n\t\t\tsmap[sz] = pis\n\t\t} else {\n\t\t\tsmap[sz] = picinfo.Pics{pi}\n\t\t}\n\t}\n\n\tmx := len(smap)\n\tpv.PProg.Start(mx)\n\n\tszs := make([]int64, mx)\n\tidx := 0\n\tfor sz := range smap {\n\t\tszs[idx] = sz\n\t\tidx++\n\t}\n\n\tncp := runtime.NumCPU()\n\tnper := mx / ncp\n\tst := 0\n\tfor i := 0; i < ncp; i++ {\n\t\ted := st + nper\n\t\tif i == ncp-1 {\n\t\t\ted = mx\n\t\t}\n\t\tgo pv.CleanDupesThr(dryRun, smax, szs, smap, st, ed)\n\t\tpv.WaitGp.Add(1)\n\t\tst = ed\n\t}\n\tpv.WaitGp.Wait()\n\tpv.SaveAllInfo()\n\tfmt.Println(\"...Done\\n\")\n\tgi.PromptDialog(nil, gi.DlgOpts{Title: \"Done\", Prompt: \"Done Cleaning Duplicates\"}, gi.AddOk, gi.NoCancel, nil, nil)\n\tpv.DirInfo(false)\n}", "func testResourceDeletionIgnored(t *testing.T, initialResource func(string) e2e.UpdateOptions, updateResource func(r *e2e.UpdateOptions)) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\tt.Cleanup(cancel)\n\tmgmtServer := startManagementServer(t)\n\tnodeID := uuid.New().String()\n\tbs := generateBootstrapContents(t, mgmtServer.Address, true, nodeID)\n\txdsR := xdsResolverBuilder(t, bs)\n\tresources := initialResource(nodeID)\n\n\t// Update the management server with initial resources setup.\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcc, err := grpc.Dial(fmt.Sprintf(\"xds:///%s\", serviceName), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(xdsR))\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to dial local test server: %v.\", err)\n\t}\n\tt.Cleanup(func() { cc.Close() })\n\n\tif err := verifyRPCtoAllEndpoints(cc); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Mutate resource and update on the server.\n\tupdateResource(&resources)\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Make an RPC every 50ms for the next 500ms. This is to ensure that the\n\t// updated resource is received from the management server and is processed by\n\t// gRPC. Since resource deletions are ignored by the xDS client, we expect RPCs\n\t// to all endpoints to keep succeeding.\n\ttimer := time.NewTimer(500 * time.Millisecond)\n\tticker := time.NewTicker(50 * time.Millisecond)\n\tt.Cleanup(ticker.Stop)\n\tfor {\n\t\tif err := verifyRPCtoAllEndpoints(cc); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-timer.C:\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t}\n\t}\n}", "func (s *Sync) fixDupes(claims []jsonrpc.Claim) (bool, error) {\n\tstart := time.Now()\n\tdefer func(start time.Time) {\n\t\ttiming.TimedComponent(\"fixDupes\").Add(time.Since(start))\n\t}(start)\n\tabandonedClaims := false\n\tvideoIDs := make(map[string]jsonrpc.Claim)\n\tfor _, c := range claims {\n\t\tif !isYtsyncClaim(c, s.DbChannelData.ChannelClaimID) {\n\t\t\tcontinue\n\t\t}\n\t\ttn := c.Value.GetThumbnail().GetUrl()\n\t\tvideoID := tn[strings.LastIndex(tn, \"/\")+1:]\n\n\t\tcl, ok := videoIDs[videoID]\n\t\tif !ok || cl.ClaimID == c.ClaimID {\n\t\t\tvideoIDs[videoID] = c\n\t\t\tcontinue\n\t\t}\n\t\t// only keep the most recent one\n\t\tclaimToAbandon := c\n\t\tvideoIDs[videoID] = cl\n\t\tif c.Height > cl.Height {\n\t\t\tclaimToAbandon = cl\n\t\t\tvideoIDs[videoID] = c\n\t\t}\n\t\t//it's likely that all we need is s.DbChannelData.PublishAddress.IsMine but better be safe than sorry I guess\n\t\tif (claimToAbandon.Address != s.DbChannelData.PublishAddress.Address || s.DbChannelData.PublishAddress.IsMine) && !s.syncedVideos[videoID].Transferred {\n\t\t\tlog.Debugf(\"abandoning %+v\", claimToAbandon)\n\t\t\t_, err := s.daemon.StreamAbandon(claimToAbandon.Txid, claimToAbandon.Nout, nil, true)\n\t\t\tif err != nil {\n\t\t\t\treturn true, err\n\t\t\t}\n\t\t\tabandonedClaims = true\n\t\t} else {\n\t\t\tlog.Debugf(\"claim is not ours. Have the user run this: lbrynet stream abandon --txid=%s --nout=%d\", claimToAbandon.Txid, claimToAbandon.Nout)\n\t\t}\n\t}\n\treturn abandonedClaims, nil\n}", "func mergeResources(src, dst *model.PdfPageResources) error {\n\t// Merge colorspaces.\n\tcolorspaces, _ := src.GetColorspaces()\n\tif colorspaces != nil && len(colorspaces.Colorspaces) > 0 {\n\t\tfor name, colorspace := range colorspaces.Colorspaces {\n\t\t\tcolorspaceName := *core.MakeName(name)\n\t\t\tif dst.HasColorspaceByName(colorspaceName) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\terr := dst.SetColorspaceByName(colorspaceName, colorspace)\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 removeSourcesUsed(bld *build.File, ruleKind, attrName string, srcs srcSet) {\n\tfor _, rule := range buildRules(bld, ruleKind) {\n\t\tfor s := range srcs {\n\t\t\tpkg := filepath.Dir(bld.Path)\n\t\t\t// Handles \":foo.ts\" references, and concatenated lists [foo.ts] + [bar.ts]\n\t\t\t// TODO(martinprobst): What to do about sources that don't seem to exist?\n\t\t\tif edit.ListFind(rule.Attr(attrName), s, pkg) != nil {\n\t\t\t\tdelete(srcs, s)\n\t\t\t}\n\t\t}\n\t}\n}", "func resourceHostUpdate(d *schema.ResourceData, m interface{}) error {\n\tapi := m.(*zabbix.API)\n\n\titem, err := buildHostObject(d, m)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// templates may need a bit extra effort\n\tif d.HasChange(\"templates\") {\n\t\told, new := d.GetChange(\"templates\")\n\t\tdiff := old.(*schema.Set).Difference(new.(*schema.Set))\n\n\t\t// removals, we need to unlink and clear\n\t\tif diff.Len() > 0 {\n\t\t\titem.TemplateIDsClear = buildTemplateIds(diff)\n\t\t}\n\t}\n\n\titem.HostID = d.Id()\n\n\titems := []zabbix.Host{*item}\n\n\terr = api.HostsUpdate(items)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn resourceHostRead(d, m)\n}", "func (c *Client) updateResources(ctx context.Context, id string, resources types.Resources) error {\n\tif !c.lock.TrylockWithRetry(ctx, id) {\n\t\treturn errtypes.ErrLockfailed\n\t}\n\tdefer c.lock.Unlock(id)\n\n\tpack, err := c.watch.get(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr, err := toLinuxResources(resources)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn pack.task.Update(ctx, containerd.WithResources(r))\n}", "func (c *CLI) SyncResources(filePath string) (string, error) {\n\tvar req syncListRequest\n\tif err := fileutil.LoadFile(filePath, &req); err != nil {\n\t\treturn \"\", err\n\t}\n\tfor i := range req.Resources {\n\t\treq.Resources[i].Data = fileutil.YAMLtoJSONCompat(req.Resources[i].Data)\n\t}\n\n\tvar response []syncResponse\n\tif _, err := c.Create(context.Background(), \"/sync\", req, &response); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn encodeToYAML(syncListResponse{Resources: response})\n}", "func (sp *schemaPuller) PullCRDs(context context.Context, resourceNames ...string) (map[schema.GroupResource]*apiextensionsv1.CustomResourceDefinition, error) {\n\tcrds := map[schema.GroupResource]*apiextensionsv1.CustomResourceDefinition{}\n\t_, apiResourcesLists, err := sp.discoveryClient.ServerGroupsAndResources()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpullAllResources := len(resourceNames) == 0\n\tresourcesToPull := sets.NewString(resourceNames...)\n\n\tapiResourceNames := map[schema.GroupVersion]sets.String{}\n\tfor _, apiResourcesList := range apiResourcesLists {\n\t\tgv, err := schema.ParseGroupVersion(apiResourcesList.GroupVersion)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tapiResourceNames[gv] = sets.NewString()\n\t\tfor _, apiResource := range apiResourcesList.APIResources {\n\t\t\tapiResourceNames[gv].Insert(apiResource.Name)\n\t\t}\n\n\t}\n\n\tapiResourcesLists, err = sp.discoveryClient.ServerPreferredResources()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, apiResourcesList := range apiResourcesLists {\n\t\tgv, err := schema.ParseGroupVersion(apiResourcesList.GroupVersion)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"skipping discovery due to error parsing GroupVersion %s: %v\", apiResourcesList.GroupVersion, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, apiResource := range apiResourcesList.APIResources {\n\t\t\tgroupResource := schema.GroupResource{\n\t\t\t\tGroup: gv.Group,\n\t\t\t\tResource: apiResource.Name,\n\t\t\t}\n\t\t\tif !pullAllResources && !resourcesToPull.Has(groupResource.String()) && !resourcesToPull.Has(apiResource.Name) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif genericcontrolplanescheme.Scheme.IsGroupRegistered(gv.Group) && !genericcontrolplanescheme.Scheme.IsVersionRegistered(gv) {\n\t\t\t\tklog.Warningf(\"ignoring an apiVersion since it is part of the core KCP resources, but not compatible with KCP version: %s\", gv.String())\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tgvk := gv.WithKind(apiResource.Kind)\n\t\t\tif genericcontrolplanescheme.Scheme.Recognizes(gvk) || extensionsapiserver.Scheme.Recognizes(gvk) {\n\t\t\t\tklog.Infof(\"ignoring a resource since it is part of the core KCP resources: %s (%s)\", apiResource.Name, gvk.String())\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcrdName := apiResource.Name\n\t\t\tif gv.Group == \"\" {\n\t\t\t\tcrdName = crdName + \".core\"\n\t\t\t} else {\n\t\t\t\tcrdName = crdName + \".\" + gv.Group\n\t\t\t}\n\n\t\t\tvar resourceScope apiextensionsv1.ResourceScope\n\t\t\tif apiResource.Namespaced {\n\t\t\t\tresourceScope = apiextensionsv1.NamespaceScoped\n\t\t\t} else {\n\t\t\t\tresourceScope = apiextensionsv1.ClusterScoped\n\t\t\t}\n\n\t\t\tklog.Infof(\"processing discovery for resource %s (%s)\", apiResource.Name, crdName)\n\t\t\tvar schemaProps apiextensionsv1.JSONSchemaProps\n\t\t\tvar additionalPrinterColumns []apiextensionsv1.CustomResourceColumnDefinition\n\t\t\tcrd, err := sp.crdClient.CustomResourceDefinitions().Get(context, crdName, metav1.GetOptions{})\n\t\t\tif err == nil {\n\t\t\t\tif apihelpers.IsCRDConditionTrue(crd, apiextensionsv1.NonStructuralSchema) {\n\t\t\t\t\tklog.Warningf(\"non-structural schema for resource %s (%s): the resources will not be validated\", apiResource.Name, gvk.String())\n\t\t\t\t\tschemaProps = apiextensionsv1.JSONSchemaProps{\n\t\t\t\t\t\tType: \"object\",\n\t\t\t\t\t\tXPreserveUnknownFields: boolPtr(true),\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar versionFound bool\n\t\t\t\t\tfor _, version := range crd.Spec.Versions {\n\t\t\t\t\t\tif version.Name == gv.Version {\n\t\t\t\t\t\t\tschemaProps = *version.Schema.OpenAPIV3Schema\n\t\t\t\t\t\t\tadditionalPrinterColumns = version.AdditionalPrinterColumns\n\t\t\t\t\t\t\tversionFound = true\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif !versionFound {\n\t\t\t\t\t\tklog.Errorf(\"expected version not found in CRD %s: %s\", crdName, gv.Version)\n\t\t\t\t\t\tschemaProps = apiextensionsv1.JSONSchemaProps{\n\t\t\t\t\t\t\tType: \"object\",\n\t\t\t\t\t\t\tXPreserveUnknownFields: boolPtr(true),\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\tif !errors.IsNotFound(err) {\n\t\t\t\t\tklog.Errorf(\"error looking up CRD for %s: %v\", crdName, err)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tprotoSchema := sp.models[gvk]\n\t\t\t\tif protoSchema == nil {\n\t\t\t\t\tklog.Infof(\"ignoring a resource that has no OpenAPI Schema: %s (%s)\", apiResource.Name, gvk.String())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tswaggerSpecDefinitionName := protoSchema.GetPath().String()\n\n\t\t\t\tvar errors []error\n\t\t\t\tconverter := &SchemaConverter{\n\t\t\t\t\tschemaProps: &schemaProps,\n\t\t\t\t\tschemaName: swaggerSpecDefinitionName,\n\t\t\t\t\tvisited: sets.NewString(),\n\t\t\t\t\terrors: &errors,\n\t\t\t\t}\n\t\t\t\tprotoSchema.Accept(converter)\n\t\t\t\tif len(*converter.errors) > 0 {\n\t\t\t\t\tklog.Errorf(\"error during the OpenAPI schema import of resource %s (%s) : %v\", apiResource.Name, gvk.String(), *converter.errors)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thasSubResource := func(subResource string) bool {\n\t\t\t\tgroupResourceNames := apiResourceNames[gv]\n\t\t\t\tif groupResourceNames != nil {\n\t\t\t\t\treturn groupResourceNames.Has(apiResource.Name + \"/\" + subResource)\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tstatusSubResource := &apiextensionsv1.CustomResourceSubresourceStatus{}\n\t\t\tif !hasSubResource(\"status\") {\n\t\t\t\tstatusSubResource = nil\n\t\t\t}\n\n\t\t\tscaleSubResource := &apiextensionsv1.CustomResourceSubresourceScale{\n\t\t\t\tSpecReplicasPath: \".spec.replicas\",\n\t\t\t\tStatusReplicasPath: \".status.replicas\",\n\t\t\t}\n\t\t\tif !hasSubResource(\"scale\") {\n\t\t\t\tscaleSubResource = nil\n\t\t\t}\n\n\t\t\tcrd = &apiextensionsv1.CustomResourceDefinition{\n\t\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\t\tKind: \"CustomResourceDefinition\",\n\t\t\t\t\tAPIVersion: \"apiextensions.k8s.io/v1\",\n\t\t\t\t},\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: crdName,\n\t\t\t\t\tLabels: map[string]string{},\n\t\t\t\t\tAnnotations: map[string]string{},\n\t\t\t\t},\n\t\t\t\tSpec: apiextensionsv1.CustomResourceDefinitionSpec{\n\t\t\t\t\tGroup: gv.Group,\n\t\t\t\t\tVersions: []apiextensionsv1.CustomResourceDefinitionVersion{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: gv.Version,\n\t\t\t\t\t\t\tSchema: &apiextensionsv1.CustomResourceValidation{\n\t\t\t\t\t\t\t\tOpenAPIV3Schema: &schemaProps,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tSubresources: &apiextensionsv1.CustomResourceSubresources{\n\t\t\t\t\t\t\t\tStatus: statusSubResource,\n\t\t\t\t\t\t\t\tScale: scaleSubResource,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tServed: true,\n\t\t\t\t\t\t\tStorage: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tScope: resourceScope,\n\t\t\t\t\tNames: apiextensionsv1.CustomResourceDefinitionNames{\n\t\t\t\t\t\tPlural: apiResource.Name,\n\t\t\t\t\t\tKind: apiResource.Kind,\n\t\t\t\t\t\tCategories: apiResource.Categories,\n\t\t\t\t\t\tShortNames: apiResource.ShortNames,\n\t\t\t\t\t\tSingular: apiResource.SingularName,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\tif len(additionalPrinterColumns) != 0 {\n\t\t\t\tcrd.Spec.Versions[0].AdditionalPrinterColumns = additionalPrinterColumns\n\t\t\t}\n\t\t\tapiextensionsv1.SetDefaults_CustomResourceDefinition(crd)\n\n\t\t\t// In Kubernetes, to make it clear to the API consumer that APIs in *.k8s.io or *.kubernetes.io domains\n\t\t\t// should be following all quality standards of core Kubernetes, CRDs under these domains\n\t\t\t// are expected to go through the API Review process and so must link the API review approval PR\n\t\t\t// in an `api-approved.kubernetes.io` annotation.\n\t\t\t// Without this annotation, a CRD under the *.k8s.io or *.kubernetes.io domains is rejected by the API server\n\t\t\t//\n\t\t\t// Of course here we're simply adding already-known resources of existing physical clusters as CRDs in KCP.\n\t\t\t// But to please this Kubernetes approval requirement, let's add the required annotation in imported CRDs\n\t\t\t// with one of the KCP PRs that hacked Kubernetes CRD support for KCP.\n\t\t\tif apihelpers.IsProtectedCommunityGroup(gv.Group) {\n\t\t\t\tcrd.ObjectMeta.Annotations[\"api-approved.kubernetes.io\"] = \"https://github.com/kcp-dev/kubernetes/pull/4\"\n\t\t\t}\n\t\t\tcrds[groupResource] = crd\n\t\t}\n\t}\n\treturn crds, nil\n}", "func (r *ResourceHandler) UpdateStageResources(project string, stage string, resources []*models.Resource) (string, error) {\n\tr.ensureHandlerIsSet()\n\treturn r.resourceHandler.UpdateResourcesByURI(context.TODO(), r.Scheme+\"://\"+r.BaseURL+v1ProjectPath+\"/\"+project+pathToStage+\"/\"+stage+pathToResource, resources)\n}", "func DestroyResources(resources []DestroyableResource, dryRun bool, parallel int) int {\n\tnumOfResourcesToDelete := len(resources)\n\tnumOfDeletedResources := 0\n\n\tvar retryableResourceErrors []RetryDestroyError\n\n\tjobQueue := make(chan DestroyableResource, numOfResourcesToDelete)\n\n\tworkerResults := make(chan workerResult, numOfResourcesToDelete)\n\n\tfor workerID := 1; workerID <= parallel; workerID++ {\n\t\tgo worker(workerID, dryRun, jobQueue, workerResults)\n\t}\n\n\tlog.Debug(\"start distributing resources to workers for this run\")\n\n\tfor _, r := range resources {\n\t\tjobQueue <- r\n\t}\n\n\tclose(jobQueue)\n\n\tfor i := 1; i <= numOfResourcesToDelete; i++ {\n\t\tresult := <-workerResults\n\n\t\tif result.resourceHasBeenDeleted {\n\t\t\tnumOfDeletedResources++\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif result.Err != nil {\n\t\t\tretryableResourceErrors = append(retryableResourceErrors, *result.Err)\n\t\t}\n\t}\n\n\tif len(retryableResourceErrors) > 0 && numOfDeletedResources > 0 {\n\t\tvar resourcesToRetry []DestroyableResource\n\t\tfor _, retryErr := range retryableResourceErrors {\n\t\t\tresourcesToRetry = append(resourcesToRetry, retryErr.Resource)\n\t\t}\n\n\t\tnumOfDeletedResources += DestroyResources(resourcesToRetry, dryRun, parallel)\n\t}\n\n\tif len(retryableResourceErrors) > 0 && numOfDeletedResources == 0 {\n\t\tinternal.LogTitle(fmt.Sprintf(\"failed to delete the following resources (retries exceeded): %d\",\n\t\t\tlen(retryableResourceErrors)))\n\n\t\tfor _, err := range retryableResourceErrors {\n\t\t\tlog.WithError(err).WithField(\"id\", err.Resource.ID()).Warn(internal.Pad(err.Resource.Type()))\n\t\t}\n\t}\n\n\treturn numOfDeletedResources\n}", "func (s *Synchronizer) checkDuplicated(ctx context.Context) error {\n\toldFacts := s.option.Cache.FactsByKey()\n\n\tif err := s.factsUpdateList(ctx); err != nil {\n\t\treturn fmt.Errorf(\"update facts list: %w\", err)\n\t}\n\n\tnewFacts := s.option.Cache.FactsByKey()\n\n\tisDuplicated, message := isDuplicatedUsingFacts(s.startedAt, oldFacts[s.agentID], newFacts[s.agentID])\n\n\tif !isDuplicated {\n\t\treturn nil\n\t}\n\n\tlogger.Printf(message)\n\tlogger.Printf(\n\t\t\"The following links may be relevant to solve the issue: https://go.bleemeo.com/l/doc-duplicated-agent\",\n\t)\n\n\tuntil := s.now().Add(delay.JitterDelay(15*time.Minute, 0.05))\n\ts.Disable(until, bleemeoTypes.DisableDuplicatedAgent)\n\n\tif s.option.DisableCallback != nil {\n\t\ts.option.DisableCallback(bleemeoTypes.DisableDuplicatedAgent, until)\n\t}\n\n\t// The agent is duplicated, update the last duplication date on the API.\n\tparams := map[string]string{\n\t\t\"fields\": \"last_duplication_date\",\n\t}\n\n\tdata := map[string]time.Time{\n\t\t\"last_duplication_date\": time.Now(),\n\t}\n\n\t_, err := s.client.Do(s.ctx, \"PATCH\", fmt.Sprintf(\"v1/agent/%s/\", s.agentID), params, data, nil)\n\tif err != nil {\n\t\tlogger.V(1).Printf(\"Failed to update duplication date: %s\", err)\n\t}\n\n\treturn errConnectorTemporaryDisabled\n}", "func (g *Group) RemoveFiles(dst string) error {\n\tif dst == \"\" {\n\t\treturn fmt.Errorf(\"Empty destination string\")\n\t}\n\tvar assets []string\n\tpattern := path.Join(dst, ASSETS, SCRIPTS, g.name+\"-*.min.js\")\n\tfiles, err := filepath.Glob(pattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\tassets = append(assets, files...)\n\tpattern = path.Join(dst, ASSETS, STYLES, g.name+\"-*.min.css\")\n\tfiles, err = filepath.Glob(pattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\tassets = append(assets, files...)\n\tfor _, a := range assets {\n\t\terr = os.Remove(a)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func isSafeDeleteTemplate(st *defs, use attrVal, hgrpDeleted attrVal, hostname string) bool {\n for _, v := range use {\n if (*st)[v].attrExist(\"host_name\") {\n // check if host_name contain any values other than hostname, if so, dont delete\n if !(*st)[v][\"host_name\"].HasOnly(hostname){\n return false\n }\n }\n if (*st)[v].attrExist(\"hostgroup_name\") {\n // check if hostgroup_name contain any values other than the deleted hostgroups, if so, dont delete\n if !hgrpDeleted.HasAll(*(*st)[v][\"hostgroup_name\"]...) {\n return false\n }\n }\n if (*st)[v].attrExist(\"use\") {\n isSafeDeleteTemplate(st, *(*st)[v][\"use\"], hgrpDeleted, hostname)\n }\n }\n return true\n}", "func ConcatTiles(tileset1, tileset2 *Tileset, metasprite2 *Metasprite, delMirror, delFlip bool) {\n\tif metasprite2 != nil {\n\t\tlen := byte(tileset1.Size())\n\t\tfor _, spr := range metasprite2.sprites {\n\t\t\tspr.Idx += len\n\t\t}\n\t}\n\n\ttileset1.tiles = append(tileset1.tiles, tileset2.tiles...)\n\n\tif tileset1.tiledim == Tile8x16 {\n\t\tremoveDuplicated8x16Tiles(tileset1, metasprite2, delMirror, delFlip)\n\t} else {\n\t\tremoveDuplicated8x8Tiles(tileset1, metasprite2, delMirror, delFlip)\n\t}\n}", "func (p *DockerPod) UpdateResources(id string, resource *schedTypes.TaskResources) error {\n\tvar exist bool\n\tvar conTask *container.BcsContainerTask\n\n\tfor _, con := range p.conTasks {\n\t\tif con.RuntimeConf.ID == id {\n\t\t\texist = true\n\t\t\tconTask = con\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !exist {\n\t\treturn fmt.Errorf(\"container id %s is invalid\", id)\n\t}\n\n\terr := p.conClient.UpdateResources(id, resource)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconTask.RuntimeConf.Resource.Cpus = *resource.ReqCpu\n\tconTask.RuntimeConf.Resource.Mem = *resource.ReqMem\n\treturn nil\n}", "func prepareCopyURLs(sourceURLs []string, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair, olderThan, newerThan string) chan URLs {\n\tcopyURLsCh := make(chan URLs)\n\tgo func(sourceURLs []string, targetURL string, copyURLsCh chan URLs, encKeyDB map[string][]prefixSSEPair) {\n\t\tdefer close(copyURLsCh)\n\t\tcpType, err := guessCopyURLType(sourceURLs, targetURL, isRecursive, encKeyDB)\n\t\tfatalIf(err.Trace(), \"Unable to guess the type of copy operation.\")\n\n\t\tswitch cpType {\n\t\tcase copyURLsTypeA:\n\t\t\tcopyURLsCh <- prepareCopyURLsTypeA(sourceURLs[0], targetURL, encKeyDB)\n\t\tcase copyURLsTypeB:\n\t\t\tcopyURLsCh <- prepareCopyURLsTypeB(sourceURLs[0], targetURL, encKeyDB)\n\t\tcase copyURLsTypeC:\n\t\t\tfor cURLs := range prepareCopyURLsTypeC(sourceURLs[0], targetURL, isRecursive, encKeyDB) {\n\t\t\t\tcopyURLsCh <- cURLs\n\t\t\t}\n\t\tcase copyURLsTypeD:\n\t\t\tfor cURLs := range prepareCopyURLsTypeD(sourceURLs, targetURL, isRecursive, encKeyDB) {\n\t\t\t\tcopyURLsCh <- cURLs\n\t\t\t}\n\t\tdefault:\n\t\t\tcopyURLsCh <- URLs{Error: errInvalidArgument().Trace(sourceURLs...)}\n\t\t}\n\t}(sourceURLs, targetURL, copyURLsCh, encKeyDB)\n\n\tfinalCopyURLsCh := make(chan URLs)\n\tgo func() {\n\t\tdefer close(finalCopyURLsCh)\n\t\tfor cpURLs := range copyURLsCh {\n\t\t\t// Skip objects older than --older-than parameter if specified\n\t\t\tif olderThan != \"\" && isOlder(cpURLs.SourceContent.Time, olderThan) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Skip objects newer than --newer-than parameter if specified\n\t\t\tif newerThan != \"\" && isNewer(cpURLs.SourceContent.Time, newerThan) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfinalCopyURLsCh <- cpURLs\n\t\t}\n\t}()\n\n\treturn finalCopyURLsCh\n}", "func (e WorkloadGenerator) GenerateDeltas(\n\tproxy *model.Proxy,\n\treq *model.PushRequest,\n\tw *model.WatchedResource,\n) (model.Resources, model.DeletedResources, model.XdsLogDetails, bool, error) {\n\tupdatedAddresses := model.ConfigNameOfKind(req.ConfigsUpdated, kind.Address)\n\tisReq := req.IsRequest()\n\tif len(updatedAddresses) == 0 && len(req.ConfigsUpdated) > 0 {\n\t\t// Nothing changed..\n\t\treturn nil, nil, model.XdsLogDetails{}, false, nil\n\t}\n\tsubs := sets.New(w.ResourceNames...)\n\n\taddresses := updatedAddresses\n\tif !w.Wildcard {\n\t\t// If it;s not a wildcard, filter out resources we are not subscribed to\n\t\taddresses = updatedAddresses.Intersection(subs)\n\t}\n\t// Specific requested resource: always include\n\taddresses = addresses.Merge(req.Delta.Subscribed)\n\n\tif !w.Wildcard {\n\t\t// We only need this for on-demand. This allows us to subscribe the client to resources they\n\t\t// didn't explicitly request.\n\t\t// For wildcard, they subscribe to everything already.\n\t\tadditional := e.s.Env.ServiceDiscovery.AdditionalPodSubscriptions(proxy, addresses, subs)\n\t\taddresses.Merge(additional)\n\t}\n\n\t// TODO: it is needlessly wasteful to do a full sync just because the rest of Istio thought it was \"full\"\n\t// The only things that can really trigger a \"full\" push here is trust domain or network changing, which is extremely rare\n\t// We do a full push for wildcard requests (initial proxy sync) or for full pushes with no ConfigsUpdates (since we don't know what changed)\n\tfull := (isReq && w.Wildcard) || (!isReq && req.Full && len(req.ConfigsUpdated) == 0)\n\n\t// Nothing to do\n\tif len(addresses) == 0 && !full {\n\t\tif isReq {\n\t\t\t// We need to respond for requests, even if we have nothing to respond with\n\t\t\treturn make(model.Resources, 0), nil, model.XdsLogDetails{}, false, nil\n\t\t}\n\t\t// For NOP pushes, no need\n\t\treturn nil, nil, model.XdsLogDetails{}, false, nil\n\t}\n\n\tresources := make(model.Resources, 0)\n\taddrs, removed := e.s.Env.ServiceDiscovery.AddressInformation(addresses)\n\t// Note: while \"removed\" is a weird name for a resource that never existed, this is how the spec works:\n\t// https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol#id2\n\n\thave := sets.New[string]()\n\tfor _, addr := range addrs {\n\t\taliases := addr.Aliases()\n\t\tn := addr.ResourceName()\n\t\thave.Insert(n)\n\t\tswitch w.TypeUrl {\n\t\tcase v3.WorkloadType:\n\t\t\tif addr.GetWorkload() != nil {\n\t\t\t\tresources = append(resources, &discovery.Resource{\n\t\t\t\t\tName: n,\n\t\t\t\t\tAliases: aliases,\n\t\t\t\t\tResource: protoconv.MessageToAny(addr.GetWorkload()), // TODO: pre-marshal\n\t\t\t\t})\n\t\t\t}\n\t\tcase v3.ServiceType:\n\t\t\tif addr.GetService() != nil {\n\t\t\t\tresources = append(resources, &discovery.Resource{\n\t\t\t\t\tName: n,\n\t\t\t\t\tAliases: aliases,\n\t\t\t\t\tResource: protoconv.MessageToAny(addr.GetService()), // TODO: pre-marshal\n\t\t\t\t})\n\t\t\t}\n\t\tcase v3.AddressType:\n\t\t\tresources = append(resources, &discovery.Resource{\n\t\t\t\tName: n,\n\t\t\t\tAliases: aliases,\n\t\t\t\tResource: protoconv.MessageToAny(addr), // TODO: pre-marshal\n\t\t\t})\n\t\t}\n\t}\n\n\tif !w.Wildcard {\n\t\t// For on-demand, we may have requested a VIP but gotten Pod IPs back. We need to update\n\t\t// the internal book-keeping to subscribe to the Pods, so that we push updates to those Pods.\n\t\tw.ResourceNames = sets.SortedList(sets.New(w.ResourceNames...).Merge(have))\n\t}\n\tif full {\n\t\t// If it's a full push, AddressInformation won't have info to compute the full set of removals.\n\t\t// Instead, we need can see what resources are missing that we were subscribe to; those were removed.\n\t\tremoves := subs.Difference(have).InsertAll(removed...)\n\t\tremoved = sets.SortedList(removes)\n\t}\n\treturn resources, removed, model.XdsLogDetails{}, true, nil\n}", "func (cp *statusConnectionPool) resurrect(c *Connection, removeDead bool) error {\n\tif debugLogger != nil {\n\t\tdebugLogger.Logf(\"Resurrecting %s\\n\", c.URL)\n\t}\n\n\tc.markAsLive()\n\tcp.live = append(cp.live, c)\n\n\tif removeDead {\n\t\tindex := -1\n\t\tfor i, conn := range cp.dead {\n\t\t\tif conn == c {\n\t\t\t\tindex = i\n\t\t\t}\n\t\t}\n\t\tif index >= 0 {\n\t\t\t// Remove item; https://github.com/golang/go/wiki/SliceTricks\n\t\t\tcopy(cp.dead[index:], cp.dead[index+1:])\n\t\t\tcp.dead = cp.dead[:len(cp.dead)-1]\n\t\t}\n\t}\n\n\treturn nil\n}", "func genericCleanupResource(\n\tresourceName string,\n\tlistFunc func() ([]interface{}, error),\n\ttoStrFunc func(interface{}) string,\n\tdeleteFunc func(interface{}) (int, error)) {\n\n\tfmt.Printf(\"Getting %s list ...\\n\", resourceName)\n\tall, err := listFunc()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed getting %s list: %s\\n\", resourceName, err.Error())\n\t}\n\n\tfmt.Printf(\"Found %d %ss created by tests\\n\", len(all), resourceName)\n\tif len(all) == 0 {\n\t\treturn\n\t}\n\tfor _, res := range all {\n\t\tfmt.Println(toStrFunc(res))\n\t}\n\n\tdelete := deleteListPrompt()\n\tif delete == deleteNone {\n\t\tfmt.Printf(\"Not deleting any %ss\\n\", resourceName)\n\t} else {\n\t\tdeleted := 0\n\t\tfor _, d := range all {\n\t\t\tdeleteOne := deleteYes\n\t\t\tif delete == deleteOneByOne {\n\t\t\t\tdeleteOne = deleteOnePrompt(fmt.Sprintf(\"%s %s\", resourceName, toStrFunc(d)))\n\t\t\t}\n\t\t\tif deleteOne == deleteYes {\n\t\t\t\tfmt.Printf(\"Deleting %s %s ... \", resourceName, toStrFunc(d))\n\t\t\t\tstatusCode, err := deleteFunc(d)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(\"failed: %s\\n\", err.Error())\n\t\t\t\t} else {\n\t\t\t\t\tdeleted++\n\t\t\t\t\tfmt.Printf(\"success (code %d)\\n\", statusCode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"Successfully deleted %d %ss\\n\", deleted, resourceName)\n\t}\n}", "func maybeRecreate(ctx context.Context, live, obj runtime.Object, m *kubePackage, r *apiResource) error {\n\terr := mergeObjects(live, obj)\n\tif errors.Is(errors.Unwrap(err), ErrUpdateImmutable) && m.force {\n\t\tif m.dryRun {\n\t\t\tfmt.Fprintf(os.Stdout, \"\\n\\n**WARNING** %s %s is immutable and will be deleted and recreated.\\n\", strings.ToLower(r.GVK.Kind), maybeNamespaced(r.Name, r.Namespace))\n\t\t}\n\t\t// kubeDelete() already properly handles a dry run, so the resource won't be deleted if -force is set, but in dry run mode\n\t\tif err := m.kubeDelete(ctx, r, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else if err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *BranchedResourceCache) UpdateBranchedResources(updated, deleted map[string][]NamedProtoMessage) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\t// update ResourceCache with new or updated resources\n\tfor branch, resources := range updated {\n\t\tc.renewResourceCache(branch)\n\t\tif _, ok := c.cache[branch]; !ok {\n\t\t\tinitResources := append(c.staticResources, c.dynamicResources...)\n\t\t\tc.cache[branch] = NewResourceCache(c.typeURL, initResources)\n\t\t}\n\t\tc.cache[branch].UpdateResources(resources)\n\t}\n\n\t// 2. delete resources from ResourceCache\n\tfor branch, resources := range deleted {\n\t\tif _, ok := c.cache[branch]; !ok {\n\t\t\tcontinue\n\t\t}\n\t\tc.cache[branch].DeleteResources(resources)\n\t}\n}", "func mergeResources(mtaObj MTA, mtaExtResources []*ResourceExt) error {\n\tfor _, extResource := range mtaExtResources {\n\t\tif resource := mtaObj.GetResourceByName(extResource.Name); resource != nil {\n\t\t\terr := chain().\n\t\t\t\textendBoolPtr(&resource.Active, &extResource.Active, mergeResourceActiveErrorMsg, resource.Name).\n\t\t\t\textendMap(&resource.Properties, resource.PropertiesMetaData, extResource.Properties, mergeResourcePropertiesErrorMsg, resource.Name).\n\t\t\t\textendMap(&resource.Parameters, resource.ParametersMetaData, extResource.Parameters, mergeResourceParametersErrorMsg, resource.Name).\n\t\t\t\terr\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = mergeRequires(extResource.Requires, resource,\n\t\t\t\tmsg{unknownResourceRequiresErrorMsg, []interface{}{extResource.Name}},\n\t\t\t\tmsg{mergeResourceRequiresPropertiesErrorMsg, []interface{}{resource.Name}},\n\t\t\t\tmsg{mergeResourceRequiresParametersErrorMsg, []interface{}{resource.Name}}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.Errorf(unknownResourceErrorMsg, extResource.Name)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (e *Eval) reviseResources(ctx context.Context, tasks []*sched.Task, flows []*Flow) {\n\tpredictions := make(map[*sched.Task]predictor.Prediction)\n\tif e.Predictor != nil {\n\t\t// Compute predictions if applicable\n\t\tpredictions = e.Predictor.Predict(ctx, tasks...)\n\t}\n\tfor i, task := range tasks {\n\t\tif predicted, ok := predictions[task]; ok {\n\t\t\t// Set predicted resources for each task (and flow).\n\t\t\toldResources := task.Config.Resources.String()\n\t\t\tf := flows[i]\n\t\t\tnewReserved := make(reflow.Resources)\n\t\t\tnewReserved.Set(f.Reserved)\n\t\t\tfor k, v := range predicted.Resources {\n\t\t\t\tnewReserved[k] = v\n\t\t\t}\n\t\t\tnewReserved[\"mem\"] = math.Max(newReserved[\"mem\"], minExecMemory)\n\t\t\te.Mutate(f, SetReserved(newReserved))\n\t\t\ttask.Config = f.ExecConfig()\n\t\t\te.Log.Debugf(\"(flow %s): modifying resources from %s to %s\", task.FlowID.Short(), oldResources, task.Config.Resources)\n\t\t\ttask.ExpectedDuration = predicted.Duration\n\t\t\te.Log.Debugf(\"(flow %s): predicted duration %s\", task.FlowID.Short(), predicted.Duration.Round(time.Second))\n\t\t}\n\n\t\t// Whether resources were modified by predictor or not, check if they need to be capped.\n\t\toldResources := task.Config.Resources\n\t\tcappedR, capped, err := e.capMemory(oldResources)\n\t\tswitch {\n\t\tcase err != nil:\n\t\t\te.Log.Errorf(\"(flow %s): reviseResources %s: %v\", task.FlowID.Short(), oldResources, err)\n\t\tcase capped:\n\t\t\tf := flows[i]\n\t\t\te.Mutate(f, SetReserved(cappedR))\n\t\t\ttask.Config = f.ExecConfig()\n\t\t\te.Log.Printf(\"(flow %s): capping resources from %s to %s (max available %s)\", task.FlowID.Short(), oldResources, task.Config.Resources, e.MaxResources)\n\t\t}\n\t}\n}", "func (b *Botanist) DeleteStaleContainerRuntimeResources(ctx context.Context) error {\n\twantedContainerRuntimeTypes := sets.NewString()\n\tfor _, worker := range b.Shoot.Info.Spec.Provider.Workers {\n\t\tif worker.CRI != nil {\n\t\t\tfor _, containerRuntime := range worker.CRI.ContainerRuntimes {\n\t\t\t\tkey := getContainerRuntimeKey(containerRuntime.Type, worker.Name)\n\t\t\t\twantedContainerRuntimeTypes.Insert(key)\n\t\t\t}\n\t\t}\n\t}\n\treturn b.deleteContainerRuntimeResources(ctx, wantedContainerRuntimeTypes)\n}", "func (client *Client) UntagResourcesWithOptions(request *UntagResourcesRequest, runtime *util.RuntimeOptions) (_result *UntagResourcesResponse, _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.All)) {\n\t\tquery[\"All\"] = request.All\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceId)) {\n\t\tquery[\"ResourceId\"] = request.ResourceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceType)) {\n\t\tquery[\"ResourceType\"] = request.ResourceType\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.TagKey)) {\n\t\tquery[\"TagKey\"] = request.TagKey\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UntagResources\"),\n\t\tVersion: tea.String(\"2020-03-31\"),\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 = &UntagResourcesResponse{}\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 collectCRDResources(discovery discovery.DiscoveryInterface) ([]*metav1.APIResourceList, error) {\n\tresources, err := discovery.ServerResources()\n\tcrdResources := []*metav1.APIResourceList{}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, res := range resources {\n\t\tgv, err := schema.ParseGroupVersion(res.GroupVersion)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif gv.Group != \"apiextensions.k8s.io\" {\n\t\t\tcontinue\n\t\t}\n\t\temptyAPIResourceList := metav1.APIResourceList{\n\t\t\tGroupVersion: res.GroupVersion,\n\t\t}\n\t\temptyAPIResourceList.APIResources = findCRDGVRs(res.APIResources)\n\t\tcrdResources = append(crdResources, &emptyAPIResourceList)\n\t}\n\n\treturn crdResources, nil\n}", "func CopyStaticResources(dir string, copyFiles bool) error {\n\n\tstaticDir, err := staticBuildDir(dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfullPkgPath, err := absoluteStaticServerPath()\n\tif err != nil {\n\t\treturn errors.New(\"Couldn't get full package path: \" + err.Error())\n\t}\n\n\tworkingDirectory, err := os.Getwd()\n\n\tif err != nil {\n\t\treturn errors.New(\"Can't get working directory: \" + err.Error())\n\t}\n\n\tinfos, err := ioutil.ReadDir(fullPkgPath)\n\n\tif err != nil {\n\t\treturn errors.New(\"Couldn't list files in remote directory: \" + err.Error())\n\t}\n\n\tabsLocalDirPath := filepath.Join(workingDirectory, staticDir) + string(filepath.Separator)\n\n\tfor _, info := range infos {\n\n\t\tname := info.Name()\n\n\t\tif filesToExclude[name] {\n\t\t\tcontinue\n\t\t}\n\n\t\tlocalPath := filepath.Join(staticDir, name)\n\n\t\tabsRemotePath := filepath.Join(fullPkgPath, name)\n\t\trelRemotePath, err := path.RelativizePaths(absLocalDirPath, absRemotePath)\n\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Couldn't relativize paths: \" + err.Error())\n\t\t}\n\n\t\trejoinedPath := filepath.Join(absLocalDirPath, relRemotePath)\n\n\t\tif _, err := os.Stat(rejoinedPath); os.IsNotExist(err) {\n\n\t\t\treturn errors.New(\"Unexpected error: relRemotePath of \" + relRemotePath + \" doesn't exist \" + absLocalDirPath + \" : \" + absRemotePath + \"(\" + rejoinedPath + \")\")\n\t\t}\n\n\t\tif _, err := os.Stat(localPath); err == nil {\n\t\t\t//Must already exist, so can skip\n\t\t\tcontinue\n\t\t}\n\n\t\tif copyFiles && !info.IsDir() {\n\t\t\tfmt.Println(\"Copying \" + localPath + \" to \" + relRemotePath)\n\t\t\tif err := copyFile(absRemotePath, localPath); err != nil {\n\t\t\t\treturn errors.New(\"Couldn't copy \" + name + \": \" + err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"Linking \" + localPath + \" to \" + relRemotePath)\n\t\t\tif err := os.Symlink(relRemotePath, localPath); err != nil {\n\t\t\t\treturn errors.New(\"Couldn't link \" + name + \": \" + err.Error())\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func PushRegionResources(req *restful.Request, resp *restful.Response) {\n\tresourcesReq := new(types.RegionResourcesReq)\n\terr := req.ReadEntity(&resourcesReq)\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to unmarshall region resources from request body, err: %s\", err)\n\t\tutils.WriteFailedJSONResponse(resp, http.StatusBadRequest, utils.RequestBodyParamInvalid(err.Error()))\n\t\treturn\n\t}\n\tklog.Infof(\"RegionResourceReq: %s\", utils.GetJSONString(resourcesReq))\n\tresources := resourcesReq.RegionResources\n\tsched := scheduler.GetScheduler()\n\tif sched == nil {\n\t\tklog.Errorf(\"Scheduler is not initialized, please wait...\")\n\t\tutils.WriteFailedJSONResponse(resp, http.StatusInternalServerError, utils.InternalServerError())\n\t\treturn\n\t}\n\tfor _, resource := range resources {\n\t\terr = sched.UpdateSiteDynamicResource(resource.RegionName, &types.SiteResource{CPUMemResources: resource.CPUMemResources, VolumeResources: resource.VolumeResources})\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Schedule to update site dynamic resource for region %s with err %v\", resource.RegionName, err)\n\t\t\tutils.WriteFailedJSONResponse(resp, http.StatusInternalServerError, utils.InternalServerWithError(err.Error()))\n\t\t\treturn\n\t\t}\n\t}\n\tresourceResp := types.SiteResourceRes{Result: \"ok\"}\n\tresp.WriteHeaderAndEntity(http.StatusCreated, resourceResp)\n}", "func removeEscalatingResources(in rbacv1.PolicyRule) rbacv1.PolicyRule {\n\tvar ruleCopy *rbacv1.PolicyRule\n\n\tfor _, resource := range escalatingScopeResources {\n\t\tif !(has(in.APIGroups, resource.Group) && has(in.Resources, resource.Resource)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif ruleCopy == nil {\n\t\t\t// we're using a cache of cache of an object that uses pointers to data. I'm pretty sure we need to do a copy to avoid\n\t\t\t// muddying the cache\n\t\t\truleCopy = in.DeepCopy()\n\t\t}\n\n\t\truleCopy.Resources = remove(ruleCopy.Resources, resource.Resource)\n\t}\n\n\tif ruleCopy != nil {\n\t\treturn *ruleCopy\n\t}\n\n\treturn in\n}", "func removeEscalatingResources(in rbacv1.PolicyRule) rbacv1.PolicyRule {\n\tvar ruleCopy *rbacv1.PolicyRule\n\n\tfor _, resource := range escalatingScopeResources {\n\t\tif !(has(in.APIGroups, resource.Group) && has(in.Resources, resource.Resource)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif ruleCopy == nil {\n\t\t\t// we're using a cache of cache of an object that uses pointers to data. I'm pretty sure we need to do a copy to avoid\n\t\t\t// muddying the cache\n\t\t\truleCopy = in.DeepCopy()\n\t\t}\n\n\t\truleCopy.Resources = remove(ruleCopy.Resources, resource.Resource)\n\t}\n\n\tif ruleCopy != nil {\n\t\treturn *ruleCopy\n\t}\n\n\treturn in\n}", "func (na *Nagent) dedupReferences(compositeKey string) {\n\tlog.Infof(\"Lateral DB: %v pre dedup: %v\", compositeKey, na.LateralDB[compositeKey])\n\tif len(na.LateralDB[compositeKey]) < 2 {\n\t\treturn\n\t}\n\tmarker := 0\n\tfor idx := 1; idx < len(na.LateralDB[compositeKey]); idx++ {\n\t\tif na.LateralDB[compositeKey][marker] == na.LateralDB[compositeKey][idx] {\n\t\t\tcontinue\n\t\t}\n\t\tmarker++\n\t\tna.LateralDB[compositeKey][marker] = na.LateralDB[compositeKey][idx]\n\t}\n\tna.LateralDB[compositeKey] = na.LateralDB[compositeKey][:marker+1]\n}", "func (c *Controller) cleanupNegotiatedAPIResource(ctx context.Context, clusterName string, gvr metav1.GroupVersionResource, negotiatedApiResource *apiresourcev1alpha1.NegotiatedAPIResource) error {\n\t// In any case change the status on every APIResourceImport with the same GVR, to remove Compatible and Available conditions.\n\n\tobjs, err := c.apiResourceImportIndexer.ByIndex(clusterNameAndGVRIndexName, GetClusterNameAndGVRIndexKey(clusterName, gvr))\n\tif err != nil {\n\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\treturn err\n\t}\n\tfor _, obj := range objs {\n\t\tapiResourceImport := obj.(*apiresourcev1alpha1.APIResourceImport).DeepCopy()\n\t\tapiResourceImport.RemoveCondition(apiresourcev1alpha1.Available)\n\t\tapiResourceImport.RemoveCondition(apiresourcev1alpha1.Compatible)\n\t\tif _, err := c.kcpClient.ApiresourceV1alpha1().APIResourceImports().UpdateStatus(ctx, apiResourceImport, metav1.UpdateOptions{}); err != nil {\n\t\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// if a CRD with the same GR has a version == to the current NegotiatedAPIResource version *and* has the current object as owner:\n\t// => if this CRD version is the only one, then delete the CRD\n\t// else remove this CRD version from the CRD, as well as the corresponding owner\n\n\tcrdName := gvr.Resource\n\tif gvr.Group == \"\" {\n\t\tcrdName = crdName + \".core\"\n\t} else {\n\t\tcrdName = crdName + \".\" + gvr.Group\n\t}\n\n\tcrdKey, err := cache.MetaNamespaceKeyFunc(&metav1.PartialObjectMetadata{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: crdName,\n\t\t\tClusterName: clusterName,\n\t\t},\n\t})\n\tif err != nil {\n\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\treturn err\n\t}\n\tcrd, err := c.crdLister.Get(crdKey)\n\tif k8serrors.IsNotFound(err) {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\treturn err\n\t}\n\n\tvar ownerReferenceAlreadyExists bool\n\tvar cleanedOwnerReferences []metav1.OwnerReference\n\tfor _, ownerRef := range crd.OwnerReferences {\n\t\tif ownerRef.Name == negotiatedApiResource.Name && ownerRef.UID == negotiatedApiResource.UID {\n\t\t\townerReferenceAlreadyExists = true\n\t\t\tcontinue\n\t\t}\n\t\tcleanedOwnerReferences = append(cleanedOwnerReferences, ownerRef)\n\t}\n\tif !ownerReferenceAlreadyExists {\n\t\treturn nil\n\t}\n\n\tvar cleanedVersions []apiextensionsv1.CustomResourceDefinitionVersion\n\tfor _, version := range crd.Spec.Versions {\n\t\tif version.Name == gvr.Version {\n\t\t\tcontinue\n\t\t}\n\t\tcleanedVersions = append(cleanedVersions, version)\n\t}\n\tif len(cleanedVersions) == len(crd.Spec.Versions) {\n\t\treturn nil\n\t}\n\tif len(cleanedVersions) == 0 {\n\t\tif err := c.apiExtensionsClient.ApiextensionsV1().CustomResourceDefinitions().Delete(ctx, crd.Name, metav1.DeleteOptions{}); err != nil {\n\t\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tcrd = crd.DeepCopy()\n\t\tcrd.Spec.Versions = cleanedVersions\n\t\tcrd.OwnerReferences = cleanedOwnerReferences\n\t\tif _, err := c.apiExtensionsClient.ApiextensionsV1().CustomResourceDefinitions().Update(ctx, crd, metav1.UpdateOptions{}); err != nil {\n\t\t\tklog.Errorf(\"Error in %s: %v\", runtime.GetCaller(), err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (b *Botanist) DeployContainerRuntimeResources(ctx context.Context) error {\n\tfns := []flow.TaskFn{}\n\tfor _, worker := range b.Shoot.Info.Spec.Provider.Workers {\n\t\tif worker.CRI != nil {\n\t\t\tfor _, containerRuntime := range worker.CRI.ContainerRuntimes {\n\t\t\t\tcr := containerRuntime\n\t\t\t\tworkerName := worker.Name\n\t\t\t\ttoApply := extensionsv1alpha1.ContainerRuntime{\n\t\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\t\tName: getContainerRuntimeKey(cr.Type, workerName),\n\t\t\t\t\t\tNamespace: b.Shoot.SeedNamespace,\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tfns = append(fns, func(ctx context.Context) error {\n\t\t\t\t\t_, err := controllerutil.CreateOrUpdate(ctx, b.K8sSeedClient.Client(), &toApply, func() error {\n\t\t\t\t\t\tmetav1.SetMetaDataAnnotation(&toApply.ObjectMeta, v1beta1constants.GardenerOperation, v1beta1constants.GardenerOperationReconcile)\n\t\t\t\t\t\ttoApply.Spec.BinaryPath = extensionsv1alpha1.ContainerDRuntimeContainersBinFolder\n\t\t\t\t\t\ttoApply.Spec.Type = cr.Type\n\t\t\t\t\t\tif cr.ProviderConfig != nil {\n\t\t\t\t\t\t\ttoApply.Spec.ProviderConfig = &cr.ProviderConfig.RawExtension\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttoApply.Spec.WorkerPool.Name = workerName\n\t\t\t\t\t\ttoApply.Spec.WorkerPool.Selector.MatchLabels = map[string]string{gardencorev1beta1constants.LabelWorkerPool: workerName, gardencorev1beta1constants.LabelWorkerPoolDeprecated: workerName}\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t})\n\t\t\t\t\treturn err\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn flow.Parallel(fns...)(ctx)\n}", "func match(manifests []model.Manifest, requestedManifests []model.ManifestName) ([]model.ManifestName, error) {\n\tif len(requestedManifests) == 0 {\n\t\tvar result []model.ManifestName\n\t\tfor _, m := range manifests {\n\t\t\tresult = append(result, m.Name)\n\t\t}\n\t\treturn result, nil\n\t}\n\n\tmanifestsByName := make(map[model.ManifestName]model.Manifest)\n\tfor _, m := range manifests {\n\t\tmanifestsByName[m.Name] = m\n\t}\n\n\tmanifestsToRun := make(map[model.ManifestName]bool)\n\tvar unknownNames []string\n\n\tfor _, m := range requestedManifests {\n\t\tif _, ok := manifestsByName[m]; !ok {\n\t\t\tunknownNames = append(unknownNames, string(m))\n\t\t\tcontinue\n\t\t}\n\n\t\taddManifestAndDeps(manifestsToRun, manifestsByName, m)\n\t}\n\n\tvar result []model.ManifestName\n\tfor _, m := range manifests {\n\t\t// Default to including UnresourcedYAML (\"Uncategorized\") to match historical behavior.\n\t\tif manifestsToRun[m.Name] || m.Name == model.UnresourcedYAMLManifestName {\n\t\t\tresult = append(result, m.Name)\n\t\t}\n\t}\n\n\tif len(unknownNames) > 0 {\n\t\tunmatchedNames := unmatchedManifestNames(manifests, requestedManifests)\n\n\t\treturn nil, fmt.Errorf(`You specified some resources that could not be found: %s\nIs this a typo? Existing resources in Tiltfile: %s`,\n\t\t\tsliceutils.QuotedStringList(unknownNames),\n\t\t\tsliceutils.QuotedStringList(unmatchedNames))\n\t}\n\n\treturn result, nil\n}", "func DelAllResources(nsId string, resourceType string, forceFlag string) error {\n\n\terr := common.CheckString(nsId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn err\n\t}\n\n\tresourceIdList, err := ListResourceId(nsId, resourceType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(resourceIdList) == 0 {\n\t\treturn nil\n\t}\n\n\tfor _, v := range resourceIdList {\n\t\terr := DelResource(nsId, resourceType, v, forceFlag)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (client *Client) UntagResourcesWithOptions(request *UntagResourcesRequest, runtime *util.RuntimeOptions) (_result *UntagResourcesResponse, _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.All)) {\n\t\tquery[\"All\"] = request.All\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerAccount)) {\n\t\tquery[\"OwnerAccount\"] = request.OwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.RegionId)) {\n\t\tquery[\"RegionId\"] = request.RegionId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceId)) {\n\t\tquery[\"ResourceId\"] = request.ResourceId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerAccount)) {\n\t\tquery[\"ResourceOwnerAccount\"] = request.ResourceOwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerId)) {\n\t\tquery[\"ResourceOwnerId\"] = request.ResourceOwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceType)) {\n\t\tquery[\"ResourceType\"] = request.ResourceType\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.TagKey)) {\n\t\tquery[\"TagKey\"] = request.TagKey\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UntagResources\"),\n\t\tVersion: tea.String(\"2015-01-01\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &UntagResourcesResponse{}\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 (p *DeliveryConfigProcessor) UpsertResource(resource *ExportableResource, envName string, content []byte) (added bool, err error) {\n\tdata, err := p.bytesToData(content)\n\tif err != nil {\n\t\treturn false, xerrors.Errorf(\"failed to parse content: %w\", err)\n\t}\n\tdeliveryResource := &DeliveryResource{}\n\terr = yaml.Unmarshal(content, &deliveryResource)\n\tif err != nil {\n\t\treturn false, xerrors.Errorf(\"unmarshal delivery resource: %w\", ErrorInvalidContent{Content: content, ParseError: err})\n\t}\n\n\tenvIx := p.findEnvIndex(envName)\n\tenvsNode := walky.GetKey(p.rawDeliveryConfig, \"environments\")\n\n\tif envsNode == nil || envIx < 0 {\n\t\t// new environment\n\t\tkeyNode, _ := walky.ToNode(\"environments\")\n\t\tif envsNode == nil {\n\t\t\tenvsNode = walky.NewSequenceNode()\n\t\t}\n\t\tnewEnvNode, err := walky.ToNode(map[string]interface{}{\n\t\t\t\"name\": envName,\n\t\t\t\"constraints\": p.constraintsProvider(envName, p.deliveryConfig),\n\t\t\t\"notifications\": p.notificationsProvider(envName, p.deliveryConfig),\n\t\t\t\"resources\": []interface{}{data},\n\t\t\t\"verifyWith\": p.verifyWithProvider(envName, p.deliveryConfig),\n\t\t\t\"postDeploy\": p.postDeployProvider(envName, p.deliveryConfig),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t}\n\t\terr = walky.AppendNode(envsNode, newEnvNode)\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"append node: %w\", err)\n\t\t}\n\t\terr = walky.AssignMapNode(p.rawDeliveryConfig, keyNode, envsNode)\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"assign map node: %w\", err)\n\t\t}\n\t\t// update in memory struct in case we look for this environment again later\n\t\tp.deliveryConfig.Environments = append(p.deliveryConfig.Environments, &DeliveryEnvironment{\n\t\t\tName: envName,\n\t\t\tResources: []*DeliveryResource{deliveryResource},\n\t\t})\n\t\tadded = true\n\t} else if len(envsNode.Content) > envIx {\n\t\tenvNode := envsNode.Content[envIx]\n\t\tif !walky.HasKey(envNode, \"constraints\") {\n\t\t\tkeyNode, _ := walky.ToNode(\"constraints\")\n\t\t\tvalNode, err := walky.ToNode(p.constraintsProvider(envName, p.deliveryConfig))\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t\t}\n\t\t\terr = walky.AssignMapNode(envNode, keyNode, valNode)\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"assign map node: %w\", err)\n\t\t\t}\n\t\t}\n\t\tif !walky.HasKey(envNode, \"notifications\") {\n\t\t\tkeyNode, _ := walky.ToNode(\"notifications\")\n\t\t\tvalNode, err := walky.ToNode(p.notificationsProvider(envName, p.deliveryConfig))\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t\t}\n\t\t\terr = walky.AssignMapNode(envNode, keyNode, valNode)\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"assign map node: %w\", err)\n\t\t\t}\n\t\t}\n\t\tresourcesNode := walky.GetKey(envNode, \"resources\")\n\t\tif resourcesNode != nil {\n\t\t\tresourceIx := p.findResourceIndex(resource, envIx)\n\t\t\tdataNode, err := walky.ToNode(data)\n\t\t\tif err != nil {\n\t\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t\t}\n\t\t\tif resourceIx < 0 {\n\t\t\t\tp.deliveryConfig.Environments[envIx].Resources = append(p.deliveryConfig.Environments[envIx].Resources, deliveryResource)\n\t\t\t\twalky.AppendNode(resourcesNode, dataNode)\n\t\t\t\tadded = true\n\t\t\t} else {\n\t\t\t\tp.deliveryConfig.Environments[envIx].Resources[resourceIx] = deliveryResource\n\t\t\t\tresourcesNode.Content[resourceIx] = dataNode\n\t\t\t}\n\t\t}\n\t\tkeyNode, _ := walky.ToNode(\"verifyWith\")\n\t\tveryWithNode, err := walky.ToNode(p.verifyWithProvider(envName, p.deliveryConfig))\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t}\n\t\twalky.AssignMapNode(envNode, keyNode, veryWithNode) // overwrite previous config\n\n\t\tkeyNode, _ = walky.ToNode(\"postDeploy\")\n\t\tpostDeployNode, err := walky.ToNode(p.postDeployProvider(envName, p.deliveryConfig))\n\t\tif err != nil {\n\t\t\treturn false, xerrors.Errorf(\"convert to node: %w\", err)\n\t\t}\n\t\twalky.AssignMapNode(envNode, keyNode, postDeployNode) // overwrite previous config\n\t}\n\treturn added, nil\n}", "func ExcludeKubernetesResource(fs afero.Afero, basePath string, excludedResource string) ([]resid.ResId, error) {\n\tkustomization, err := getKustomization(fs, basePath)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"get kustomization for %s\", basePath)\n\t}\n\n\texcludedResource = strings.TrimPrefix(excludedResource, string(filepath.Separator))\n\n\tnewResources := []string{}\n\tvar excludedResourceBytes []byte\n\tfor _, existingResource := range kustomization.Resources {\n\t\tif existingResource != excludedResource {\n\t\t\tnewResources = append(newResources, existingResource)\n\t\t} else {\n\t\t\texcludedResourceBytes, err = fs.ReadFile(filepath.Join(basePath, excludedResource))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"read to-be-excluded resource file\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(newResources) != len(kustomization.Resources) {\n\t\t// parse to-be-excluded resource file\n\n\t\texcludedResources, err := NewKubernetesResources(excludedResourceBytes)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"parse to-be-excluded resource file\")\n\t\t}\n\n\t\tkustomization.Resources = newResources\n\t\t// write updated kustomization to disk - resource has been removed\n\n\t\terr = writeKustomization(fs, basePath, kustomization)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"persist kustomization for %s\", basePath)\n\t\t}\n\t\treturn ResIDs(excludedResources), nil\n\t}\n\n\t// check if the resource is already removed from this dir\n\talreadyRemoved, err := fs.Exists(filepath.Join(basePath, excludedResource))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"check if %s exists in %s\", excludedResource, basePath)\n\t}\n\tif alreadyRemoved {\n\t\t// the file to be removed exists within this base dir, and not within the kustomization yaml\n\t\texcludedResourceBytes, err = fs.ReadFile(filepath.Join(basePath, excludedResource))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"read already-excluded resource file\")\n\t\t}\n\n\t\texcludedResources, err := NewKubernetesResources(excludedResourceBytes)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"parse already-excluded resource file\")\n\t\t}\n\n\t\treturn ResIDs(excludedResources), nil\n\t}\n\n\tfor _, newBase := range kustomization.Bases {\n\t\tnewBase = filepath.Clean(filepath.Join(basePath, newBase))\n\t\tcleanBase := strings.ReplaceAll(newBase, string(filepath.Separator), \"-\")\n\n\t\tif strings.HasPrefix(excludedResource, cleanBase) {\n\t\t\tupdatedResource := strings.TrimPrefix(excludedResource, cleanBase)\n\t\t\tupdatedResource = strings.TrimPrefix(updatedResource, string(filepath.Separator))\n\n\t\t\treturn ExcludeKubernetesResource(fs, newBase, updatedResource)\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"unable to find resource %s in %s or its bases\", excludedResource, basePath)\n}", "func (dc *DeploymentController) cleanupDeployment(ctx context.Context, oldRSs []*apps.ReplicaSet, deployment *apps.Deployment) error {\n\tlogger := klog.FromContext(ctx)\n\tif !deploymentutil.HasRevisionHistoryLimit(deployment) {\n\t\treturn nil\n\t}\n\n\t// Avoid deleting replica set with deletion timestamp set\n\taliveFilter := func(rs *apps.ReplicaSet) bool {\n\t\treturn rs != nil && rs.ObjectMeta.DeletionTimestamp == nil\n\t}\n\tcleanableRSes := controller.FilterReplicaSets(oldRSs, aliveFilter)\n\n\tdiff := int32(len(cleanableRSes)) - *deployment.Spec.RevisionHistoryLimit\n\tif diff <= 0 {\n\t\treturn nil\n\t}\n\n\tsort.Sort(deploymentutil.ReplicaSetsByRevision(cleanableRSes))\n\tlogger.V(4).Info(\"Looking to cleanup old replica sets for deployment\", \"deployment\", klog.KObj(deployment))\n\n\tfor i := int32(0); i < diff; i++ {\n\t\trs := cleanableRSes[i]\n\t\t// Avoid delete replica set with non-zero replica counts\n\t\tif rs.Status.Replicas != 0 || *(rs.Spec.Replicas) != 0 || rs.Generation > rs.Status.ObservedGeneration || rs.DeletionTimestamp != nil {\n\t\t\tcontinue\n\t\t}\n\t\tlogger.V(4).Info(\"Trying to cleanup replica set for deployment\", \"replicaSet\", klog.KObj(rs), \"deployment\", klog.KObj(deployment))\n\t\tif err := dc.client.AppsV1().ReplicaSets(rs.Namespace).Delete(ctx, rs.Name, metav1.DeleteOptions{}); err != nil && !errors.IsNotFound(err) {\n\t\t\t// Return error instead of aggregating and continuing DELETEs on the theory\n\t\t\t// that we may be overloading the api server.\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func normalizeAPIGroupResources(apiGroupResource *restmapper.APIGroupResources) []metav1.APIResource {\n\tvar versionedResources []metav1.APIResource\n\tfor version, vr := range apiGroupResource.VersionedResources {\n\t\tfor _, resource := range vr {\n\t\t\tresource.Group = apiGroupResource.Group.Name\n\t\t\tresource.Version = version\n\t\t\tversionedResources = append(versionedResources, resource)\n\t\t}\n\t}\n\n\t// Ensure deterministic output.\n\tpreferredVersion := apiGroupResource.Group.PreferredVersion.Version\n\tsort.SliceStable(versionedResources, func(i, j int) bool {\n\t\tif versionedResources[i].Version == versionedResources[j].Version {\n\t\t\treturn versionedResources[i].Name < versionedResources[j].Name\n\t\t}\n\n\t\t// preferred version\n\t\tif versionedResources[i].Version == preferredVersion {\n\t\t\treturn true\n\t\t}\n\t\tif versionedResources[j].Version == preferredVersion {\n\t\t\treturn false\n\t\t}\n\n\t\t// compare kube-like version\n\t\t// Versions will be sorted based on GA/alpha/beta first and then major and minor versions.\n\t\t// e.g. v2, v1, v1beta2, v1beta1, v1alpha1.\n\t\treturn version.CompareKubeAwareVersionStrings(versionedResources[i].Version, versionedResources[j].Version) > 0\n\t})\n\n\t// pick out preferred version or highest semantic version\n\tregistered := make(map[string]bool)\n\tvar normalizedVersionResources []metav1.APIResource\n\tfor _, vr := range versionedResources {\n\t\tif registered[vr.Name] {\n\t\t\tcontinue\n\t\t}\n\t\tnormalizedVersionResources = append(normalizedVersionResources, vr)\n\t\tregistered[vr.Name] = true\n\t}\n\treturn normalizedVersionResources\n}", "func GenRedeployPipelineYaml(runtimeID uint64) apistructs.PipelineYml {\n\tyml := apistructs.PipelineYml{\n\t\tVersion: \"1.1\",\n\t\tStages: [][]*apistructs.PipelineYmlAction{\n\t\t\t{{\n\t\t\t\tType: \"dice-deploy-redeploy\",\n\t\t\t\tAlias: \"dice-deploy-redeploy\",\n\t\t\t\tVersion: \"1.0\",\n\t\t\t\tParams: map[string]interface{}{\n\t\t\t\t\t\"runtime_id\": strconv.FormatUint(runtimeID, 10),\n\t\t\t\t},\n\t\t\t}},\n\t\t\t{{\n\t\t\t\tType: \"dice-deploy-addon\",\n\t\t\t\tVersion: \"1.0\",\n\t\t\t\tParams: map[string]interface{}{\n\t\t\t\t\t\"deployment_id\": \"${dice-deploy-redeploy:OUTPUT:deployment_id}\",\n\t\t\t\t},\n\t\t\t}},\n\t\t\t{{\n\t\t\t\tType: \"dice-deploy-service\",\n\t\t\t\tVersion: \"1.0\",\n\t\t\t\tParams: map[string]interface{}{\n\t\t\t\t\t\"deployment_id\": \"${dice-deploy-redeploy:OUTPUT:deployment_id}\",\n\t\t\t\t},\n\t\t\t}},\n\t\t\t{{\n\t\t\t\tType: \"dice-deploy-domain\",\n\t\t\t\tVersion: \"1.0\",\n\t\t\t\tParams: map[string]interface{}{\n\t\t\t\t\t\"deployment_id\": \"${dice-deploy-redeploy:OUTPUT:deployment_id}\",\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t}\n\n\treturn yml\n}", "func mergePatchMatches(fs afero.Afero, basePath string, mergePatch string, excludedResource resid.ResId) (bool, error) {\n\t// read contents of resource and convert it to ResID form\n\tpatchBytes, err := fs.ReadFile(filepath.Join(basePath, string(mergePatch)))\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"read %s in %s to exclude patches for %s\", string(mergePatch), basePath, excludedResource.String())\n\t}\n\n\tpatchResources, err := NewKubernetesResources(patchBytes)\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"parse %s in %s to exclude patches for %s\", string(mergePatch), basePath, excludedResource.String())\n\t}\n\n\tpatchIDs := ResIDs(patchResources)\n\n\tfor _, patchID := range patchIDs {\n\t\tif patchID.GvknEquals(excludedResource) {\n\t\t\t// this file of patches touches the excluded resource, and should be discarded\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "func (s *server) veleroResourcesExist() error {\n\ts.logger.Info(\"Checking existence of Velero custom resource definitions\")\n\n\t// add more group versions whenever available\n\tgvResources := map[string]sets.String{\n\t\tvelerov1api.SchemeGroupVersion.String(): velerov1api.CustomResourceKinds(),\n\t\tvelerov2alpha1api.SchemeGroupVersion.String(): velerov2alpha1api.CustomResourceKinds(),\n\t}\n\n\tfor _, lst := range s.discoveryHelper.Resources() {\n\t\tif resources, found := gvResources[lst.GroupVersion]; found {\n\t\t\tfor _, resource := range lst.APIResources {\n\t\t\t\ts.logger.WithField(\"kind\", resource.Kind).Info(\"Found custom resource\")\n\t\t\t\tresources.Delete(resource.Kind)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar errs []error\n\tfor gv, resources := range gvResources {\n\t\tfor kind := range resources {\n\t\t\terrs = append(errs, errors.Errorf(\"custom resource %s not found in Velero API group %s\", kind, gv))\n\t\t}\n\t}\n\n\tif len(errs) > 0 {\n\t\terrs = append(errs, errors.New(\"Velero custom resources not found - apply config/crd/v1/bases/*.yaml,config/crd/v2alpha1/bases*.yaml, to update the custom resource definitions\"))\n\t\treturn kubeerrs.NewAggregate(errs)\n\t}\n\n\ts.logger.Info(\"All Velero custom resource definitions exist\")\n\treturn nil\n}", "func (dst *Hosts) Merge(src Hosts) {\n\tif dst == nil || len(src) == 0 {\n\t\treturn\n\t}\n\n\tcopied := *dst\n\tcopied = append(copied, src...)\n\n\tregistry := map[string]int{}\n\tfor i := len(copied); i > 0; i-- {\n\t\tregistry[copied[i-1].Name] = i - 1\n\t}\n\tunique := copied[:0]\n\tfor i, host := range copied {\n\t\torigin := registry[host.Name]\n\t\tif i == origin {\n\t\t\tunique = append(unique, host)\n\t\t\tcontinue\n\t\t}\n\t\tunique[origin].Merge(host)\n\t}\n\n\t*dst = unique\n}", "func UnExcludeKubernetesResource(fs afero.Afero, basePath string, unExcludedResource string) error {\n\tkustomization, err := getKustomization(fs, basePath)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"get kustomization for %s\", basePath)\n\t}\n\n\tunExcludedResource = strings.TrimPrefix(unExcludedResource, string(filepath.Separator))\n\n\t// check if the resource is already included, if it is there is nothing left to do\n\tfor _, existingResource := range kustomization.Resources {\n\t\tif existingResource == unExcludedResource {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tresourceLength := len(kustomization.Resources)\n\n\terr = fs.Walk(basePath, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"walk %s\", path)\n\t\t}\n\t\trelPath, err := filepath.Rel(basePath, path)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"get relative path to %s from %s\", path, basePath)\n\t\t}\n\n\t\tif relPath == unExcludedResource {\n\t\t\tkustomization.Resources = append(kustomization.Resources, unExcludedResource)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"walk files in %s\", basePath)\n\t}\n\n\tif resourceLength != len(kustomization.Resources) {\n\t\t// write updated kustomization to disk - resource has been reincluded\n\t\terr = writeKustomization(fs, basePath, kustomization)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"persist kustomization for %s\", basePath)\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, newBase := range kustomization.Bases {\n\t\tnewBase = filepath.Clean(filepath.Join(basePath, newBase))\n\t\tcleanBase := strings.ReplaceAll(newBase, string(filepath.Separator), \"-\")\n\n\t\tif strings.HasPrefix(unExcludedResource, cleanBase) {\n\t\t\tupdatedResource := strings.TrimPrefix(unExcludedResource, cleanBase)\n\t\t\tupdatedResource = strings.TrimPrefix(updatedResource, string(filepath.Separator))\n\n\t\t\treturn UnExcludeKubernetesResource(fs, newBase, updatedResource)\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"unable to find resource %s in %s or its bases\", unExcludedResource, basePath)\n}", "func (r *TenantReconciler) pruningResources(ns string, keys []string, obj runtime.Object) error {\n\tcapsuleLabel, err := capsulev1alpha1.GetTypeLabel(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\texists, err := labels.NewRequirement(capsuleLabel, selection.Exists, []string{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tnotIn, err := labels.NewRequirement(capsuleLabel, selection.NotIn, keys)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.Log.Info(\"Pruning objects with label selector \" + notIn.String())\n\terr = retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\treturn r.DeleteAllOf(context.TODO(), obj, &client.DeleteAllOfOptions{\n\t\t\tListOptions: client.ListOptions{\n\t\t\t\tLabelSelector: labels.NewSelector().Add(*exists, *notIn),\n\t\t\t\tNamespace: ns,\n\t\t\t},\n\t\t\tDeleteOptions: client.DeleteOptions{},\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func SortResources(resources []*metav1.APIResourceList) {\n\tsort.SliceStable(resources, func(i, j int) bool {\n\t\tleft := resources[i]\n\t\tleftGV, _ := schema.ParseGroupVersion(left.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif leftGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"greater\"\n\t\t\treturn false\n\t\t}\n\n\t\tright := resources[j]\n\t\trightGV, _ := schema.ParseGroupVersion(right.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif rightGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"less\"\n\t\t\treturn true\n\t\t}\n\n\t\treturn i < j\n\t})\n}", "func (r *deletedReconciler) deleteCreatedResources(ctx context.Context, name, namespace string) (err error) {\n\tlabelMap := map[string]string{\n\t\tOpsrcOwnerNameLabel: name,\n\t\tOpsrcOwnerNamespaceLabel: namespace,\n\t}\n\tlabelSelector := labels.SelectorFromSet(labelMap)\n\toptions := &client.ListOptions{LabelSelector: labelSelector}\n\n\t// Delete Catalog Source Configs\n\tcatalogSourceConfigs := &marketplace.CatalogSourceConfigList{}\n\terr = r.client.List(ctx, options, catalogSourceConfigs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, catalogSourceConfig := range catalogSourceConfigs.Items {\n\t\tr.logger.Infof(\"Removing catalogSourceConfig %s from namespace %s\", catalogSourceConfig.Name, catalogSourceConfig.Namespace)\n\t\terr = r.client.Delete(ctx, &catalogSourceConfig)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn\n}", "func TestRemoveDups(t *testing.T) {\n\tsuite.Run(t, new(RemoveDupsTestingSuite))\n}", "func testAccCheckTwingateResourceDestroy(s *terraform.State) error {\n\tclient := testAccProvider.Meta().(*Client)\n\n\tfor _, rs := range s.RootModule().Resources {\n\t\tif rs.Type != \"twingate_resource\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tresourceId := rs.Primary.ID\n\n\t\terr := client.deleteResource(resourceId)\n\t\t// expecting error here , since the resource is already gone\n\t\tif err == nil {\n\t\t\treturn fmt.Errorf(\"resource with ID %s still present : \", resourceId)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (r *Compare) CompareCRDs() (map[string][]schema.GroupVersionResource, error) {\n\tsrcCRDResource, err := collectPreferredCRDResource(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdstCRDResourceList, err := collectCRDResources(r.DstDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcrdGVDiff := r.compareResources(srcCRDResource, dstCRDResourceList)\n\t// if len(crdGVDiff)>0, then CRD APIVersion is incompatible between src and dest\n\tif len(crdGVDiff) > 0 {\n\t\tsrcCRDs, err := collectPreferredResources(r.SrcDiscovery)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsrcCRDs, err = r.includeCRDsOnly(srcCRDs, srcCRDResource, r.SrcClient)\n\n\t\tdstCRDs, err := collectNamespacedResources(r.DstDiscovery)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdstCRDs, err = r.includeCRDsOnly(dstCRDs, dstCRDResourceList, r.DstClient)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcrdsDiff := r.compareResources(srcCRDs, dstCRDs)\n\t\tincompatibleGVKs, err := convertToGVRList(crdsDiff)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Don't report an incompatibleGVK if user settings will skip resource anyways\n\t\texcludedResources := toStringSlice(settings.ExcludedInitialResources.Union(toSet(r.Plan.Status.ExcludedResources)))\n\t\tfilteredGVKs := []schema.GroupVersionResource{}\n\t\tfor _, gvr := range incompatibleGVKs {\n\t\t\tskip := false\n\t\t\tfor _, resource := range excludedResources {\n\t\t\t\tif strings.EqualFold(gvr.Resource, resource) {\n\t\t\t\t\tskip = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !skip {\n\t\t\t\tfilteredGVKs = append(filteredGVKs, gvr)\n\t\t\t}\n\t\t}\n\n\t\treturn r.collectIncompatibleMapping(filteredGVKs)\n\t}\n\treturn nil, nil\n}", "func (dn *Daemon) deleteStaleData(oldIgnConfig, newIgnConfig ign3types.Config) error {\n\tklog.Info(\"Deleting stale data\")\n\tnewFileSet := make(map[string]struct{})\n\tfor _, f := range newIgnConfig.Storage.Files {\n\t\tnewFileSet[f.Path] = struct{}{}\n\t}\n\n\t// need to skip these on upgrade if they are in a MC, or else we will remove all certs!\n\tcertsToSkip := []string{\n\t\tuserCABundleFilePath,\n\t\tcaBundleFilePath,\n\t\tcloudCABundleFilePath,\n\t}\n\tfor _, f := range oldIgnConfig.Storage.Files {\n\t\tif _, ok := newFileSet[f.Path]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tskipBecauseCert := false\n\t\tfor _, cert := range certsToSkip {\n\t\t\tif cert == f.Path {\n\t\t\t\tskipBecauseCert = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif strings.Contains(filepath.Dir(f.Path), imageCAFilePath) {\n\t\t\tskipBecauseCert = true\n\t\t}\n\t\tif skipBecauseCert {\n\t\t\tcontinue\n\t\t}\n\t\tif _, err := os.Stat(noOrigFileStampName(f.Path)); err == nil {\n\t\t\tif delErr := os.Remove(noOrigFileStampName(f.Path)); delErr != nil {\n\t\t\t\treturn fmt.Errorf(\"deleting noorig file stamp %q: %w\", noOrigFileStampName(f.Path), delErr)\n\t\t\t}\n\t\t\tklog.V(2).Infof(\"Removing file %q completely\", f.Path)\n\t\t} else if _, err := os.Stat(origFileName(f.Path)); err == nil {\n\t\t\t// Add a check for backwards compatibility: basically if the file doesn't exist in /usr/etc (on FCOS/RHCOS)\n\t\t\t// and no rpm is claiming it, we assume that the orig file came from a wrongful backup of a MachineConfig\n\t\t\t// file instead of a file originally on disk. See https://bugzilla.redhat.com/show_bug.cgi?id=1814397\n\t\t\tvar restore bool\n\t\t\tif _, err := exec.Command(\"rpm\", \"-qf\", f.Path).CombinedOutput(); err == nil {\n\t\t\t\t// File is owned by an rpm\n\t\t\t\trestore = true\n\t\t\t} else if strings.HasPrefix(f.Path, \"/etc\") && dn.os.IsCoreOSVariant() {\n\t\t\t\tif _, err := os.Stat(withUsrPath(f.Path)); err != nil {\n\t\t\t\t\tif !os.IsNotExist(err) {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the error is ErrNotExist then we don't restore the file\n\t\t\t\t} else {\n\t\t\t\t\trestore = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif restore {\n\t\t\t\tif err := restorePath(f.Path); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tklog.V(2).Infof(\"Restored file %q\", f.Path)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif delErr := os.Remove(origFileName(f.Path)); delErr != nil {\n\t\t\t\treturn fmt.Errorf(\"deleting orig file %q: %w\", origFileName(f.Path), delErr)\n\t\t\t}\n\t\t}\n\n\t\t// Check Systemd.Units.Dropins - don't remove the file if configuration has been converted into a dropin\n\t\tif dn.isPathInDropins(f.Path, &newIgnConfig.Systemd) {\n\t\t\tklog.Infof(\"Not removing file %q: replaced with systemd dropin\", f.Path)\n\t\t\tcontinue\n\t\t}\n\n\t\tklog.V(2).Infof(\"Deleting stale config file: %s\", f.Path)\n\t\tif err := os.Remove(f.Path); err != nil {\n\t\t\tnewErr := fmt.Errorf(\"unable to delete %s: %w\", f.Path, err)\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\treturn newErr\n\t\t\t}\n\t\t\t// otherwise, just warn\n\t\t\tklog.Warningf(\"%v\", newErr)\n\t\t}\n\t\tklog.Infof(\"Removed stale file %q\", f.Path)\n\t}\n\n\tnewUnitSet := make(map[string]struct{})\n\tnewDropinSet := make(map[string]struct{})\n\tfor _, u := range newIgnConfig.Systemd.Units {\n\t\tfor j := range u.Dropins {\n\t\t\tpath := filepath.Join(pathSystemd, u.Name+\".d\", u.Dropins[j].Name)\n\t\t\tnewDropinSet[path] = struct{}{}\n\t\t}\n\t\tpath := filepath.Join(pathSystemd, u.Name)\n\t\tnewUnitSet[path] = struct{}{}\n\t}\n\n\tfor _, u := range oldIgnConfig.Systemd.Units {\n\t\tfor j := range u.Dropins {\n\t\t\tpath := filepath.Join(pathSystemd, u.Name+\".d\", u.Dropins[j].Name)\n\t\t\tif _, ok := newDropinSet[path]; !ok {\n\t\t\t\tif _, err := os.Stat(noOrigFileStampName(path)); err == nil {\n\t\t\t\t\tif delErr := os.Remove(noOrigFileStampName(path)); delErr != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"deleting noorig file stamp %q: %w\", noOrigFileStampName(path), delErr)\n\t\t\t\t\t}\n\t\t\t\t\tklog.V(2).Infof(\"Removing file %q completely\", path)\n\t\t\t\t} else if _, err := os.Stat(origFileName(path)); err == nil {\n\t\t\t\t\tif err := restorePath(path); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tklog.V(2).Infof(\"Restored file %q\", path)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tklog.V(2).Infof(\"Deleting stale systemd dropin file: %s\", path)\n\t\t\t\tif err := os.Remove(path); err != nil {\n\t\t\t\t\tnewErr := fmt.Errorf(\"unable to delete %s: %w\", path, err)\n\t\t\t\t\tif !os.IsNotExist(err) {\n\t\t\t\t\t\treturn newErr\n\t\t\t\t\t}\n\t\t\t\t\t// otherwise, just warn\n\t\t\t\t\tklog.Warningf(\"%v\", newErr)\n\t\t\t\t}\n\t\t\t\tklog.Infof(\"Removed stale systemd dropin %q\", path)\n\t\t\t}\n\t\t}\n\t\tpath := filepath.Join(pathSystemd, u.Name)\n\t\tif _, ok := newUnitSet[path]; !ok {\n\t\t\t// since the unit doesn't exist anymore within the MachineConfig,\n\t\t\t// look to restore defaults here, so that symlinks are removed first\n\t\t\t// if the system has the service disabled\n\t\t\t// writeUnits() will catch units that still have references in other MCs\n\t\t\tif err := dn.presetUnit(u); err != nil {\n\t\t\t\tklog.Infof(\"Did not restore preset for %s (may not exist): %s\", u.Name, err)\n\t\t\t}\n\t\t\tif _, err := os.Stat(noOrigFileStampName(path)); err == nil {\n\t\t\t\tif delErr := os.Remove(noOrigFileStampName(path)); delErr != nil {\n\t\t\t\t\treturn fmt.Errorf(\"deleting noorig file stamp %q: %w\", noOrigFileStampName(path), delErr)\n\t\t\t\t}\n\t\t\t\tklog.V(2).Infof(\"Removing file %q completely\", path)\n\t\t\t} else if _, err := os.Stat(origFileName(path)); err == nil {\n\t\t\t\tif err := restorePath(path); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tklog.V(2).Infof(\"Restored file %q\", path)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tklog.V(2).Infof(\"Deleting stale systemd unit file: %s\", path)\n\t\t\tif err := os.Remove(path); err != nil {\n\t\t\t\tnewErr := fmt.Errorf(\"unable to delete %s: %w\", path, err)\n\t\t\t\tif !os.IsNotExist(err) {\n\t\t\t\t\treturn newErr\n\t\t\t\t}\n\t\t\t\t// otherwise, just warn\n\t\t\t\tklog.Warningf(\"%v\", newErr)\n\t\t\t}\n\t\t\tklog.Infof(\"Removed stale systemd unit %q\", path)\n\t\t}\n\t}\n\n\treturn nil\n}", "func resourceAzurermResourceGroupNameDiffSuppress(k, old, new string, d *schema.ResourceData) bool {\n\treturn strings.ToLower(old) == strings.ToLower(new)\n}", "func (c *Clients) CheckPendingResources(r *ReleaseData) (bool, error) {\n\tlog.Printf(\"Checking pending resources in %s\", r.Name)\n\tvar err error\n\tvar errCount int\n\tvar pArray []bool\n\tif r.Manifest == \"\" {\n\t\treturn true, errors.New(\"Manifest not provided in the request\")\n\t}\n\tinfos, err := c.getManifestDetails(r)\n\tif err != nil {\n\t\t// Retry if resources not found\n\t\t// todo: Need to have retry count\n\t\tre := regexp.MustCompile(\"not found\")\n\t\tif re.MatchString(err.Error()) {\n\t\t\tlog.Println(err.Error())\n\t\t\treturn true, nil\n\t\t}\n\t\treturn true, err\n\t}\n\tfor _, info := range infos {\n\t\tif errCount >= retryCount*2 {\n\t\t\treturn true, fmt.Errorf(\"couldn't get the resources\")\n\t\t}\n\t\tswitch value := kube.AsVersioned(info).(type) {\n\t\tcase *appsv1.Deployment, *appsv1beta1.Deployment, *appsv1beta2.Deployment, *extensionsv1beta1.Deployment:\n\t\t\tcurrentDeployment, err := c.ClientSet.AppsV1().Deployments(info.Namespace).Get(context.Background(), info.Name, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\terrCount++\n\t\t\t\tlog.Printf(\"Warning: Got error getting deployment %s\", err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// If paused deployment will never be ready\n\t\t\tif currentDeployment.Spec.Paused {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !deploymentReady(currentDeployment) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *corev1.PersistentVolumeClaim:\n\t\t\tif !volumeReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *corev1.Service:\n\t\t\tif !serviceReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *extensionsv1beta1.DaemonSet, *appsv1.DaemonSet, *appsv1beta2.DaemonSet:\n\t\t\tds, err := c.ClientSet.AppsV1().DaemonSets(info.Namespace).Get(context.Background(), info.Name, metav1.GetOptions{})\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting daemonset %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !daemonSetReady(ds) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *appsv1.StatefulSet, *appsv1beta1.StatefulSet, *appsv1beta2.StatefulSet:\n\t\t\tsts, err := c.ClientSet.AppsV1().StatefulSets(info.Namespace).Get(context.Background(), info.Name, metav1.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting statefulset %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !statefulSetReady(sts) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *extensionsv1beta1.Ingress:\n\t\t\tif !ingressReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *networkingv1beta1.Ingress:\n\t\t\tif !ingressNReady(value) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *apiextv1beta1.CustomResourceDefinition:\n\t\t\tif err := info.Get(); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tcrd := &apiextv1beta1.CustomResourceDefinition{}\n\t\t\tif err := scheme.Scheme.Convert(info.Object, crd, nil); err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting CRD %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !crdBetaReady(crd) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\tcase *apiextv1.CustomResourceDefinition:\n\t\t\tif err := info.Get(); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tcrd := &apiextv1.CustomResourceDefinition{}\n\t\t\tif err := scheme.Scheme.Convert(info.Object, crd, nil); err != nil {\n\t\t\t\tlog.Printf(\"Warning: Got error getting CRD %s\", err.Error())\n\t\t\t\terrCount++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !crdReady(crd) {\n\t\t\t\tpArray = append(pArray, false)\n\t\t\t}\n\t\t}\n\t}\n\tif len(pArray) > 0 || errCount != 0 {\n\t\treturn true, err\n\t}\n\treturn false, err\n}", "func createDuplicates(cfg *duplicate.Config) {\n\tif cfg.File == \"\" {\n\t\tfmt.Println(\"Please specify the original file path (flag \\\"-file\\\")\")\n\t} else {\n\t\tfmt.Println(\"Functionality in development\")\n\t}\n}", "func TestPopulateResources(t *testing.T) {\n\ttestName := \"TestPopulateResources\"\n\n\tbeforeTest()\n\t// kinds to check for status\n\tvar kindsToCheckStatus = map[string]bool{}\n\n\tvar files = []string{\n\t\tKappnavConfigFile,\n\t\tCrdApplication,\n\t\tappBookinfo,\n\t\tappDetails,\n\t\tdeploymentDetailsV1,\n\t\tserviceDetails,\n\t\tingressBookinfo,\n\t\tappProductpage,\n\t\tnetworkpolicyProductpage,\n\t\tdeploymentProcuctpageV1,\n\t\tserviceProductpage,\n\t\tappRatings,\n\t\tdeploymentRatingsV1,\n\t\tserviceRatings,\n\t\tappReviews,\n\t\tnetworkpolicyReviews,\n\t\tdeploymentReviewsV1,\n\t\tdeploymentReviewsV2,\n\t\tdeploymentReviewsV3,\n\t\tserviceReview,\n\t\tcrdFoo,\n\t\tfooExample,\n\t\tappFoo,\n\t\tkappnavCRFile,\n\t}\n\n\titeration0IDs, err := readResourceIDs(files)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t/* Iteration 0: all normal */\n\ttestActions := newTestActions(testName, kindsToCheckStatus)\n\tvar emptyIDs = []resourceID{}\n\ttestActions.addIteration(iteration0IDs, emptyIDs)\n\n\t/* iteration 1: clean up */\n\ttestActions.addIteration(emptyIDs, emptyIDs)\n\n\t/* create a watcher that populates all resources */\n\tclusterWatcher, err := createClusterWatcher(iteration0IDs, testActions, StatusFailureRate)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer clusterWatcher.shutDown()\n\n\t// ensure we can find each resource\n\tfor _, res := range iteration0IDs {\n\t\texists, _ := resourceExists(clusterWatcher, res)\n\t\tif !exists {\n\t\t\tt.Fatal(fmt.Errorf(\"can't find resource for %s\\n,\", res.fileName))\n\t\t}\n\t}\n\n\terr = testActions.transitionAll()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func DelResource(nsId string, resourceType string, resourceId string, forceFlag string) error {\n\n\tfmt.Printf(\"DelResource() called; %s %s %s \\n\", nsId, resourceType, resourceId) // for debug\n\n\terr := common.CheckString(nsId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn err\n\t}\n\n\terr = common.CheckString(resourceId)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn err\n\t}\n\tcheck, err := CheckResource(nsId, resourceType, resourceId)\n\n\tif !check {\n\t\terrString := \"The \" + resourceType + \" \" + resourceId + \" does not exist.\"\n\t\t//mapA := map[string]string{\"message\": errString}\n\t\t//mapB, _ := json.Marshal(mapA)\n\t\terr := fmt.Errorf(errString)\n\t\t//return http.StatusNotFound, mapB, err\n\t\treturn err\n\t}\n\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn err\n\t}\n\n\tkey := common.GenResourceKey(nsId, resourceType, resourceId)\n\tfmt.Println(\"key: \" + key)\n\n\tkeyValue, _ := common.CBStore.Get(key)\n\t/*\n\t\tif keyValue == nil {\n\t\t\tmapA := map[string]string{\"message\": \"Failed to find the resource with given ID.\"}\n\t\t\tmapB, _ := json.Marshal(mapA)\n\t\t\terr := fmt.Errorf(\"Failed to find the resource with given ID.\")\n\t\t\treturn http.StatusNotFound, mapB, err\n\t\t}\n\t*/\n\t//fmt.Println(\"keyValue: \" + keyValue.Key + \" / \" + keyValue.Value)\n\n\t//cspType := common.GetResourcesCspType(nsId, resourceType, resourceId)\n\n\tif os.Getenv(\"SPIDER_CALL_METHOD\") == \"REST\" {\n\n\t\tvar url string\n\n\t\t// Create Req body\n\t\ttype JsonTemplate struct {\n\t\t\tConnectionName string\n\t\t}\n\t\ttempReq := JsonTemplate{}\n\n\t\tswitch resourceType {\n\t\tcase common.StrImage:\n\t\t\t// delete image info\n\t\t\terr := common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\t//return http.StatusInternalServerError, nil, err\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// \"DELETE FROM `image` WHERE `id` = '\" + resourceId + \"';\"\n\t\t\t_, err = common.ORM.Delete(&TbImageInfo{Namespace: nsId, Id: resourceId})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Data deleted successfully..\")\n\t\t\t}\n\n\t\t\t//return http.StatusOK, nil, nil\n\t\t\treturn nil\n\t\tcase common.StrSpec:\n\t\t\t// delete spec info\n\n\t\t\t//get related recommend spec\n\t\t\t//keyValue, err := common.CBStore.Get(key)\n\t\t\tcontent := TbSpecInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &content)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t//delete related recommend spec\n\t\t\terr = DelRecommendSpec(nsId, resourceId, content.NumvCPU, content.MemGiB, content.StorageGiB)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// \"DELETE FROM `spec` WHERE `id` = '\" + resourceId + \"';\"\n\t\t\t_, err = common.ORM.Delete(&TbSpecInfo{Namespace: nsId, Id: resourceId})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Data deleted successfully..\")\n\t\t\t}\n\n\t\t\t//return http.StatusOK, nil, nil\n\t\t\treturn nil\n\t\tcase common.StrSSHKey:\n\t\t\ttemp := TbSshKeyInfo{}\n\t\t\terr = json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\turl = common.SpiderRestUrl + \"/keypair/\" + temp.Name\n\t\tcase common.StrVNet:\n\t\t\ttemp := TbVNetInfo{}\n\t\t\terr = json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\turl = common.SpiderRestUrl + \"/vpc/\" + temp.Name\n\t\tcase common.StrSecurityGroup:\n\t\t\ttemp := TbSecurityGroupInfo{}\n\t\t\terr = json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\turl = common.SpiderRestUrl + \"/securitygroup/\" + temp.Name\n\t\t/*\n\t\t\tcase \"subnet\":\n\t\t\t\ttemp := subnetInfo{}\n\t\t\t\tjson.Unmarshal([]byte(keyValue.Value), &content)\n\t\t\t\treturn content.CspSubnetId\n\t\t\tcase \"publicIp\":\n\t\t\t\ttemp := publicIpInfo{}\n\t\t\t\tjson.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\t\turl = common.SPIDER_REST_URL + \"/publicip/\" + temp.CspPublicIpName\n\t\t\tcase \"vNic\":\n\t\t\t\ttemp := vNicInfo{}\n\t\t\t\tjson.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\t\ttempReq.ConnectionName = temp.ConnectionName\n\t\t\t\turl = common.SPIDER_REST_URL + \"/vnic/\" + temp.CspVNicName\n\t\t*/\n\t\tdefault:\n\t\t\terr := fmt.Errorf(\"invalid resourceType\")\n\t\t\t//return http.StatusBadRequest, nil, err\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Println(\"url: \" + url)\n\n\t\tclient := resty.New().SetCloseConnection(true)\n\n\t\tresp, err := client.R().\n\t\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\t\tSetBody(tempReq).\n\t\t\t//SetResult(&SpiderSpecInfo{}). // or SetResult(AuthSuccess{}).\n\t\t\t//SetError(&AuthError{}). // or SetError(AuthError{}).\n\t\t\tDelete(url)\n\n\t\tif err != nil {\n\t\t\tcommon.CBLog.Error(err)\n\t\t\terr := fmt.Errorf(\"an error occurred while requesting to CB-Spider\")\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Println(\"HTTP Status code: \" + strconv.Itoa(resp.StatusCode()))\n\t\tswitch {\n\t\tcase forceFlag == \"true\":\n\t\t\turl += \"?force=true\"\n\t\t\tfmt.Println(\"forceFlag == true; url: \" + url)\n\n\t\t\t_, err := client.R().\n\t\t\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\t\t\tSetBody(tempReq).\n\t\t\t\t//SetResult(&SpiderSpecInfo{}). // or SetResult(AuthSuccess{}).\n\t\t\t\t//SetError(&AuthError{}). // or SetError(AuthError{}).\n\t\t\t\tDelete(url)\n\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\terr := fmt.Errorf(\"an error occurred while requesting to CB-Spider\")\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\tcase resp.StatusCode() >= 400 || resp.StatusCode() < 200:\n\t\t\terr := fmt.Errorf(string(resp.Body()))\n\t\t\tcommon.CBLog.Error(err)\n\t\t\treturn err\n\t\tdefault:\n\t\t\terr := common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t} else {\n\n\t\t// Set CCM gRPC API\n\t\tccm := api.NewCloudResourceHandler()\n\t\terr := ccm.SetConfigPath(os.Getenv(\"CBTUMBLEBUG_ROOT\") + \"/conf/grpc_conf.yaml\")\n\t\tif err != nil {\n\t\t\tcommon.CBLog.Error(\"ccm failed to set config : \", err)\n\t\t\treturn err\n\t\t}\n\t\terr = ccm.Open()\n\t\tif err != nil {\n\t\t\tcommon.CBLog.Error(\"ccm api open failed : \", err)\n\t\t\treturn err\n\t\t}\n\t\tdefer ccm.Close()\n\n\t\tswitch resourceType {\n\t\tcase common.StrImage:\n\t\t\t// delete image info\n\t\t\terr := common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\t//return http.StatusInternalServerError, nil, err\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// \"DELETE FROM `image` WHERE `id` = '\" + resourceId + \"';\"\n\t\t\t_, err = common.ORM.Delete(&TbImageInfo{Namespace: nsId, Id: resourceId})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Data deleted successfully..\")\n\t\t\t}\n\n\t\t\t//return http.StatusOK, nil, nil\n\t\t\treturn nil\n\t\tcase common.StrSpec:\n\t\t\t// delete spec info\n\n\t\t\t//get related recommend spec\n\t\t\tcontent := TbSpecInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &content)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr = common.CBStore.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t//delete related recommend spec\n\t\t\terr = DelRecommendSpec(nsId, resourceId, content.NumvCPU, content.MemGiB, content.StorageGiB)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// \"DELETE FROM `spec` WHERE `id` = '\" + resourceId + \"';\"\n\t\t\t_, err = common.ORM.Delete(&TbSpecInfo{Namespace: nsId, Id: resourceId})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Data deleted successfully..\")\n\t\t\t}\n\n\t\t\treturn nil\n\n\t\tcase common.StrSSHKey:\n\t\t\ttemp := TbSshKeyInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = ccm.DeleteKeyByParam(temp.ConnectionName, temp.Name, forceFlag)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase common.StrVNet:\n\t\t\ttemp := TbVNetInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = ccm.DeleteVPCByParam(temp.ConnectionName, temp.Name, forceFlag)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase common.StrSecurityGroup:\n\t\t\ttemp := TbSecurityGroupInfo{}\n\t\t\terr := json.Unmarshal([]byte(keyValue.Value), &temp)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = ccm.DeleteSecurityByParam(temp.ConnectionName, temp.Name, forceFlag)\n\t\t\tif err != nil {\n\t\t\t\tcommon.CBLog.Error(err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tdefault:\n\t\t\terr := fmt.Errorf(\"invalid resourceType\")\n\t\t\treturn err\n\t\t}\n\n\t\terr = common.CBStore.Delete(key)\n\t\tif err != nil {\n\t\t\tcommon.CBLog.Error(err)\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\n\t}\n}", "func (vrm *ResourceManager) ApplyResourceDiff() error {\n\n\t// Get Actual VolumeGroup on node.\n\tactualVgConfig, err := vrm.getRealVgList()\n\tif err != nil {\n\t\tlog.Errorf(\"ApplyResourceDiff:: Get Node Actual VolumeGroup Error: %s\", err.Error())\n\t\treturn err\n\t}\n\tif len(vrm.volumeGroupDeviceMap) > 0 {\n\t\tvrm.applyDeivce(actualVgConfig)\n\t}\n\tif len(vrm.volumeGroupRegionMap) > 0 {\n\t\tvrm.applyRegion(actualVgConfig)\n\t}\n\n\tlog.Infof(\"ApplyResourceDiff:: Finish volumegroup loop...\")\n\treturn nil\n}", "func (d *DryccCmd) ResourceDelete(appID, name string) error {\n\ts, appID, err := load(d.ConfigFile, appID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.Printf(\"Deleting %s from %s... \", name, appID)\n\n\tquit := progress(d.WOut)\n\terr = resources.Delete(s.Client, appID, name)\n\tquit <- true\n\t<-quit\n\tif d.checkAPICompatibility(s.Client, err) != nil {\n\t\treturn err\n\t}\n\n\td.Println(\"done\")\n\treturn nil\n}", "func (rcsw *RemoteClusterServiceWatcher) cleanupMirroredResources() error {\n\tmatchLabels := map[string]string{\n\t\tconsts.MirroredResourceLabel: \"true\",\n\t\tconsts.RemoteClusterNameLabel: rcsw.clusterName,\n\t}\n\n\tservices, err := rcsw.localAPIClient.Svc().Lister().List(labels.Set(matchLabels).AsSelector())\n\tif err != nil {\n\t\tinnerErr := fmt.Errorf(\"could not retrieve mirrored services that need cleaning up: %s\", err)\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn innerErr\n\t\t}\n\t\t// if its not notFound then something else went wrong, so we can retry\n\t\treturn RetryableError{[]error{innerErr}}\n\t}\n\n\tvar errors []error\n\tfor _, svc := range services {\n\t\tif err := rcsw.localAPIClient.Client.CoreV1().Services(svc.Namespace).Delete(svc.Name, &metav1.DeleteOptions{}); err != nil {\n\t\t\tif kerrors.IsNotFound(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terrors = append(errors, fmt.Errorf(\"Could not delete service %s/%s: %s\", svc.Namespace, svc.Name, err))\n\t\t} else {\n\t\t\trcsw.log.Debugf(\"Deleted service %s/%s\", svc.Namespace, svc.Name)\n\t\t}\n\t}\n\n\tendpoints, err := rcsw.localAPIClient.Endpoint().Lister().List(labels.Set(matchLabels).AsSelector())\n\tif err != nil {\n\t\tinnerErr := fmt.Errorf(\"could not retrieve Endpoints that need cleaning up: %s\", err)\n\t\tif kerrors.IsNotFound(err) {\n\t\t\treturn innerErr\n\t\t}\n\t\treturn RetryableError{[]error{innerErr}}\n\t}\n\n\tfor _, endpt := range endpoints {\n\t\tif err := rcsw.localAPIClient.Client.CoreV1().Endpoints(endpt.Namespace).Delete(endpt.Name, &metav1.DeleteOptions{}); err != nil {\n\t\t\tif kerrors.IsNotFound(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terrors = append(errors, fmt.Errorf(\"Could not delete Endpoints %s/%s: %s\", endpt.Namespace, endpt.Name, err))\n\t\t} else {\n\t\t\trcsw.log.Debugf(\"Deleted Endpoints %s/%s\", endpt.Namespace, endpt.Name)\n\t\t}\n\t}\n\n\tif len(errors) > 0 {\n\t\treturn RetryableError{errors}\n\t}\n\treturn nil\n}", "func deleteServiceTemplate(sd *defs, st *defs, ht *defs, svc *serviceOffset, tmplEnabledDisabled attrVal, hgrpDeleted attrVal, hostname string, bflags attrVal){\n for _, t := range tmplEnabledDisabled {\n if (*st)[t].attrExist(\"host_name\"){\n (*st)[t][\"host_name\"].deleteAttrVal(st , ht, t, \"SVCTMPL HOSTNAME\", \"host_name\", hostname, bflags, hostname)\n if len(*(*st)[t][\"host_name\"]) == 0 {\n printDeletion(t, \"SVCTMPL HOSTNAME\", \"host_name\", \"\", \"attr\", bflags)\n delete((*st)[t], \"host_name\")\n }\n }\n if (*st)[t].attrExist(\"hostgroup_name\"){\n (*st)[t][\"hostgroup_name\"].deleteAttrVal(st , ht, t, \"SVCTMPL HOSTGROUP_NAME\", \"hostgroup_name\", hostname,bflags, hgrpDeleted...)\n if len(*(*st)[t][\"hostgroup_name\"]) == 0 {\n printDeletion(t, \"SVCTMPL HOSTGROUP_NAME\", \"hostgroup_name\", \"\", \"attr\", bflags)\n delete((*st)[t], \"hostgroup_name\")\n }\n }\n if !(*st)[t].attrExist(\"host_name\") && !(*st)[t].attrExist(\"hostgroup_name\"){ // delete hostgroup obj definition\n if !(*st)[t].attrExist(\"register\") || (*st)[t][\"register\"].ToString() == \"1\" {\n if (*st)[t].attrExist(\"use\") && !isTemplateBeingUsed(sd, st, t){\n if isSafeDeleteTemplate(st, *(*st)[t][\"use\"], hgrpDeleted, hostname) {\n printDeletion(t, \"SVCTMPL\", \"\", \"\", \"def\", bflags)\n svc.tmpl.deleted.Add(t)\n delete(*st, t)\n }\n } else if isTemplateBeingUsed(sd, st, t){\n unregisterTemplate := attrVal{\"0\"}\n (*st)[t][\"register\"] = &unregisterTemplate\n fmt.Printf(\"%vRegister%v:%v[SVCTMPL EDIT]%v: Unregister service template %v\\n\", Yellow, RST, Blue, RST, t)\n } else {\n printDeletion(t, \"SVCTMPL\", \"\", \"\", \"def\", bflags)\n svc.tmpl.deleted.Add(t)\n delete(*st, t)\n }\n } else if (*st)[t].attrExist(\"use\") && !isTemplateBeingUsed(sd, st, t){\n if isSafeDeleteTemplate(st, *(*st)[t][\"use\"], hgrpDeleted, hostname) {\n fmt.Printf(\"%vWarning%v:%v[SVCTMPL]%v: found template not being used '%v'\", Yellow, RST,Blue,RST, t)\n // TODO: flag to allow not used template deletion\n// printDeletion(t, \"SVCTMPL\", \"\", \"\", \"def\")\n// svc.SetDeletedTemplate(t)\n// delete(*st, t)\n }\n } else if !isTemplateBeingUsed(sd, st, t){\n fmt.Printf(\"%vWarning%v:%v[SVCTMPL]%v: found template not being used '%v'\", Yellow, RST,Blue,RST, t)\n }\n }\n }\n}", "func (s *Synk) deleteResourceSets(ctx context.Context, name string, version int32) error {\n\tc := s.client.Resource(resourceSetGVR)\n\n\tlist, err := c.List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"list existing resources\")\n\t}\n\tfor _, r := range list.Items {\n\t\tn, v, ok := decodeResourceSetName(r.GetName())\n\t\tif !ok || n != name || v >= version {\n\t\t\tcontinue\n\t\t}\n\t\t// TODO: should we possibly opt for foreground deletion here so\n\t\t// we only return after all dependents have been deleted as well?\n\t\t// kubectl doesn't allow to opt into foreground deletion in general but\n\t\t// here it would likely bring us closer to the apply --prune semantics.\n\t\tif err := c.Delete(ctx, r.GetName(), metav1.DeleteOptions{}); err != nil {\n\t\t\treturn errors.Wrapf(err, \"delete ResourceSet %q\", r.GetName())\n\t\t}\n\t}\n\treturn nil\n}", "func (c *clusterCache) GetManagedLiveObjs(targetObjs []*unstructured.Unstructured, isManaged func(r *Resource) bool) (map[kube.ResourceKey]*unstructured.Unstructured, error) {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\n\tfor _, o := range targetObjs {\n\t\tif len(c.namespaces) > 0 {\n\t\t\tif o.GetNamespace() == \"\" && !c.clusterResources {\n\t\t\t\treturn nil, fmt.Errorf(\"Cluster level %s %q can not be managed when in namespaced mode\", o.GetKind(), o.GetName())\n\t\t\t} else if o.GetNamespace() != \"\" && !c.managesNamespace(o.GetNamespace()) {\n\t\t\t\treturn nil, fmt.Errorf(\"Namespace %q for %s %q is not managed\", o.GetNamespace(), o.GetKind(), o.GetName())\n\t\t\t}\n\t\t}\n\t}\n\n\tmanagedObjs := make(map[kube.ResourceKey]*unstructured.Unstructured)\n\t// iterate all objects in live state cache to find ones associated with app\n\tfor key, o := range c.resources {\n\t\tif isManaged(o) && o.Resource != nil && len(o.OwnerRefs) == 0 {\n\t\t\tmanagedObjs[key] = o.Resource\n\t\t}\n\t}\n\t// but are simply missing our label\n\tlock := &sync.Mutex{}\n\terr := kube.RunAllAsync(len(targetObjs), func(i int) error {\n\t\ttargetObj := targetObjs[i]\n\t\tkey := kube.GetResourceKey(targetObj)\n\t\tlock.Lock()\n\t\tmanagedObj := managedObjs[key]\n\t\tlock.Unlock()\n\n\t\tif managedObj == nil {\n\t\t\tif existingObj, exists := c.resources[key]; exists {\n\t\t\t\tif existingObj.Resource != nil {\n\t\t\t\t\tmanagedObj = existingObj.Resource\n\t\t\t\t} else {\n\t\t\t\t\tvar err error\n\t\t\t\t\tmanagedObj, err = c.kubectl.GetResource(context.TODO(), c.config, targetObj.GroupVersionKind(), existingObj.Ref.Name, existingObj.Ref.Namespace)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tif errors.IsNotFound(err) {\n\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if _, watched := c.apisMeta[key.GroupKind()]; !watched {\n\t\t\t\tvar err error\n\t\t\t\tmanagedObj, err = c.kubectl.GetResource(context.TODO(), c.config, targetObj.GroupVersionKind(), targetObj.GetName(), targetObj.GetNamespace())\n\t\t\t\tif err != nil {\n\t\t\t\t\tif errors.IsNotFound(err) {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif managedObj != nil {\n\t\t\tconverted, err := c.kubectl.ConvertToVersion(managedObj, targetObj.GroupVersionKind().Group, targetObj.GroupVersionKind().Version)\n\t\t\tif err != nil {\n\t\t\t\t// fallback to loading resource from kubernetes if conversion fails\n\t\t\t\tc.log.V(1).Info(fmt.Sprintf(\"Failed to convert resource: %v\", err))\n\t\t\t\tmanagedObj, err = c.kubectl.GetResource(context.TODO(), c.config, targetObj.GroupVersionKind(), managedObj.GetName(), managedObj.GetNamespace())\n\t\t\t\tif err != nil {\n\t\t\t\t\tif errors.IsNotFound(err) {\n\t\t\t\t\t\treturn nil\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tmanagedObj = converted\n\t\t\t}\n\t\t\tlock.Lock()\n\t\t\tmanagedObjs[key] = managedObj\n\t\t\tlock.Unlock()\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn managedObjs, nil\n}", "func testResourceDeletionNotIgnored(t *testing.T, initialResource func(string) e2e.UpdateOptions, updateResource func(r *e2e.UpdateOptions)) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout*1000)\n\tt.Cleanup(cancel)\n\tmgmtServer := startManagementServer(t)\n\tnodeID := uuid.New().String()\n\tbs := generateBootstrapContents(t, mgmtServer.Address, false, nodeID)\n\txdsR := xdsResolverBuilder(t, bs)\n\tresources := initialResource(nodeID)\n\n\t// Update the management server with initial resources setup.\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcc, err := grpc.Dial(fmt.Sprintf(\"xds:///%s\", serviceName), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(xdsR))\n\tif err != nil {\n\t\tt.Fatalf(\"failed to dial local test server: %v\", err)\n\t}\n\tt.Cleanup(func() { cc.Close() })\n\n\tif err := verifyRPCtoAllEndpoints(cc); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Mutate resource and update on the server.\n\tupdateResource(&resources)\n\tif err := mgmtServer.Update(ctx, resources); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Spin up go routines to verify RPCs fail after the update.\n\tclient := testgrpc.NewTestServiceClient(cc)\n\twg := sync.WaitGroup{}\n\twg.Add(2)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor ; ctx.Err() == nil; <-time.After(10 * time.Millisecond) {\n\t\t\tif _, err := client.EmptyCall(ctx, &testpb.Empty{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor ; ctx.Err() == nil; <-time.After(10 * time.Millisecond) {\n\t\t\tif _, err := client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\twg.Wait()\n\tif ctx.Err() != nil {\n\t\tt.Fatal(\"Context expired before RPCs failed.\")\n\t}\n}", "func TestCreatesAllowedDuringNamespaceDeletion(t *testing.T) {\n\tconfig := &origin.MasterConfig{\n\t\tKubeletClientConfig: &kclient.KubeletConfig{},\n\t\tEtcdHelper: etcdstorage.NewEtcdStorage(nil, nil, \"\"),\n\t}\n\tstorageMap := config.GetRestStorage()\n\tresources := sets.String{}\n\n\tfor resource := range storageMap {\n\t\tresources.Insert(strings.ToLower(resource))\n\t}\n\n\tfor resource := range recommendedCreatableResources {\n\t\tif !resources.Has(resource) {\n\t\t\tt.Errorf(\"recommendedCreatableResources has resource %v, but that resource isn't registered.\", resource)\n\t\t}\n\t}\n}", "func (fm *FileManager) Feed(src string, files []*plugin.Generated) error {\n\tvar last string\n\nFileLoop:\n\tfor i := 0; i < len(files); i++ {\n\t\tf := files[i]\n\t\tif !f.IsSetName() {\n\t\t\tif last == \"\" {\n\t\t\t\treturn fmt.Errorf(\"[%s] attended to append but no target file found\", src)\n\t\t\t}\n\t\t\tfm.patch[last] = append(fm.patch[last], f)\n\t\t\tcontinue\n\t\t}\n\t\tname := f.GetName()\n\t\tif idx, ok := fm.index[name]; !ok {\n\t\t\tfm.index[name] = len(fm.files)\n\t\t\tfm.files = append(fm.files, f)\n\t\t} else {\n\t\t\tif f.GetInsertionPoint() != \"\" {\n\t\t\t\t// FIXME: when the target file is renamed due to name collision, the patch may be invalid.\n\t\t\t\tfm.patch[name] = append(fm.patch[name], f)\n\t\t\t} else {\n\t\t\t\tfst := idx\n\t\t\t\text := filepath.Ext(name)\n\t\t\t\tpth := strings.TrimSuffix(name, ext)\n\t\t\t\tcnt := 1\n\n\t\t\t\tvar renamed string\n\t\t\t\tfor {\n\t\t\t\t\tif fm.files[idx].Content == f.Content { // duplicate content\n\t\t\t\t\t\tfm.log.Info(fmt.Sprintf(\"[%s] discard generated file '%s': size %d\", src, name, len(f.Content)))\n\t\t\t\t\t\tfor j := i + 1; j < len(files) && !files[j].IsSetName(); j++ {\n\t\t\t\t\t\t\tfm.log.Info(\"discard patch @\", files[j].GetInsertionPoint())\n\t\t\t\t\t\t\ti++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue FileLoop\n\t\t\t\t\t}\n\t\t\t\t\trenamed = fmt.Sprintf(\"%s_%d%s\", pth, cnt, ext)\n\t\t\t\t\tif cnt > fm.count[name] {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t} else {\n\t\t\t\t\t\tidx = fm.index[renamed]\n\t\t\t\t\t\tcnt++\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfm.log.Warn(fmt.Sprintf(\"[%s] file names conflict: '%s' (%d <> %d)\", src, name, len(fm.files[fst].Content), len(f.Content)))\n\t\t\t\tfm.index[renamed] = len(fm.files)\n\t\t\t\tfm.files = append(fm.files, f)\n\t\t\t\tfm.count[name]++\n\t\t\t\tf.Name = &renamed\n\t\t\t\tname = renamed // propagate the new name to last\n\t\t\t}\n\t\t}\n\t\tlast = name\n\t}\n\treturn nil\n}", "func (s *storage) cleanExpired(sources pb.SyncMapping, actives pb.SyncMapping) {\nnext:\n\tfor _, entry := range sources {\n\t\tfor _, act := range actives {\n\t\t\tif act.CurInstanceID == entry.CurInstanceID {\n\t\t\t\tcontinue next\n\t\t\t}\n\t\t}\n\n\t\tdelOp := delMappingOp(entry.ClusterName, entry.OrgInstanceID)\n\t\tif _, err := s.engine.Do(context.Background(), delOp); err != nil {\n\t\t\tlog.Errorf(err, \"Delete instance clusterName=%s instanceID=%s failed\", entry.ClusterName, entry.OrgInstanceID)\n\t\t}\n\n\t\ts.deleteInstance(entry.CurInstanceID)\n\t}\n}", "func prepareMirrorURLs(sourceURL string, targetURLs []string) <-chan mirrorURLs {\n\tmirrorURLsCh := make(chan mirrorURLs)\n\n\tgo func() {\n\t\tdefer close(mirrorURLsCh)\n\t\tsourceURL = stripRecursiveURL(sourceURL)\n\t\tif strings.HasSuffix(sourceURL, \"/\") == false {\n\t\t\tsourceURL = sourceURL + \"/\"\n\t\t}\n\t\tsourceClnt, err := url2Client(sourceURL)\n\t\tif err != nil {\n\t\t\tmirrorURLsCh <- mirrorURLs{Error: err.Trace(sourceURL)}\n\t\t\treturn\n\t\t}\n\t\ttargetClnts := make([]client.Client, len(targetURLs))\n\t\tfor i, targetURL := range targetURLs {\n\t\t\ttargetClnt, targetContent, err := url2Stat(targetURL)\n\t\t\tif err != nil {\n\t\t\t\tmirrorURLsCh <- mirrorURLs{Error: err.Trace(targetURL)}\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// if one of the targets is not dir exit\n\t\t\tif !targetContent.Type.IsDir() {\n\t\t\t\tmirrorURLsCh <- mirrorURLs{Error: errInvalidTarget(targetURL).Trace()}\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// special case, be extremely careful before changing this behavior - will lead to data loss\n\t\t\tnewTargetURL := strings.TrimSuffix(targetURL, string(targetClnt.URL().Separator)) + string(targetClnt.URL().Separator)\n\t\t\ttargetClnt, err = url2Client(newTargetURL)\n\t\t\tif err != nil {\n\t\t\t\tmirrorURLsCh <- mirrorURLs{Error: err.Trace(newTargetURL)}\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttargetClnts[i] = targetClnt\n\t\t}\n\t\tfor sURLs := range deltaSourceTargets(sourceClnt, targetClnts) {\n\t\t\tmirrorURLsCh <- sURLs\n\t\t}\n\t}()\n\treturn mirrorURLsCh\n}", "func (v GithubVCS) ConcatAllYamlFiles(ctx context.Context, objects []*github.RepositoryContent, runinfo *RunInfo) (string, error) {\n\tvar allTemplates string\n\n\tfor _, value := range objects {\n\t\tif strings.HasSuffix(value.GetName(), \".yaml\") ||\n\t\t\tstrings.HasSuffix(value.GetName(), \".yml\") {\n\t\t\tdata, err := v.GetObject(ctx, value.GetSHA(), runinfo)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tif allTemplates != \"\" && !strings.HasPrefix(string(data), \"---\") {\n\t\t\t\tallTemplates += \"---\"\n\t\t\t}\n\t\t\tallTemplates += \"\\n\" + string(data) + \"\\n\"\n\t\t}\n\t}\n\treturn allTemplates, nil\n}", "func tags_Delete_WithSameImageID(t *testing.T, opts ...configOpt) {\n\topts = append(opts)\n\tenv := newTestEnv(t, opts...)\n\tdefer env.Shutdown()\n\n\timageName, err := reference.WithName(\"foo/bar\")\n\tcheckErr(t, err, \"building named object\")\n\n\t// build two tags pointing to the same image\n\ttag1 := \"1.0.0\"\n\ttag2 := \"latest\"\n\tcreateRepositoryWithMultipleIdenticalTags(t, env, imageName.Name(), []string{tag1, tag2})\n\n\t// delete one of the tags\n\tref, err := reference.WithTag(imageName, tag1)\n\tcheckErr(t, err, \"building tag reference\")\n\n\ttagURL, err := env.builder.BuildTagURL(ref)\n\tcheckErr(t, err, \"building tag URL\")\n\n\tresp, err := httpDelete(tagURL)\n\tmsg := \"checking tag delete\"\n\tcheckErr(t, err, msg)\n\n\tdefer resp.Body.Close()\n\n\tcheckResponse(t, msg, resp, http.StatusAccepted)\n\n\t// check the other tag is still there\n\ttagsURL, err := env.builder.BuildTagsURL(imageName)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error building tags url: %v\", err)\n\t}\n\tresp, err = http.Get(tagsURL)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error getting tags: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tdec := json.NewDecoder(resp.Body)\n\tvar tagsResponse tagsAPIResponse\n\tif err := dec.Decode(&tagsResponse); err != nil {\n\t\tt.Fatalf(\"unexpected error decoding response: %v\", err)\n\t}\n\n\tif tagsResponse.Name != imageName.Name() {\n\t\tt.Fatalf(\"tags name should match image name: %v != %v\", tagsResponse.Name, imageName)\n\t}\n\n\tif len(tagsResponse.Tags) != 1 {\n\t\tt.Fatalf(\"expected 1 tag, got %d: %v\", len(tagsResponse.Tags), tagsResponse.Tags)\n\t}\n\n\tif tagsResponse.Tags[0] != tag2 {\n\t\tt.Fatalf(\"expected tag to be %q, got %q\", tagsResponse.Tags[0], tag2)\n\t}\n}", "func (r *Store) RCSPull(ctx context.Context, name, origin, remote string) error {\n\tstore, _ := r.getStore(name)\n\n\treturn store.Storage().Pull(ctx, origin, remote)\n}" ]
[ "0.570892", "0.55854475", "0.53175753", "0.5260137", "0.5203018", "0.50135106", "0.50129366", "0.5002672", "0.49678025", "0.49068257", "0.49068257", "0.4880002", "0.4870154", "0.48697236", "0.48677993", "0.48084393", "0.48019645", "0.4737808", "0.47268918", "0.47148904", "0.47110444", "0.4707466", "0.46897194", "0.46266896", "0.46266896", "0.46225718", "0.4617693", "0.4616879", "0.4607404", "0.46018964", "0.45787314", "0.4559828", "0.45471925", "0.45450217", "0.45417437", "0.4527776", "0.45204145", "0.45159626", "0.45084184", "0.4505851", "0.45018527", "0.4495657", "0.44923508", "0.44904482", "0.44874337", "0.44668075", "0.4465866", "0.44608957", "0.44595924", "0.4458279", "0.4454844", "0.44515", "0.44511968", "0.44457406", "0.44418925", "0.44348696", "0.44235075", "0.44144928", "0.44144928", "0.44021687", "0.4398327", "0.43925658", "0.43917185", "0.43873972", "0.43814036", "0.43804297", "0.4369963", "0.43618023", "0.43572724", "0.43471885", "0.43434155", "0.433504", "0.43332922", "0.4327248", "0.4322365", "0.4322222", "0.43105325", "0.4310411", "0.43065277", "0.4303879", "0.4303645", "0.4299363", "0.42959896", "0.42926016", "0.4292479", "0.42850167", "0.42846048", "0.42830148", "0.42775387", "0.42773747", "0.42754427", "0.42728385", "0.42702034", "0.4270044", "0.4267151", "0.42616972", "0.4257671", "0.42555976", "0.42474487", "0.4245717" ]
0.732469
0
syncBucket syncs the local gallery with the bucket
syncBucket синхронизирует локальную галерею с бакетом
func syncBucket(name string) { objects, err := s3.ListBucket(name, "") if err != nil { log.Printf("Can't list objects in bucket: %v", err) } // download each file that we don't have yet locally: for _, object := range objects { localfile := filepath.Join(galleryPath, object) if _, err := os.Stat(localfile); err != nil { err = s3.DownloadFromBucket("gallery", object, localfile) if err != nil { log.Printf("Can't download file %v: %v", object, err) } } } log.Printf("Done downloading missing files from bucket %v", name) // upload metadata files that are not yet remote: files, err := ioutil.ReadDir(galleryPath) if err != nil { log.Printf("Can't scan local gallery for metadata: %v", err) return } for _, f := range files { if strings.HasSuffix(f.Name(), "meta") { if !has(objects, f.Name()) { err = s3.UploadToBucket("gallery", f.Name(), filepath.Join(galleryPath, f.Name()), "text/plain") if err != nil { log.Printf("Can't upload metadata file %v: %v", f.Name(), err) } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Sync(t time.Time, log *zap.Logger) {\n\tlog.Info(\"S3 sync begun\")\n\n\tbucket := Config.bucket\n\tregion := Config.bucketRegion\n\n\tsvc := setUpAwsSession(region)\n\tresp, err := listBucket(bucket, region, svc, log)\n\tif err != nil {\n\t\tlog.Error(\"failed to list bucket\",\n\t\t\tzap.Error(err),\n\t\t\tzap.String(\"bucket\", bucket),\n\t\t\tzap.String(\"region\", region),\n\t\t)\n\n\t\treturn\n\t}\n\n\tif err := parseAllFiles(resp, bucket, svc, log); err != nil {\n\t\treturn\n\t}\n\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tUp = true\n\tHealth = true\n\n\tlog.Info(\"S3 sync finished\")\n}", "func (gcs *localStorage) Upload(b []byte, bucket, fileName string) (string, error) {\n\t_, err := os.Stat(bucket) // checking if bucket exists\n\tif os.IsNotExist(err) {\n\t\terr := os.MkdirAll(bucket, 0755)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"falha ao criar diretório %s, erro %q\", bucket, err)\n\t\t}\n\t}\n\tname := fmt.Sprintf(\"%s/%s\", bucket, fileName)\n\tif err := ioutil.WriteFile(name, b, 0644); err != nil {\n\t\treturn \"\", fmt.Errorf(\"falha ao salver arquivo %s no caminho %s, erro %q\", fileName, name, err)\n\t}\n\treturn fmt.Sprintf(\"%s/%s\", bucket, fileName), nil\n}", "func (b *Bucket) Bucket(name string) *Bucket { panic(\"n/i\") }", "func (h *S3Handler) uploadToS3(p *Project, wg *sync.WaitGroup) {\n\n\tdefer recovery()\n\t// get image content\n\tdefer wg.Done()\n\tvar arr []string\n\n\tfor _, url := range(p.Image) {\n\n\t\tbuffer:= img(url)\n\t\tif len(*buffer) > 0 {\n\t\t\t// upload to s3\n\n\t\t\ts := strings.Split(url, \"/\")\n\t\t\turl_key := s[len(s)-1]\n\n\t\t\tmyurl := fmt.Sprintf(\"https://%s.s3.ap-south-1.amazonaws.com/%s\", S3_BUCKET, url_key)\n\n\t\t\t_, err := s3.New(h.Session).PutObject(&s3.PutObjectInput{\n\n\t\t\t\tBucket: aws.String(S3_BUCKET),\n\t\t\t\tKey: aws.String(url_key),\n\t\t\t\tACL: aws.String(\"public-read\"),\n\t\t\t\tBody: bytes.NewReader(*buffer),\n\t\t\t\tContentLength: aws.Int64(int64(len(*buffer))),\n\t\t\t\tContentType: aws.String(http.DetectContentType(*buffer)),\n\t\t\t\tContentDisposition: aws.String(\"attachment\"),\n\t\t\t})\n\n\t\t\tif err != nil{\n\t\t\t\tpanic(\"********************************************************************************************************************************************\")\n\n\n\t\t\t}else {\n\t\t\t\tarr = append(arr, myurl)\n\t\t\t\t//fmt.Println(akki)\n\n\t\t\t}\n\t\t}\n\n\n\t}\n\n\t// update to mongodb\n\tobjID, _ := primitive.ObjectIDFromHex(p.ID)\n\n\tfilter := bson.M{\"_id\": bson.M{\"$eq\": objID}}\n\n\n\tupdate := bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"new_image_urlss\": arr,\n\n\t\t},\n\t}\n\tupdateResult, _ := h.Collection.UpdateOne(context.TODO(), filter, update)\n\n\tfmt.Println(updateResult)\n\n\n}", "func patchBucket(w http.ResponseWriter, r *http.Request) {\n\n\tpathParams := mux.Vars(r)\n\tsageBucketID := pathParams[\"bucket\"]\n\t//objectKey := pathParams[\"key\"]\n\n\tvars := mux.Vars(r)\n\tusername := vars[\"username\"]\n\n\t//rawQuery := r.URL.RawQuery\n\n\t// normal bucket metadata\n\n\tallowed, err := userHasBucketPermission(username, sageBucketID, \"FULL_CONTROL\")\n\tif err != nil {\n\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tif !allowed {\n\t\trespondJSONError(w, http.StatusUnauthorized, \"Write access to bucket metadata denied (%s, %s)\", username, sageBucketID)\n\t\treturn\n\t}\n\n\tvar deltaBucket map[string]string\n\n\terr = json.NewDecoder(r.Body).Decode(&deltaBucket)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Could not parse json: %s\", err.Error())\n\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tlog.Printf(\"got: %v\", deltaBucket)\n\n\tdb, err := sql.Open(\"mysql\", mysqlDSN)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Unable to connect to database: %v\", err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\tnewBucketname, ok := deltaBucket[\"name\"]\n\tif ok {\n\n\t\tinsertQueryStr := \"UPDATE Buckets SET name=? WHERE id=UUID_TO_BIN(?) ;\"\n\t\t_, err = db.Exec(insertQueryStr, newBucketname, sageBucketID)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"Bucket creation in mysql failed: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t}\n\n\t// return should return real bucket\n\n\tnewBucket, err := GetSageBucket(sageBucketID)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"GetSageBucket returned: %s\", err.Error())\n\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\trespondJSON(w, http.StatusOK, newBucket)\n\t//bucket fields:\n\t//metadata , name , type, (owner, change requires permission change)\n\n\t//permission\n\n}", "func (t *targetrunner) renamelocalbucket(bucketFrom, bucketTo string, p BucketProps, clone *bucketMD) (errstr string) {\n\t// ready to receive migrated obj-s _after_ that point\n\t// insert directly w/o incrementing the version (metasyncer will do at the end of the operation)\n\tclone.LBmap[bucketTo] = p\n\tt.bmdowner.put(clone)\n\n\twg := &sync.WaitGroup{}\n\tch := make(chan string, len(ctx.mountpaths.Available))\n\tfor mpath := range ctx.mountpaths.Available {\n\t\tfromdir := filepath.Join(makePathLocal(mpath), bucketFrom)\n\t\twg.Add(1)\n\t\tgo func(fromdir string, wg *sync.WaitGroup) {\n\t\t\ttime.Sleep(time.Millisecond * 100) // FIXME: 2-phase for the targets to 1) prep (above) and 2) rebalance\n\t\t\tch <- t.renameOne(fromdir, bucketFrom, bucketTo)\n\t\t\twg.Done()\n\t\t}(fromdir, wg)\n\t}\n\twg.Wait()\n\tclose(ch)\n\tfor errstr = range ch {\n\t\tif errstr != \"\" {\n\t\t\treturn\n\t\t}\n\t}\n\tfor mpath := range ctx.mountpaths.Available {\n\t\tfromdir := filepath.Join(makePathLocal(mpath), bucketFrom)\n\t\tif err := os.RemoveAll(fromdir); err != nil {\n\t\t\tglog.Errorf(\"Failed to remove dir %s\", fromdir)\n\t\t}\n\t}\n\tclone.del(bucketFrom, true)\n\treturn\n}", "func Initrepo(server string, secure bool, accesskey string, secretkey string, enckey string, bucketname string, dir string) bool {\n\t// New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically\n\t// determined based on the Endpoint value.\n\ts3Client, err := minio.New(server, accesskey, secretkey, secure)\n\tif err != nil {\n\t\tjc.SendString(fmt.Sprintln(err))\n\t\treturn false\n\t}\n\n\tfound, err := s3Client.BucketExists(bucketname)\n\tif err != nil {\n\t\tjc.SendString(fmt.Sprintln(err))\n\t\treturn false\n\t}\n\n\tif found {\n\t\tjc.SendString(\"Bucket exists.\")\n\t} else {\n\t\tjc.SendString(\"Creating bucket.\")\n\t\terr = s3Client.MakeBucket(bucketname, \"us-east-1\")\n\t\tif err != nil {\n\t\t\tjc.SendString(fmt.Sprintln(err))\n\t\t\treturn false\n\t\t}\n\t}\n\tvar strs []string\n\tslash := dir[len(dir)-1:]\n\tif slash != \"/\" {\n\t\tstrs = append(strs, dir)\n\t\tstrs = append(strs, \"/\")\n\t\tdir = strings.Join(strs, \"\")\n\t}\n\tvar dbname []string\n\tvar dbnameLocal []string\n\tdbname = append(dbname, bucketname)\n\tdbname = append(dbname, \".db\")\n\tdbnameLocal = append(dbnameLocal, dir)\n\tdbnameLocal = append(dbnameLocal, \".\")\n\tdbnameLocal = append(dbnameLocal, strings.Join(dbname, \"\"))\n\t// check if dir exists, create if not\n\tbasedir := filepath.Dir(strings.Join(dbnameLocal, \"\"))\n\tos.MkdirAll(basedir, os.ModePerm)\n\n\t// create empty repository\n\tfile, err := os.Create(strings.Join(dbnameLocal, \"\"))\n\tdefer file.Close()\n\tif err != nil {\n\t\tjc.SendString(fmt.Sprintln(err))\n\t\treturn false\n\t}\n\tdbuploadlist := make(map[string]string)\n\t// add these files to the upload list\n\tdbuploadlist[strings.Join(dbname, \"\")] = strings.Join(dbnameLocal, \"\")\n\tfailedUploads, err := Upload(server, 443, secure, accesskey, secretkey, enckey, dbuploadlist, bucketname)\n\tif err != nil {\n\t\tfor _, hash := range failedUploads {\n\t\t\tjc.SendString(fmt.Sprintln(\"Failed to upload: \", hash))\n\t\t}\n\t\treturn false\n\t}\n\n\terr = os.Remove(strings.Join(dbnameLocal, \"\"))\n\tif err != nil {\n\t\tjc.SendString(fmt.Sprintln(\"Error deleting database!\", err))\n\t}\n\treturn true\n\n}", "func (s *synchronizer) restoreBucket(ctx context.Context, bucketSlug string) error {\n\n\tlocalBucket, err := s.getBucket(ctx, bucketSlug)\n\tif err != nil {\n\t\tlog.Error(\"Error in getBucket\", err)\n\t\treturn err\n\t}\n\n\tmirrorBucket, err := s.getMirrorBucket(ctx, bucketSlug)\n\tif err != nil {\n\t\tlog.Error(\"Error in getMirrorBucket\", err)\n\t\treturn err\n\t}\n\n\titerator := func(c context.Context, b *bucket.Bucket, itemPath string) error {\n\t\texists, _ := localBucket.FileExists(c, itemPath)\n\n\t\tif exists {\n\t\t\tnewerBucket, err := s.newerBucketPath(c, localBucket, mirrorBucket, itemPath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif newerBucket == localBucket {\n\t\t\t\t// do not overwrite: mirror is not newer\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tbucketModel, err := s.model.FindBucket(ctx, bucketSlug)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\titem, err := mirrorBucket.ListDirectory(ctx, itemPath)\n\t\tif s.eventNotifier != nil && err == nil {\n\t\t\tinfo := utils.MapDirEntryToFileInfo(api_buckets_pb.ListPathResponse(*item), itemPath)\n\t\t\tinfo.BackedUp = true\n\t\t\tinfo.LocallyAvailable = exists\n\t\t\tinfo.RestoreInProgress = true\n\t\t\ts.eventNotifier.SendFileEvent(events.NewFileEvent(info, events.FileRestoring, bucketSlug, bucketModel.DbID))\n\t\t}\n\n\t\ts.NotifyFileRestore(bucketSlug, itemPath)\n\t\treturn nil\n\t}\n\n\tif _, err = mirrorBucket.Each(ctx, \"\", iterator, true); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (cs *CloudStorage) Upload(ctx context.Context, user *domain.User,\n\tbucket string, attrs *domain.ImgAttrs, r io.Reader, prefix string) error {\n\twc := cs.Bucket(bucket).Object(prefix).NewWriter(ctx)\n\tif _, err := io.Copy(wc, r); err != nil {\n\t\treturn err\n\t}\n\tif err := wc.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (bm *BucketManager) InsertBucket(settings *BucketSettings) error {\n\tposts := url.Values{}\n\tposts.Add(\"name\", settings.Name)\n\tif settings.Type == Couchbase {\n\t\tposts.Add(\"bucketType\", \"couchbase\")\n\t} else if settings.Type == Memcached {\n\t\tposts.Add(\"bucketType\", \"memcached\")\n\t} else if settings.Type == Ephemeral {\n\t\tposts.Add(\"bucketType\", \"ephemeral\")\n\t} else {\n\t\tpanic(\"Unrecognized bucket type.\")\n\t}\n\tif settings.FlushEnabled {\n\t\tposts.Add(\"flushEnabled\", \"1\")\n\t} else {\n\t\tposts.Add(\"flushEnabled\", \"0\")\n\t}\n\tposts.Add(\"replicaNumber\", fmt.Sprintf(\"%d\", settings.Replicas))\n\tposts.Add(\"authType\", \"sasl\")\n\tposts.Add(\"saslPassword\", settings.Password)\n\tposts.Add(\"ramQuotaMB\", fmt.Sprintf(\"%d\", settings.Quota))\n\n\tdata := []byte(posts.Encode())\n\n\treq := &gocbcore.HttpRequest{\n\t\tService: gocbcore.ServiceType(MgmtService),\n\t\tPath: \"/pools/default/buckets\",\n\t\tMethod: \"POST\",\n\t\tBody: data,\n\t\tContentType: \"application/x-www-form-urlencoded\",\n\t}\n\n\tresp, err := bm.httpClient.DoHttpRequest(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode != 202 {\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = resp.Body.Close()\n\t\tif err != nil {\n\t\t\tlogDebugf(\"Failed to close socket (%s)\", err)\n\t\t}\n\t\treturn networkError{statusCode: resp.StatusCode, message: string(data)}\n\t}\n\n\treturn nil\n}", "func (p *PBM) ResyncStorage(l *log.Event) error {\n\tstg, err := p.GetStorage(l)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to get backup store\")\n\t}\n\n\t_, err = stg.FileStat(StorInitFile)\n\tif errors.Is(err, storage.ErrNotExist) {\n\t\terr = stg.Save(StorInitFile, bytes.NewBufferString(version.DefaultInfo.Version), 0)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"init storage\")\n\t}\n\n\tbcps, err := stg.List(\"\", MetadataFileSuffix)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get a backups list from the storage\")\n\t}\n\n\terr = p.moveCollection(BcpCollection, BcpOldCollection)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"copy current backups meta from %s to %s\", BcpCollection, BcpOldCollection)\n\t}\n\terr = p.moveCollection(PITRChunksCollection, PITRChunksOldCollection)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"copy current pitr meta from %s to %s\", PITRChunksCollection, PITRChunksOldCollection)\n\t}\n\n\tif len(bcps) == 0 {\n\t\treturn nil\n\t}\n\n\tvar ins []interface{}\n\tfor _, b := range bcps {\n\t\td, err := stg.SourceReader(b.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"read meta for %v\", b.Name)\n\t\t}\n\n\t\tv := BackupMeta{}\n\t\terr = json.NewDecoder(d).Decode(&v)\n\t\td.Close()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"unmarshal backup meta\")\n\t\t}\n\t\terr = checkBackupFiles(&v, stg)\n\t\tif err != nil {\n\t\t\tl.Warning(\"skip snapshot %s: %v\", v.Name, err)\n\t\t\tcontinue\n\t\t}\n\t\tins = append(ins, v)\n\t}\n\t_, err = p.Conn.Database(DB).Collection(BcpCollection).InsertMany(p.ctx, ins)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"insert retrieved backups meta\")\n\t}\n\n\tpitrf, err := stg.List(PITRfsPrefix, \"\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get list of pitr chunks\")\n\t}\n\tif len(pitrf) == 0 {\n\t\treturn nil\n\t}\n\n\tvar pitr []interface{}\n\tfor _, f := range pitrf {\n\t\t_, err := stg.FileStat(PITRfsPrefix + \"/\" + f.Name)\n\t\tif err != nil {\n\t\t\tl.Warning(\"skip pitr chunk %s/%s because of %v\", PITRfsPrefix, f.Name, err)\n\t\t\tcontinue\n\t\t}\n\t\tchnk := PITRmetaFromFName(f.Name)\n\t\tif chnk != nil {\n\t\t\tpitr = append(pitr, chnk)\n\t\t}\n\t}\n\n\tif len(pitr) == 0 {\n\t\treturn nil\n\t}\n\n\t_, err = p.Conn.Database(DB).Collection(PITRChunksCollection).InsertMany(p.ctx, pitr)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"insert retrieved pitr meta\")\n\t}\n\n\treturn nil\n}", "func upload(resp []byte, b, r string) error {\n\n\t// put bytes in reader\n\tfile := bytes.NewReader(resp)\n\n\t// configure s3 client\n\tsess, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(\"eu-west-2\")},\n\t)\n\n\t// use timestamp and repo as filename\n\tt := time.Now()\n\ttf := t.Format(time.RFC3339)\n\tfn := (tf) + \"-\" + (r)\n\n\tuploader := s3manager.NewUploader(sess)\n\n\t// upload to s3\n\t_, err = uploader.Upload(&s3manager.UploadInput{\n\t\tBucket: aws.String(b),\n\t\tKey: aws.String(fn),\n\t\tBody: file,\n\t})\n\tif err != nil {\n\t\texitErrorf(\"could not upload %q to %q, %v: \", fn, b, err)\n\t}\n\n\tfmt.Printf(\"successfully uploaded %q to %q\\n\", fn, b)\n\treturn nil\n}", "func (c *SiteReplicationSys) syncLocalToPeers(ctx context.Context) error {\n\t// If local has buckets, enable versioning on them, create them on peers\n\t// and setup replication rules.\n\tobjAPI := newObjectLayerFn()\n\tif objAPI == nil {\n\t\treturn errSRObjectLayerNotReady\n\t}\n\tbuckets, err := objAPI.ListBuckets(ctx)\n\tif err != nil {\n\t\treturn errSRBackendIssue(err)\n\t}\n\tfor _, bucketInfo := range buckets {\n\t\tbucket := bucketInfo.Name\n\n\t\t// MinIO does not store bucket location - so we just check if\n\t\t// object locking is enabled.\n\t\tlockConfig, err := globalBucketMetadataSys.GetObjectLockConfig(bucket)\n\t\tif err != nil {\n\t\t\tif _, ok := err.(BucketObjectLockConfigNotFound); !ok {\n\t\t\t\treturn errSRBackendIssue(err)\n\t\t\t}\n\t\t}\n\n\t\tvar opts BucketOptions\n\t\tif lockConfig != nil {\n\t\t\topts.LockEnabled = lockConfig.ObjectLockEnabled == \"Enabled\"\n\t\t}\n\n\t\t// Now call the MakeBucketHook on existing bucket - this will\n\t\t// create buckets and replication rules on peer clusters.\n\t\terr = c.MakeBucketHook(ctx, bucket, opts)\n\t\tif err != nil {\n\t\t\treturn errSRBucketConfigError(err)\n\t\t}\n\n\t\t// Replicate bucket policy if present.\n\t\tpolicy, err := globalPolicySys.Get(bucket)\n\t\tfound := true\n\t\tif _, ok := err.(BucketPolicyNotFound); ok {\n\t\t\tfound = false\n\t\t} else if err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tif found {\n\t\t\tpolicyJSON, err := json.Marshal(policy)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\terr = c.BucketMetaHook(ctx, madmin.SRBucketMeta{\n\t\t\t\tType: madmin.SRBucketMetaTypePolicy,\n\t\t\t\tBucket: bucket,\n\t\t\t\tPolicy: policyJSON,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBucketMetaError(err)\n\t\t\t}\n\t\t}\n\n\t\t// Replicate bucket tags if present.\n\t\ttags, err := globalBucketMetadataSys.GetTaggingConfig(bucket)\n\t\tfound = true\n\t\tif _, ok := err.(BucketTaggingNotFound); ok {\n\t\t\tfound = false\n\t\t} else if err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tif found {\n\t\t\ttagCfg, err := xml.Marshal(tags)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\ttagCfgStr := base64.StdEncoding.EncodeToString(tagCfg)\n\t\t\terr = c.BucketMetaHook(ctx, madmin.SRBucketMeta{\n\t\t\t\tType: madmin.SRBucketMetaTypeTags,\n\t\t\t\tBucket: bucket,\n\t\t\t\tTags: &tagCfgStr,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBucketMetaError(err)\n\t\t\t}\n\t\t}\n\n\t\t// Replicate object-lock config if present.\n\t\tobjLockCfg, err := globalBucketMetadataSys.GetObjectLockConfig(bucket)\n\t\tfound = true\n\t\tif _, ok := err.(BucketObjectLockConfigNotFound); ok {\n\t\t\tfound = false\n\t\t} else if err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tif found {\n\t\t\tobjLockCfgData, err := xml.Marshal(objLockCfg)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\tobjLockStr := base64.StdEncoding.EncodeToString(objLockCfgData)\n\t\t\terr = c.BucketMetaHook(ctx, madmin.SRBucketMeta{\n\t\t\t\tType: madmin.SRBucketMetaTypeObjectLockConfig,\n\t\t\t\tBucket: bucket,\n\t\t\t\tTags: &objLockStr,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBucketMetaError(err)\n\t\t\t}\n\t\t}\n\n\t\t// Replicate existing bucket bucket encryption settings\n\t\tsseConfig, err := globalBucketMetadataSys.GetSSEConfig(bucket)\n\t\tfound = true\n\t\tif _, ok := err.(BucketSSEConfigNotFound); ok {\n\t\t\tfound = false\n\t\t} else if err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tif found {\n\t\t\tsseConfigData, err := xml.Marshal(sseConfig)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\tsseConfigStr := base64.StdEncoding.EncodeToString(sseConfigData)\n\t\t\terr = c.BucketMetaHook(ctx, madmin.SRBucketMeta{\n\t\t\t\tType: madmin.SRBucketMetaTypeSSEConfig,\n\t\t\t\tBucket: bucket,\n\t\t\t\tSSEConfig: &sseConfigStr,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBucketMetaError(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t{\n\t\t// Replicate IAM policies on local to all peers.\n\t\tallPolicies, err := globalIAMSys.ListPolicies(ctx, \"\")\n\t\tif err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\n\t\tfor pname, policy := range allPolicies {\n\t\t\tpolicyJSON, err := json.Marshal(policy)\n\t\t\tif err != nil {\n\t\t\t\treturn wrapSRErr(err)\n\t\t\t}\n\t\t\terr = c.IAMChangeHook(ctx, madmin.SRIAMItem{\n\t\t\t\tType: madmin.SRIAMItemPolicy,\n\t\t\t\tName: pname,\n\t\t\t\tPolicy: policyJSON,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRIAMError(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t{\n\t\t// Replicate policy mappings on local to all peers.\n\t\tuserPolicyMap := make(map[string]MappedPolicy)\n\t\tgroupPolicyMap := make(map[string]MappedPolicy)\n\t\tglobalIAMSys.store.rlock()\n\t\terrU := globalIAMSys.store.loadMappedPolicies(ctx, stsUser, false, userPolicyMap)\n\t\terrG := globalIAMSys.store.loadMappedPolicies(ctx, stsUser, true, groupPolicyMap)\n\t\tglobalIAMSys.store.runlock()\n\t\tif errU != nil {\n\t\t\treturn errSRBackendIssue(errU)\n\t\t}\n\t\tif errG != nil {\n\t\t\treturn errSRBackendIssue(errG)\n\t\t}\n\n\t\tfor user, mp := range userPolicyMap {\n\t\t\terr := c.IAMChangeHook(ctx, madmin.SRIAMItem{\n\t\t\t\tType: madmin.SRIAMItemPolicyMapping,\n\t\t\t\tPolicyMapping: &madmin.SRPolicyMapping{\n\t\t\t\t\tUserOrGroup: user,\n\t\t\t\t\tIsGroup: false,\n\t\t\t\t\tPolicy: mp.Policies,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRIAMError(err)\n\t\t\t}\n\t\t}\n\n\t\tfor group, mp := range groupPolicyMap {\n\t\t\terr := c.IAMChangeHook(ctx, madmin.SRIAMItem{\n\t\t\t\tType: madmin.SRIAMItemPolicyMapping,\n\t\t\t\tPolicyMapping: &madmin.SRPolicyMapping{\n\t\t\t\t\tUserOrGroup: group,\n\t\t\t\t\tIsGroup: true,\n\t\t\t\t\tPolicy: mp.Policies,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRIAMError(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t{\n\t\t// Check for service accounts and replicate them. Only LDAP user\n\t\t// owned service accounts are supported for this operation.\n\t\tserviceAccounts := make(map[string]auth.Credentials)\n\t\tglobalIAMSys.store.rlock()\n\t\terr := globalIAMSys.store.loadUsers(ctx, svcUser, serviceAccounts)\n\t\tglobalIAMSys.store.runlock()\n\t\tif err != nil {\n\t\t\treturn errSRBackendIssue(err)\n\t\t}\n\t\tfor user, acc := range serviceAccounts {\n\t\t\tclaims, err := globalIAMSys.GetClaimsForSvcAcc(ctx, acc.AccessKey)\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBackendIssue(err)\n\t\t\t}\n\t\t\tif claims != nil {\n\t\t\t\tif _, isLDAPAccount := claims[ldapUserN]; !isLDAPAccount {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\t_, policy, err := globalIAMSys.GetServiceAccount(ctx, acc.AccessKey)\n\t\t\tif err != nil {\n\t\t\t\treturn errSRBackendIssue(err)\n\t\t\t}\n\t\t\tvar policyJSON []byte\n\t\t\tif policy != nil {\n\t\t\t\tpolicyJSON, err = json.Marshal(policy)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn wrapSRErr(err)\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = c.IAMChangeHook(ctx, madmin.SRIAMItem{\n\t\t\t\tType: madmin.SRIAMItemSvcAcc,\n\t\t\t\tSvcAccChange: &madmin.SRSvcAccChange{\n\t\t\t\t\tCreate: &madmin.SRSvcAccCreate{\n\t\t\t\t\t\tParent: acc.ParentUser,\n\t\t\t\t\t\tAccessKey: user,\n\t\t\t\t\t\tSecretKey: acc.SecretKey,\n\t\t\t\t\t\tGroups: acc.Groups,\n\t\t\t\t\t\tClaims: claims,\n\t\t\t\t\t\tSessionPolicy: json.RawMessage(policyJSON),\n\t\t\t\t\t\tStatus: acc.Status,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn errSRIAMError(err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (bo *bmdOwnerBase) _put(bucketmd *bucketMD) {\n\tbucketmd.vstr = strconv.FormatInt(bucketmd.Version, 10)\n\tbo.bucketmd.Store(unsafe.Pointer(bucketmd))\n}", "func commitFileUpload(\n\tctx context.Context,\n\tfs *fsMutable,\n\tchans commitChans,\n\tbundleUploadWaitGroup *sync.WaitGroup,\n\tcaFs cafs.Fs,\n\tuploadTask commitUploadTask) {\n\tdefer bundleUploadWaitGroup.Done()\n\tfile, err := fs.localCache.OpenFile(getPathToBackingFile(uploadTask.inodeID),\n\t\tos.O_RDONLY|os.O_SYNC, fileDefaultMode)\n\tif err != nil {\n\t\tselect {\n\t\tcase chans.error <- err:\n\t\t\tfs.l.Error(\"Commit: backing fs open() error on file upload\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"filename\", uploadTask.name))\n\t\tcase <-chans.done:\n\t\t}\n\t\treturn\n\t}\n\t// written, key, keys, duplicate, err =\n\tputRes, err := caFs.Put(ctx, file)\n\tif err != nil {\n\t\tselect {\n\t\tcase chans.error <- err:\n\t\t\tfs.l.Error(\"Commit: cafs Put() error on file upload\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"filename\", uploadTask.name))\n\t\tcase <-chans.done:\n\t\t}\n\t\treturn\n\t}\n\tbe := model.BundleEntry{\n\t\tHash: putRes.Key.String(),\n\t\tNameWithPath: uploadTask.name,\n\t\tFileMode: 0, // #TODO: #35 file mode support\n\t\tSize: uint64(putRes.Written),\n\t}\n\tselect {\n\tcase chans.bundleEntry <- be:\n\tcase <-chans.done:\n\t}\n\n}", "func commitFileUpload(\n\tctx context.Context,\n\tfs *fsMutable,\n\tchans commitChans,\n\tbundleUploadWaitGroup *sync.WaitGroup,\n\tcaFs cafs.Fs,\n\tuploadTask commitUploadTask) {\n\tdefer bundleUploadWaitGroup.Done()\n\tfile, err := fs.localCache.OpenFile(getPathToBackingFile(uploadTask.inodeID),\n\t\tos.O_RDONLY|os.O_SYNC, fileDefaultMode)\n\tif err != nil {\n\t\tselect {\n\t\tcase chans.error <- err:\n\t\t\tfs.l.Error(\"Commit: backing fs open() error on file upload\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"filename\", uploadTask.name))\n\t\tcase <-chans.done:\n\t\t}\n\t\treturn\n\t}\n\t// written, key, keys, duplicate, err =\n\tputRes, err := caFs.Put(ctx, file)\n\tif err != nil {\n\t\tselect {\n\t\tcase chans.error <- err:\n\t\t\tfs.l.Error(\"Commit: cafs Put() error on file upload\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"filename\", uploadTask.name))\n\t\tcase <-chans.done:\n\t\t}\n\t\treturn\n\t}\n\tbe := model.BundleEntry{\n\t\tHash: putRes.Key.String(),\n\t\tNameWithPath: uploadTask.name,\n\t\tFileMode: 0, // #TODO: #35 file mode support\n\t\tSize: uint64(putRes.Written),\n\t}\n\tselect {\n\tcase chans.bundleEntry <- be:\n\tcase <-chans.done:\n\t}\n\n}", "func Upload(w http.ResponseWriter, r *http.Request) {\n\t// Get uploaded file\n\tr.ParseMultipartForm(32 << 20)\n\tfile, _, err := r.FormFile(\"uploadFile\")\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\t// Get isPublic attribute\n\tIsPublicFromValue := r.FormValue(\"IsPublic\")\n\tif IsPublicFromValue == \"\" {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tIsPublic, err := strconv.ParseBool(IsPublicFromValue)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Identify who the user is\n\tusername := r.Context().Value(\"username\")\n\tif username == nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Get user bucket id\n\tbucketID, err := GetUserGUID(username.(string))\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Generate a unique ID to identify the photo object\n\tphotoID := uuid.New().String()\n\n\t// Register photo in photos table\n\tphoto := Photo{\n\t\tID: photoID,\n\t\tIsPublic: IsPublic,\n\t\tUserID: *bucketID,\n\t}\n\tDB.Create(&photo)\n\n\t// Retrieve user's bucket\n\tbkt := Client.Bucket(getBucketForPhoto(photo))\n\n\t// Verify existence of bucket\n\t// Only run in production as Google Cloud Storage emulator for local development does not support metadata retrieval\n\t// TODO: Need more robust diaster recovery\n\tif !IsDebug {\n\t\t_, err = Client.Bucket(getBucketForPhoto(photo)).Attrs(r.Context())\n\t\tif err == storage.ErrBucketNotExist {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(\"Bucket does not exist: \" + err.Error()))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Upload photo to bucket\n\tobj := bkt.Object(photoID)\n\tobjWriter := obj.NewWriter(r.Context())\n\tif _, err := io.Copy(objWriter, file); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err := objWriter.Close(); err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Write([]byte(photoID))\n\tw.WriteHeader(http.StatusOK)\n}", "func (d *gcpVolDriver) syncWithHost() error {\n\tlog.Println(\"Synchronizing: load existing volumes into driver & Google Cloud Storage\")\n\t// get existing volumes defined for the driver\n\tvolumesNames, err := d.getVolumesFromHost()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, v := range volumesNames {\n\t\tlog.Printf(\"Synchronizing: existing volume '%s' found\\n\", v)\n\t\t// create a GCStorage bucket for that volume if not exist\n\t\tbucketName, err := d.handleCreateGCStorageBucket(v)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// add this volume to the driver's in-memory map of volumes\n\t\td.mountedBuckets[v] = &gcsVolumes{\n\t\t\tvolume: &volume.Volume{\n\t\t\t\tName: v,\n\t\t\t\tMountpoint: filepath.Join(d.driverRootDir, v, \"_data\"),\n\t\t\t},\n\t\t\tgcsBucketName: bucketName,\n\t\t\tcleanCloud: true,\n\t\t}\n\t}\n\treturn nil\n}", "func (is *ImageStoreLocal) FinishBlobUpload(repo, uuid string, body io.Reader, dstDigest godigest.Digest) error {\n\tif err := dstDigest.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tsrc := is.BlobUploadPath(repo, uuid)\n\n\t_, err := os.Stat(src)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to stat blob\")\n\n\t\treturn zerr.ErrUploadNotFound\n\t}\n\n\tblobFile, err := os.Open(src)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open blob\")\n\n\t\treturn zerr.ErrUploadNotFound\n\t}\n\n\tdefer blobFile.Close()\n\n\tdigester := sha256.New()\n\n\t_, err = io.Copy(digester, blobFile)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"repository\", repo).Str(\"blob\", src).Str(\"digest\", dstDigest.String()).\n\t\t\tMsg(\"unable to compute hash\")\n\n\t\treturn err\n\t}\n\n\tsrcDigest := godigest.NewDigestFromEncoded(godigest.SHA256, fmt.Sprintf(\"%x\", digester.Sum(nil)))\n\n\tif srcDigest != dstDigest {\n\t\tis.log.Error().Str(\"srcDigest\", srcDigest.String()).\n\t\t\tStr(\"dstDigest\", dstDigest.String()).Msg(\"actual digest not equal to expected digest\")\n\n\t\treturn zerr.ErrBadBlobDigest\n\t}\n\n\tdir := path.Join(is.rootDir, repo, \"blobs\", dstDigest.Algorithm().String())\n\n\tvar lockLatency time.Time\n\n\tis.Lock(&lockLatency)\n\tdefer is.Unlock(&lockLatency)\n\n\terr = ensureDir(dir, is.log)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Msg(\"error creating blobs/sha256 dir\")\n\n\t\treturn err\n\t}\n\n\tdst := is.BlobPath(repo, dstDigest)\n\n\tif is.dedupe && fmt.Sprintf(\"%v\", is.cache) != fmt.Sprintf(\"%v\", nil) {\n\t\terr = is.DedupeBlob(src, dstDigest, dst)\n\t\tif err := inject.Error(err); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to dedupe blob\")\n\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif err := os.Rename(src, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to finish blob\")\n\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (gs *GistStorage) Push(localPath, remotePath string) (err error) {\n\tvar public bool = false\n\n\t// Read the encrypted data store content\n\tfileBytes, err := ioutil.ReadFile(localPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfileContent := string(fileBytes)\n\n\t// Build a Gist file store\n\tfiles := map[github.GistFilename]github.GistFile{\n\t\tgithub.GistFilename(remotePath): github.GistFile{\n\t\t\tContent: &fileContent,\n\t\t},\n\t}\n\n\t// Create a gist representation ready to be\n\t// pushed over network\n\tgist := &github.Gist{\n\t\tPublic: &public,\n\t\tFiles: files,\n\t}\n\n\t// Push the gist to github\n\t_, _, err = gs.connexion.Gists.Create(gist)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *Shipper) Sync(ctx context.Context) (uploaded int, err error) {\n\tmeta, err := ReadMetaFile(s.dir)\n\tif err != nil {\n\t\t// If we encounter any error, proceed with an empty meta file and overwrite it later.\n\t\t// The meta file is only used to avoid unnecessary bucket.Exists call,\n\t\t// which are properly handled by the system if their occur anyway.\n\t\tif !os.IsNotExist(err) {\n\t\t\tlevel.Warn(s.logger).Log(\"msg\", \"reading meta file failed, will override it\", \"err\", err)\n\t\t}\n\t\tmeta = &Meta{Version: MetaVersion1}\n\t}\n\n\t// Build a map of blocks we already uploaded.\n\thasUploaded := make(map[ulid.ULID]struct{}, len(meta.Uploaded))\n\tfor _, id := range meta.Uploaded {\n\t\thasUploaded[id] = struct{}{}\n\t}\n\n\t// Reset the uploaded slice so we can rebuild it only with blocks that still exist locally.\n\tmeta.Uploaded = nil\n\n\tvar (\n\t\tchecker = newLazyOverlapChecker(s.logger, s.bucket, s.getLabels)\n\t\tuploadErrs int\n\t)\n\n\tuploadCompacted := s.uploadCompactedFunc()\n\tmetas, err := s.blockMetasFromOldest()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tfor _, m := range metas {\n\t\t// Do not sync a block if we already uploaded or ignored it. If it's no longer found in the bucket,\n\t\t// it was generally removed by the compaction process.\n\t\tif _, uploaded := hasUploaded[m.ULID]; uploaded {\n\t\t\tmeta.Uploaded = append(meta.Uploaded, m.ULID)\n\t\t\tcontinue\n\t\t}\n\n\t\tif m.Stats.NumSamples == 0 {\n\t\t\t// Ignore empty blocks.\n\t\t\tlevel.Debug(s.logger).Log(\"msg\", \"ignoring empty block\", \"block\", m.ULID)\n\t\t\tcontinue\n\t\t}\n\n\t\t// We only ship of the first compacted block level as normal flow.\n\t\tif m.Compaction.Level > 1 {\n\t\t\tif !uploadCompacted {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// Check against bucket if the meta file for this block exists.\n\t\tok, err := s.bucket.Exists(ctx, path.Join(m.ULID.String(), block.MetaFilename))\n\t\tif err != nil {\n\t\t\treturn 0, errors.Wrap(err, \"check exists\")\n\t\t}\n\t\tif ok {\n\t\t\tmeta.Uploaded = append(meta.Uploaded, m.ULID)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Skip overlap check if out of order uploads is enabled.\n\t\tif m.Compaction.Level > 1 && !s.allowOutOfOrderUploads {\n\t\t\tif err := checker.IsOverlapping(ctx, m.BlockMeta); err != nil {\n\t\t\t\treturn 0, errors.Errorf(\"Found overlap or error during sync, cannot upload compacted block, details: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tif err := s.upload(ctx, m); err != nil {\n\t\t\tif !s.allowOutOfOrderUploads {\n\t\t\t\treturn 0, errors.Wrapf(err, \"upload %v\", m.ULID)\n\t\t\t}\n\n\t\t\t// No error returned, just log line. This is because we want other blocks to be uploaded even\n\t\t\t// though this one failed. It will be retried on second Sync iteration.\n\t\t\tlevel.Error(s.logger).Log(\"msg\", \"shipping failed\", \"block\", m.ULID, \"err\", err)\n\t\t\tuploadErrs++\n\t\t\tcontinue\n\t\t}\n\t\tmeta.Uploaded = append(meta.Uploaded, m.ULID)\n\t\tuploaded++\n\t\ts.metrics.uploads.Inc()\n\t}\n\tif err := WriteMetaFile(s.logger, s.dir, meta); err != nil {\n\t\tlevel.Warn(s.logger).Log(\"msg\", \"updating meta file failed\", \"err\", err)\n\t}\n\n\ts.metrics.dirSyncs.Inc()\n\tif uploadErrs > 0 {\n\t\ts.metrics.uploadFailures.Add(float64(uploadErrs))\n\t\treturn uploaded, errors.Errorf(\"failed to sync %v blocks\", uploadErrs)\n\t}\n\n\tif uploadCompacted {\n\t\ts.metrics.uploadedCompacted.Set(1)\n\t} else {\n\t\ts.metrics.uploadedCompacted.Set(0)\n\t}\n\treturn uploaded, nil\n}", "func putBucket(w http.ResponseWriter, r *http.Request) {\n\n\tpathParams := mux.Vars(r)\n\tsageBucketID := pathParams[\"bucket\"]\n\t//objectKey := pathParams[\"key\"]\n\n\tvars := mux.Vars(r)\n\tusername := vars[\"username\"]\n\n\trawQuery := r.URL.RawQuery\n\n\tif strings.Contains(rawQuery, \"permission\") {\n\t\tallowed, err := userHasBucketPermission(username, sageBucketID, \"WRITE_ACP\")\n\t\tif err != nil {\n\t\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\t\treturn\n\t\t}\n\t\tif !allowed {\n\t\t\trespondJSONError(w, http.StatusUnauthorized, \"Write access to bucket permissions denied (%s, %s)\", username, sageBucketID)\n\t\t\treturn\n\t\t}\n\n\t\tbucketObject, err := GetSageBucket(sageBucketID)\n\t\tif err != nil {\n\t\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tvar newPerm SAGEBucketPermission\n\n\t\terr = json.NewDecoder(r.Body).Decode(&newPerm)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"Could not parse json: %s\", err.Error())\n\t\t\trespondJSONError(w, http.StatusBadRequest, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tif bucketObject.Owner == newPerm.Grantee {\n\t\t\trespondJSONError(w, http.StatusBadRequest, \"You cannot change your own permissons.\")\n\t\t\treturn\n\t\t}\n\n\t\tif newPerm.GranteeType == \"\" {\n\t\t\trespondJSONError(w, http.StatusBadRequest, \"GranteeType missing\")\n\t\t\treturn\n\t\t}\n\n\t\tif newPerm.GranteeType == \"GROUP\" && newPerm.Grantee == \"AllUsers\" && newPerm.Permission != \"READ\" {\n\t\t\trespondJSONError(w, http.StatusBadRequest, \"Buckets can be made public only for READ access.\")\n\t\t\treturn\n\t\t}\n\n\t\t//do something\n\t\tdb, err := sql.Open(\"mysql\", mysqlDSN)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"Unable to connect to database: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tdefer db.Close()\n\n\t\tinsertQueryStr := \"INSERT INTO BucketPermissions (id, granteeType, grantee, permission) VALUES ( UUID_TO_BIN(?), ? , ?, ?) ;\"\n\t\t_, err = db.Exec(insertQueryStr, sageBucketID, newPerm.GranteeType, newPerm.Grantee, newPerm.Permission)\n\t\tif err != nil {\n\t\t\tme, ok := err.(*mysql.MySQLError)\n\t\t\tif ok {\n\t\t\t\tif me.Number == 1062 {\n\t\t\t\t\t// entry already exists, quietly respond OK\n\t\t\t\t\trespondJSON(w, http.StatusOK, newPerm)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = fmt.Errorf(\"Adding bucket permissions failed: %s\", err.Error())\n\t\t\trespondJSONError(w, http.StatusUnauthorized, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\trespondJSON(w, http.StatusOK, newPerm)\n\t\treturn\n\t}\n\n\trespondJSONError(w, http.StatusUnauthorized, \"Only query ?permissions supported\")\n\treturn\n\t//respondJSON(w, http.StatusOK, newBucket)\n\t//bucket fields:\n\t//metadata , name , type, (owner, change requires permission change)\n\n\t//permission\n\n}", "func (s *Syncer) Sync(localObjects []uploader.Object, saveRoot string) error {\n\tremoteObjects, err := s.uploader.ListObjects(saveRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"find %d local objects\", len(localObjects))\n\tlog.Printf(\"find %d remote objects\", len(remoteObjects))\n\tlog.Printf(\"compare the local files and the remote objects...\")\n\ts.compareObjects(localObjects, remoteObjects)\n\n\tlog.Printf(\"found %d files to be uploaded, uploading...\", len(s.tobeUploadedObjects))\n\tfor _, obj := range s.tobeUploadedObjects {\n\t\tlog.Printf(\"[%s] %s => %s\", obj.Type, obj.FilePath, obj.Key)\n\t\tif err := s.uploader.Upload(obj.Key, obj.FilePath); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Printf(\"found %d files to be deleted, cleaning...\", len(s.tobeDeletedObjects))\n\tfor _, obj := range s.tobeDeletedObjects {\n\t\tlog.Printf(\"[deleted] %s\", obj.Key)\n\t\tif err := s.uploader.Delete(obj.Key); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Printf(\"files sync done.\")\n\treturn nil\n}", "func (gcs *StorageConnection) StoreInBucket(ctx context.Context, fileName, url string) (err error) {\n\tvar response *http.Response\n\t//TODO add more filename validation\n\tif fileName == \"\" {\n\t\treturn fmt.Errorf(\"Filename is empty.\")\n\t}\n\t// Get HTTP response\n\tresponse, err = http.Get(url)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"HTTP response returned an error: %v\", err)\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode == http.StatusOK {\n\t\tobj := gcs.bucket.Object(fileName)\n\n\t\t// w implements io.Writer.\n\t\tw := obj.NewWriter(ctx)\n\n\t\t// Copy file into storage\n\t\t_, err = io.Copy(w, response.Body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to copy %v to bucket with the error: %v\", fileName, err)\n\t\t}\n\n\t\tif err = w.Close(); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to close storage connection: %v\", err)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *TestSuite) TestPutBucket(c *C) {\n\troot, e := ioutil.TempDir(os.TempDir(), \"fs-\")\n\tc.Assert(e, IsNil)\n\tdefer os.RemoveAll(root)\n\n\tbucketPath := filepath.Join(root, \"bucket\")\n\tfsClient, err := fsNew(bucketPath)\n\tc.Assert(err, IsNil)\n\terr = fsClient.MakeBucket(\"us-east-1\", true, false)\n\tc.Assert(err, IsNil)\n}", "func syncRepo(c *gin.Context) {\n\tr := c.Param(\"repo\")\n\tif strings.Contains(r, \"not-found\") {\n\t\tmsg := fmt.Sprintf(\"Repo %s does not exist\", r)\n\n\t\tc.AbortWithStatusJSON(http.StatusNotFound, types.Error{Message: &msg})\n\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, fmt.Sprintf(\"Repo %s has been synced\", r))\n}", "func (api *bucketAPI) SyncUpdate(obj *objstore.Bucket) error {\n\tif api.ct.objResolver != nil {\n\t\tlog.Fatal(\"Cannot use Sync update when object resolver is enabled on ctkit\")\n\t}\n\tnewObj := obj\n\tvar writeErr error\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tnewObj, writeErr = apicl.ObjstoreV1().Bucket().Update(context.Background(), obj)\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleBucketEvent(&kvstore.WatchEvent{Object: newObj, Type: kvstore.Updated})\n\t}\n\n\treturn writeErr\n}", "func syncFileUp(fileMapping LocalToRemoteFileMapping, encrypt bool,\n\texistingDriveFiles map[string]*drive.File, pb *pb.ProgressBar) error {\n\tdebug.Printf(\"syncFileUp: %#v\", fileMapping.LocalFileInfo)\n\n\t// We need to create the file or folder on Google Drive.\n\tvar err error\n\n\t// Get the *drive.File for the folder to create the new file in.\n\t// This folder should definitely exist at this point, since we\n\t// create all folders needed before starting to upload files.\n\tdirPath := filepath.Dir(fileMapping.RemotePath)\n\tif dirPath == \".\" {\n\t\tdirPath = \"/\"\n\t}\n\tparentFile, ok := existingDriveFiles[dirPath]\n\tif !ok {\n\t\tparentFile, err = getDriveFile(dirPath)\n\t\tif err != nil {\n\t\t\t// We can't really recover at this point; the\n\t\t\t// parent folder definitely should have been\n\t\t\t// created by now, and we can't proceed without\n\t\t\t// it...\n\t\t\tprintErrorAndExit(fmt.Errorf(\"skicka: %v\\n\", err))\n\t\t}\n\t}\n\n\tbaseName := filepath.Base(fileMapping.RemotePath)\n\tvar driveFile *drive.File\n\n\tif fileMapping.LocalFileInfo.IsDir() {\n\t\tdriveFile, _ = createDriveFolder(baseName,\n\t\t\tfileMapping.LocalFileInfo.Mode(), fileMapping.LocalFileInfo.ModTime(), parentFile)\n\t\tatomic.AddInt64(&stats.UploadBytes, fileMapping.LocalFileInfo.Size())\n\t\tpb.Add64(fileMapping.LocalFileInfo.Size())\n\t\tverbose.Printf(\"Created Google Drive folder %s\", fileMapping.RemotePath)\n\n\t\t// We actually only update the map when we create new folders;\n\t\t// we don't update it for new files. There are two reasons\n\t\t// for this: first, once we've created a file, we don't\n\t\t// access it again during a given run of skicka.\n\t\t// Second, file upload is multi-threaded, and would require a\n\t\t// mutex to the map, which doesn't seem worth the trouble\n\t\t// given the first reason.\n\t\t//\n\t\t// Note that if the contents of Google Drive are modified in\n\t\t// another session, this map may become stale; we don't\n\t\t// explicitly look out for this and will presumably error out\n\t\t// in interesting ways if it does happen.\n\t\texistingDriveFiles[fileMapping.RemotePath] = driveFile\n\t} else {\n\t\tif driveFile, ok = existingDriveFiles[fileMapping.RemotePath]; !ok {\n\t\t\tdriveFile, err = createDriveFile(baseName, fileMapping.LocalFileInfo.Mode(),\n\t\t\t\tfileMapping.LocalFileInfo.ModTime(), encrypt, parentFile)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tvar iv []byte\n\t\tif encrypt {\n\t\t\tiv, err = getInitializationVector(driveFile)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to get IV: %v\\n\", err)\n\t\t\t}\n\t\t}\n\n\t\tfor ntries := 0; ntries < 5; ntries++ {\n\t\t\tvar reader io.Reader\n\t\t\tvar countingReader *ByteCountingReader\n\n\t\t\tcontentsReader, length, err :=\n\t\t\t\tgetFileContentsReaderForUpload(fileMapping.LocalPath, encrypt, iv)\n\t\t\tif contentsReader != nil {\n\t\t\t\tdefer contentsReader.Close()\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treader = contentsReader\n\n\t\t\tif pb != nil {\n\t\t\t\tcountingReader = &ByteCountingReader{\n\t\t\t\t\tR: reader,\n\t\t\t\t}\n\t\t\t\treader = io.TeeReader(countingReader, pb)\n\t\t\t}\n\n\t\t\terr = uploadFileContents(driveFile, reader, length, ntries)\n\t\t\tif err == nil {\n\t\t\t\t// Success!\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif re, ok := err.(RetryHTTPTransmitError); ok {\n\t\t\t\tdebug.Printf(\"%s: got retry http error--retrying: %s\",\n\t\t\t\t\tfileMapping.LocalPath, re.Error())\n\t\t\t\tif pb != nil {\n\t\t\t\t\t// The \"progress\" made so far on this file should be rolled back\n\t\t\t\t\tpb.Add64(int64(0 - countingReader.bytesRead))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdebug.Printf(\"%s: giving up due to error: %v\",\n\t\t\t\t\tfileMapping.LocalPath, err)\n\t\t\t\t// This file won't be uploaded, so subtract the expected progress\n\t\t\t\t// from the total expected bytes\n\t\t\t\tif pb != nil {\n\t\t\t\t\tpb.Add64(int64(0 - countingReader.bytesRead))\n\t\t\t\t\tpb.Total -= length\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tverbose.Printf(\"Updated local %s -> Google Drive %s\", fileMapping.LocalPath,\n\t\tfileMapping.RemotePath)\n\treturn updateModificationTime(driveFile, fileMapping.LocalFileInfo.ModTime())\n}", "func remoteS3(localarch string) {\n\tdefer func() {\n\t\t_ = os.Remove(localarch)\n\t}()\n\tendpoint := brf.Creds.StorageTargetEndpoint\n\taccessKeyID := \"\"\n\tsecretAccessKey := \"\"\n\tfor _, p := range brf.Creds.Params {\n\t\tif p.Key == \"AWS_ACCESS_KEY_ID\" {\n\t\t\taccessKeyID = p.Value\n\t\t}\n\t\tif p.Key == \"AWS_SECRET_ACCESS_KEY\" {\n\t\t\tsecretAccessKey = p.Value\n\t\t}\n\t}\n\tuseSSL := true\n\t_, f := filepath.Split(localarch)\n\tbucket := brf.InfraService + \"-backup-\" + strings.TrimSuffix(f, filepath.Ext(f))\n\tobject := \"latest.zip\"\n\tctype := \"application/zip\"\n\n\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Info(fmt.Sprintf(\"Trying to back up to %s/%s in S3 compatible remote storage\", bucket, object))\n\tif mc, err := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL); err != nil {\n\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Fatal(fmt.Sprintf(\"%s \", err))\n\t} else {\n\t\tlocation := \"us-east-1\"\n\t\tif err = mc.MakeBucket(bucket, location); err != nil {\n\t\t\texists, err := mc.BucketExists(bucket)\n\t\t\tif err == nil && exists {\n\t\t\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Info(fmt.Sprintf(\"Bucket %s already exists\", bucket))\n\t\t\t} else {\n\t\t\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Fatal(fmt.Sprintf(\"%s\", err))\n\t\t\t}\n\t\t}\n\t\tif nbytes, err := mc.FPutObject(bucket, object, localarch, ctype); err != nil {\n\t\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Fatal(fmt.Sprintf(\"%s\", err))\n\t\t} else {\n\t\t\tlog.WithFields(log.Fields{\"func\": \"remoteS3\"}).Info(fmt.Sprintf(\"Successfully stored %s/%s (%d Bytes) in S3 compatible remote storage %s\", bucket, object, nbytes, endpoint))\n\t\t}\n\t}\n}", "func syncLocalAssets(cr command.Runner) error {\n\tfs, err := localAssets()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, f := range fs {\n\t\terr := cr.Copy(f)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (gcs *gcsPhotos) uploadPhotos() []string {\n ext := \".jpg\"\n subDir := \"photos/\"\n testPhotos := []string{ \"0\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\"}\n\t \n for _, name := range testPhotos {\n ffile := subDir + name + ext\n srcFile, fName, err := gcs.read(ffile)\n if err != nil {\n log.Errorf(gcs.ctx, \"Open / read file error %v\", err)\n return nil\n }\n fName = fName + ext\n gcs.write(fName, srcFile)\n log.Infof(gcs.ctx, \"In File: %s, Out File: %s\\n\", ffile, fName)\n }\n\t return gcs.retrievePhotos()\n}", "func uploadConcurrent(localPath string, bucket string) {\n\n\tconst maxWorkers = 5\n\n\t// helper function to allocate int64 and\n\t// initialize it in one function call\n\tvar newInt64 = func(init int64) *int64 {\n\t\tval := new(int64)\n\t\t*val = init\n\t\treturn val\n\t}\n\n\tvar partNumber int64 = 1 // part number must start from 1 according to AWS SDK\n\tvar totalBytes int64\n\n\tkeyName := filepath.Base(localPath) // extract file name from the path and consider it as key name\n\n\ts, err := session.NewSession()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\ts3client := s3.New(s)\n\n\tmpuInput := &s3.CreateMultipartUploadInput{\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(keyName),\n\t}\n\n\t// initiate multipart upload\n\tmpu, err := s3client.CreateMultipartUpload(mpuInput)\n\tif err != nil {\n\t\tprintAwsError(err)\n\t\tpanic(err)\n\t}\n\n\tfile, err := os.Open(localPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\n\t// etags will store multipart upload Etag values\n\t// for proper completion of multipart upload\n\tetags := make([]*s3.CompletedPart, 0)\n\n\tetagschan := make(chan *s3.CompletedPart)\n\tworkersCtrl := make(chan struct{}, maxWorkers)\n\tendRead := make(chan struct{})\n\tendUpload := make(chan struct{})\n\n\tgo func() {\n\t\tvar cleanup = func() {\n\t\t\tclose(workersCtrl)\n\t\t\tclose(etagschan)\n\t\t\tclose(endRead)\n\t\t\tclose(endUpload)\n\t\t}\n\t\tdefer cleanup()\n\t\tdone := false\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase etag := <-etagschan:\n\t\t\t\tetags = append(etags, etag)\n\t\t\t\t<-workersCtrl\n\t\t\t\tif done && len(workersCtrl) == 0 {\n\t\t\t\t\tgoto End\n\t\t\t\t}\n\t\t\tcase <-endRead:\n\t\t\t\tdone = true\n\t\t\t\tif len(workersCtrl) == 0 {\n\t\t\t\t\tgoto End\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tEnd:\n\t\tendUpload <- struct{}{}\n\t}()\n\n\tfmt.Println(\"Uploading...\")\n\tfor {\n\t\tbuf := make([]byte, 1024 * 1024 * (*c))\n\t\tbytesRead, err := file.Read(buf)\n\t\tif err == io.EOF {\n\t\t\t// io.EOF always returns bytesRead = 0 so we are safe to break\n\t\t\tendRead <- struct{}{}\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// increment workers count toward max\n\t\tworkersCtrl <- struct{}{}\n\n\t\tgo func(buf []byte, pn int64) {\n\t\t\tbufReader := bytes.NewReader(buf)\n\t\t\tinput := &s3.UploadPartInput{\n\t\t\t\tBody: bufReader,\n\t\t\t\tBucket: aws.String(bucket),\n\t\t\t\tKey: aws.String(keyName),\n\t\t\t\tPartNumber: aws.Int64(pn),\n\t\t\t\tUploadId: mpu.UploadId,\n\t\t\t}\n\t\t\tresult, err := s3client.UploadPart(input)\n\t\t\tif err != nil {\n\t\t\t\tprintAwsError(err)\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tetagschan <- &s3.CompletedPart{ ETag:result.ETag, PartNumber: newInt64(pn) }\n\t\t\ttotalBytes += bufReader.Size()\n\t\t}(buf[0:bytesRead], partNumber) // bytes read, not buffer size\n\n\t\tpartNumber++\n\t}\n\n\t<-endUpload\n\n\tsort.Slice(etags, func(i, j int) bool {\n\t\treturn *etags[i].PartNumber < *etags[j].PartNumber\n\t})\n\n\tcmpuInput := &s3.CompleteMultipartUploadInput{\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(keyName),\n\t\tMultipartUpload: &s3.CompletedMultipartUpload{\n\t\t\tParts: etags,\n\t\t},\n\t\tUploadId: mpu.UploadId,\n\t}\n\n\tresult, err := s3client.CompleteMultipartUpload(cmpuInput)\n\tif err != nil {\n\t\tprintAwsError(err)\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Successfully uploaded object\", *result.Key, \"to bucket. Etag:\", *result.Bucket, *result.ETag)\n}", "func SyncPublicS3Files(awsSession *session.Session, staticS3Bucket, staticS3Prefix, staticDir string, metadatas ...Metadata) error {\n\tuploader := s3manager.NewUploader(awsSession)\n\n\t// Set the default cache-control, users can override this value with a Metadata arg.\n\tmetadata := map[string]*string{\n\t\t\"Cache-Control\": aws.String(\"max-age=604800\"),\n\t}\n\tfor _, kv := range metadatas {\n\t\tmetadata[kv.Key] = aws.String(kv.Value)\n\t}\n\n\tdi, err := NewDirectoryIterator(staticS3Bucket, staticS3Prefix, staticDir, \"public-read\", metadata)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = uploader.UploadWithIterator(aws.BackgroundContext(), di)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func upload(bucket, file string, config *s3util.Config) error {\n\t// open the local file to upload\n\tlocalFile, err := os.Open(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer localFile.Close()\n\n\theaders := http.Header{}\n\theaders.Add(\"x-amz-acl\", \"private\")\n\ts3File, err := s3util.Create(generateS3Url(bucket, filepath.Base(file)), headers, config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s3File.Close()\n\n\t// copy the file\n\t_, err = io.Copy(s3File, localFile)\n\treturn err\n}", "func (s *Storage) Push(request *openapi.BackupRequest, filename string) error {\n\tfor _, v := range request.Envs {\n\t\tos.Setenv(v.Name, v.Value)\n\t}\n\tctx := context.Background()\n\tclient, err := getClient(ctx)\n\tif err != nil {\n\t\tlog.Printf(\"Error push/gcp %s to %s:%s, error: %v\", filename, request.Bucket, request.Location, err)\n\t\treturn fmt.Errorf(\"Cannot get Client: %v\", err)\n\t}\n\tdefer client.Close()\n\n\t// Open local file.\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\tlog.Printf(\"Error push/opening %s to %s:%s, error: %v\", filename, request.Bucket, request.Location, err)\n\t\treturn fmt.Errorf(\"os.Open: %v\", err)\n\t}\n\tdefer f.Close()\n\n\tctx, cancel := context.WithTimeout(ctx, time.Second*60)\n\tdefer cancel()\n\tlocation := request.Location\n\tif request.Location[0:1] == \"/\" {\n\t\tlocation = request.Location[1:]\n\t}\n\twc := client.Bucket(request.Bucket).Object(location).NewWriter(ctx)\n\tif _, err = io.Copy(wc, f); err != nil {\n\t\tlog.Printf(\"Error push/writer %s to %s:%s, error: %v\", filename, request.Bucket, request.Location, err)\n\t\treturn fmt.Errorf(\"io.Copy: %v\", err)\n\t}\n\tif err := wc.Close(); err != nil {\n\t\tlog.Printf(\"Error push/close %s to %s:%s, error: %v\", filename, request.Bucket, request.Location, err)\n\t\treturn fmt.Errorf(\"Writer.Close: %v\", err)\n\t}\n\tlog.Printf(\"Pushing %s to %s:%s, succeeded\", filename, request.Bucket, request.Location)\n\treturn nil\n}", "func (api *bucketAPI) SyncDelete(obj *objstore.Bucket) error {\n\tvar writeErr error\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, writeErr = apicl.ObjstoreV1().Bucket().Delete(context.Background(), &obj.ObjectMeta)\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleBucketEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Deleted})\n\t}\n\n\treturn writeErr\n}", "func (m *minioServer) putter(ctx context.Context, bucket, object, fpath string, overwrite bool) error {\n\tif err := m.ensureBucketExists(ctx, bucket); err != nil {\n\t\treturn fmt.Errorf(\"unable to validate %s bucket exists: %w\", bucket, err)\n\t}\n\tfi, err := os.Stat(fpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl := log.WithFields(log.Fields{\n\t\t\"bucket\": bucket,\n\t\t\"creator\": myHostName,\n\t\t\"from\": fpath,\n\t\t\"func\": \"putter\",\n\t\t\"object\": object,\n\t\t\"overwrite\": overwrite,\n\t\t\"size\": fmt.Sprintf(\"%d\", fi.Size()),\n\t})\n\n\tfo, err := os.Open(fpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tl.Info(\"Calculating SHA256 for upload consideration\")\n\tsha256, err := calcSha256(fo)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.WithField(\"sha256\", sha256).Infof(\"Calculated SHA256\")\n\n\tmC, err := m.client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts, err := mC.StatObject(ctx, bucket, object, minio.GetObjectOptions{})\n\tif err == nil {\n\t\trSHA, ok := s.UserMetadata[\"X-Amz-Meta-Sha256\"]\n\t\tif ok {\n\t\t\tif rSHA == sha256 && fi.Size() == s.Size {\n\t\t\t\tl.Infof(\"Exact version has already been uploaded, skipping\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tl.WithFields(log.Fields{\n\t\t\t\t\"remote sha\": rSHA,\n\t\t\t\t\"remote size\": s.Size,\n\t\t\t}).Info(\"Replacing remove version\")\n\t\t}\n\n\t\tif !overwrite {\n\t\t\tl.Warning(\"Skipping overwrite of file; overwrite set to false for the this file\")\n\t\t}\n\t}\n\n\tl.WithField(\"sha256\", sha256).Info(\"Starting Upload\")\n\ti, err := mC.FPutObject(ctx, bucket, object, fpath,\n\t\tminio.PutObjectOptions{\n\t\t\t// When uploaded, user-metadata will be X-Amz-Meta-<key>\n\t\t\tUserMetadata: map[string]string{\n\t\t\t\t\"creator\": myHostName,\n\t\t\t\t\"sha256\": sha256,\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to upload to %s/%s: %w\", bucket, object, err)\n\t}\n\tl.WithFields(log.Fields{\n\t\t\"etag\": i.ETag,\n\t\t\"remote size\": i.Size,\n\t}).Info(\"Uploaded\")\n\n\treturn nil\n}", "func (g *gcs) Upload(ctx context.Context, localPath string, remotePath string) (err error) {\n\tgcsObject := g.bucket.Object(remotePath)\n\tgcsWriter := gcsObject.NewWriter(g.context)\n\n\tsourceFile, err := os.Open(localPath)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer sourceFile.Close()\n\n\tif _, err = io.Copy(gcsWriter, sourceFile); err != nil {\n\t\treturn\n\t}\n\n\tif err = gcsWriter.Close(); err != nil {\n\t\tgcsObject.Delete(g.context)\n\t\treturn\n\t}\n\n\tif err = gcsObject.ACL().Set(g.context, storage.AllUsers, storage.RoleReader); err != nil {\n\t\tgcsObject.Delete(g.context)\n\t\treturn\n\t}\n\n\treturn\n}", "func cleanBucket(ctx context.Context, bkt *storage.BucketHandle, mod, ver string) error {\n\tif err := bkt.Object(config.PackageVersionedName(mod, ver, \"mod\")).Delete(ctx); err != nil {\n\t\treturn err\n\t}\n\tif err := bkt.Object(config.PackageVersionedName(mod, ver, \"info\")).Delete(ctx); err != nil {\n\t\treturn err\n\t}\n\tif err := bkt.Object(config.PackageVersionedName(mod, ver, \"zip\")).Delete(ctx); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (w *streamedBlockWriter) syncDir() (err error) {\n\tdf, err := fileutil.OpenDir(w.blockDir)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"open temporary block blockDir\")\n\t}\n\n\tdefer runutil.CloseWithErrCapture(&err, df, \"close temporary block blockDir\")\n\n\tif err := fileutil.Fdatasync(df); err != nil {\n\t\treturn errors.Wrap(err, \"sync temporary blockDir\")\n\t}\n\n\treturn nil\n}", "func (is *ObjectStorage) FinishBlobUpload(repo, uuid string, body io.Reader, dstDigest godigest.Digest) error {\n\tif err := dstDigest.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tsrc := is.BlobUploadPath(repo, uuid)\n\n\t// complete multiUploadPart\n\tfileWriter, err := is.store.Writer(context.Background(), src, true)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open blob\")\n\n\t\treturn zerr.ErrBadBlobDigest\n\t}\n\n\tif err := fileWriter.Commit(); err != nil {\n\t\tis.log.Error().Err(err).Msg(\"failed to commit file\")\n\n\t\treturn err\n\t}\n\n\tif err := fileWriter.Close(); err != nil {\n\t\tis.log.Error().Err(err).Msg(\"failed to close file\")\n\n\t\treturn err\n\t}\n\n\tfileReader, err := is.store.Reader(context.Background(), src, 0)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open file\")\n\n\t\treturn zerr.ErrUploadNotFound\n\t}\n\n\tdefer fileReader.Close()\n\n\tsrcDigest, err := godigest.FromReader(fileReader)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open blob\")\n\n\t\treturn zerr.ErrBadBlobDigest\n\t}\n\n\tif srcDigest != dstDigest {\n\t\tis.log.Error().Str(\"srcDigest\", srcDigest.String()).\n\t\t\tStr(\"dstDigest\", dstDigest.String()).Msg(\"actual digest not equal to expected digest\")\n\n\t\treturn zerr.ErrBadBlobDigest\n\t}\n\n\tdst := is.BlobPath(repo, dstDigest)\n\n\tvar lockLatency time.Time\n\n\tis.Lock(&lockLatency)\n\tdefer is.Unlock(&lockLatency)\n\n\tif is.dedupe && fmt.Sprintf(\"%v\", is.cache) != fmt.Sprintf(\"%v\", nil) {\n\t\tif err := is.DedupeBlob(src, dstDigest, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to dedupe blob\")\n\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif err := is.store.Move(context.Background(), src, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to finish blob\")\n\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func uploadToS3(data urlbox.ShotData) (s3Link string) {\n\tif data.URL != \"\" && data.Width > 0 && data.Height > 0 {\n\t\tawsSecret := os.Getenv(\"SNAPMAKER_AWS_ACCESS_SECRET\")\n\t\tawsKey := os.Getenv(\"SNAPMAKER_AWS_ACCESS_KEY\")\n\n\t\tif awsSecret == \"\" || awsKey == \"\" {\n\t\t\tlog.Fatal(\"[!]invalid AWS credentials\")\n\t\t}\n\t\tauth, _ := aws.GetAuth(awsKey, awsSecret)\n\t\tclient := s3.New(auth, aws.USEast)\n\n\t\tsnapBucket := client.Bucket(BUCKETNAME)\n\n\t\tfileName := urlbox.GetFileName(data)\n\t\tbytes, filetype := getFile(fileName)\n\t\tsnapBucket.Put(fileName, bytes, filetype, s3.PublicRead)\n\t\ts3Link = snapBucket.URL(fileName)\n\t\tos.Remove(fileName)\n\t}\n\treturn\n}", "func (mb *metadataBackend) sync() error {\n\treturn mb.db.Sync()\n}", "func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) error {\n\tsize, err := objstore.TryToGetSize(r)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"getting size of %s\", name)\n\t}\n\n\tpartNums, lastSlice := int(math.Floor(float64(size)/partSize)), size%partSize\n\tif partNums == 0 {\n\t\tbody, err := bce.NewBodyFromSizedReader(r, lastSlice)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to create SizedReader for %s\", name)\n\t\t}\n\n\t\tif _, err := b.client.PutObject(b.name, name, body, nil); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to upload %s\", name)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tresult, err := b.client.BasicInitiateMultipartUpload(b.name, name)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to initiate MultipartUpload for %s\", name)\n\t}\n\n\tuploadEveryPart := func(partSize int64, part int, uploadId string) (string, error) {\n\t\tbody, err := bce.NewBodyFromSizedReader(r, partSize)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tetag, err := b.client.UploadPart(b.name, name, uploadId, part, body, nil)\n\t\tif err != nil {\n\t\t\tif err := b.client.AbortMultipartUpload(b.name, name, uploadId); err != nil {\n\t\t\t\treturn etag, err\n\t\t\t}\n\t\t\treturn etag, err\n\t\t}\n\t\treturn etag, nil\n\t}\n\n\tvar parts []api.UploadInfoType\n\n\tfor part := 1; part <= partNums; part++ {\n\t\tetag, err := uploadEveryPart(partSize, part, result.UploadId)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to upload part %d for %s\", part, name)\n\t\t}\n\t\tparts = append(parts, api.UploadInfoType{PartNumber: part, ETag: etag})\n\t}\n\n\tif lastSlice != 0 {\n\t\tetag, err := uploadEveryPart(lastSlice, partNums+1, result.UploadId)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to upload the last part for %s\", name)\n\t\t}\n\t\tparts = append(parts, api.UploadInfoType{PartNumber: partNums + 1, ETag: etag})\n\t}\n\n\tif _, err := b.client.CompleteMultipartUploadFromStruct(b.name, name, result.UploadId, &api.CompleteMultipartUploadArgs{Parts: parts}); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to set %s upload completed\", name)\n\t}\n\treturn nil\n}", "func (instance *Storage) Sync() error {\n\tif dirty {\n\t\tif err := writeToFile(); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\tdirty = false\n\t\t}\n\t}\n\treturn nil\n}", "func SuggestBucket(method, bucket, kind string) (string, error) {\n\tif method == DirectUploadMethod {\n\t\treturn \"\", nil\n\t}\n\tif bucket == \"\" {\n\t\tb, err := gql.SuggestedBucket(kind, method)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn b, nil\n\t}\n\n\tb, buckets, err := gql.QueryBucket(kind, method, bucket)\n\tif err != nil {\n\t\te := fmt.Sprintf(\"Valid buckets are: %q. Your input: %q\\n\", buckets, bucket)\n\t\treturn \"\", errors.New(e)\n\t}\n\treturn b, nil\n}", "func (gcs *GSCClient) Upload(b []byte, bucket, fileName string) (string, error) {\n\tr := bytes.NewReader(b)\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\twc := gcs.client.Bucket(bucket).Object(fileName).NewWriter(ctx)\n\tif _, err := io.Copy(wc, r); err != nil {\n\t\treturn \"\", fmt.Errorf(\"falha ao copiar conteúdo de arquivo local para o bucket no GCS (%s/%s), erro %q\", bucket, fileName, err)\n\t}\n\tif err := wc.Close(); err != nil {\n\t\treturn \"\", fmt.Errorf(\"falha ao fechar storate.Writter object (%s/%s), erro %q\", bucket, fileName, err)\n\t}\n\treturn fmt.Sprintf(\"%s/%s\", bucket, fileName), nil\n}", "func DeployBucket(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Bucket, error) {\n\tparsed, err := abi.JSON(strings.NewReader(BucketABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(BucketBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &Bucket{BucketCaller: BucketCaller{contract: contract}, BucketTransactor: BucketTransactor{contract: contract}, BucketFilterer: BucketFilterer{contract: contract}}, nil\n}", "func putObject(ctx *context, onDisk string, uploadKey string) error {\n\t// Setup\n\tsess := session.Must(session.NewSession())\n\t// Ex: $HOME/temp/blast/db/README\n\tlog.Print(\"File upload. Source: \" + onDisk)\n\tlocal, err := ctx.os.Open(onDisk)\n\tif err != nil {\n\t\treturn handle(\"Error in opening file on disk.\", err)\n\t}\n\tdefer func() {\n\t\tif err = local.Close(); err != nil {\n\t\t\terrOut(\"Error in closing local file\", err)\n\t\t}\n\t}()\n\n\t// Upload to S3\n\tuploader := s3manager.NewUploader(sess)\n\toutput, err := uploader.Upload(&s3manager.UploadInput{\n\t\tBody: local,\n\t\tBucket: aws.String(ctx.bucket),\n\t\tKey: aws.String(uploadKey),\n\t})\n\tawsOutput(fmt.Sprintf(\"%#v\", output))\n\tif err != nil && !strings.Contains(err.Error(),\n\t\t\"IllegalLocationConstraintException\") {\n\t\treturn handle(fmt.Sprintf(\"Error in file upload of %s to S3.\", onDisk), err)\n\t}\n\n\t// Remove file locally after upload finished\n\tif err = ctx.os.Remove(onDisk); err != nil {\n\t\treturn handle(\"Error in deleting temporary file on local disk.\", err)\n\t}\n\treturn err\n}", "func (s *storageClient) upload(ctx context.Context, r io.Reader, objectName string) error {\n\tw := s.client.Bucket(s.bucketName).Object(objectName).NewWriter(ctx)\n\tif _, err := io.Copy(w, r); err != nil {\n\t\treturn fmt.Errorf(\"error while uploading to GCS object %q: %w\", objectName, err)\n\t}\n\t// The actual upload might happen after Close is called so we need to capture any errors.\n\tif err := w.Close(); err != nil {\n\t\treturn fmt.Errorf(\"error finishing upload to GCS object %q: %w\", objectName, err)\n\t}\n\treturn nil\n}", "func (api *bucketAPI) SyncCreate(obj *objstore.Bucket) error {\n\tnewObj := obj\n\tevtType := kvstore.Created\n\tvar writeErr error\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tnewObj, writeErr = apicl.ObjstoreV1().Bucket().Create(context.Background(), obj)\n\t\tif writeErr != nil && strings.Contains(writeErr.Error(), \"AlreadyExists\") {\n\t\t\tnewObj, writeErr = apicl.ObjstoreV1().Bucket().Update(context.Background(), obj)\n\t\t\tevtType = kvstore.Updated\n\t\t}\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleBucketEvent(&kvstore.WatchEvent{Object: newObj, Type: evtType})\n\t}\n\treturn writeErr\n}", "func uploadBlob(registry, name string) (string, error) {\n\tfile, err := makeLayer()\n\tif err != nil {\n\t\tfmt.Printf(\"makeLayer Error\\n\")\n\t\treturn \"\", err\n\t}\n\tdefer os.Remove(file.Name())\n\n\thasher := sha256.New()\n\tif _, err := io.Copy(hasher, file); err != nil {\n\t\treturn \"\", err\n\t}\n\tdigest := fmt.Sprintf(\"%x\", hasher.Sum(nil))\n\tfileLength, err := file.Seek(0, os.SEEK_CUR)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif _, err := file.Seek(0, os.SEEK_SET); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tuploadURL := fmt.Sprintf(\"%s/v2/%s/blobs/uploads/?digest=sha256:%s\", registry, name, digest)\n\treq, err := http.NewRequest(http.MethodPost, uploadURL, file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treq.Close = true\n\treq.Header.Set(\"Content-Length\", fmt.Sprintf(\"%d\", fileLength))\n\treq.Header.Set(\"Content-Type\", \"application/octet-stream\")\n\tresp, err := http.DefaultClient.Do(req)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor resp.StatusCode == http.StatusAccepted {\n\t\tdefer resp.Body.Close()\n\t\t_, err := ioutil.ReadAll(resp.Body)\n\n\t\tfmt.Printf(\"Got `%s` even though we wanted one-stop upload, retrying\\n\", resp.Status)\n\t\t// The last upload closed the file; reopen it\n\t\tfile, err = os.Open(file.Name())\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tnewURL, err := url.Parse(resp.Header.Get(\"Location\"))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tquery := newURL.Query()\n\t\tquery.Add(\"digest\", \"sha256:\"+digest)\n\t\tnewURL.RawQuery = query.Encode()\n\t\tnewreq, err := http.NewRequest(http.MethodPut, newURL.String(), file)\n\t\t// The last argument is the request body to upload.\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tnewreq.Close = true\n\t\tnewreq.Header.Set(\"Content-Length\", fmt.Sprintf(\"%d\", fileLength))\n\t\tnewreq.Header.Set(\"Content-Type\", \"application/octet-stream\")\n\n\t\tnewresp, err := http.DefaultClient.Do(newreq)\n\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tresp = newresp\n\t}\n\n\tswitch resp.StatusCode {\n\tcase http.StatusCreated:\n\t\tbreak\n\tcase http.StatusAccepted:\n\t\tpanic(\"Got status accepted outside loop\")\n\tcase http.StatusBadRequest, http.StatusMethodNotAllowed, http.StatusForbidden, http.StatusNotFound:\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"Error uploading: %s: %s\", resp.Status, string(body))\n\tcase http.StatusUnauthorized:\n\t\treturn \"\", fmt.Errorf(\"Error uploading: unauthorized\")\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"Error uploading: unknown status %s\", resp.Status)\n\t}\n\n\treturn digest, nil\n}", "func (s *Server) upload(info string) {\n\t// rsync -av -e 'ssh -o \"ProxyCommand ssh -p port bastion-dev@proxy exec nc %h %p 2>/dev/null\"' test.txt app@target:~/\n\t// rsync -avrP -e 'ssh -o ProxyCommand=\"ssh -W %h:%p bastion-dev@proxy -p port\"' test.txt app@target:~/\n\tssh := fmt.Sprintf(`ssh -o StrictHostKeyChecking=no -l %s -p %s`, s.User, strings.TrimLeft(s.Port, \":\"))\n\tif s.Proxy != nil {\n\t\tssh = fmt.Sprintf(`ssh -o StrictHostKeyChecking=no -o ProxyCommand=\"ssh -W %%h:%%p %s@%s -p %s\"`, s.Proxy.User, s.Proxy.Host, strings.TrimLeft(s.Proxy.Port, \":\"))\n\t}\n\n\tappName := cfg.App.Name\n\tdst := fmt.Sprintf(\"%s@%s:%s/harp/%s/\", s.User, s.Host, s.Home, appName)\n\t// if option.debug {\n\t// \tfmt.Println(\"rsync\", \"-az\", \"--delete\", \"-e\", ssh, filepath.Join(tmpDir, appName), filepath.Join(tmpDir, \"files\"), dst)\n\t// }\n\targs := []string{\"-az\", \"--delete\", \"-e\", ssh}\n\tif option.debug {\n\t\targs = append(args, \"-P\")\n\t}\n\tif !option.noBuild {\n\t\targs = append(args, filepath.Join(tmpDir, appName))\n\t}\n\tif !option.noFiles {\n\t\targs = append(args, filepath.Join(tmpDir, \"files\"))\n\t}\n\tif option.debug {\n\t\tfmt.Println(\"upload cmd:\", strings.Join(append([]string{\"rsync\"}, append(args, dst)...), \" \"))\n\t}\n\tcmd := exec.Command(\"rsync\", append(args, dst)...)\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\ts.exitf(\"failed to sync binary %s: %s\", appName, err)\n\t}\n\n\tsession := s.getSession()\n\toutput, err := session.CombinedOutput(fmt.Sprintf(\"cat <<EOF > %s/harp/%s/harp-build.info\\n%s\\nEOF\", s.Home, appName, info))\n\tif err != nil {\n\t\ts.exitf(\"failed to save build info: %s: %s\", err, string(output))\n\t}\n\tsession.Close()\n}", "func (b *OSSBackend) Upload(blobID string, blobPath string) error {\n\tblobID = b.objectPrefix + blobID\n\tif exist, err := b.bucket.IsObjectExist(blobID); err != nil {\n\t\treturn err\n\t} else if exist {\n\t\treturn nil\n\t}\n\n\tvar stat os.FileInfo\n\tstat, err := os.Stat(blobPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tblobSize := stat.Size()\n\n\tvar needMultiparts bool = false\n\t// Blob size bigger than 100MB, apply multiparts upload.\n\tif blobSize >= multipartsUploadThreshold {\n\t\tneedMultiparts = true\n\t}\n\n\tstart := time.Now()\n\n\tif needMultiparts {\n\t\tlogrus.Debugf(\"Upload %s using multiparts method\", blobID)\n\t\tchunks, err := oss.SplitFileByPartNum(blobPath, splitPartsCount)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\timur, err := b.bucket.InitiateMultipartUpload(blobID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar parts []oss.UploadPart\n\n\t\tg := new(errgroup.Group)\n\t\tfor _, chunk := range chunks {\n\t\t\tck := chunk\n\t\t\tg.Go(func() error {\n\t\t\t\tp, err := b.bucket.UploadPartFromFile(imur, blobPath, ck.Offset, ck.Size, ck.Number)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t// TODO: We don't verify data part MD5 from ETag right now.\n\t\t\t\t// But we can do it if we have to.\n\t\t\t\tparts = append(parts, p)\n\t\t\t\treturn nil\n\t\t\t})\n\t\t}\n\n\t\tif err := g.Wait(); err != nil {\n\t\t\treturn errors.Wrap(err, \"Uploading parts failed\")\n\t\t}\n\n\t\t_, err = b.bucket.CompleteMultipartUpload(imur, parts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treader, err := os.Open(blobPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer reader.Close()\n\t\terr = b.bucket.PutObject(blobID, reader)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tend := time.Now()\n\telapsed := end.Sub(start)\n\tlogrus.Debugf(\"Uploading blob %s costs %s\", blobID, elapsed)\n\n\treturn err\n}", "func PutCopySyncer(src, dst *s3.Bucket, key s3.Key) error {\n\t_, err := dst.PutCopy(key.Key, s3.Private, s3.CopyOptions{}, src.Name+\"/\"+key.Key)\n\treturn err\n}", "func InitDBBucket() {\n\tdb.Update(func(tx *bolt.Tx) error {\n\t\t_, err := tx.CreateBucketIfNotExists([]byte(DefaultBucket))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\treturn nil\n\t})\n}", "func (b *Bucket) Upload(_ context.Context, name string, r io.Reader) error {\n\tbody, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tb.objects[name] = body\n\treturn nil\n}", "func (c *runningConfig) magicPut(remote, local string) error {\n\t// open the file to be transferred\n\tfile, err := os.Open(local)\n\tdefer file.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error loading local file %s - %v\", local, err)\n\t}\n\n\tbytes := make([]byte, chunkSize)\n\tbuffer := bufio.NewReader(file)\n\t// at most, buffer.Read can only read len(bytes) bytes\n\t_, err = buffer.Read(bytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading from local file %s - %v\", local, err)\n\t}\n\n\t// determine the filetype based on the bytes you read\n\tfiletype := http.DetectContentType(bytes)\n\t_, err = file.Seek(0, 0)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error resetting local file %s - %v\", local, err)\n\t}\n\n\t// set up for multipart upload\n\tmultiUploader, err := c.bucket.InitMulti(remote, filetype, s3.ACL(\"private\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error opening remote file %s - %v\", remote, err)\n\t}\n\n\t// upload all of the file in pieces\n\tparts, err := multiUploader.PutAll(file, chunkSize)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing to remote file %s - %v\", local, err)\n\t}\n\n\t// complete the file\n\terr = multiUploader.Complete(parts)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error completing file %s - %v\", remote, err)\n\t}\n\n\treturn nil\n}", "func initializeBucket() {\n\tclient := getClient()\n\tparams := &s3.GetBucketLocationInput{\n\t\tBucket: aws.String(S3_BUCKET_NAME), // Required\n\t}\n\t_, err := client.GetBucketLocation(params)\n\tif err != nil {\n\t\t// bucket does not exist\n\t\tparams := &s3.CreateBucketInput{\n\t\t\tBucket: aws.String(S3_BUCKET_NAME), // Required\n\t\t}\n\t\t_, err := client.CreateBucket(params)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Attempted to create bucket with name \" + S3_BUCKET_NAME + \", but failed.\")\n\t\t\tfmt.Println(\"Error was: \" + err.Error())\n\t\t\tos.Exit(2)\n\t\t}\n\t\t// fmt.Println(\"created new bucket with name: \" + S3_BUCKET_NAME)\n\t}\n}", "func UploadToGCloudStorage(bucket, filePath, fileName string, isPublic bool) (string, error) {\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\tlogrus.Error(\"[UploadToGCloudStorage] Open file error: \", err)\n\t\treturn \"\", err\n\t}\n\n\tdefer func() {\n\t\terr = file.Close()\n\t}()\n\n\tobj := client.Bucket(bucket).Object(fileName)\n\twriter := obj.NewWriter(ctx)\n\tif _, err = io.Copy(writer, file); err != nil {\n\t\tlogrus.Error(\"[UploadToGCloudStorage] Copy file error: \", err)\n\t\treturn \"\", err\n\t}\n\n\tif err = writer.Close(); err != nil {\n\t\tlogrus.Error(\"[UploadToGCloudStorage] close writer error: \", err)\n\t\treturn \"\", err\n\t}\n\n\tif isPublic {\n\t\tacl := client.Bucket(bucket).Object(fileName).ACL()\n\t\tif err := acl.Set(ctx, storage.AllUsers, storage.RoleReader); err != nil {\n\t\t\tlogrus.Error(\"[UploadToGCloudStorage] ACL set error: \", err)\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn fileName, nil\n}", "func (b *fakeBosClient) PutBucket(bucket string) (string, error) {\n\treturn \"\", fmt.Errorf(\"test\")\n}", "func (stc *SyncClient) remotePutBlob(hash string, blob []byte) error {\n\tresp, err := stc.client.Post(fmt.Sprintf(\"/api/blobstore/blob/%s\", hash), blob)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif err := clientutil.ExpectStatusCode(resp, http.StatusCreated); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *Shipper) upload(ctx context.Context, meta *metadata.Meta) error {\n\tlevel.Info(s.logger).Log(\"msg\", \"upload new block\", \"id\", meta.ULID)\n\n\t// We hard-link the files into a temporary upload directory so we are not affected\n\t// by other operations happening against the TSDB directory.\n\tupdir := filepath.Join(s.dir, \"thanos\", \"upload\", meta.ULID.String())\n\n\t// Remove updir just in case.\n\tif err := os.RemoveAll(updir); err != nil {\n\t\treturn errors.Wrap(err, \"clean upload directory\")\n\t}\n\tif err := os.MkdirAll(updir, 0750); err != nil {\n\t\treturn errors.Wrap(err, \"create upload dir\")\n\t}\n\tdefer func() {\n\t\tif err := os.RemoveAll(updir); err != nil {\n\t\t\tlevel.Error(s.logger).Log(\"msg\", \"failed to clean upload directory\", \"err\", err)\n\t\t}\n\t}()\n\n\tdir := filepath.Join(s.dir, meta.ULID.String())\n\tif err := hardlinkBlock(dir, updir); err != nil {\n\t\treturn errors.Wrap(err, \"hard link block\")\n\t}\n\t// Attach current labels and write a new meta file with Thanos extensions.\n\tif lset := s.getLabels(); lset != nil {\n\t\tmeta.Thanos.Labels = lset.Map()\n\t}\n\tmeta.Thanos.Source = s.source\n\tmeta.Thanos.SegmentFiles = block.GetSegmentFiles(updir)\n\tif err := meta.WriteToDir(s.logger, updir); err != nil {\n\t\treturn errors.Wrap(err, \"write meta file\")\n\t}\n\treturn block.Upload(ctx, s.logger, s.bucket, updir, s.hashFunc)\n}", "func cleanupBucket(bucketName string, c *minio.Client) error {\n\t// Create a done channel to control 'ListObjectsV2' go routine.\n\tdoneCh := make(chan struct{})\n\t// Exit cleanly upon return.\n\tdefer close(doneCh)\n\t// Iterate over all objects in the bucket via listObjectsV2 and delete\n\tfor objCh := range c.ListObjects(context.Background(), bucketName, minio.ListObjectsOptions{Recursive: true}) {\n\t\tif objCh.Err != nil {\n\t\t\treturn objCh.Err\n\t\t}\n\t\tif objCh.Key != \"\" {\n\t\t\terr := c.RemoveObject(context.Background(), bucketName, objCh.Key, minio.RemoveObjectOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tfor objPartInfo := range c.ListIncompleteUploads(context.Background(), bucketName, \"\", true) {\n\t\tif objPartInfo.Err != nil {\n\t\t\treturn objPartInfo.Err\n\t\t}\n\t\tif objPartInfo.Key != \"\" {\n\t\t\terr := c.RemoveIncompleteUpload(context.Background(), bucketName, objPartInfo.Key)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\t// objects are already deleted, clear the buckets now\n\terr := c.RemoveBucket(context.Background(), bucketName)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error {\n\tw := b.bkt.Object(name).NewWriter(ctx)\n\n\tif _, err := io.Copy(w, r); err != nil {\n\t\treturn err\n\t}\n\treturn w.Close()\n}", "func (t *targetrunner) runRechecksumBucket(bucket string) {\n\t// check if re-checksumming of a given bucket is currently being performed\n\txrcksum := t.xactions.renewRechecksum(bucket)\n\tif xrcksum == nil {\n\t\treturn\n\t}\n\n\t// re-checksum every object in a given bucket\n\tglog.Infof(\"Re-checksum: %s started: bucket: %s\", xrcksum, bucket)\n\tavailablePaths, _ := fs.Mountpaths.Get()\n\tfor contentType, contentResolver := range fs.CSM.RegisteredContentTypes {\n\t\tif !contentResolver.PermToProcess() { // FIXME: PermToRechecksum?\n\t\t\tcontinue\n\t\t}\n\n\t\twg := &sync.WaitGroup{}\n\t\tfor _, mpathInfo := range availablePaths {\n\t\t\twg.Add(1)\n\t\t\tgo func(mpathInfo *fs.MountpathInfo) {\n\t\t\t\tmpathL := mpathInfo.MakePath(contentType, true /*bucket is local*/)\n\t\t\t\tt.oneRechecksumBucket(mpathInfo, mpathL, xrcksum)\n\t\t\t\twg.Done()\n\t\t\t}(mpathInfo)\n\t\t}\n\t\twg.Wait()\n\t\tfor _, mpathInfo := range availablePaths {\n\t\t\twg.Add(1)\n\t\t\tgo func(mpathInfo *fs.MountpathInfo) {\n\t\t\t\tmpathC := mpathInfo.MakePath(contentType, false /*cloud*/)\n\t\t\t\tt.oneRechecksumBucket(mpathInfo, mpathC, xrcksum)\n\t\t\t\twg.Done()\n\t\t\t}(mpathInfo)\n\t\t}\n\t\twg.Wait()\n\t}\n\n\t// finish up\n\txrcksum.EndTime(time.Now())\n}", "func IMAGE_API_SendToCloudStorage(req *http.Request, mpf multipart.File, hdr *multipart.FileHeader, prefix string) (string, error) {\n\text, extErr := filterExtension(req, hdr) // ensure that file's extension is an image\n\tif extErr != nil { // if it is not, exit, returning error\n\t\treturn \"\", extErr\n\t}\n\n\tuploadName := prefix + makeSHA(mpf) + \".\" + ext // build new filename based on the image data instead. this will keep us from making multiple files of the same data.\n\tmpf.Seek(0, 0) // makeSHA moved the reader, move it back.\n\n\tctx := appengine.NewContext(req)\n\treturn uploadName, addFileToGCS(ctx, uploadName, mpf) // upload the file and name. if there is an error, our parent will catch it.}\n}", "func PutBucket(ctx context.Context, project, bucket string, cfg *pb.Bucket) {\n\tif cfg == nil {\n\t\tcfg = &pb.Bucket{}\n\t}\n\tif cfg.Name == \"\" {\n\t\tcfg.Name = bucket\n\t}\n\tconvey.So(datastore.Put(ctx, &model.Bucket{\n\t\tParent: model.ProjectKey(ctx, project),\n\t\tID: bucket,\n\t\tProto: cfg,\n\t}), convey.ShouldBeNil)\n}", "func (group *UploadGroup) Upload(contents string, bucket string, filename string, month time.Time) {\n\tgroup.wg.Add(1)\n\tuploadResult := UploadResult{\n\t\tmake(chan *s3manager.UploadOutput, 1),\n\t\tmake(chan error, 1),\n\t}\n\n\tgo func(outc chan *s3manager.UploadOutput, ec chan error) {\n\t\tdefer group.wg.Done()\n\t\toutput, err := Upload(contents, bucket, filename, month)\n\t\tec <- err\n\t\toutc <- output\n\t}(uploadResult.S3Output, uploadResult.Err)\n\n\tgroup.Outputs = append(group.Outputs, uploadResult)\n}", "func (lb *Elb) sync() {\n\tfor _ = range lb.syncCh {\n\t\tlog.Printf(\"-- ELB:%s:syncing:%s\\n\", lb.name, lb.members)\n\t\tinstancesInAwsElb, err := lb.getInstancesInAwsElb()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, instance := range instancesInAwsElb {\n\t\t\tif !lb.memberExists(instance, lb.members) {\n\t\t\t\tlb.removeInstanceFromAwsElb(instance)\n\t\t\t}\n\t\t}\n\t\tfor _, instance := range lb.members {\n\t\t\tif !lb.memberExists(instance, instancesInAwsElb) {\n\t\t\t\tlb.addInstanceToAwsElb(instance)\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *S3) upload(ctx context.Context, snapshot, extraMetadata string, now time.Time) (*snapshotFile, error) {\n\tlogrus.Infof(\"Uploading snapshot %s to S3\", snapshot)\n\tbasename := filepath.Base(snapshot)\n\tvar snapshotFileName string\n\tvar sf snapshotFile\n\tif s.config.EtcdS3Folder != \"\" {\n\t\tsnapshotFileName = filepath.Join(s.config.EtcdS3Folder, basename)\n\t} else {\n\t\tsnapshotFileName = basename\n\t}\n\n\ttoCtx, cancel := context.WithTimeout(ctx, s.config.EtcdS3Timeout)\n\tdefer cancel()\n\topts := minio.PutObjectOptions{NumThreads: 2}\n\tif strings.HasSuffix(snapshot, compressedExtension) {\n\t\topts.ContentType = \"application/zip\"\n\t} else {\n\t\topts.ContentType = \"application/octet-stream\"\n\t}\n\tuploadInfo, err := s.client.FPutObject(toCtx, s.config.EtcdS3BucketName, snapshotFileName, snapshot, opts)\n\tif err != nil {\n\t\tsf = snapshotFile{\n\t\t\tName: filepath.Base(uploadInfo.Key),\n\t\t\tMetadata: extraMetadata,\n\t\t\tNodeName: \"s3\",\n\t\t\tCreatedAt: &metav1.Time{\n\t\t\t\tTime: now,\n\t\t\t},\n\t\t\tMessage: base64.StdEncoding.EncodeToString([]byte(err.Error())),\n\t\t\tSize: 0,\n\t\t\tStatus: failedSnapshotStatus,\n\t\t\tS3: &s3Config{\n\t\t\t\tEndpoint: s.config.EtcdS3Endpoint,\n\t\t\t\tEndpointCA: s.config.EtcdS3EndpointCA,\n\t\t\t\tSkipSSLVerify: s.config.EtcdS3SkipSSLVerify,\n\t\t\t\tBucket: s.config.EtcdS3BucketName,\n\t\t\t\tRegion: s.config.EtcdS3Region,\n\t\t\t\tFolder: s.config.EtcdS3Folder,\n\t\t\t\tInsecure: s.config.EtcdS3Insecure,\n\t\t\t},\n\t\t}\n\t\tlogrus.Errorf(\"Error received during snapshot upload to S3: %s\", err)\n\t} else {\n\t\tca, err := time.Parse(time.RFC3339, uploadInfo.LastModified.Format(time.RFC3339))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsf = snapshotFile{\n\t\t\tName: filepath.Base(uploadInfo.Key),\n\t\t\tMetadata: extraMetadata,\n\t\t\tNodeName: \"s3\",\n\t\t\tCreatedAt: &metav1.Time{\n\t\t\t\tTime: ca,\n\t\t\t},\n\t\t\tSize: uploadInfo.Size,\n\t\t\tStatus: successfulSnapshotStatus,\n\t\t\tS3: &s3Config{\n\t\t\t\tEndpoint: s.config.EtcdS3Endpoint,\n\t\t\t\tEndpointCA: s.config.EtcdS3EndpointCA,\n\t\t\t\tSkipSSLVerify: s.config.EtcdS3SkipSSLVerify,\n\t\t\t\tBucket: s.config.EtcdS3BucketName,\n\t\t\t\tRegion: s.config.EtcdS3Region,\n\t\t\t\tFolder: s.config.EtcdS3Folder,\n\t\t\t\tInsecure: s.config.EtcdS3Insecure,\n\t\t\t},\n\t\t}\n\t}\n\treturn &sf, nil\n}", "func (bc *BoltClient) InitBucket() {\n\terr := bc.boltDB.Update(func(tx *bolt.Tx) error {\n\t\t_, err := tx.CreateBucketIfNotExists([]byte(bc.BucketName))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"create bucket failed: %s\", err)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func setupBucket(ctx context.Context, cloud, bucket string) (*blob.Bucket, error) {\n\tswitch cloud {\n\tcase \"aws\":\n\t\treturn setupAWS(ctx, bucket)\n\tcase \"gcp\":\n\t\treturn setupGCP(ctx, bucket)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid cloud provider: %s\", cloud)\n\t}\n}", "func (is *ImageStoreLocal) FullBlobUpload(repo string, body io.Reader, dstDigest godigest.Digest,\n) (string, int64, error) {\n\tif err := dstDigest.Validate(); err != nil {\n\t\treturn \"\", -1, err\n\t}\n\n\tif err := is.InitRepo(repo); err != nil {\n\t\treturn \"\", -1, err\n\t}\n\n\tu, err := guuid.NewV4()\n\tif err != nil {\n\t\treturn \"\", -1, err\n\t}\n\n\tuuid := u.String()\n\n\tsrc := is.BlobUploadPath(repo, uuid)\n\n\tblobFile, err := os.Create(src)\n\tif err != nil {\n\t\tis.log.Error().Err(err).Str(\"blob\", src).Msg(\"failed to open blob\")\n\n\t\treturn \"\", -1, zerr.ErrUploadNotFound\n\t}\n\n\tdefer func() {\n\t\tif is.commit {\n\t\t\t_ = blobFile.Sync()\n\t\t}\n\n\t\t_ = blobFile.Close()\n\t}()\n\n\tdigester := sha256.New()\n\tmw := io.MultiWriter(blobFile, digester)\n\n\tnbytes, err := io.Copy(mw, body)\n\tif err != nil {\n\t\treturn \"\", -1, err\n\t}\n\n\tsrcDigest := godigest.NewDigestFromEncoded(godigest.SHA256, fmt.Sprintf(\"%x\", digester.Sum(nil)))\n\tif srcDigest != dstDigest {\n\t\tis.log.Error().Str(\"srcDigest\", srcDigest.String()).\n\t\t\tStr(\"dstDigest\", dstDigest.String()).Msg(\"actual digest not equal to expected digest\")\n\n\t\treturn \"\", -1, zerr.ErrBadBlobDigest\n\t}\n\n\tdir := path.Join(is.rootDir, repo, \"blobs\", dstDigest.Algorithm().String())\n\n\tvar lockLatency time.Time\n\n\tis.Lock(&lockLatency)\n\tdefer is.Unlock(&lockLatency)\n\n\t_ = ensureDir(dir, is.log)\n\tdst := is.BlobPath(repo, dstDigest)\n\n\tif is.dedupe && fmt.Sprintf(\"%v\", is.cache) != fmt.Sprintf(\"%v\", nil) {\n\t\tif err := is.DedupeBlob(src, dstDigest, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to dedupe blob\")\n\n\t\t\treturn \"\", -1, err\n\t\t}\n\t} else {\n\t\tif err := os.Rename(src, dst); err != nil {\n\t\t\tis.log.Error().Err(err).Str(\"src\", src).Str(\"dstDigest\", dstDigest.String()).\n\t\t\t\tStr(\"dst\", dst).Msg(\"unable to finish blob\")\n\n\t\t\treturn \"\", -1, err\n\t\t}\n\t}\n\n\treturn uuid, nbytes, nil\n}", "func (s *Socker) SyncImages(configFile, repoFilter, filter string) error {\n\tif configFile == \"\" {\n\t\tconfigFile = dftImageConfigFile\n\t}\n\timages, err := ParseImages(repoFilter, filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdata, err := yaml.Marshal(images)\n\tif err != nil {\n\t\tlog.Errorf(\"marshal yaml data failed: %v\", err)\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(configFile, data, permRecordFile)\n}", "func (s *BCDNSyncer) Sync(sourcePath string) error {\n\tobjMap := make(map[string]api.BCDNObject)\n\n\tmetrics := struct {\n\t\ttotal int\n\t\tnewFile int\n\t\tmodifiedFile int\n\t\tdeletedFile int\n\t}{0, 0, 0, 0}\n\terr := filepath.Walk(sourcePath, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"prevent panic by handling failure accessing a path %q: %v\\n\", path, err)\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"DEBUG: checking path: %q\\n\", path)\n\t\trelPath, err := filepath.Rel(sourcePath, path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif info.IsDir() {\n\t\t\treturn s.fetchDirectory(objMap, relPath)\n\t\t}\n\t\tmetrics.total += 1\n\t\tfileContent, fsChecksum, err := getFileContent(path)\n\n\t\tobj, ok := objMap[relPath]\n\t\tif !ok {\n\t\t\tlog.Printf(\"DEBUG: %s not found in storage, uploading...\\n\", relPath)\n\t\t\tmetrics.newFile += 1\n\t\t\treturn s.uploadFile(relPath, fileContent, fsChecksum)\n\t\t}\n\n\t\tfsChecksum = strings.ToLower(fsChecksum)\n\t\tobjChecksum := strings.ToLower(obj.Checksum)\n\t\tif fsChecksum != objChecksum {\n\t\t\tmetrics.modifiedFile += 1\n\t\t\tlog.Printf(\"DEBUG: %s checksum doesn't match, local: [%s] remote: [%s]\\n\", relPath, fsChecksum, objChecksum)\n\t\t\tdelete(objMap, relPath)\n\t\t\treturn s.uploadFile(relPath, fileContent, fsChecksum)\n\t\t}\n\t\tlog.Printf(\"DEBUG: %s matches with remote storage, skipping.\\n\", relPath)\n\n\t\tdelete(objMap, relPath)\n\n\t\treturn nil\n\t})\n\tfor relPath, obj := range objMap {\n\t\tif !obj.IsDirectory {\n\t\t\tmetrics.deletedFile += 1\n\t\t\tlog.Printf(\"%s object must be deleted.\\n\", relPath)\n\t\t\ts.deletePath(relPath)\n\t\t}\n\t}\n\n\tlog.Printf(\"Total files: %d New files: %d Modified files: %d Deleted files: %d\\n\", metrics.total, metrics.newFile, metrics.modifiedFile, metrics.deletedFile)\n\n\treturn err\n}", "func (p *Packager) Upload(r io.ReadSeeker, key string) (string, error) {\n\tfmt.Printf(\"Uploading %s\\n\", key)\n\n\tinput := &s3.PutObjectInput{\n\t\tBucket: aws.String(p.S3Bucket),\n\t\tBody: r,\n\t\tKey: aws.String(key),\n\t}\n\n\tif p.KMSKeyID != \"\" {\n\t\tinput.ServerSideEncryption = aws.String(\"aws:kms\")\n\t\tinput.SSEKMSKeyId = aws.String(p.KMSKeyID)\n\t}\n\n\t_, err := p.svc.PutObject(input)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(\"s3://%s/%s\", p.S3Bucket, key), nil\n}", "func (remote *LocalRemote) Push(image, imageRoot string) error {\n\tlog.Println(\"pushing local\", remote.Url.Path)\n\n\treturn remote.rsyncTo(imageRoot, \"\")\n}", "func (s *SharemeService) HandleUpload(hc *HTTPContext, c *gae.Context, session *Session) []*Share {\n\tret := make([]*Share, 0)\n\tbis := s.storageService.HandleUpload(hc)\n\tfor _, stat := range bis {\n\t\tdsk, err := datastore.Put(c, datastore.NewIncompleteKey(c, \"Share\", nil), stat)\n\t\tif err != nil {\n\t\t\t//TODO: delete blob\n\t\t\tcontinue\n\t\t}\n\t\tfkey := dsk.Encode()\n\t\tsession.Set(fmt.Sprintf(\"%s%s\", KeySessionPrefix, fkey), stat.Name)\n\t\trstat := s.Stat(c, fkey)\n\t\tret = append(ret, &rstat)\n\n\t}\n\treturn ret\n}", "func testPutObject() {\n\tstartTime := time.Now()\n\tfunction := \"testPutObject\"\n\tbucket := randString(60, rand.NewSource(time.Now().UnixNano()), \"versioning-test-\")\n\tobject := \"testObject\"\n\texpiry := 1 * time.Minute\n\targs := map[string]interface{}{\n\t\t\"bucketName\": bucket,\n\t\t\"objectName\": object,\n\t\t\"expiry\": expiry,\n\t}\n\n\t_, err := s3Client.CreateBucket(&s3.CreateBucketInput{\n\t\tBucket: aws.String(bucket),\n\t})\n\tif err != nil {\n\t\tfailureLog(function, args, startTime, \"\", \"CreateBucket failed\", err).Fatal()\n\t\treturn\n\t}\n\tdefer cleanupBucket(bucket, function, args, startTime)\n\n\tputVersioningInput := &s3.PutBucketVersioningInput{\n\t\tBucket: aws.String(bucket),\n\t\tVersioningConfiguration: &s3.VersioningConfiguration{\n\t\t\tStatus: aws.String(\"Enabled\"),\n\t\t},\n\t}\n\n\t_, err = s3Client.PutBucketVersioning(putVersioningInput)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"NotImplemented: A header you provided implies functionality that is not implemented\") {\n\t\t\tignoreLog(function, args, startTime, \"Versioning is not implemented\").Info()\n\t\t\treturn\n\t\t}\n\t\tfailureLog(function, args, startTime, \"\", \"Put versioning failed\", err).Fatal()\n\t\treturn\n\t}\n\n\tputInput1 := &s3.PutObjectInput{\n\t\tBody: aws.ReadSeekCloser(strings.NewReader(\"my content 1\")),\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(object),\n\t}\n\t_, err = s3Client.PutObject(putInput1)\n\tif err != nil {\n\t\tfailureLog(function, args, startTime, \"\", fmt.Sprintf(\"PUT expected to succeed but got %v\", err), err).Fatal()\n\t\treturn\n\t}\n\tputInput2 := &s3.PutObjectInput{\n\t\tBody: aws.ReadSeekCloser(strings.NewReader(\"content file 2\")),\n\t\tBucket: aws.String(bucket),\n\t\tKey: aws.String(object),\n\t}\n\t_, err = s3Client.PutObject(putInput2)\n\tif err != nil {\n\t\tfailureLog(function, args, startTime, \"\", fmt.Sprintf(\"PUT expected to succeed but got %v\", err), err).Fatal()\n\t\treturn\n\t}\n\n\tinput := &s3.ListObjectVersionsInput{\n\t\tBucket: aws.String(bucket),\n\t}\n\n\tresult, err := s3Client.ListObjectVersions(input)\n\tif err != nil {\n\t\tfailureLog(function, args, startTime, \"\", fmt.Sprintf(\"PUT expected to succeed but got %v\", err), err).Fatal()\n\t\treturn\n\t}\n\n\tif len(result.Versions) != 2 {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected number of versions\")).Fatal()\n\t\treturn\n\t}\n\n\tvid1 := *result.Versions[0]\n\tvid2 := *result.Versions[1]\n\n\tif *vid1.VersionId == \"\" || *vid2.VersionId == \"\" || *vid1.VersionId == *vid2.VersionId {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected VersionId field\")).Fatal()\n\t\treturn\n\t}\n\n\tif *vid1.IsLatest == false || *vid2.IsLatest == true {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected IsLatest field\")).Fatal()\n\t\treturn\n\t}\n\n\tif *vid1.Size != 14 || *vid2.Size != 12 {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected Size field\")).Fatal()\n\t\treturn\n\t}\n\n\tif !etagRegex.MatchString(*vid1.ETag) || !etagRegex.MatchString(*vid2.ETag) {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected ETag field\")).Fatal()\n\t\treturn\n\t}\n\n\tif *vid1.Key != \"testObject\" || *vid2.Key != \"testObject\" {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected Key field\")).Fatal()\n\t\treturn\n\t}\n\n\tif (*vid1.LastModified).Before(*vid2.LastModified) {\n\t\tfailureLog(function, args, startTime, \"\", \"Unexpected list content\", errors.New(\"unexpected Last modified field\")).Fatal()\n\t\treturn\n\t}\n\n\tsuccessLogger(function, args, startTime).Info()\n}", "func (media *SavedMedia) Sync() error {\n\tinsta := media.insta\n\tbody, _, err := insta.sendRequest(\n\t\t&reqOptions{\n\t\t\tEndpoint: urlFeedSaved,\n\t\t\tQuery: map[string]string{\n\t\t\t\t\"include_igtv_preview\": \"true\",\n\t\t\t\t\"include_igtv_tab\": \"true\",\n\t\t\t\t\"include_clips_subtab\": \"false\", // default is false, but could be set to true\n\t\t\t\t\"clips_subtab_first\": \"false\",\n\t\t\t\t\"show_igtv_first\": \"false\",\n\t\t\t\t\"include_collection_info\": \"false\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttmp := collectionSync{}\n\terr = json.Unmarshal(body, &tmp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmedia.NextID = tmp.Media.NextID\n\tmedia.MoreAvailable = tmp.Media.MoreAvailable\n\tmedia.NumResults = tmp.Media.NumResults\n\n\tmedia.Items = tmp.Media.Items\n\tmedia.setValues()\n\n\treturn nil\n}", "func (fs *Stow) Upload(ctx context.Context, path, mediaType string, r io.ReadCloser) (map[string]interface{}, error) {\n\t_, err := fs.fileUrl(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocation, err := stow.Dial(fs.kind, fs.config)\n\tif err != nil {\n\t\tlog.Errorf(\"stow.Dial fail: %v\", err)\n\t\treturn nil, err\n\t}\n\tdefer location.Close()\n\n\tcontainer, err := location.Container(fs.bucket)\n\tif err != nil {\n\t\tlog.Errorf(\"stow.GetContainer fail: %v\", err)\n\t\treturn nil, err\n\t}\n\n\titem, err := container.Item(path)\n\tif item != nil {\n\t\t// TODO overwrite existing item instead of remove\n\t\tcontainer.RemoveItem(path)\n\t}\n\terr = nil\n\n\t// TODO check if put requires to load file content into memory\n\t// TODO add metadata\n\t_, err = container.Put(path, r, 0, nil)\n\tif err != nil {\n\t\tlog.Errorf(\"container.Put fail: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tdg, close, err := dgraph.NewClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer close()\n\n\ttx := dg.NewTxn()\n\tdefer dgraph.Discard(ctx, tx)\n\n\tfile, err := FindFileImpl(ctx, tx, path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif file == nil {\n\t\tfile = &FileInfo{}\n\t}\n\tfile.Path = path\n\tfile.MediaType = mediaType\n\n\treturn AddFile(ctx, tx, file)\n}", "func (m Mux) Bucket(ctx context.Context, rawurl string) (Bucket, string, error) {\n\tu, err := url.Parse(rawurl)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tstore, ok := m[u.Scheme]\n\tif !ok {\n\t\treturn nil, \"\", errors.E(errors.NotSupported, \"blob.Bucket\", rawurl,\n\t\t\terrors.Errorf(\"no implementation for scheme %s\", u.Scheme))\n\t}\n\tbucket, err := store.Bucket(ctx, u.Host)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\treturn bucket, strings.TrimPrefix(rawurl, bucket.Location()), err\n}", "func UpdateBucket(context *gin.Context) {\n\tresponseCode := constant.INVALID_PARAMS\n\n\tbucketToUpdate := models.Bucket{}\n\tif err := context.ShouldBindWith(&bucketToUpdate, binding.Form); err != nil {\n\t\t//log.Println(err)\n\t\tutils.AppLogger.Info(err.Error(), zap.String(\"service\", \"UpdateBucket()\"))\n\t\tcontext.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\n\t\t\t\"code\": responseCode,\n\t\t\t\"data\": make(map[string]string),\n\t\t\t\"msg\": constant.GetMessage(responseCode),\n\t\t})\n\t\treturn\n\t}\n\n\tvalidCheck := validation.Validation{}\n\tvalidCheck.Required(bucketToUpdate.ID, \"bucket_id\").Message(\"Must have bucket id\")\n\tvalidCheck.MaxSize(bucketToUpdate.Name, 64, \"bucket_name\").Message(\"Bucket name length can not exceed 64\")\n\n\tdata := make(map[string]interface{})\n\tif !validCheck.HasErrors() {\n\t\tif err := models.UpdateBucket(&bucketToUpdate); err != nil {\n\t\t\tif err == models.NoSuchBucketError {\n\t\t\t\tresponseCode = constant.BUCKET_NOT_EXIST\n\t\t\t} else {\n\t\t\t\tresponseCode = constant.INTERNAL_SERVER_ERROR\n\t\t\t}\n\t\t} else {\n\t\t\tresponseCode = constant.BUCKET_UPDATE_SUCCESS\n\t\t}\n\t} else {\n\t\tfor _, err := range validCheck.Errors {\n\t\t\t//log.Println(err.Message)\n\t\t\tutils.AppLogger.Info(err.Message, zap.String(\"service\", \"UpdateBucket()\"))\n\t\t}\n\t}\n\n\tdata[\"bucket_id\"] = bucketToUpdate.ID\n\tcontext.JSON(http.StatusOK, gin.H{\n\t\t\"code\": responseCode,\n\t\t\"data\": data,\n\t\t\"msg\": constant.GetMessage(responseCode),\n\t})\n}", "func (h Hosting) UploadHostingAssets(realmClient realm.Client, groupID, appID string, hostingDiffs HostingDiffs, errHandler func(err error)) error {\n\tvar wg sync.WaitGroup\n\n\tjobCh := make(chan func())\n\terrCh := make(chan error)\n\tdoneCh := make(chan struct{})\n\n\tvar errs []error\n\tgo func() {\n\t\tfor err := range errCh {\n\t\t\terrHandler(err)\n\t\t\terrs = append(errs, err)\n\t\t}\n\t\tdoneCh <- struct{}{}\n\t}()\n\n\tfor n := 0; n < numHostingWorkers; n++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tfor job := range jobCh {\n\t\t\t\tjob()\n\t\t\t}\n\t\t}()\n\t}\n\n\tassetsDir := filepath.Join(h.RootDir, NameFiles)\n\n\tfor _, added := range hostingDiffs.Added {\n\t\tasset := added // the closure otherwise sees the same value for `added` each iteration\n\t\tjobCh <- func() {\n\t\t\tif err := realmClient.HostingAssetUpload(groupID, appID, assetsDir, asset); err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"failed to add %s: %w\", asset.FilePath, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, deleted := range hostingDiffs.Deleted {\n\t\tasset := deleted // the closure otherwise sees the same value for `added` each iteration\n\t\tjobCh <- func() {\n\t\t\tif err := realmClient.HostingAssetRemove(groupID, appID, asset.FilePath); err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"failed to remove %s: %w\", asset.FilePath, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, modified := range hostingDiffs.Modified {\n\t\tasset := modified // the closure otherwise sees the same value for `added` each iteration\n\t\tjobCh <- func() {\n\t\t\tif asset.AttrsModified && !asset.BodyModified {\n\t\t\t\tif err := realmClient.HostingAssetAttributesUpdate(groupID, appID, asset.FilePath, asset.Attrs...); err != nil {\n\t\t\t\t\terrCh <- fmt.Errorf(\"failed to update attributes for %s: %w\", asset.FilePath, err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err := realmClient.HostingAssetUpload(groupID, appID, assetsDir, asset.HostingAsset); err != nil {\n\t\t\t\t\terrCh <- fmt.Errorf(\"failed to update %s: %w\", asset.FilePath, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tclose(jobCh)\n\twg.Wait()\n\n\tclose(errCh)\n\t<-doneCh\n\n\tif len(errs) > 0 {\n\t\treturn fmt.Errorf(\"%d error(s) occurred while importing hosting assets\", len(errs))\n\t}\n\treturn nil\n}", "func uploadBookHandler(res http.ResponseWriter, req *http.Request) {\n _, claims, err := jwtauth.FromContext(req.Context())\n if err != nil {\n log.Println(err)\n res.WriteHeader(500)\n return\n }\n\n // Parse the uploaded forms\n if err := req.ParseMultipartForm(maxFormMemory); err != nil {\n res.WriteHeader(500)\n return\n }\n\n // Upload each uploaded book to the server\n for _, header := range req.MultipartForm.File[\"books\"] {\n filename := header.Filename\n file, err := header.Open()\n if err != nil {\n res.WriteHeader(500)\n log.Println(err)\n return\n }\n\n stream, err := booksBucket.OpenUploadStream(filename, options.GridFSUpload())\n if err != nil {\n res.WriteHeader(400)\n log.Println(err)\n return\n }\n defer stream.Close()\n\n if _, err := io.Copy(stream, file); err != nil {\n res.WriteHeader(500)\n log.Println(err)\n return\n }\n\n _, err = usersCollection.UpdateOne(\n context.Background(),\n bson.M{\"username\": claims[\"username\"].(string)},\n bson.M{\"$push\": bson.M{\"books\": Book{Id: stream.FileID.(primitive.ObjectID), Title: filename}}},\n options.Update().SetUpsert(true),\n )\n if err != nil {\n res.WriteHeader(500)\n log.Println(err)\n return\n }\n }\n\n // Go back to the library page \n http.Redirect(res, req, \"/library\", 302)\n}", "func syncWithRemote(remote string, dest string) error {\n\tif _, err := os.Stat(dest); os.IsNotExist(err) {\n\t\tcloneBareRepository(remote, dest)\n\t}\n\n\tif err := os.Chdir(dest); err != nil {\n\t\treturn err\n\t}\n\n\tcmd := exec.Command(\"echo\", \"git\", \"fetch\", remote)\n\n\terr := cmd.Run()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Client) SyncImages(request *SyncImagesRequest) (response *SyncImagesResponse, err error) {\n return c.SyncImagesWithContext(context.Background(), request)\n}", "func (t *targetrunner) renameLB(bucketFrom, bucketTo string) (err error) {\n\t// ready to receive migrated obj-s _after_ that point\n\t// insert directly w/o incrementing the version (metasyncer will do at the end of the operation)\n\twg := &sync.WaitGroup{}\n\n\tpid := t.smapowner.get().ProxySI.DaemonID\n\tavailablePaths, _ := fs.Mountpaths.Get()\n\tch := make(chan error, len(fs.CSM.RegisteredContentTypes)*len(availablePaths))\n\tfor contentType := range fs.CSM.RegisteredContentTypes {\n\t\tfor _, mpathInfo := range availablePaths {\n\t\t\t// Create directory for new local bucket\n\t\t\ttoDir := mpathInfo.MakePathBucket(contentType, bucketTo, true /*bucket is local*/)\n\t\t\tif err := cmn.CreateDir(toDir); err != nil {\n\t\t\t\tch <- fmt.Errorf(\"failed to create dir %s, error: %v\", toDir, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\twg.Add(1)\n\t\t\tfromDir := mpathInfo.MakePathBucket(contentType, bucketFrom, true /*bucket is local*/)\n\t\t\tgo func(fromDir string) {\n\t\t\t\ttime.Sleep(time.Millisecond * 100) // FIXME: 2-phase for the targets to 1) prep (above) and 2) rebalance\n\t\t\t\tch <- t.renameOne(fromDir, bucketFrom, bucketTo, pid)\n\t\t\t\twg.Done()\n\t\t\t}(fromDir)\n\t\t}\n\t}\n\twg.Wait()\n\tclose(ch)\n\tfor err = range ch {\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (is *ImageStoreLocal) PutImageManifest(repo, reference, mediaType string, //nolint: gocyclo\n\tbody []byte,\n) (godigest.Digest, godigest.Digest, error) {\n\tif err := is.InitRepo(repo); err != nil {\n\t\tis.log.Debug().Err(err).Msg(\"init repo\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\tvar lockLatency time.Time\n\n\tvar err error\n\n\tis.Lock(&lockLatency)\n\tdefer func() {\n\t\tis.Unlock(&lockLatency)\n\n\t\tif err == nil {\n\t\t\tmonitoring.SetStorageUsage(is.metrics, is.rootDir, repo)\n\t\t\tmonitoring.IncUploadCounter(is.metrics, repo)\n\t\t}\n\t}()\n\n\trefIsDigest := true\n\n\tmDigest, err := common.GetAndValidateRequestDigest(body, reference, is.log)\n\tif err != nil {\n\t\tif errors.Is(err, zerr.ErrBadManifest) {\n\t\t\treturn mDigest, \"\", err\n\t\t}\n\n\t\trefIsDigest = false\n\t}\n\n\tdigest, err := common.ValidateManifest(is, repo, reference, mediaType, body, is.log)\n\tif err != nil {\n\t\treturn digest, \"\", err\n\t}\n\n\tindex, err := common.GetIndex(is, repo, is.log)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// create a new descriptor\n\tdesc := ispec.Descriptor{\n\t\tMediaType: mediaType, Size: int64(len(body)), Digest: mDigest,\n\t}\n\n\tif !refIsDigest {\n\t\tdesc.Annotations = map[string]string{ispec.AnnotationRefName: reference}\n\t}\n\n\tvar subjectDigest godigest.Digest\n\n\tartifactType := \"\"\n\n\tif mediaType == ispec.MediaTypeImageManifest {\n\t\tvar manifest ispec.Manifest\n\n\t\terr := json.Unmarshal(body, &manifest)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\tif manifest.Subject != nil {\n\t\t\tsubjectDigest = manifest.Subject.Digest\n\t\t}\n\n\t\tartifactType = zcommon.GetManifestArtifactType(manifest)\n\t} else if mediaType == ispec.MediaTypeImageIndex {\n\t\tvar index ispec.Index\n\n\t\terr := json.Unmarshal(body, &index)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\tif index.Subject != nil {\n\t\t\tsubjectDigest = index.Subject.Digest\n\t\t}\n\n\t\tartifactType = zcommon.GetIndexArtifactType(index)\n\t}\n\n\tupdateIndex, oldDgst, err := common.CheckIfIndexNeedsUpdate(&index, &desc, is.log)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tif !updateIndex {\n\t\treturn desc.Digest, subjectDigest, nil\n\t}\n\n\t// write manifest to \"blobs\"\n\tdir := path.Join(is.rootDir, repo, \"blobs\", mDigest.Algorithm().String())\n\t_ = ensureDir(dir, is.log)\n\tfile := path.Join(dir, mDigest.Encoded())\n\n\t// in case the linter will not pass, it will be garbage collected\n\tif err := is.writeFile(file, body); err != nil {\n\t\tis.log.Error().Err(err).Str(\"file\", file).Msg(\"unable to write\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\terr = common.UpdateIndexWithPrunedImageManifests(is, &index, repo, desc, oldDgst, is.log)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\t// now update \"index.json\"\n\tindex.Manifests = append(index.Manifests, desc)\n\tdir = path.Join(is.rootDir, repo)\n\tfile = path.Join(dir, \"index.json\")\n\n\tbuf, err := json.Marshal(index)\n\tif err := inject.Error(err); err != nil {\n\t\tis.log.Error().Err(err).Str(\"file\", file).Msg(\"unable to marshal JSON\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\t// update the descriptors artifact type in order to check for signatures when applying the linter\n\tdesc.ArtifactType = artifactType\n\n\t// apply linter only on images, not signatures or indexes\n\tpass, err := common.ApplyLinter(is, is.linter, repo, desc)\n\tif !pass {\n\t\tis.log.Error().Err(err).Str(\"repository\", repo).Str(\"reference\", reference).Msg(\"linter didn't pass\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\terr = is.writeFile(file, buf)\n\tif err := inject.Error(err); err != nil {\n\t\tis.log.Error().Err(err).Str(\"file\", file).Msg(\"unable to write\")\n\n\t\treturn \"\", \"\", err\n\t}\n\n\treturn desc.Digest, subjectDigest, nil\n}", "func reloc(bucketName, oldPath, newPath string, keys s3gof3r.Keys) error {\n\ts3 := s3gof3r.New(\"s3.amazonaws.com\", keys)\n\tbucket := s3.Bucket(bucketName)\n\t// this is a POST at the bottom, and copies are a PUT. whee.\n\t//w, err := s3.Bucket(bucketName).PutWriter(newPath, copyInstruction, s3Conf)\n\t// So, implement our own aws copy API.\n\treq, err := http.NewRequest(\"PUT\", \"\", &bytes.Buffer{})\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.URL.Scheme = s3Conf.Scheme\n\treq.URL.Host = fmt.Sprintf(\"%s.%s\", bucketName, s3.Domain)\n\treq.URL.Path = path.Clean(fmt.Sprintf(\"/%s\", newPath))\n\t// Communicate the copy source object with a header.\n\t// Be advised that if this object doesn't exist, amazon reports that as a 404... yes, a 404 that has nothing to do with the query URI.\n\treq.Header.Add(\"x-amz-copy-source\", path.Join(\"/\", bucketName, oldPath))\n\tbucket.Sign(req)\n\tresp, err := s3Conf.Client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\treturn newRespError(resp)\n\t}\n\t// delete previous location\n\tif err := bucket.Delete(oldPath); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (h *Handler) ensureBucket() error {\n\t_, err := h.gcsClient.Bucket(h.Config.Bucket).Attrs(h.clientContext)\n\terr = convertGCSError(err)\n\t// assumes that bucket is administered by other entity\n\tif err == nil {\n\t\treturn nil\n\t}\n\tif !trace.IsNotFound(err) {\n\t\th.Errorf(\"Failed to ensure that bucket %q exists (%v). GCS session uploads may fail. If you've set up the bucket already and gave Teleport write-only access, feel free to ignore this error.\", h.Bucket, err)\n\t\treturn nil\n\t}\n\terr = h.gcsClient.Bucket(h.Config.Bucket).Create(h.clientContext, h.Config.ProjectID, &storage.BucketAttrs{\n\t\tVersioningEnabled: true,\n\t\tEncryption: &storage.BucketEncryption{DefaultKMSKeyName: h.Config.KMSKeyName},\n\t\t// See https://cloud.google.com/storage/docs/json_api/v1/buckets/insert#parameters\n\t\tPredefinedACL: \"projectPrivate\",\n\t\tPredefinedDefaultObjectACL: \"projectPrivate\",\n\t})\n\terr = convertGCSError(err)\n\tif err != nil {\n\t\tif !trace.IsAlreadyExists(err) {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\t// if this gcsClient has not created the bucket, don't reconfigure it\n\t\treturn nil\n\t}\n\treturn nil\n}", "func TestWithGCS(t *testing.T) {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Minute*5)\n\tdefer cancel()\n\tconst (\n\t\tmod = \"stashmod\"\n\t\tver = \"v1.0.0\"\n\t)\n\tstrg := getStorage(t)\n\tstrg.Delete(ctx, mod, ver)\n\tdefer strg.Delete(ctx, mod, ver)\n\n\t// sanity check\n\t_, err := strg.GoMod(ctx, mod, ver)\n\tif !errors.Is(err, errors.KindNotFound) {\n\t\tt.Fatalf(\"expected the stash bucket to return a NotFound error but got: %v\", err)\n\t}\n\n\tvar eg errgroup.Group\n\tfor i := 0; i < 5; i++ {\n\t\tcontent := uuid.New().String()\n\t\tms := &mockGCPStasher{strg, content}\n\t\ts := WithGCSLock(ms)\n\t\teg.Go(func() error {\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\t\t\tdefer cancel()\n\t\t\t_, err := s.Stash(ctx, \"stashmod\", \"v1.0.0\")\n\t\t\treturn err\n\t\t})\n\t}\n\n\terr = eg.Wait()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tinfo, err := strg.Info(ctx, mod, ver)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tmodContent, err := strg.GoMod(ctx, mod, ver)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tzip, err := strg.Zip(ctx, mod, ver)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer zip.Close()\n\tzipContent, err := io.ReadAll(zip)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !bytes.Equal(info, modContent) {\n\t\tt.Fatalf(\"expected info and go.mod to be equal but info was {%v} and content was {%v}\", string(info), string(modContent))\n\t}\n\tif !bytes.Equal(info, zipContent) {\n\t\tt.Fatalf(\"expected info and zip to be equal but info was {%v} and content was {%v}\", string(info), string(zipContent))\n\t}\n}", "func (ct *ctrlerCtx) diffBucket(apicl apiclient.Services) {\n\topts := api.ListWatchOptions{}\n\n\t// get a list of all objects from API server\n\tobjlist, err := apicl.ObjstoreV1().Bucket().List(context.Background(), &opts)\n\tif err != nil {\n\t\tct.logger.Errorf(\"Error getting a list of objects. Err: %v\", err)\n\t\treturn\n\t}\n\n\tct.logger.Infof(\"diffBucket(): BucketList returned %d objects\", len(objlist))\n\n\t// build an object map\n\tobjmap := make(map[string]*objstore.Bucket)\n\tfor _, obj := range objlist {\n\t\tobjmap[obj.GetKey()] = obj\n\t}\n\n\tlist, err := ct.Bucket().List(context.Background(), &opts)\n\tif err != nil && !strings.Contains(err.Error(), \"not found in local cache\") {\n\t\tct.logger.Infof(\"Failed to get a list of objects. Err: %s\", err)\n\t\treturn\n\t}\n\n\t// if an object is in our local cache and not in API server, trigger delete for it\n\tfor _, obj := range list {\n\t\t_, ok := objmap[obj.GetKey()]\n\t\tif !ok {\n\t\t\tct.logger.Infof(\"diffBucket(): Deleting existing object %#v since its not in apiserver\", obj.GetKey())\n\t\t\tevt := kvstore.WatchEvent{\n\t\t\t\tType: kvstore.Deleted,\n\t\t\t\tKey: obj.GetKey(),\n\t\t\t\tObject: &obj.Bucket,\n\t\t\t}\n\t\t\tct.handleBucketEvent(&evt)\n\t\t}\n\t}\n\n\t// trigger create event for all others\n\tfor _, obj := range objlist {\n\t\tct.logger.Infof(\"diffBucket(): Adding object %#v\", obj.GetKey())\n\t\tevt := kvstore.WatchEvent{\n\t\t\tType: kvstore.Created,\n\t\t\tKey: obj.GetKey(),\n\t\t\tObject: obj,\n\t\t}\n\t\tct.handleBucketEvent(&evt)\n\t}\n}", "func (m *manager) forceSync(quotaID string) error {\n\tm.bucketsLock.RLock()\n\tb, ok := m.buckets[quotaID]\n\tif !ok {\n\t\tm.bucketsLock.RUnlock()\n\t\treturn nil\n\t}\n\tm.bucketsLock.RUnlock()\n\tm.bucketsSyncingLock.Lock()\n\tm.bucketsSyncing[b] = struct{}{}\n\tm.bucketsSyncingLock.Unlock()\n\tdefer func() {\n\t\tm.bucketsSyncingLock.Lock()\n\t\tdelete(m.bucketsSyncing, b)\n\t\tm.bucketsSyncingLock.Unlock()\n\t}()\n\treturn b.sync()\n}", "func UploadFiles(c *gin.Context) {\n\tlocationFull := \"\"\n\tpreviewImage := \"\"\n\tpathName := \"files_\" + c.Request.Header[\"Application-Id\"][0]\n\n\tformFile, _ := c.FormFile(\"file\")\n\n\tfile, _ := formFile.Open()\n\tdefer file.Close()\n\n\tvar copiedFile io.Reader\n\tvar buf bytes.Buffer\n\n\tif isImage(formFile.Header[\"Content-Type\"][0]) {\n\t\tcopiedFile = io.TeeReader(file, &buf)\n\t\tpreview, err := makePreview(copiedFile)\n\n\t\tif err == nil {\n\t\t\tnewFileName, _ := newFileName(pathName, formFile.Header[\"Content-Type\"][0])\n\t\t\tpreviewImage, _ = s3.Upload(preview, newFileName)\n\t\t}\n\t}\n\n\tnewFileName, err := newFileName(pathName, formFile.Header[\"Content-Type\"][0])\n\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tvar errUpload error\n\tif buf.Len() == 0 {\n\t\tlocationFull, errUpload = s3.Upload(file, newFileName)\n\t} else {\n\t\tr := bytes.NewReader(buf.Bytes())\n\t\tlocationFull, errUpload = s3.Upload(r, newFileName)\n\t}\n\n\tif errUpload != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": errUpload.Error()})\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"result\": map[string]string{\n\t\t\t\"url\": locationFull,\n\t\t\t\"previewUrl\": previewImage,\n\t\t\t\"type\": formFile.Header[\"Content-Type\"][0],\n\t\t}})\n}", "func (b *Bucket) Upload(file *os.File, filename string) error {\n\t// set session\n\tsess, err := b.setSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuploader := b.newUploaderfunc(sess)\n\t_, err = uploader.Upload(&s3manager.UploadInput{\n\t\tBucket: aws.String(b.BucketName),\n\t\tKey: aws.String(crPath + filename),\n\t\tBody: file,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error uploading %s to bucket %s : %s\", filename, b.BucketName, err.Error())\n\t}\n\n\treturn nil\n}", "func (iter *SyncFolderIterator) UploadObject() s3manager.BatchUploadObject {\n\tfi := iter.fileInfos[0]\n\titer.fileInfos = iter.fileInfos[1:]\n\tbody, err := os.Open(fi.fullpath)\n\tif err != nil {\n\t\titer.err = err\n\t}\n\n\textension := filepath.Ext(fi.key)\n\tmimeType := mime.TypeByExtension(extension)\n\n\tif mimeType == \"\" {\n\t\tmimeType = \"binary/octet-stream\"\n\t}\n\n\tinput := s3manager.UploadInput{\n\t\tBucket: &iter.bucket,\n\t\tKey: &fi.key,\n\t\tBody: body,\n\t\tContentType: &mimeType,\n\t}\n\n\treturn s3manager.BatchUploadObject{\n\t\tObject: &input,\n\t}\n}", "func (client StorageGatewayClient) updateCloudSync(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/storageGateways/{storageGatewayId}/cloudSyncs/{cloudSyncName}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateCloudSyncResponse\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 syncHierarchyUp(localPath string, driveRoot string,\n\texistingFiles map[string]*drive.File,\n\tencrypt bool, ignoreTimes bool) error {\n\tif encrypt {\n\t\tvar err error\n\t\tkey, err = decryptEncryptionKey()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Kick off a background thread to periodically allow uploading\n\t// a bit more data. This allowance is consumed by the\n\t// RateLimitedReader Read() function.\n\tlaunchBandwidthTask(config.Upload.Bytes_per_second_limit)\n\n\tfileMappings, err := compileUploadFileTree(localPath, driveRoot, encrypt)\n\tcheckFatalError(err, \"skicka: error getting local filetree: %v\\n\")\n\ttimeDelta(\"Walk local directories\")\n\tfileMappings, err = filterFilesToUpload(fileMappings, existingFiles, encrypt, ignoreTimes)\n\tcheckFatalError(err, \"skicka: error determining files to sync: %v\\n\")\n\n\tif len(fileMappings) == 0 {\n\t\tfmt.Fprintln(os.Stderr, \"There are no new files that need to be uploaded.\")\n\t\treturn nil\n\t}\n\n\tnBytesToUpload := int64(0)\n\tfor _, info := range fileMappings {\n\t\tnBytesToUpload += info.LocalFileInfo.Size()\n\t}\n\n\t// Given the list of files to sync, first find all of the directories and\n\t// then either get or create a Drive folder for each one.\n\tdirectoryMappingMap := make(map[string]LocalToRemoteFileMapping)\n\tvar directoryNames []string\n\tfor _, localfile := range fileMappings {\n\t\tif localfile.LocalFileInfo.IsDir() {\n\t\t\tdirectoryNames = append(directoryNames, localfile.RemotePath)\n\t\t\tdirectoryMappingMap[localfile.RemotePath] = localfile\n\t\t}\n\t}\n\n\t// Now sort the directories by name, which ensures that the parent of each\n\t// directory is available if we need to create its children.\n\tsort.Strings(directoryNames)\n\n\tprogressBar := pb.New64(nBytesToUpload).SetUnits(pb.U_BYTES)\n\tprogressBar.ShowBar = true\n\tprogressBar.Output = os.Stderr\n\tprogressBar.Start()\n\n\tnUploadErrors := int32(0)\n\n\t// And finally sync the directories, which serves to create any missing ones.\n\tfor _, dirName := range directoryNames {\n\t\tfile := directoryMappingMap[dirName]\n\t\terr = syncFileUp(file, encrypt, existingFiles, progressBar)\n\t\tif err != nil {\n\t\t\tnUploadErrors++\n\t\t\tprintErrorAndExit(fmt.Errorf(\"skicka: %s: %v\\n\", file.LocalPath, err))\n\t\t}\n\t\tupdateActiveMemory()\n\t}\n\ttimeDelta(\"Create Google Drive directories\")\n\n\t// And finally actually update the files that look like they need it.\n\t// Because round-trips to the Drive APIs take a while, we kick off multiple\n\t// worker jobs to do the updates. (However, we don't want too have too\n\t// many workers; this would both lead to lots of 403 rate limit\n\t// errors as well as possibly increase memory use too much if we're\n\t// uploading lots of large files...)\n\tnWorkers := 4\n\n\t// Create a channel that holds indices into the filesToSync array for\n\t// the workers to consume.\n\tindexChan := make(chan int)\n\tdoneChan := make(chan int)\n\n\tuploadWorker := func() {\n\t\tfor {\n\t\t\tindex := <-indexChan\n\t\t\tif index < 0 {\n\t\t\t\tdebug.Printf(\"Worker got index %d; exiting\", index)\n\t\t\t\tdoneChan <- 1\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tlocalFile := fileMappings[index]\n\n\t\t\terr = syncFileUp(localFile, encrypt, existingFiles, progressBar)\n\t\t\tif err != nil {\n\t\t\t\tatomic.AddInt32(&nUploadErrors, 1)\n\t\t\t\tfmt.Fprintf(os.Stderr, \"skicka: %s: %v\\n\",\n\t\t\t\t\tlocalFile.LocalPath, err)\n\t\t\t}\n\t\t\tupdateActiveMemory()\n\t\t}\n\t}\n\n\t// Launch the workers.\n\tfor i := 0; i < nWorkers; i++ {\n\t\tgo uploadWorker()\n\t}\n\t// Communicate the indices of the entries in the localFiles[] array\n\t// to be processed by the workers.\n\tfor index, file := range fileMappings {\n\t\tif !file.LocalFileInfo.IsDir() {\n\t\t\tindexChan <- index\n\t\t}\n\t}\n\t// -1 signifies \"no more work\"; workers exit when they see this.\n\tfor i := 0; i < nWorkers; i++ {\n\t\tindexChan <- -1\n\t}\n\t// Wait for all of the workers to finish.\n\tfor i := 0; i < nWorkers; i++ {\n\t\t<-doneChan\n\t}\n\tprogressBar.Finish()\n\n\ttimeDelta(\"Sync files\")\n\n\tif nUploadErrors == 0 {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"%d files not uploaded due to errors\", nUploadErrors)\n}" ]
[ "0.6680358", "0.602391", "0.57765335", "0.5678034", "0.5564744", "0.55118626", "0.5504865", "0.5477009", "0.5462354", "0.54434687", "0.54375553", "0.54249734", "0.5424158", "0.53969073", "0.5366358", "0.5366358", "0.5363845", "0.5360529", "0.5357023", "0.5355839", "0.5343172", "0.5339702", "0.5338103", "0.5326292", "0.5325198", "0.532063", "0.52894306", "0.5288342", "0.52788675", "0.52781504", "0.5253367", "0.52507514", "0.5248301", "0.5237444", "0.5224132", "0.5219741", "0.5216028", "0.5208887", "0.5197255", "0.5192053", "0.5190576", "0.5181615", "0.5134196", "0.5126793", "0.51235276", "0.51210403", "0.51048684", "0.510448", "0.5101829", "0.50961816", "0.50961035", "0.50951356", "0.50797796", "0.5071833", "0.5071784", "0.50581723", "0.5056809", "0.5052043", "0.50409126", "0.5032487", "0.50296545", "0.5020773", "0.50176334", "0.501297", "0.5008234", "0.5005466", "0.5004241", "0.49955553", "0.49850255", "0.49850014", "0.49837828", "0.49795732", "0.49745664", "0.4959061", "0.49556765", "0.495261", "0.49506605", "0.49353275", "0.49344745", "0.4927393", "0.4913637", "0.49092305", "0.490849", "0.48986077", "0.48970205", "0.4894631", "0.48939043", "0.48773363", "0.4873609", "0.48724434", "0.48697412", "0.48563161", "0.485475", "0.48534203", "0.48499575", "0.4836552", "0.48345098", "0.4827826", "0.48230964", "0.48138914" ]
0.8269777
0
RegisterHandler registers a file descriptor with the Poller and returns a Pollable which can be used for reading/writing as well as readiness notification. File descriptors registered with the poller will be placed into nonblocking mode.
RegisterHandler регистрирует дескриптор файла с помощью Poller и возвращает Pollable, который может использоваться для чтения/записи, а также для уведомления о готовности. Дескрипторы файлов, зарегистрированные с помощью poller, будут помещены в неблокирующий режим.
func (p *Poller) RegisterHandler(fd uintptr, h EventHandler, data interface{}) (*Pollable, error) { if err := syscall.SetNonblock(int(fd), true); err != nil { return nil, err } return p.register(fd, h, data) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewPoller() (*Epoll, error) {\n\treturn NewPollerWithBuffer(128)\n}", "func (h *Handler) AddPoller(c echo.Context) error {\n\tid := c.Param(\"id\")\n\trequest := &PollerRequest{}\n\tvar err error\n\tif err = c.Bind(request); err != nil {\n\t\treturn err\n\t}\n\tp := &poller.Poller{}\n\tp.UUID = uuid.NewV4().String()\n\tp.Action = request.Action\n\tp.Driver = &particleio.ParticleIO{\n\t\tUUID: p.UUID,\n\t\tDeviceID: request.DeviceID,\n\t\tAccessToken: request.AccessToken,\n\t}\n\tp.PollInterval, err = time.ParseDuration(request.PollInterval)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.IsPolling = request.IsPolling\n\tp.User = id\n\n\tdb := h.DB.Clone()\n\tdefer db.Close()\n\n\tif err := db.DB(\"oxylus\").C(\"pollers\").Insert(&p); err != nil {\n\t\treturn err\n\t}\n\t// if ispolling then send the poller to the registry\n\t// turn this into a channel\n\th.PollerRegistry.Add(p.UUID, p)\n\treturn c.NoContent(http.StatusCreated)\n}", "func New() *PollerRegistry {\n\treturn &PollerRegistry{\n\t\tRegistry: make(map[string]*poller.Poller),\n\t\tToDB: make(chan interface{}),\n\t\tUpdateStatus: make(chan string),\n\t}\n}", "func (w *filePoller) Add(name string) error {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\n\tif w.closed {\n\t\treturn errPollerClosed\n\t}\n\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfi, err := os.Stat(name)\n\tif err != nil {\n\t\tf.Close()\n\t\treturn err\n\t}\n\n\tif w.watches == nil {\n\t\tw.watches = make(map[string]chan struct{})\n\t}\n\tif _, exists := w.watches[name]; exists {\n\t\tf.Close()\n\t\treturn fmt.Errorf(\"watch exists\")\n\t}\n\tchClose := make(chan struct{})\n\tw.watches[name] = chClose\n\n\tgo w.watch(f, fi, chClose)\n\treturn nil\n}", "func (r *Raft) RegisterHandler() {\n\tmux := http.NewServeMux()\n\n\tmux.HandleFunc(\"/health\", r.serveHealth)\n\tmux.HandleFunc(\"/askVote\", r.sendRequestVoteReply)\n\tmux.HandleFunc(\"/heartbeatPluslog\", r.serveHeartbeatPluslog)\n\n\tr.server = &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", r.config.Server.Port),\n\t\tHandler: mux,\n\t}\n}", "func NewPoller(poll PollerFunc, interval time.Duration) *Poller {\n\treturn &Poller{\n\t\tChannel: make(chan interface{}),\n\t\tPoll: poll,\n\t\tWaitInterval: interval,\n\t\tisStopped: false,\n\t\tisFinished: false,\n\t\tgroup: &sync.WaitGroup{},\n\t\tstopMutex: &sync.Mutex{},\n\t}\n}", "func NewPoller(getFunc GetFunc, period time.Duration, store Store) *Poller {\n\treturn &Poller{\n\t\tgetFunc: getFunc,\n\t\tperiod: period,\n\t\tstore: store,\n\t}\n}", "func Watch(specfile, dir string, fallback http.Handler, stderr io.Writer) *Handler {\n\tif stderr == nil {\n\t\tstderr = ioutil.Discard\n\t}\n\th := &Handler{\n\t\tspecfile: specfile,\n\t\tdir: dir,\n\t\tfallback: fallback,\n\t\tstderr: stderr,\n\t\tlogger: log.New(stderr, \"\", log.LstdFlags),\n\t}\n\tgo func() {\n\t\th.mend()\n\t\ttime.AfterFunc(time.Second/5, func() {\n\t\t\th.OnChange()\n\t\t})\n\t\th.watch()\n\t}()\n\treturn h\n}", "func NewPoller() *Poller {\n\treturn &Poller{}\n}", "func New() (*Poller, error) {\n\tfd, err := unix.EpollCreate1(unix.EPOLL_CLOEXEC)\n\tif err != nil {\n\t\terr = os.NewSyscallError(\"epoll_create1\", err)\n\t\tlog.WithError(err).Error(\"failed to create an epoll instance\")\n\t\treturn nil, err\n\t}\n\n\tp := &Poller{\n\t\tepfd: fd,\n\t}\n\n\treturn p, nil\n}", "func (c *Client) RegisterHandler(n string, h EventHandler) {\n var handlers []EventHandler\n\n reg, ok := c.Subscribers.Load(n)\n\n if ok {\n handlers = reg.([]EventHandler)\n }\n\n handlers = append(handlers, h)\n c.Subscribers.Store(n, handlers)\n}", "func NewWatcher(bufsize, sysBufSize int, sleepTime time.Duration, fn func([]*WatchEvent),\n) (w *Watcher, err error) {\n\tfd, err := syscall.InotifyInit()\n\tif err != nil {\n\t\treturn\n\t}\n\tif fd == -1 {\n\t\terr = os.NewSyscallError(\"inotify_init\", err)\n\t\treturn\n\t}\n\tif useNonBlock {\n\t\tsyscall.SetNonblock(fd, true)\n\t}\n\tw = &Watcher{\n\t\tfd: fd,\n\t\tfn: fn,\n\t\tev: make(chan []*WatchEvent, bufsize),\n\t\twds: make(map[int32]string),\n\t\tflags: make(map[string]uint32),\n\t\tsl: sleepTime,\n\t\tsysbufsize: sysBufSize,\n\t}\n\tgo w.readEvents()\n\tgo w.handleEvents()\n\treturn\n}", "func New(pattern string) *Handler {\n\trhandlerm.Lock()\n\tdefer rhandlerm.Unlock()\n\n\t_, exists := rhandlers[pattern]\n\tif exists {\n\t\tpanic(\"handler `\" + pattern + \"` already exists\")\n\t}\n\n\th := &Handler{\n\t\tpattern: pattern,\n\t\twstrings: make(chan wstring, 1),\n\t\twints: make(chan wint, 1),\n\t}\n\trhandlers[pattern] = h\n\twhandlers <- h\n\n\treturn h\n}", "func (d *Daemon) RegisterHandler(fun HandlerFunc) {\n\td.handlers = append(d.handlers, fun)\n}", "func RegisterHandler(cb Callback) *Job {\n var job = &Job{\n\t\tcb: cb,\n\t\ttimestamp: -1,\n }\n\n\thandlerQueue.Push(job)\n\treturn job\n}", "func NewPoller(url string, interval time.Duration, out chan PollMsg, shutdown chan *sync.WaitGroup) *Poller {\n\treturn &Poller{\n\t\tURL: url,\n\t\tInterval: interval,\n\t\tOut: out,\n\t\tShutdown: shutdown,\n\t}\n}", "func NewFilePoller(ctx context.Context, f FileChannel, pollTimeout time.Duration) *FilePoller {\n\treturn &FilePoller{File: f, ctx: ctx, pollTimeout: pollTimeout}\n}", "func (l *Loader) NewWatcher(done <-chan struct{}) <-chan error {\n\tif !l.watcher {\n\t\treturn nil\n\t}\n\tupdate := make(chan error)\n\tw := watcher{}\n\tgo w.watcher(l.filename, done, update)\n\treturn update\n}", "func Listen(pattern string, f func(*Response)) Handler {\n\treturn Handler{\n\t\tMethod: PublicMsg,\n\t\tPattern: pattern,\n\t\tRun: f,\n\t}\n}", "func NewWatcher(file string, deadTime time.Duration) (*Watcher, error) {\n\tfileToWatch, err := filepath.Abs(file)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Couldn't get absolute path of file. \" + err.Error())\n\t}\n\tdirectoryToWatch := filepath.Dir(fileToWatch)\n\n\tw := Watcher{\n\t\tC: make(chan struct{}),\n\t\tstopChan: make(chan struct{}),\n\t}\n\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, errors.New(\"Couldn't establish watcher. \" + err.Error())\n\t}\n\n\tgo func() {\n\t\tt := time.NewTimer(deadTime)\n\t\ttimerRunning := true\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-watcher.Events:\n\t\t\t\t// Received an event. Check it's for our file.\n\t\t\t\teventFile, evErr := filepath.Abs(event.Name)\n\t\t\t\tif evErr != nil || eventFile != fileToWatch {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// It's for our file so stop and restart the timer.\n\t\t\t\tif timerRunning {\n\t\t\t\t\tif !t.Stop() {\n\t\t\t\t\t\t// empty the timer chan if we failed to stop it\n\t\t\t\t\t\t<-t.C\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tt.Reset(deadTime)\n\t\t\t\ttimerRunning = true\n\t\t\tcase watcherErr := <-watcher.Errors:\n\t\t\t\tlog.Println(\"Throttled Watcher error:\", watcherErr)\n\t\t\tcase <-t.C:\n\t\t\t\ttimerRunning = false\n\t\t\t\tw.C <- struct{}{}\n\t\t\tcase <-w.stopChan:\n\t\t\t\tif timerRunning {\n\t\t\t\t\tt.Stop()\n\t\t\t\t}\n\t\t\t\twatcher.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = watcher.Add(directoryToWatch)\n\tif err != nil {\n\t\tw.stopChan <- struct{}{}\n\t\treturn nil, errors.New(\"Couldn't watch directory. \" + err.Error())\n\t}\n\n\treturn &w, nil\n\n}", "func RegisterHandler() {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt, syscall.SIGTERM)\n\tgo func() {\n\t\t<-c\n\t\tdoneMu.Lock()\n\t\tdone = true\n\t\tdoneMu.Unlock()\n\t}()\n}", "func NewPollerWithBuffer(count int) (*Epoll, error) {\n\tfd, err := unix.EpollCreate1(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Epoll{\n\t\tfd: fd,\n\t\tlock: &sync.RWMutex{},\n\t\tconns: make(map[int]net.Conn),\n\t\tconnbuf: make([]net.Conn, count, count),\n\t\tevents: make([]unix.EpollEvent, count, count),\n\t}, nil\n}", "func New[T any](pl exported.Pipeline, resp *http.Response) (*Poller[T], error) {\n\tif resp == nil {\n\t\tlog.Write(log.EventLRO, \"Resuming Core-Fake-Poller poller.\")\n\t\treturn &Poller[T]{pl: pl}, nil\n\t}\n\n\tlog.Write(log.EventLRO, \"Using Core-Fake-Poller poller.\")\n\tfakeStatus := resp.Header.Get(shared.HeaderFakePollerStatus)\n\tif fakeStatus == \"\" {\n\t\treturn nil, errors.New(\"response is missing Fake-Poller-Status header\")\n\t}\n\n\tctxVal := resp.Request.Context().Value(shared.CtxAPINameKey{})\n\tif ctxVal == nil {\n\t\treturn nil, errors.New(\"missing value for CtxAPINameKey\")\n\t}\n\n\tapiName, ok := ctxVal.(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"expected string for CtxAPINameKey, the type was %T\", ctxVal)\n\t}\n\n\tqp := \"\"\n\tif resp.Request.URL.RawQuery != \"\" {\n\t\tqp = \"?\" + resp.Request.URL.RawQuery\n\t}\n\n\tp := &Poller[T]{\n\t\tpl: pl,\n\t\tresp: resp,\n\t\tAPIName: apiName,\n\t\t// NOTE: any changes to this path format MUST be reflected in SanitizePollerPath()\n\t\tFakeURL: fmt.Sprintf(\"%s://%s%s%s%s\", resp.Request.URL.Scheme, resp.Request.URL.Host, resp.Request.URL.Path, lroStatusURLSuffix, qp),\n\t\tFakeStatus: fakeStatus,\n\t}\n\treturn p, nil\n}", "func (this *PollDriver) Add(fd int, mode PollMode) error {\n\tvar already bool\n\n\t// Make this method exclusive\n\tthis.lock.Lock()\n\tdefer this.lock.Unlock()\n\n\t// Set up the event structure\n\tthis.ctlEvent.Fd = int32(fd)\n\tthis.ctlEvent.Events, already = this.events[fd]\n\n\tswitch mode {\n\tcase POLL_MODE_READ:\n\t\tthis.ctlEvent.Events |= POLL_READFLAGS\n\tcase POLL_MODE_WRITE:\n\t\tthis.ctlEvent.Events |= POLL_WRITEFLAGS\n\tdefault:\n\t\treturn pollErrInvalidMode\n\t}\n\n\t// Modify or add poll\n\tvar op int\n\tif already {\n\t\top = syscall.EPOLL_CTL_MOD\n\t} else {\n\t\top = syscall.EPOLL_CTL_ADD\n\t}\n\n\t// System call\n\tif err := syscall.EpollCtl(this.handle, op, fd, &this.ctlEvent); err != nil {\n\t\treturn os.NewSyscallError(\"epoll_ctl\", err)\n\t}\n\n\t// Record the events we're interested in\n\tthis.events[fd] = this.ctlEvent.Events\n\n\t// return success\n\treturn nil\n}", "func (s *Server) Register(path string, handler HandlerFunc) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.handlers[path] = handler\n}", "func (w *Watcher) Register(cb func(bts []byte)) {\n\tw.writeCallback = cb\n}", "func Poller(in <-chan *Resource, out chan<- *Resource, status chan<- State) {\n\tfor r := range in {\n\t\ts := r.Poll()\n\t\tstatus <- State{r.url, s}\n\t\tout <- r\n\t}\n}", "func (h *BasicHost) RegisterProtocol(\n\tpid common.Pid,\n\thandler ProtocolHandler,\n\tadapters ...ProtocolAdapter,\n) {\n\th.host.SetStreamHandler(pid.ProtocolID(), func(stream net.Stream) {\n\t\tdefer stream.Reset()\n\t\tmsg, err := common.ReadMessage(stream)\n\t\tif err != nil {\n\t\t\tlog.Println(\"failed to read message from stream :\", err)\n\t\t\treturn\n\t\t}\n\t\tgo handler.Handle(adapters...)(msg)\n\t})\n}", "func (p *Poller) Watch(processEventFn func(fd int, eFlags uint32) error) error {\n\tif p == nil {\n\t\treturn errors.New(\"nil poller\")\n\t}\n\n\tevents := make([]unix.EpollEvent, 100)\n\n\tfor {\n\t\teventsGot, err := unix.EpollWait(p.epfd, events, -1)\n\t\tif err != nil {\n\t\t\tif err == unix.EINTR {\n\t\t\t\t// No connections are ready for read or write, try again\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr = os.NewSyscallError(\"epoll_wait\", err)\n\t\t\tlog.WithError(err).Errorf(\"failed to watch on epoll fd: %d\", p.epfd)\n\t\t\treturn err\n\t\t}\n\n\t\tevents = events[:eventsGot]\n\n\t\tfor _, e := range events {\n\t\t\terr = processEventFn(int(e.Fd), e.Events)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (e *epoll) AddWatcher(fd int, events uint32, cb interface{}, p interface{}) error {\n\t_, ok := e.callbacks[fd]\n\tif !ok {\n\t\te.callbacks[fd] = epollEvent{fun: cb, param: p}\n\t} else {\n\t\treturn errors.New(\"epoll duplicated watch fd\")\n\t}\n\n\terr := syscall.EpollCtl(e.efd, syscall.EPOLL_CTL_ADD, fd, &syscall.EpollEvent{Events: events, Fd: int32(fd)})\n\tif err != nil {\n\t\tdelete(e.callbacks, fd)\n\t\treturn err\n\t}\n\treturn err\n}", "func NewPoller() *Poller {\n\treturn &Poller{\n\t\tinterval: DefaultPollingInterval,\n\t}\n}", "func (c *Client) RegisterWatcher(ctx context.Context, req *pdpb.RegisterWatcherReq) (*pdpb.RegisterWatcherRsp, error) {\n\trsp, err := c.proxyRPC(ctx,\n\t\treq,\n\t\tfunc() {\n\t\t\treq.From = c.name\n\t\t\treq.ID = c.seq\n\t\t},\n\t\tfunc(cc context.Context) (interface{}, error) {\n\t\t\treturn c.pd.RegisterWatcher(cc, req, grpc.FailFast(true))\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn rsp.(*pdpb.RegisterWatcherRsp), nil\n}", "func NewWriteHandler(logger log.Logger, reg prometheus.Registerer, appendable storage.Appendable) http.Handler {\n\th := &writeHandler{\n\t\tlogger: logger,\n\t\tappendable: appendable,\n\n\t\tsamplesWithInvalidLabelsTotal: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\tNamespace: \"prometheus\",\n\t\t\tSubsystem: \"api\",\n\t\t\tName: \"remote_write_invalid_labels_samples_total\",\n\t\t\tHelp: \"The total number of remote write samples which contains invalid labels.\",\n\t\t}),\n\t}\n\tif reg != nil {\n\t\treg.MustRegister(h.samplesWithInvalidLabelsTotal)\n\t}\n\treturn h\n}", "func pollHandler(ctx *router.Context) {\n\tc, w := ctx.Context, ctx.Writer\n\tif err := poll(c, config.LuciConfigServer); err != nil {\n\t\tlogging.WithError(err).Errorf(c, \"Failed to poll.\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n}", "func RegisterHandler(pattern string, handler http.Handler) {\n\tregisterHandler(pattern, handler, patternHandlers, PatternMuxer)\n}", "func (s *Server) RegisterHandler(pattern string, handler http.Handler, secure bool) {\n\ts.mux.Handle(\n\t\tpattern,\n\t\ts.HandlerChain(\n\t\t\thandler,\n\t\t\tsecure,\n\t\t),\n\t)\n}", "func NewWatcher(filename string) Watcher {\n\treturn &watchImpl{filename: filename}\n}", "func (h *Hub) CreateHandler() func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) {\n\treturn func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) {\n\t\tconn, err := upgrader.Upgrade(w, r, nil)\n\t\tif err != nil {\n\t\t\th.log.Error().Err(err).Msg(\"Failed to upgrade websocket connection\")\n\t\t\treturn\n\t\t}\n\t\t// Create and register client\n\t\tc := &client{hub: h, conn: conn, send: make(chan []byte, 256)}\n\t\th.register <- c\n\n\t\t// read & write in go routines.\n\t\tgo c.writePump()\n\t\tgo c.readPump()\n\t}\n}", "func RegisterWatcher(cb func(key Subsystem, err error)) (unregister func()) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\thandle := new(watchHandle)\n\twatchers[handle] = cb\n\tif timer == nil {\n\t\ttimer = time.AfterFunc(time.Minute, timerSelfCheck)\n\t}\n\treturn func() {\n\t\tmu.Lock()\n\t\tdefer mu.Unlock()\n\t\tdelete(watchers, handle)\n\t\tif len(watchers) == 0 && timer != nil {\n\t\t\ttimer.Stop()\n\t\t\ttimer = nil\n\t\t}\n\t}\n}", "func (p *StreamingEndpointsCreatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func New(handler http.Handler) backend.CallResourceHandler {\n\treturn &httpResourceHandler{\n\t\thandler: handler,\n\t}\n}", "func NewHandler(f func(*Message), path string, description ...string) *Handler {\n\thandler := &Handler{f: f}\n\thandler.variables, handler.pattern = parse(path)\n\tif len(description) > 0 {\n\t\thandler.description = description[0]\n\t}\n\treturn handler\n}", "func (m *FPGADevicePluginServer) Register(kubeletEndpoint, resourceName string) error {\n\tconn, err := grpc.Dial(kubeletEndpoint, grpc.WithInsecure(),\n\t\tgrpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {\n\t\t\treturn net.DialTimeout(\"unix\", addr, timeout)\n\t\t}))\n\n\tif err != nil {\n\t\tlog.Debugf(\"Cann't connect to kubelet service\")\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tclient := pluginapi.NewRegistrationClient(conn)\n\treqt := &pluginapi.RegisterRequest{\n\t\tVersion: pluginapi.Version,\n\t\tEndpoint: path.Base(m.socket),\n\t\tResourceName: resourceName,\n\t}\n\n\t_, err = client.Register(context.Background(), reqt)\n\tif err != nil {\n\t\tlog.Debugf(\"Cann't register to kubelet service\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewHandler(handler HandlerFunc) *Handler {\n\tph := &Handler{panicChan: make(chan Info), handle: handler, mu: &sync.Mutex{}, quit: make(chan struct{})}\n\tgo ph.listen()\n\treturn ph\n}", "func Register(id int, handlerName string) int", "func (p *Parallel) Register(f interface{}, args ...interface{}) *Handler {\n\treturn p.NewPipeline().Register(f, args...)\n}", "func RegistrationHandler(cr *ConnectionRegistry) http.HandlerFunc {\n\treturn func(writer http.ResponseWriter, request *http.Request) {\n\n\t\t// websocket stuff\n\t\tws, err := upgrader.Upgrade(writer, request, nil)\n\t\tif err != nil {\n\t\t\thttp.Error(writer, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\n\t\t// create new connection struct\n\t\tconn := NewConnection(request.URL.Query()[\"id\"][0], ConnConfig{\n\t\t\treceive: &broadcastChannel,\n\t\t})\n\n\t\t// register new connection\n\t\terr = cr.Save(conn)\n\t\tif err != nil {\n\t\t\thttp.Error(writer, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\t\t// read/write loops to websocket; read bocks until closed\n\t\tconn.Start(ws)\n\t\t// Remove connection when closed\n\t\terr = cr.Remove(conn.ID)\n\t\tif err != nil {\n\t\t\thttp.Error(writer, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (srv *RegistryServer) RegisterEventHandler(ctx context.Context, handler *Handler) (*RegisterResponse, error) {\n\tvar err error\n\tout := new(RegisterResponse)\n\tfmt.Printf(\"Received a registration request \\n\")\n\t//Check there is no registration already from this server for this subject\n\tproxy := srv.registry.AlreadyRegisteredClientAndMessage(handler.ClientId, handler.MessageId)\n\tif proxy != nil {\n\t\tfmt.Printf(\"Received a registration request for the second time for client %s message %s\\n\", handler.ClientId, handler.MessageId)\n\t\t//Delete old registration and create new because chances are sequence number has changed so need\n\t\t//to pick up new sequnce number\n\t\tfmt.Printf(\"Deleting duplicate proxy..\")\n\t\tsrv.registry.DeleteProxy(handler.ClientId, handler.MessageId)\n\t\tfmt.Printf(\"Deleted duplicate proxy\")\n\t}\n\terr = srv.registry.AddNewProxy(handler)\n\n\treturn out, err\n}", "func NewWatcher() (*Watcher, error) {\n\t// Need to set nonblocking mode for SetDeadline to work, otherwise blocking\n\t// I/O operations won't terminate on close.\n\tfd, errno := unix.InotifyInit1(unix.IN_CLOEXEC | unix.IN_NONBLOCK)\n\tif fd == -1 {\n\t\treturn nil, errno\n\t}\n\n\tw := &Watcher{\n\t\tfd: fd,\n\t\tinotifyFile: os.NewFile(uintptr(fd), \"\"),\n\t\twatches: newWatches(),\n\t\tEvents: make(chan Event),\n\t\tErrors: make(chan error),\n\t\tdone: make(chan struct{}),\n\t\tdoneResp: make(chan struct{}),\n\t}\n\n\tgo w.readEvents()\n\treturn w, nil\n}", "func New(p *Page) (Poller, error) {\n\tid := \"\"\n\tl := log.With().Str(\"func\", \"poller.New\").Logger()\n\n\tif p.ID != nil && len(*p.ID) > 0 {\n\t\tid = *p.ID\n\t} else {\n\t\tid = randomdata.SillyName()\n\t\tl.Info().Msg(\"generating random name...\")\n\t}\n\tl = l.With().Str(\"id\", id).Logger()\n\n\t// -- Validation\n\tmethod, err := parseHTTPMethod(p.Method)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparsedURL, err := parseURL(p.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// -- Set ups\n\trandomFrequency, ticks, offset := parsePollOptions(id, p.PollOptions)\n\tif randomFrequency {\n\t\tticks = nextRandomTick(ticks-offset, ticks+offset)\n\t}\n\n\trandUA, userAgents := parseUserAgentOptions(id, p.UserAgentOptions)\n\n\theaders := http.Header{}\n\tif p.Headers == nil {\n\t\tl.Warn().Msg(\"no headers provided\")\n\t} else {\n\t\tfor headerKey, headerVal := range p.Headers {\n\t\t\theaders[headerKey] = []string{headerVal}\n\t\t}\n\t\tswitch hlen := len(p.Headers); {\n\t\tcase hlen == 0:\n\t\t\tl.Warn().Msg(\"no headers provided\")\n\t\tcase hlen < 3:\n\t\t\tl.Warn().Msg(\"few headers provided\")\n\t\t}\n\t}\n\n\thttpClient := &http.Client{\n\t\tTimeout: time.Duration(defaultHTTPClientTimeout) * time.Second,\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\tif p.FollowRedirect {\n\t\thttpClient.CheckRedirect = nil\n\t}\n\n\trequest, err := http.NewRequestWithContext(context.Background(), method, parsedURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequest.Header = headers\n\n\t// -- Complete and return\n\treturn &pagePoller{\n\t\tid: id,\n\t\thttpClient: httpClient,\n\t\trequest: request,\n\t\tuserAgents: userAgents,\n\t\tticks: ticks,\n\t\trandTick: randomFrequency,\n\t\toffsetRange: offset,\n\t\tlastUAIndex: -1,\n\t\trandUa: randUA,\n\t}, nil\n}", "func (d *dumper) RegisterHandler(h Handler) {\n\tname := h.Name()\n\t_, duplicate := d.handlers[name]\n\td.handlers[name] = h\n\n\tif duplicate {\n\t\tfor _, spec := range d.methods {\n\t\t\tif spec.handler == name {\n\t\t\t\tspec.h = h\n\t\t\t}\n\t\t}\n\n\t\tfor _, spec := range d.regexps {\n\t\t\tif spec.handler == name {\n\t\t\t\tspec.h = h\n\t\t\t}\n\t\t}\n\t}\n}", "func NewDispatcher(handler Handler, waiter Waiter, config *DispatcherConfig) *Dispatcher {\n\tif config == nil {\n\t\tconfig = defaultDispatcherConfig\n\t}\n\n\tpool := make(chan chan RetryJob, config.MaxWorkers)\n\treturn &Dispatcher{\n\t\tWorkerPool: pool,\n\t\tConfig: config,\n\t\thandler: handler,\n\t\twaiter: waiter,\n\t}\n}", "func (d Dependency) NewHandler() operations.V1ReadHelloStatusHandlerFunc {\n\tif d.ContextCreator == nil {\n\t\tlogger.Fatalf(nil, \"context creator not set for Dependency\")\n\t}\n\tif d.Storage == nil {\n\t\tlogger.Fatalf(nil, \"storage not set for Dependency\")\n\t}\n\n\treturn func(params operations.V1ReadHelloStatusParams) middleware.Responder {\n\t\tctx := d.ContextCreator.Create(params.HTTPRequest)\n\t\treturn d.handle(ctx, params)\n\t}\n}", "func ListenAndRegister(c context.Context, l *Listener, reg *Registry, fn func(d device.D) error) error {\n\tfor {\n\t\tdh, err := l.Accept(c)\n\t\tif err != nil {\n\t\t\t// Note: may be a Context cancellation / deadline.\n\t\t\treturn err\n\t\t}\n\t\tif d, isNew := reg.Observe(dh); isNew && fn != nil {\n\t\t\tif err := fn(d); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (p *Poller) Start() {\n\tgo func(url string, interval time.Duration, out chan<- PollMsg, shutdown <-chan *sync.WaitGroup) {\n\t\twg := &sync.WaitGroup{}\n\t\tdefer func() {\n\t\t\twg.Done()\n\t\t}()\n\n\t\tticker := time.NewTicker(interval)\n\t\tmsg := PollMsg{}\n\t\tresp, err := http.Get(url)\n\t\tif err != nil {\n\t\t\tmsg.Error = append(msg.Error, err)\n\t\t}\n\n\t\tdata, err2 := ioutil.ReadAll(resp.Body)\n\t\tif err2 != nil {\n\t\t\tmsg.Error = append(msg.Error, err2)\n\t\t}\n\n\t\tmsg.Payload = data\n\t\tout <- msg\n\n\t\tresp.Body.Close()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase wg = <-shutdown:\n\t\t\t\treturn\n\t\t\tcase <-ticker.C:\n\t\t\t\tmsg := PollMsg{}\n\t\t\t\tresp, err := http.Get(url)\n\t\t\t\tif err != nil {\n\t\t\t\t\tmsg.Error = append(msg.Error, err)\n\t\t\t\t}\n\n\t\t\t\tdata, err2 := ioutil.ReadAll(resp.Body)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\tmsg.Error = append(msg.Error, err2)\n\t\t\t\t}\n\n\t\t\t\tmsg.Payload = data\n\t\t\t\tout <- msg\n\n\t\t\t\tresp.Body.Close()\n\t\t\t}\n\t\t}\n\t}(p.URL, p.Interval, p.Out, p.Shutdown)\n}", "func poll(f *os.File) error {\n\tconst (\n\t\tevents = 0x001 // POLLIN\n\t\ttimeout = -1 // TSS2_TCTI_TIMEOUT_BLOCK=-1; block indefinitely until data is available\n\t)\n\tpollFds := []unix.PollFd{\n\t\t{Fd: int32(f.Fd()), Events: events},\n\t}\n\t_, err := unix.Poll(pollFds, timeout)\n\treturn err\n}", "func (p *Poller) Poll(ctx context.Context, pf PollFunc) (interface{}, error) {\n\tif p.timeout > 0 {\n\t\tctxWithTimeout, cancel := context.WithTimeout(ctx, p.timeout)\n\t\tdefer cancel()\n\t\tctx = ctxWithTimeout\n\t}\n\n\tticker := time.NewTicker(p.interval)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tdone, res, err := pf(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif !done {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\treturn res, nil\n\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ctx.Err()\n\t\t}\n\t}\n}", "func New(notifier *gobrake.Notifier) *Handler {\n\th := Handler{notifier}\n\treturn &h\n}", "func NewRegisterHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdec func(*http.Request) goahttp.Decoder,\n\tenc func(context.Context, http.ResponseWriter) goahttp.Encoder,\n\teh func(context.Context, http.ResponseWriter, error),\n) http.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeRegisterRequest(mux, dec)\n\t\tencodeResponse = EncodeRegisterResponse(enc)\n\t\tencodeError = EncodeRegisterError(enc)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"register\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"mtd\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\teh(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tres, err := endpoint(ctx, payload)\n\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\teh(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\teh(ctx, w, err)\n\t\t}\n\t})\n}", "func RegisterProxy(initialEntry *ServiceEntry, entries chan *ServiceEntry, iface *net.Interface) (*Server, error) {\n\ts, err := newServer(initialEntry, iface)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.waitGroup.Add(1)\n\tgo s.mainloop(entries)\n\n\treturn s, nil\n}", "func New() (*FileWatcher, error) {\n\t// Create a new file watcher\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf := &FileWatcher{\n\t\twatcher: watcher,\n\t\ttriggerClose: make(chan struct{}),\n\t}\n\n\t// Start the goroutine to watch the files\n\tgo func() {\n\t\tdefer f.watcher.Close()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-watcher.Events:\n\t\t\t\t// Skip if the event function is not defined\n\t\t\t\tif f.onEvent == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Create a new event object\n\t\t\t\te := &Event{\n\t\t\t\t\tPath: event.Name,\n\t\t\t\t\tevent: &event,\n\t\t\t\t}\n\n\t\t\t\t// Call the callback in a safe way\n\t\t\t\tfunc() {\n\t\t\t\t\t// Recover panics and log the error\n\t\t\t\t\tdefer func() {\n\t\t\t\t\t\tif e := recover(); e != nil {\n\t\t\t\t\t\t\tlog.L.Error(\"filewatcher callback panic: %v\", e)\n\t\t\t\t\t\t}\n\t\t\t\t\t}()\n\n\t\t\t\t\tf.onEvent(e)\n\t\t\t\t}()\n\n\t\t\t\t// If a new folder was created, then add it to monitor recursive actions\n\t\t\t\tif e.IsCreate() {\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\tif stat, err := os.Stat(e.Path); err == nil && stat.IsDir() {\n\t\t\t\t\t\t\terr = f.Add(e.Path)\n\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\tlog.L.Error(\"filewatcher: failed to add recursive directory: %v\", err)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}()\n\t\t\t\t}\n\n\t\t\t\t// We don't have to remove deleted directories from the watcher,\n\t\t\t\t// because they are removed automatically...\n\t\t\tcase err := <-watcher.Errors:\n\t\t\t\tlog.L.Error(\"a file watcher error occurred: %s\", err.Error())\n\t\t\tcase <-f.triggerClose:\n\t\t\t\t// Just exit the loop\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn f, nil\n}", "func NewHookHandler(cfg *config.Config) HookHandler {\n\tvar lock sync.Mutex\n\n\tvar handler HookHandler\n\thandler.lock = &lock\n\thandler.config = cfg\n\treturn handler\n}", "func (m *serverMessageHandlerManager) registerHandler(packetType gearman.PacketType, handler serverMessageHandler) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\tm.handlers[packetType] = handler\n}", "func AddHandler(handler func()) {\n\t// Create the channel and start the main interrupt handler which invokes all other callbacks and exits if not\n\t// already done.\n\tif Chan == nil {\n\t\tChan = make(chan os.Signal, 1)\n\t\tsignal.Notify(Chan, Signals...)\n\t\tgo Listener()\n\t}\n\tAddHandlerChan <- handler\n}", "func (r *Replicator) RegisterWSHandler() *http.ServeMux {\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(fmt.Sprintf(ccommon.HTTPHandlerPattern, ccommon.EndpointOpenReplicationRemoteReadStream), r.OpenReplicationRemoteReadStreamHandler)\n\tmux.HandleFunc(fmt.Sprintf(ccommon.HTTPHandlerPattern, ccommon.EndpointOpenReplicationReadStream), r.OpenReplicationReadStreamHandler)\n\treturn mux\n}", "func New(dir string, conn *websocket.Conn) *Watcher {\n\treturn &Watcher{\n\t\tConn: conn,\n\t\tDir: dir,\n\t}\n}", "func NewHandleFunc(h func(*Client)) http.HandlerFunc {\n\n\tupgrader := &websocket.Upgrader{\n\t\tReadBufferSize: 1024,\n\t\tWriteBufferSize: 1024,\n\t\tCheckOrigin: func(r *http.Request) bool {\n\t\t\treturn true\n\t\t},\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tserveWs(h, upgrader, w, r)\n\t}\n}", "func RegisterRegistryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterRegistryHandlerClient(ctx, mux, NewRegistryClient(conn))\n}", "func RegisterHandler(command string, handlerFunc HandlerFunc) {\n\thandlers[command] = handlerFunc\n}", "func (w *watcher) AddEventHandler(h ResourceEventHandler) {\n\tw.handler = h\n}", "func (api *API) RegisterHandler(path string, handler http.Handler) {\n\tapi.hasHandlers = true\n\thttp.Handle(path, api.RequireToken(handler.ServeHTTP))\n}", "func NewPollerJob(resourceUrl string) PollerJob{\n\treturn PollerJob{\n\t\tresourceUrl:resourceUrl,\n\t\tsuspend: make(chan bool),\n\t\tresume: make(chan bool),\n\t}\n}", "func makeWatcherInputHandler(serCh serverChannelsT) handlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif len(serCh.watcherInput) == maxBufferSize {\n\t\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\t\tw.Write([]byte(\"Server too busy.\"))\n\t\t\treturn\n\t\t}\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\treplyChan := make(chan []byte)\n\t\tserCh.watcherInput <- update.RawWatcherInputT{\n\t\t\tContent: body,\n\t\t\tReplyChan: replyChan,\n\t\t\tBodyReadErr: err,\n\t\t}\n\t\tresp := <-replyChan\n\t\tw.Write(resp)\n\t}\n}", "func (rl *RateLimiter) Handler(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t// Make a new PluggableResponseWriter if we need to\n\t\tDebugOut.Printf(\"RateLimiter Pluggable ResponseWriter...\\n\")\n\t\trw, _ := prw.NewPluggableResponseWriterIfNot(w)\n\t\tdefer rw.Flush()\n\n\t\thttpError := tollbooth.LimitByRequest(rl.Limiter, rw, r)\n\t\tif httpError != nil {\n\t\t\tDebugOut.Printf(\"%s: %s\\n\", ErrRequestError{r, \"Request tripped limiter\"}.String(), r.RequestURI)\n\t\t\tif !rl.collectOnly {\n\t\t\t\trl.ExecOnLimitReached(rw, r)\n\t\t\t\trw.Header().Add(\"Content-Type\", rl.GetMessageContentType())\n\t\t\t\tsec := 1\n\t\t\t\tmax := rl.GetMax()\n\t\t\t\tif max < 1.0 && max > 0.0 {\n\t\t\t\t\tsec = int(math.Ceil(1.0 / max))\n\t\t\t\t}\n\t\t\t\trw.Header().Add(\"Retry-After\", fmt.Sprintf(\"%d\", sec))\n\t\t\t\trw.WriteHeader(httpError.StatusCode)\n\t\t\t\trw.Write([]byte(httpError.Message))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tnext.ServeHTTP(rw, r)\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func NewHandler() (*Handler, error) {\n\trdCloser, err := NewReaderCloser()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Handler{\n\t\treaderCloser: rdCloser,\n\t\tbufioReader: bufio.NewReader(rdCloser),\n\t}, nil\n}", "func (h *Handler) UpdatePoller(c echo.Context) error {\n\tid := c.Param(\"id\")\n\trequest := &PollerRequest{}\n\tvar err error\n\tif err = c.Bind(request); err != nil {\n\t\treturn err\n\t}\n\n\tdb := h.DB.Clone()\n\tdefer db.Close()\n\n\tnewInterval, err := time.ParseDuration(request.PollInterval)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tif err := db.DB(\"oxylus\").C(\"pollers\").Update(\n\t\tbson.M{\"uuid\": id},\n\t\tbson.M{\"$set\": bson.M{\n\t\t\t\"ispolling\": request.IsPolling,\n\t\t\t\"action\": request.Action,\n\t\t\t\"pollinterval\": newInterval}}); err != nil {\n\t\treturn err\n\t}\n\n\tif request.IsPolling {\n\t\tvar p poller.Poller\n\t\tif err := db.DB(\"oxylus\").C(\"pollers\").Find(bson.M{\"uuid\": id}).One(&p); err != nil {\n\t\t\treturn err\n\t\t}\n\t\th.PollerRegistry.Add(id, &p)\n\t} else {\n\t\th.PollerRegistry.Remove(id)\n\t}\n\n\treturn c.NoContent(http.StatusOK)\n}", "func (c *watchImpl) Watch(handler WatcherHandler) (chan struct{}, error) {\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := watcher.Add(path.Dir(c.filename)); err != nil {\n\t\treturn nil, err\n\t}\n\tstopCh := make(chan struct{}, 0)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase err := <-watcher.Errors:\n\t\t\t\tgo handler.Error(err)\n\t\t\tcase ev := <-watcher.Events:\n\t\t\t\tif ev.Op&fsnotify.Write == fsnotify.Write || ev.Op&fsnotify.Create == fsnotify.Create {\n\t\t\t\t\tif ev.Name == c.filename {\n\t\t\t\t\t\tgo handler.Updated()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase <-stopCh:\n\t\t\t\twatcher.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn stopCh, nil\n}", "func (e *Client) Register(ctx context.Context, filename string) error {\n\tconst action = \"/register\"\n\turl := e.baseURL + action\n\n\treqBody, err := json.Marshal(map[string]interface{}{\n\t\t\"events\": []EventType{Shutdown},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\thttpReq, err := http.NewRequestWithContext(ctx, \"POST\", url, bytes.NewBuffer(reqBody))\n\tif err != nil {\n\t\treturn err\n\t}\n\thttpReq.Header.Set(extensionNameHeader, filename)\n\thttpRes, err := e.httpClient.Do(httpReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif httpRes.StatusCode != 200 {\n\t\treturn fmt.Errorf(\"request failed with status %s\", httpRes.Status)\n\t}\n\tdefer httpRes.Body.Close()\n\te.extensionID = httpRes.Header.Get(extensionIdentiferHeader)\n\treturn nil\n}", "func RegisterFleaHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterFleaHandlerClient(ctx, mux, NewFleaClient(conn))\n}", "func makeRegisterHandler(endpoints endpoint.Endpoints, options []grpc.ServerOption) grpc.Handler {\n\treturn grpc.NewServer(endpoints.RegisterEndpoint, decodeRegisterRequest, encodeRegisterResponse, options...)\n}", "func makeRegisterHandler(endpoints endpoint.Endpoints, options []grpc.ServerOption) grpc.Handler {\n\treturn grpc.NewServer(endpoints.RegisterEndpoint, decodeRegisterRequest, encodeRegisterResponse, options...)\n}", "func (c *ListenConfig) Listen(path string) (net.Listener, error) {\n\th, err := makeServerPipeHandle(path, c.SecurityDescriptor, c, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl := &pipeListener{\n\t\tfirstHandle: h,\n\t\tpath: path,\n\t\tconfig: *c,\n\t\tacceptCh: make(chan chan acceptResponse),\n\t\tcloseCh: make(chan int),\n\t\tdoneCh: make(chan int),\n\t}\n\t// The first connection is swallowed on Windows 7 & 8, so synthesize it.\n\tif maj, min, _ := windows.RtlGetNtVersionNumbers(); maj < 6 || (maj == 6 && min < 4) {\n\t\tpath16, err := windows.UTF16PtrFromString(path)\n\t\tif err == nil {\n\t\t\th, err = windows.CreateFile(path16, 0, 0, nil, windows.OPEN_EXISTING, windows.SECURITY_SQOS_PRESENT|windows.SECURITY_ANONYMOUS, 0)\n\t\t\tif err == nil {\n\t\t\t\twindows.CloseHandle(h)\n\t\t\t}\n\t\t}\n\t}\n\tgo l.listenerRoutine()\n\treturn l, nil\n}", "func NewHandler(mux *drpcmux.Mux, cb handlerFunc) *Handler {\n\tif cb == nil {\n\t\tcb = defaultHandlerFunc\n\t}\n\treturn &Handler{\n\t\tmux: mux,\n\t\tcb: cb,\n\t}\n}", "func (p PollingListener) ListenAndServe(handler Handler) {\n\tpollingURL := \"https://\" + path.Join(\"api.telegram.org/\", \"bot\"+p.Token, \"getUpdates\")\n\tpollingURL += \"?timeout=\" + strconv.Itoa(p.Timeout)\n\tvar offset = -1\nmainLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-p.s:\n\t\t\tbreak mainLoop\n\t\tdefault:\n\t\t\tif resp, err := p.Client.Get(pollingURL + \"&offset=\" + strconv.Itoa(offset)); err == nil {\n\t\t\t\tvar result getResult\n\t\t\t\terr = json.NewDecoder(resp.Body).Decode(&result)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !result.OK {\n\t\t\t\t\tlog.Println(\"Result not OK\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, u := range result.Result {\n\t\t\t\t\toffset = u.UpdateID + 1\n\t\t\t\t\tgo handler.Handle(p.r, &u)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func NewWatcher(cfg WatcherConfig) (Watcher, error) {\n\tif cfg.PollInterval == 0 {\n\t\tcfg.PollInterval = DefaultPoolInterval\n\t}\n\n\tif len(cfg.Extensions) == 0 {\n\t\tcfg.Extensions = DefaultExtensions\n\t}\n\n\tallowedExts := make(map[string]bool)\n\tfor _, ext := range cfg.Extensions {\n\t\tallowedExts[\".\"+ext] = true\n\t}\n\n\twatchPaths, err := resolvePaths(cfg.WatchItems, allowedExts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tignorePaths, err := resolvePaths(cfg.IgnoreItems, allowedExts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger.Debugf(\"Resolved watch paths: %v\", watchPaths)\n\tlogger.Debugf(\"Resolved ignore paths: %v\", ignorePaths)\n\treturn &watcher{\n\t\tevents: make(chan string),\n\t\terrors: make(chan error),\n\t\tdefaultIgnore: cfg.DefaultIgnore,\n\t\tpollInterval: cfg.PollInterval,\n\t\twatchItems: watchPaths,\n\t\tignoreItems: ignorePaths,\n\t\tallowedExtensions: allowedExts,\n\t}, nil\n}", "func (e *Client) Register(ctx context.Context, filename string) (*RegisterResponse, error) {\n\tconst action = \"/register\"\n\turl := e.baseURL + action\n\n\treqBody, err := json.Marshal(map[string]interface{}{\n\t\t\"events\": []EventType{Invoke, Shutdown},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thttpReq, err := http.NewRequestWithContext(ctx, \"POST\", url, bytes.NewBuffer(reqBody))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thttpReq.Header.Set(extensionNameHeader, filename)\n\thttpRes, err := e.httpClient.Do(httpReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif httpRes.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"request failed with status %s\", httpRes.Status)\n\t}\n\tdefer httpRes.Body.Close()\n\tbody, err := ioutil.ReadAll(httpRes.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres := RegisterResponse{}\n\terr = json.Unmarshal(body, &res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te.ExtensionID = httpRes.Header.Get(extensionIdentiferHeader)\n\tfmt.Println(\"Extension id:\", e.ExtensionID)\n\treturn &res, 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 (c *regularResourceComponent) Listen() {\n\tfor ev := range c.stream {\n\t\tif c.logicalID != ev.LogicalResourceID {\n\t\t\tcontinue\n\t\t}\n\t\tupdateComponentStatus(&c.mu, &c.statuses, cfnStatus{\n\t\t\tvalue: cloudformation.StackStatus(ev.ResourceStatus),\n\t\t\treason: ev.ResourceStatusReason,\n\t\t})\n\t\tupdateComponentTimer(&c.mu, c.statuses, c.stopWatch)\n\t}\n\tclose(c.done) // No more events will be processed.\n}", "func NewHandler(dial func(addr string) (*hdhomerun.Client, error)) http.Handler {\n\treturn &handler{\n\t\tdial: dial,\n\t}\n}", "func (c *Config) RegisterHandler(handler func(*Config)) error {\n\tc.handlers = append(c.handlers, handler)\n\treturn nil\n}", "func AddHandler(informer cache.SharedIndexInformer, kind string) workqueue.RateLimitingInterface {\n\trateLimiter := workqueue.DefaultControllerRateLimiter()\n\tqueue := workqueue.NewNamedRateLimitingQueue(rateLimiter, kind)\n\thandler := NewEventHandler(kind, queue)\n\tinformer.AddEventHandler(handler)\n\treturn queue\n}", "func NewHandler(newEventStream NewEventStreamHandler) *Handler {\n\treturn NewHandlerBuffered(newEventStream, 0)\n}", "func (r *Ready) Handler(ready http.Handler) http.HandlerFunc {\n\treturn func(rw http.ResponseWriter, req *http.Request) {\n\t\tselect {\n\t\tcase <-r.Notify():\n\t\t\tready.ServeHTTP(rw, req)\n\t\tdefault:\n\t\t\tr.unreadyHandler.ServeHTTP(rw, req)\n\t\t}\n\t}\n}", "func newWatcher(loader *Loader, uri string, interval time.Duration, onStop func()) *watcher {\n\treturn &watcher{\n\t\tstate: isCreated,\n\t\tupdatedAt: 0,\n\t\tloader: loader,\n\t\turi: uri,\n\t\tupdates: make(chan Update, 1),\n\t\tinterval: interval,\n\t\tonStop: onStop,\n\t}\n}", "func New(config config.ConnectorConfig) (http.Handler, error) {\n\tif config.URI == \"\" {\n\t\treturn nil, errors.Errorf(\"URI parameter missing in connector: %#v\", config)\n\t}\n\tif !strings.HasPrefix(config.URI, prefixURI) {\n\t\treturn nil, errors.Errorf(\"Invalid URI parameter in connector, expected '%s': %#v\", prefixURI, config)\n\t}\n\n\tdirectoryPath := strings.Replace(config.URI, prefixURI, \"\", 1)\n\tif directoryPath == \"\" {\n\t\treturn nil, errors.Errorf(\"Directory path is missing in URI parameter in connector: %#v\", config)\n\t}\n\n\tstat, err := os.Stat(directoryPath)\n\tif os.IsNotExist(err) {\n\t\treturn nil, errors.Errorf(\"Directory passed in URI parameter doesn't exists, connector: %#v\", config)\n\t}\n\tif !stat.Mode().IsDir() {\n\t\treturn nil, errors.Errorf(\"URI parameter doesn't point to directory, connector: %#v\", config)\n\t}\n\n\thandler := &directoryHandler{\n\t\tpathPrefix: config.PathPrefix,\n\t\tdirectoryPath: directoryPath,\n\t}\n\n\treturn handler, nil\n}", "func New(c *Config) (Poller, error) {\n\tcfg := c.withDefaults()\n\n\tkq, err := KqueueCreate(&KqueueConfig{\n\t\tOnWaitError: cfg.OnWaitError,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn poller{kq}, nil\n}", "func (l Listener) AddHandler(cmd string, handleFunc func()) {\n\tl[cmd] = handleFunc\n}", "func (h *Hook) Register() (*Hook, error) {\n\tvar err error\n\n\th.Registered = time.Now()\n\n\th.file, err = h.file.Set(h)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn h, nil\n}", "func NewHandler(dbFile string) (h *handler, err error) {\n\terr = os.MkdirAll(filepath.Dir(dbFile), 0755)\n\tif err != nil {\n\t\treturn\n\t}\n\th = &handler{messages: make(chan *message, 1000)}\n\th.db, err = bolt.Open(dbFile, 0600, &bolt.Options{Timeout: 30 * time.Second})\n\tif err != nil {\n\t\treturn\n\t}\n\terr = h.db.Update(func(tx *bolt.Tx) error {\n\t\t_, err := tx.CreateBucket([]byte(bucket))\n\t\treturn err\n\t})\n\tgo h.Loop()\n\treturn\n}", "func NewHandler(fp string, fs http.FileSystem, fc FragmentCache) http.Handler {\n\treturn &Handler{fs, fc, fp}\n}" ]
[ "0.5313639", "0.52643883", "0.5241936", "0.5210753", "0.5175671", "0.5104131", "0.50692457", "0.5018211", "0.49877605", "0.49037454", "0.48952135", "0.4866136", "0.48658457", "0.48586193", "0.48374307", "0.4825528", "0.4811092", "0.47992", "0.47865638", "0.47729722", "0.47683546", "0.47179824", "0.47160292", "0.46524936", "0.46094006", "0.45864248", "0.45845523", "0.45735663", "0.45729288", "0.45644724", "0.45465592", "0.45352122", "0.4533333", "0.4519817", "0.45181027", "0.4502073", "0.44853067", "0.44827312", "0.4471347", "0.44657597", "0.44426084", "0.44296148", "0.44282478", "0.44214135", "0.44180715", "0.44035763", "0.44017458", "0.43955633", "0.43909675", "0.43891147", "0.43710312", "0.43707806", "0.43690974", "0.4365585", "0.43570048", "0.4345989", "0.4344802", "0.4328955", "0.4326977", "0.43266746", "0.4321242", "0.4320471", "0.4308139", "0.4305433", "0.4301735", "0.42952874", "0.42890283", "0.4288398", "0.42882866", "0.42872873", "0.42843", "0.42839998", "0.4283628", "0.42797464", "0.42794615", "0.42787355", "0.42777225", "0.42763525", "0.42752668", "0.42706892", "0.42706892", "0.42694426", "0.42658764", "0.4262229", "0.42548355", "0.4254685", "0.4250533", "0.4248258", "0.42407474", "0.42386627", "0.42342764", "0.42321432", "0.42279097", "0.4227779", "0.42245352", "0.4223584", "0.4219167", "0.4212396", "0.42117593", "0.42104357" ]
0.7504527
0
GetInstNameField returns the inst name field
GetInstNameField возвращает поле имени инстанса
func GetInstNameField(objID string) string { switch objID { case BKInnerObjIDApp: return BKAppNameField case BKInnerObjIDSet: return BKSetNameField case BKInnerObjIDModule: return BKModuleNameField case BKInnerObjIDObject: return BKInstNameField case BKInnerObjIDHost: return BKHostNameField case BKInnerObjIDProc: return BKProcNameField case BKInnerObjIDPlat: return BKCloudNameField case BKTableNameInstAsst: return BKFieldID default: if IsObjectInstAsstShardingTable(objID) { return BKFieldID } return BKInstNameField } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *GetField) Name() string { return p.name }", "func (inst *InstFPToUI) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstTrunc) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstFPExt) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstSExt) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstUIToFP) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstZExt) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstFPTrunc) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstFPToSI) GetName() string {\n\treturn inst.Name\n}", "func (inst *InstSIToFP) GetName() string {\n\treturn inst.Name\n}", "func (o *SingleSelectFieldField) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func (f *Field) Name() string {\n\tjsonTag := reflect.StructTag(f.Tag.Value[1 : len(f.Tag.Value)-1]).Get(\"json\") // Delete first and last quotation\n\tjsonTag = strings.Split(jsonTag, \",\")[0] // This can return \"-\"\n\tif jsonTag != \"\" {\n\t\treturn jsonTag\n\t}\n\n\tif f.Names != nil {\n\t\treturn f.Names[0].Name\n\t}\n\n\treturn f.Type.(*ast.Ident).Name\n}", "func (f StandInstDbNameField) Tag() quickfix.Tag { return tag.StandInstDbName }", "func (f *Fieldx) Name() string {\n\treturn f.data.Name\n}", "func (f BinaryField) GetName() string {\n\treturn f.name\n}", "func fieldname(field *ast.Field) string {\n\treturn field.Names[0].Name\n}", "func (inst *InstBitCast) GetName() string {\n\treturn inst.Name\n}", "func (f *Field) Name() string {\n\treturn f.field.Name\n}", "func (o FieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Field) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (field Field) Name() string {\n\tif len(field.Names) > 0 {\n\t\treturn field.Names[0].String()\n\t}\n\n\t// The field has no name, so we use Type name as the field name.\n\treturn itemTypeName(field.TypeValue.Type).Name\n}", "func getInstanceName(infra infraObject) string {\n\t// cloud-init will split the hostname on '.' and set the hostname to the first chunk. This causes an issue where all\n\t// nodes in a machine pool may have the same node name in Kubernetes. Converting the '.' to '-' here prevents this.\n\tinstanceName := strings.ReplaceAll(infra.meta.GetName(), \".\", \"-\")\n\tinstanceName = name2.SafeConcatName(instanceName)\n\n\treturn instanceName\n}", "func (c *Checker) getFieldName(field reflect.StructField) string {\n\tname := field.Name\n\tif c.JSONTag != nil {\n\t\tif val, ok := field.Tag.Lookup(\"json\"); ok {\n\t\t\tname = strings.Split(val, \",\")[0]\n\t\t}\n\t}\n\tif name == \"-\" {\n\t\tif !c.JSONTag.IgnoreDashFields {\n\t\t\tname = field.Name\n\t\t}\n\t}\n\treturn name\n}", "func (f *Field) GetName() string {\n\treturn formatGoName(f.Name)\n}", "func (c *STableField) Name() string {\n\tif len(c.alias) > 0 {\n\t\treturn c.alias\n\t}\n\treturn c.spec.Name()\n}", "func getInstanceName(instance ec2.Instance) (string, error) {\n\tfor _, value := range instance.Tags {\n\t\tif *value.Key == \"Name\" {\n\t\t\treturn *value.Value, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"could not find instance\")\n}", "func (inst *InstPtrToInt) GetName() string {\n\treturn inst.Name\n}", "func (d Digest) GetInstanceName() InstanceName {\n\t_, _, _, sizeBytesEnd := d.unpack()\n\treturn InstanceName{\n\t\tvalue: d.value[sizeBytesEnd+1:],\n\t}\n}", "func (bi *BaseInstance) Name() string {\n\treturn bi.name\n}", "func (bi *BaseInstance) Name() string {\n\treturn bi.name\n}", "func (o IndexingConfigurationThingIndexingConfigurationManagedFieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IndexingConfigurationThingIndexingConfigurationManagedField) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (inst *InstIntToPtr) GetName() string {\n\treturn inst.Name\n}", "func (e *Encoder) getFieldName(field reflect.StructField) string {\n\tif e.useTags {\n\t\tname := field.Tag.Get(e.tag)\n\t\t// skip columns tagged with -\n\t\tif name == \"-\" {\n\t\t\treturn \"\"\n\t\t}\n\t\tif name != \"\" {\n\t\t\treturn name\n\t\t}\n\t}\n\treturn field.Name\n\n}", "func name(v reflect.StructField) string {\n\tif name, ok := v.Tag.Lookup(\"name\"); ok {\n\t\treturn name\n\t}\n\treturn v.Name\n}", "func (o IndexingConfigurationThingGroupIndexingConfigurationManagedFieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IndexingConfigurationThingGroupIndexingConfigurationManagedField) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (s *StructField) Name() string {\n\treturn s.name\n}", "func (instance *cache) GetName() string {\n\treturn instance.name.Load().(string)\n}", "func (o IndexingConfigurationThingGroupIndexingConfigurationCustomFieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IndexingConfigurationThingGroupIndexingConfigurationCustomField) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (t *SentryTaggedStruct) GetName() string {\n\treturn \"\"\n}", "func (o IndexingConfigurationThingIndexingConfigurationCustomFieldOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IndexingConfigurationThingIndexingConfigurationCustomField) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (f *DialectMessageField) GetName() string {\n\treturn f.name\n}", "func NewStandInstDbName(val string) StandInstDbNameField {\n\treturn StandInstDbNameField{quickfix.FIXString(val)}\n}", "func ExtractFieldName(field *ast.Field) string {\r\n\tif field != nil && len(field.Names) > 0 {\r\n\t\treturn field.Names[0].Name\r\n\t}\r\n\r\n\treturn \"\"\r\n}", "func (o *FormField) 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 (c FieldsCollection) Name() *models.Field {\n\treturn c.MustGet(\"Name\")\n}", "func (e InstanceValidationError) Field() string { return e.field }", "func getFieldName(f reflect.StructField) string {\n\tn := f.Name\n\ttag, found := f.Tag.Lookup(\"json\")\n\tif found {\n\t\t// If we have a json field, and the first part of it before the\n\t\t// first comma is non-empty, that's our field name.\n\t\tparts := strings.Split(tag, \",\")\n\t\tif parts[0] != \"\" {\n\t\t\tn = parts[0]\n\t\t}\n\t}\n\treturn n\n}", "func (e *Entry) GetName() string {\n\tif len(e.NameRaw) > 0 {\n\t\treturn string(e.NameRaw)\n\t}\n\treturn e.Name\n}", "func (o InstanceOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (o InstanceOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (o InstanceOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (e GetInstanceRequestValidationError) Field() string { return e.field }", "func (inst *InstAddrSpaceCast) GetName() string {\n\treturn inst.Name\n}", "func (e IdentifierValidationError) Field() string { return e.field }", "func (o *AddOn) GetName() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&2048 != 0\n\tif ok {\n\t\tvalue = o.name\n\t}\n\treturn\n}", "func (o InstanceFromTemplateOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *InstanceFromTemplate) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (p Packet) Name() (name string) {\n\t// todo: think of ways to make this not a compiled in hack\n\t// todo: collectd 4 uses different patterns for some plugins\n\t// https://collectd.org/wiki/index.php/V4_to_v5_migration_guide\n\tswitch p.Plugin {\n\tcase \"df\":\n\t\tname = fmt.Sprintf(\"df_%s_%s\", p.PluginInstance, p.TypeInstance)\n\tcase \"interface\":\n\t\tname = fmt.Sprintf(\"%s_%s\", p.Type, p.PluginInstance)\n\tcase \"load\":\n\t\tname = \"load\"\n\tcase \"memory\":\n\t\tname = fmt.Sprintf(\"memory_%s\", p.TypeInstance)\n\tdefault:\n\t\tname = fmt.Sprintf(\"%s_%s_%s_%s\", p.Plugin, p.PluginInstance, p.Type, p.TypeInstance)\n\t}\n\treturn name\n}", "func (o *CreateInstance) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func (x ApmDatabaseInstanceEntity) GetName() string {\n\treturn x.Name\n}", "func getNameFromTag(f reflect.StructField, tagName string) string {\n\ttag, _ := parseTag(f, tagName)\n\tif tag != \"\" {\n\t\treturn tag\n\t}\n\treturn f.Name\n}", "func targetFieldName(s *types.Struct, i int) string {\n\ttag := reflect.StructTag(s.Tag(i)).Get(\"rgo\")\n\tif tag != \"\" {\n\t\treturn tag\n\t}\n\treturn s.Field(i).Name()\n}", "func (o SecondaryIndexOutput) InstanceName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SecondaryIndex) pulumi.StringOutput { return v.InstanceName }).(pulumi.StringOutput)\n}", "func (o LookupInstanceAttachmentResultOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceAttachmentResult) string { return v.Name }).(pulumi.StringOutput)\n}", "func (ipr *Ipref) Name() string { return \"ipref\" }", "func (e *EntryBase) Name() string {\n\treturn e.name()\n}", "func (m *ParentLabelDetails) GetName()(*string) {\n val, err := m.GetBackingStore().Get(\"name\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (m *LabelActionBase) GetName()(*string) {\n val, err := m.GetBackingStore().Get(\"name\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (o *GridViewUpdate) GetName() string {\n\tif o == nil || IsNil(o.Name) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Name\n}", "func (b *Base) getName() string {\n\treturn b.name\n}", "func (f BooleanField) GetName() string {\n\treturn f.name\n}", "func (d *Document) Name() string {\n\treturn fmt.Sprintf(\"%s-%s\", d.AccountId, d.InstanceId)\n}", "func (o *CloudInstanceTypeAllOf) 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 (o InstanceOutput) ImageName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.ImageName }).(pulumi.StringOutput)\n}", "func getInstanceName() string {\n\tif *baseapp.Local {\n\t\tu, err := user.Current()\n\t\tif err != nil {\n\t\t\treturn \"localhost\"\n\t\t}\n\t\treturn u.Username\n\t}\n\treturn viper.GetString(\"firestore.instance\")\n}", "func (o TableOutput) InstanceName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Table) pulumi.StringOutput { return v.InstanceName }).(pulumi.StringOutput)\n}", "func (e *Exec) GetNameID() string { return e.nameID }", "func (t *Type) GetName() string { return t.Name }", "func (bd *BlockDAG) GetName() string {\n\treturn bd.instance.GetName()\n}", "func (e GetInstanceResponseValidationError) Field() string { return e.field }", "func (o *OutputField) GetFieldName() string {\n\tif o == nil || IsNil(o.FieldName) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.FieldName\n}", "func (_DelegateProfile *DelegateProfileCallerSession) GetFieldByName(_name string) (struct {\n\tVerifier common.Address\n\tDeprecated bool\n}, error) {\n\treturn _DelegateProfile.Contract.GetFieldByName(&_DelegateProfile.CallOpts, _name)\n}", "func (s *MyTestStruct) Name() string {\n\treturn s.field_Name\n}", "func (r *PackageAggRow) GetName() string { return *r.Data.Name }", "func (ilp *IlpFormatter) Name() string {\n\treturn ilp.name\n}", "func (m *ManagementTemplateStep) GetDisplayName()(*string) {\n val, err := m.GetBackingStore().Get(\"displayName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func getColumnName(sf reflect.StructField, tag reflect.StructTag) string {\n\tdbTag := tag.Get(\"db\")\n\tif dbTag == \"\" {\n\t\treturn strings.ToLower(sf.Name)\n\t}\n\treturn dbTag\n}", "func (_DelegateProfile *DelegateProfileSession) GetFieldByName(_name string) (struct {\n\tVerifier common.Address\n\tDeprecated bool\n}, error) {\n\treturn _DelegateProfile.Contract.GetFieldByName(&_DelegateProfile.CallOpts, _name)\n}", "func (o *SyntheticMonitorUpdate) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func getNameFromTag(field reflect.StructField) tagInfo {\n\tfieldName, tags := ParseTag(field.Tag.Get(\"provider\"))\n\tif fieldName == \"\" {\n\t\trawFieldName, _ := ParseTag(field.Tag.Get(\"json\"))\n\t\tfieldName = ToSnakeCase(rawFieldName)\n\t}\n\tif fieldName == \"\" {\n\t\tfieldName = field.Name\n\t}\n\treturn tagInfo{\n\t\tname: fieldName,\n\t\tisId: tags.Contains(\"id\"),\n\t\tflatten: tags.Contains(\"flatten\"),\n\t\tignore: tags.Contains(\"ignore\"),\n\t}\n}", "func (m *NOCWidget) Name() *string {\n\treturn m.nameField\n}", "func (_DelegateProfile *DelegateProfileCaller) GetFieldByName(opts *bind.CallOpts, _name string) (struct {\n\tVerifier common.Address\n\tDeprecated bool\n}, error) {\n\tret := new(struct {\n\t\tVerifier common.Address\n\t\tDeprecated bool\n\t})\n\tout := ret\n\terr := _DelegateProfile.contract.Call(opts, out, \"getFieldByName\", _name)\n\treturn *ret, err\n}", "func (*unifinames) Name() string { return \"unifi-names\" }", "func (ev *PodCustomIfUpdate) GetName() string {\n\treturn \"Pod Custom Interfaces Update\"\n}", "func (ifce *Interface) Name() string {\n\treturn ifce.name\n}", "func (ifce *Interface) Name() string {\n\treturn ifce.name\n}", "func (o *StorageSasExpander) 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 fieldFlagName(fieldName string) (ret string) {\n\t// defer func() { log.Println(fieldName, ret) }()\n\t// TCP\n\tif ss := regexp.MustCompile(\"^[[:upper:]]{2,}$\").FindStringSubmatch(fieldName); ss != nil {\n\t\treturn strings.ToLower(ss[0])\n\t}\n\t// TCPAddr\n\tif ss := regexp.MustCompile(\"^([[:upper:]]+)([[:upper:]][^[:upper:]].*?)$\").FindStringSubmatch(fieldName); ss != nil {\n\t\treturn strings.ToLower(ss[1]) + ss[2]\n\t}\n\t// Addr\n\tif ss := regexp.MustCompile(\"^([[:upper:]])(.*)$\").FindStringSubmatch(fieldName); ss != nil {\n\t\treturn strings.ToLower(ss[1]) + ss[2]\n\t}\n\tpanic(fieldName)\n}", "func (e ErrorValidation) FieldName() string {\n\treturn e.fieldName\n}", "func (o *LogsPipelineProcessor) 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 (o *LocalDatabaseProvider) GetName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Name\n}", "func (o GetInstancesFilterOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetInstancesFilter) string { return v.Name }).(pulumi.StringOutput)\n}" ]
[ "0.683984", "0.66691345", "0.66529775", "0.6619471", "0.65891474", "0.6570262", "0.6415572", "0.63976705", "0.6358292", "0.6319564", "0.62703145", "0.62133884", "0.62109816", "0.61973596", "0.6195115", "0.6148975", "0.61299187", "0.6109643", "0.61041665", "0.60617775", "0.6018982", "0.59937555", "0.59935814", "0.59827095", "0.59723085", "0.59707934", "0.59695727", "0.59687644", "0.59687644", "0.59441936", "0.5940104", "0.59328896", "0.59224564", "0.58363706", "0.58163613", "0.5808076", "0.5760111", "0.57541966", "0.5750456", "0.57425797", "0.57425225", "0.57354414", "0.5680218", "0.56656826", "0.56572634", "0.5646315", "0.5628965", "0.56108683", "0.56108683", "0.56108683", "0.5607623", "0.5606371", "0.56015027", "0.55956566", "0.55936503", "0.5581631", "0.55735517", "0.55642295", "0.55596703", "0.5547216", "0.55371624", "0.553676", "0.5531274", "0.553121", "0.55303615", "0.55247265", "0.5517936", "0.55173707", "0.55155325", "0.550068", "0.5489093", "0.54767245", "0.5475098", "0.5470822", "0.5470631", "0.5465772", "0.5449414", "0.544321", "0.5443135", "0.543099", "0.5430459", "0.54296404", "0.542887", "0.542482", "0.5421382", "0.54063714", "0.5405876", "0.540541", "0.5403107", "0.5401463", "0.53956735", "0.5393307", "0.5386469", "0.5386469", "0.5385518", "0.538511", "0.5382951", "0.5375121", "0.5371692", "0.536042" ]
0.81934553
0
GetInstIDField get primary key of object's collection/table
GetInstIDField получает первичный ключ коллекции/таблицы объекта
func GetInstIDField(objType string) string { switch objType { case BKInnerObjIDApp: return BKAppIDField case BKInnerObjIDSet: return BKSetIDField case BKInnerObjIDModule: return BKModuleIDField case BKInnerObjIDObject: return BKInstIDField case BKInnerObjIDHost: return BKHostIDField case BKInnerObjIDProc: return BKProcIDField case BKInnerObjIDPlat: return BKCloudIDField case BKTableNameInstAsst: return BKFieldID case BKTableNameServiceInstance: return BKFieldID case BKTableNameServiceTemplate: return BKFieldID case BKTableNameProcessTemplate: return BKFieldID case BKTableNameProcessInstanceRelation: return BKProcessIDField default: if IsObjectInstAsstShardingTable(objType) { return BKFieldID } return BKInstIDField } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getPrimaryKeyField(data []models.Create) (models.TableField, string, error) {\n\tfor _, d := range data {\n\t\tfor _, f := range d.TableFields {\n\t\t\tif f.Tags.PrimaryKey {\n\t\t\t\treturn f, d.TableName, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn models.TableField{}, \"\", errors.New(\"unable to find primary key\")\n}", "func hostGetObjectId(objId int32, keyId int32, typeId int32) int32", "func (p *Pet) GetPrimaryKeyAddress() interface{} {\n\treturn &p.ID\n}", "func (user *User) PrimaryKey() uint64 {\n return user.ID\n}", "func (t *Commit) PrimaryKey() interface{} {\n\treturn t.ID\n}", "func (c *DefaultConstr) GetPrimaryKey(conn *sql.DB, schema string, tableName string) ([]string, error) {\n\treturn nil, ErrorNotSupport\n}", "func (qp *QueryParser) getPrimayKey(data interface{}) string {\n\treturn \"ID\"\n}", "func (k *Key) IntID() int64 { return k.toks[len(k.toks)-1].IntID }", "func (t *badgerTableVersion) getObjKey(id, objID []byte) []byte {\n\tprefix := []byte(t.prefix + \"object/\")\n\tprefix = append(prefix, id...)\n\tprefix = append(prefix, '/')\n\n\treturn append(prefix, objID...)\n}", "func (fieldType *AdaReferentialType) PrimaryKeyName() string {\n\tif fieldType.keys[0] == \"\" {\n\t\treturn \"ISN\"\n\t}\n\treturn fieldType.keys[0]\n}", "func GetPrimaryKeyOfTable(dbConn *sql.DB, table string) (string, error) {\n\tquery := fmt.Sprintf(\"SELECT c.column_name FROM information_schema.key_column_usage AS c LEFT JOIN information_schema.table_constraints AS t ON t.constraint_name = c.constraint_name WHERE t.table_name = '%s' AND t.constraint_type = 'PRIMARY KEY';\", table)\n\tprimaryKey := GetAllColsOfRows(dbConn, query)\n\n\tif len(primaryKey) == 0 {\n\t\treturn \"\", fmt.Errorf(\"Get Primary Key Error: No Primary Key Found For Table %s\", table)\n\t}\n\n\tif pk, ok := primaryKey[0][\"column_name\"]; ok {\n\t\treturn pk, nil\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"Get Primary Key Error: No Primary Key Found For Table %s\", table)\n\t}\n}", "func (m *Model) GetPK() string {\n\treturn m.PrimaryKey\n}", "func (p *CockroachDriver) PrimaryKeyInfo(schema, tableName string) (*bdb.PrimaryKey, error) {\n\tPrintName(\"PrimaryKeyInfo\")\n\tpkey := &bdb.PrimaryKey{}\n\tvar err error\n\n\tquery := `\n\tselect tc.constraint_name\n\tfrom ` + schema + `.rveg_primary_keys as tc\n\twhere tc.table_name = $1 and tc.table_schema = $2\n\t;\n\t`\n\n\trow := p.dbConn.QueryRow(query, tableName, schema)\n\n\tif err = row.Scan(&pkey.Name); err != nil {\n\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tqueryColumns := `\n\tselect kcu.column_name\n\tfrom information_schema.key_column_usage as kcu\n\twhere constraint_name = $1\n\t\tand table_schema = $2\n\tlimit 1\n\t;`\n\n\tvar rows *sql.Rows\n\tif rows, err = p.dbConn.Query(queryColumns, pkey.Name, schema); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tvar col = \"\"\n\tvar columns []string\n\tvar xC = 0\n\n\tfor rows.Next() {\n\t\tvar column string\n\n\t\terr = rows.Scan(&column)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif col == \"\" {\n\t\t\tcol = column\n\t\t}\n\t\tif column == \"id\" {\n\t\t\txC++\n\t\t}\n\t\tif column != col {\n\t\t\tif xC > 0 {\n\t\t\t\tcolumns = append(columns, column)\n\t\t\t}\n\t\t}\n\t\tcol = column\n\t}\n\tcolumns = append(columns, col)\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpkey.Columns = columns\n\n\treturn pkey, nil\n}", "func (d Document) PrimaryField() string {\n\tif fields := d.PrimaryFields(); len(fields) == 1 {\n\t\treturn fields[0]\n\t}\n\n\tpanic(\"rel: composite primary key is not supported\")\n}", "func (x UserGroup) PrimaryKey() string {\n\treturn \"id\"\n}", "func (dd *DatabaseDiff) ObjectKey() ObjectKey {\n\tif dd == nil || (dd.From == nil && dd.To == nil) {\n\t\treturn ObjectKey{}\n\t}\n\tif dd.From == nil {\n\t\treturn dd.To.ObjectKey()\n\t}\n\treturn dd.From.ObjectKey()\n}", "func (self *Devices) GetPrimaryKeyValue() int64 {\n return self.Id\n}", "func getRefModelPk(field modelField) *int64 {\n\tif field.value.IsNil() {\n\t\treturn nil\n\t}\n\tmi, err := getModelInfo(field.value.Interface())\n\tif err != nil {\n\t\treturn nil\n\t}\n\tfor _, field := range mi.fields {\n\t\tif isPkField(field) {\n\t\t\tif !isZeroField(field.value) {\n\t\t\t\tif field.value.Kind() == reflect.Int64 {\n\t\t\t\t\treturn field.value.Addr().Interface().(*int64)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (m *TestModel) PrimaryKey() string {\n\treturn m.ID\n}", "func (o baseObject) ObjectID() int64 {\n\treturn o.ID\n}", "func (c *Category) PrimaryKey() string {\n\treturn \"id\"\n}", "func (stmt *Statement) ObjectKey() ObjectKey {\n\treturn ObjectKey{\n\t\tType: stmt.ObjectType,\n\t\tName: stmt.ObjectName,\n\t}\n}", "func (c CommitterProbe) GetPrimaryKey() []byte {\n\treturn c.primaryKey\n}", "func (o *VolumeAttributesType) KeyId() string {\n\tr := *o.KeyIdPtr\n\treturn r\n}", "func PrimaryKey(sqlTable SQLTableStruct) string {\n\treturn fmt.Sprintf(\"%s%s\", sqlTable.Name, sqlIDSuffix)\n}", "func (c *collection) primaryKey(a *driver.Action) [2]interface{} {\n\tvar keys [2]interface{}\n\tvar err error\n\tkeys[0], err = a.Doc.GetField(c.partitionKey)\n\tif err != nil {\n\t\treturn keys\n\t}\n\tif c.sortKey != \"\" {\n\t\tkeys[1], _ = a.Doc.GetField(c.sortKey) // ignore error since keys[1] would be nil in that case\n\t}\n\treturn keys\n}", "func (obj *SObject) ExternalIDFieldName() string {\n\treturn obj.StringField(sobjectExternalIDFieldNameKey)\n}", "func IsPrimaryKey(sqlTable SQLTableStruct, sqlField SQLFieldStruct) bool {\n\treturn strings.EqualFold(fmt.Sprintf(\"%s%s\", sqlTable.Name, sqlIDSuffix), sqlField.Field)\n}", "func (t *ACLRole) PrimaryKey() interface{} {\n\treturn t.ID\n}", "func (objectIDs *DbObjectIDs) GetObjectID(key ExternalIDKey) string {\n\treturn objectIDs.objectIDs[key]\n}", "func (s Strategy) GetIDField(coralName string) string {\n\treturn s.Map.Entities[coralName].ID\n}", "func (i *IPPeerMatcher) PrimaryKey() string {\n\tblock := i.IPBlock\n\tvar except []string\n\tfor _, e := range block.Except {\n\t\texcept = append(except, e)\n\t}\n\tsort.Slice(except, func(i, j int) bool {\n\t\treturn except[i] < except[j]\n\t})\n\treturn fmt.Sprintf(\"%s: [%s]\", block.CIDR, strings.Join(except, \", \"))\n}", "func (u *User) GetPrimaryKeyAddress() interface{} {\n\treturn &u.ID\n}", "func (tbl RecordTable) PkColumn() string {\n\treturn tbl.pk\n}", "func (o ElemU) Id() int { return o.Cid }", "func (o ServiceTenantAccessPtrOutput) PrimaryKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ServiceTenantAccess) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PrimaryKey\n\t}).(pulumi.StringPtrOutput)\n}", "func PKOfDoc(doc map[string]interface{}, panicOnErr bool) uint64 {\n\tdocPK, ok := doc[PK_NAME].(string)\n\tif !ok {\n\t\tif panicOnErr {\n\t\t\tpanic(fmt.Sprintf(\"Doc %v does not have a valid PK\", doc))\n\t\t}\n\t\treturn 18446744073709551615\n\t}\n\tstrint, err := strconv.ParseUint(docPK, 10, 64)\n\tif err != nil {\n\t\tif panicOnErr {\n\t\t\tpanic(fmt.Sprintf(\"Doc %v does not have a valid PK\", doc))\n\t\t}\n\t\treturn 18446744073709551615\n\t}\n\treturn strint\n}", "func (p *Pet) GetPrimaryKeyStringValue() (string, error) {\n\treturn strconv.FormatInt(int64(p.ID), 10), nil\n}", "func (i *CollectionIterator) GetID() string {\n\tdbKey := i.getDBKey()\n\tif dbKey == nil {\n\t\treturn \"\"\n\t}\n\n\tcleanDBKey := dbKey[len(i.colPrefix):]\n\treturn string(cleanDBKey)\n}", "func (o ServiceTenantAccessOutput) PrimaryKey() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceTenantAccess) *string { return v.PrimaryKey }).(pulumi.StringPtrOutput)\n}", "func (n *Network) PrimaryKeyFields() []string {\n\treturn []string{\"id\"}\n}", "func (s *Sizing) PrimaryKeyFields() []string {\n\treturn []string{\"id\"}\n}", "func (obj *SObject) ID() string {\n\treturn obj.StringField(sobjectIDKey)\n}", "func (t *Table) GetPrimaryKey() []string {\n\treturn t.Indexs[\"PRIMARY\"].Cols\n}", "func (iter *radixIterator) Key() []byte {\n\tif iter.cursorKey != nil {\n\t\treturn iter.cursorKey\n\t}\n\tdbk, _, _ := memdb.KVFromObject(iter.cursor)\n\treturn dbk\n}", "func (c FieldsCollection) ID() *models.Field {\n\treturn c.MustGet(\"ID\")\n}", "func (p *Pet) GetPrimaryKeyHashableValue() interface{} {\n\treturn p.ID\n}", "func (self *Store) NextPk() []byte {\n\tself.mu.Lock()\n\tself.mu.Unlock()\n\treturn nil\n}", "func (p ObjectID) ID() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\",\n\t\tp.SpaceType(),\n\t\tp.ObjectType(),\n\t\tp.Instance(),\n\t)\n}", "func (vt *perfSchemaTable) GetPhysicalID() int64 {\n\treturn vt.meta.ID\n}", "func (k Key) ID() string {\n\treturn k.trimWildcard().trimPrefix().String()\n}", "func hostGetKeyId(key *byte, size int32) int32", "func getObjIDByTblName(tblName string) (ObjID, error) {\n\tvar err error\n\tvar taiObj ObjID\n\n\tswitch tblName {\n\tcase vtepdb.BridgeDomain:\n\t\ttaiObj = ObjectIDBridge\n\tcase vtepdb.Vrf:\n\t\ttaiObj = ObjectIDVrf\n\tcase vtepdb.L2port:\n\t\ttaiObj = ObjectIDL2Port\n\tcase vtepdb.L3port:\n\t\ttaiObj = ObjectIDL3Port\n\tcase vtepdb.Locator:\n\t\ttaiObj = ObjectIDTunnel\n\tcase vtepdb.RemoteFdb:\n\t\ttaiObj = ObjectIDFDB\n\tcase vtepdb.Route:\n\t\ttaiObj = ObjectIDRoute\n\tcase vtepdb.RemoteNeigh:\n\t\ttaiObj = ObjectIDNeighbour\n\tcase vtepdb.McastMacsLocal:\n\t\ttaiObj = ObjectIDMcastFDB\n\tcase vtepdb.ACL:\n\t\ttaiObj = ObjectIDACL\n\tcase vtepdb.ACLRule:\n\t\ttaiObj = ObjectIDACLRule\n\tcase vtepdb.PolicyBasedRoute:\n\t\ttaiObj = ObjectIDPBR\n\tcase vtepdb.AutoGatewayConf:\n\t\ttaiObj = ObjectIDAutoGatewayConf\n\tdefault:\n\t\treturn taiObj, errors.New(\"undefined tai object\")\n\t}\n\n\treturn taiObj, err\n}", "func stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*nodeidentity.Info).InstanceID\n\treturn key, nil\n}", "func primaryIdentity(e *openpgp.Entity) *openpgp.Identity {\n\tvar firstIdentity *openpgp.Identity\n\tfor _, ident := range e.Identities {\n\t\tif firstIdentity == nil {\n\t\t\tfirstIdentity = ident\n\t\t}\n\t\tif ident.SelfSignature.IsPrimaryId != nil && *ident.SelfSignature.IsPrimaryId {\n\t\t\treturn ident\n\t\t}\n\t}\n\treturn firstIdentity\n}", "func primaryIdentity(e *openpgp.Entity) *openpgp.Identity {\n\tvar firstIdentity *openpgp.Identity\n\tfor _, ident := range e.Identities {\n\t\tif firstIdentity == nil {\n\t\t\tfirstIdentity = ident\n\t\t}\n\t\tif ident.SelfSignature.IsPrimaryId != nil && *ident.SelfSignature.IsPrimaryId {\n\t\t\treturn ident\n\t\t}\n\t}\n\treturn firstIdentity\n}", "func (p *Partitions) Key(record Record) string {\n\treturn record.Index(p.Strategy.Partition.Columns)\n}", "func (t *Commit) PrimaryKeyColumn() string {\n\treturn CommitColumnID\n}", "func (pk PublicKey) ID() string {\n\treturn stringEntry(pk[IDProperty])\n}", "func getAutoRecordID(d types.Datum, target *types.FieldType) int64 {\n\tswitch target.Tp {\n\tcase mysql.TypeFloat, mysql.TypeDouble:\n\t\treturn int64(math.Round(d.GetFloat64()))\n\tcase mysql.TypeTiny, mysql.TypeShort, mysql.TypeInt24, mysql.TypeLong, mysql.TypeLonglong:\n\t\treturn d.GetInt64()\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported auto-increment field type '%d'\", target.Tp))\n\t}\n}", "func (c *Container) Key() string {\n\tc.Lock()\n\tdefer c.Unlock()\n\treturn c.ID\n}", "func (obj *SObject) ExternalID() string {\n\treturn obj.StringField(obj.ExternalIDFieldName())\n}", "func (o GetServiceTenantAccessOutput) PrimaryKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetServiceTenantAccess) string { return v.PrimaryKey }).(pulumi.StringOutput)\n}", "func VirtualGetObjectIDAsHexString(fieldName string) func(doc bson.M) (interface{}, error) {\n\treturn func(doc bson.M) (interface{}, error) {\n\t\tif fieldName == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"no field name specified\")\n\t\t}\n\t\tv, ok := doc[fieldName]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"field %q not found\", fieldName)\n\t\t} else if v == nil {\n\t\t\treturn nil, fmt.Errorf(\"field %q not set\", fieldName)\n\t\t}\n\n\t\t// if its an object id convert to hex\n\t\tif IsObjectID(v) {\n\t\t\toid := v.(primitive.ObjectID)\n\t\t\treturn oid.Hex(), nil\n\t\t}\n\n\t\t// otherwise just try to return the string\n\t\treturn fmt.Sprintf(\"%v\", v), nil\n\t}\n}", "func rowToKey(rowID uint64) (key uint64) {\n\treturn rowID * (ShardWidth / containerWidth)\n}", "func (p *Pet) GetPrimaryKeyZeroValue() interface{} {\n\treturn 0\n}", "func (c *JobSales) Table_PrimaryKey() query.Column {\n\treturn \"JobSalesID\"\n}", "func (o ReplicaExternalKeyOutput) KeyId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ReplicaExternalKey) pulumi.StringOutput { return v.KeyId }).(pulumi.StringOutput)\n}", "func (r ManagedResource) id() ReferenceID { return r.ID }", "func (tbl AssociationTable) PkColumn() string {\n\treturn tbl.pk\n}", "func (r *ProductRow) GetID() int32 { return *r.Data.ID }", "func (di *Iterator) Key() []byte {\n\tkey := di.iter.Key()\n\treturn key[len(types.ExtUtxoTablePrefix):]\n}", "func (x *User) PrimaryKey() string {\n\treturn x.PrimaryKeyName\n}", "func (bc *TranslatableBusinessCase) ObjectID() string {\n\treturn bc.ID.String()\n}", "func (c ValueColumn) PrimaryKey() ValueColumn {\n\tc.ctype = c.ctype + \" PRIMARY KEY \"\n\treturn c\n}", "func (t *Table) ID() uint64 { return t.id }", "func (p *Pet) GetPrimaryKeyValue() interface{} {\n\treturn p.ID\n}", "func (f *Fixture) ObjectKey(o client.Object) client.ObjectKey {\n\tk := client.ObjectKeyFromObject(o)\n\treturn k\n}", "func (bdm MySQLDBManager) ExecuteSQLPrimaryKey(table string) (column string, err error) {\n\trow, err := bdm.ExecuteSQLSelectRow(\"SHOW KEYS FROM \" + table + \" WHERE Key_name = 'PRIMARY'\")\n\n\tif err != nil {\n\t\treturn\n\t}\n\tcolumn = row[\"Column_name\"]\n\treturn\n}", "func (k *Key) StringID() string { return k.toks[len(k.toks)-1].StringID }", "func (m *DiscoveredSensitiveType) GetId()(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID) {\n val, err := m.GetBackingStore().Get(\"id\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)\n }\n return nil\n}", "func (t *ACLRole) PrimaryKeyColumn() string {\n\treturn ACLRoleColumnID\n}", "func _dbKeyForPKIDToProfileEntry(pkid *PKID) []byte {\n\tprefixCopy := append([]byte{}, _PrefixPKIDToProfileEntry...)\n\tkey := append(prefixCopy, pkid[:]...)\n\treturn key\n}", "func ObjectID(oid primitive.ObjectID) Val {\n\tv := Val{t: bsontype.ObjectID}\n\tcopy(v.bootstrap[0:12], oid[:])\n\treturn v\n}", "func (o SharedAccessPolicyOutput) PrimaryKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SharedAccessPolicy) pulumi.StringOutput { return v.PrimaryKey }).(pulumi.StringOutput)\n}", "func LegacyInstanceObjectID(obj *ResourceInstanceObjectSrc) string {\n\tif obj == nil {\n\t\treturn \"<not created>\"\n\t}\n\n\tif obj.AttrsJSON != nil {\n\t\ttype WithID struct {\n\t\t\tID string `json:\"id\"`\n\t\t}\n\t\tvar withID WithID\n\t\terr := json.Unmarshal(obj.AttrsJSON, &withID)\n\t\tif err == nil {\n\t\t\treturn withID.ID\n\t\t}\n\t} else if obj.AttrsFlat != nil {\n\t\tif flatID, exists := obj.AttrsFlat[\"id\"]; exists {\n\t\t\treturn flatID\n\t\t}\n\t}\n\n\t// For resource types created after we removed id as special there may\n\t// not actually be one at all. This is okay because older tests won't\n\t// encounter this, and new tests shouldn't be using ids.\n\treturn \"<none>\"\n}", "func (c *ReplicaSetClient) KeyOf(obj interface{}) string {\n\tkey, err := cache.MetaNamespaceKeyFunc(obj)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn key\n}", "func GetInstNameField(objID string) string {\n\tswitch objID {\n\tcase BKInnerObjIDApp:\n\t\treturn BKAppNameField\n\tcase BKInnerObjIDSet:\n\t\treturn BKSetNameField\n\tcase BKInnerObjIDModule:\n\t\treturn BKModuleNameField\n\tcase BKInnerObjIDObject:\n\t\treturn BKInstNameField\n\tcase BKInnerObjIDHost:\n\t\treturn BKHostNameField\n\tcase BKInnerObjIDProc:\n\t\treturn BKProcNameField\n\tcase BKInnerObjIDPlat:\n\t\treturn BKCloudNameField\n\tcase BKTableNameInstAsst:\n\t\treturn BKFieldID\n\tdefault:\n\t\tif IsObjectInstAsstShardingTable(objID) {\n\t\t\treturn BKFieldID\n\t\t}\n\t\treturn BKInstNameField\n\t}\n}", "func makeKey(objId string, sliceId uint32, id blizstorage.ChunkIdentity, field string) []byte {\r\n\r\n\tif bytes.Equal(id[:], sliceDBNilChunkId[:]) {\r\n\t\treturn []byte(field)\r\n\t}\r\n\r\n\t// blizstorage.ChunkIdentity2Int(id)\r\n\tpart := fmt.Sprintf(\"%s:%d:%s\", objId, sliceId, field)\r\n\r\n\treturn append(sliceDBItemPrefix, append(id[:], part...)...)\r\n}", "func (workItemType WorkItemType) GetID() string {\n return workItemType.ID.Hex()\n}", "func (m *PooledWrapper) KeyId(ctx context.Context) (string, error) {\n\treturn m.encryptor().KeyId(ctx)\n}", "func (o MongoDBDatabaseResourcePtrOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MongoDBDatabaseResource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Id\n\t}).(pulumi.StringPtrOutput)\n}", "func (event_EntityInfo) GetId(object interface{}) (uint64, error) {\n\treturn object.(*Event).Id, nil\n}", "func (objectIDs *DbObjectIDs) getUniqueID() (string, error) {\n\tid := objectIDs.ownerControllerName + \":\" + string(objectIDs.idsType.ownerObjectType)\n\tfor _, key := range objectIDs.idsType.GetExternalIDKeys() {\n\t\tvalue, ok := objectIDs.objectIDs[key]\n\t\tif !ok {\n\t\t\treturn \"\", fmt.Errorf(\"key %v is required but not present\", key)\n\t\t}\n\t\tid += \":\" + value\n\t}\n\treturn id, nil\n}", "func (c *Customer) PrimaryKeyFields() []string {\n\treturn []string{\"id\"}\n}", "func (p *PKCS11) GetKeyID() (err error) {\n findTemplate := []*pkcs11.Attribute{\n pkcs11.NewAttribute(pkcs11.CKA_ID, true), // KeyID\n pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),\n pkcs11.NewAttribute(pkcs11.CKA_PRIVATE, true),\n pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_RSA),\n }\n\n p.Ctx.FindObjectsInit(p.SessionHandle, findTemplate)\n obj, _, err := p.Ctx.FindObjects(p.SessionHandle, 1000)\n if err != nil {\n return\n }\n\n err = p.Ctx.FindObjectsFinal(p.SessionHandle)\n if err != nil {\n return\n }\n\n p.KeyID = map[int][]byte{}\n for num, objValue := range obj {\n attrs, _ := p.Ctx.GetAttributeValue(p.SessionHandle, objValue, findTemplate)\n p.KeyID[num] = attrs[0].Value\n }\n\n return\n}", "func (k *Key) GetID() int64 {\n\tif k == nil || k.ID == nil {\n\t\treturn 0\n\t}\n\treturn *k.ID\n}", "func (m *_KeyValuePair) GetIdentifier() string {\n\treturn \"14535\"\n}", "func (metas metadatas) getDocumentID(document interface{}) (id bson.ObjectId, err error) {\n\tValue := reflect.ValueOf(document)\n\tmeta, ok := metas[Value.Type()]\n\tif !ok {\n\t\treturn id, ErrDocumentNotRegistered\n\t}\n\tidFields, ok := meta.findIDField()\n\tif !ok {\n\t\treturn id, ErrIDFieldNotFound\n\t}\n\treturn Value.Elem().FieldByName(idFields.name).Interface().(bson.ObjectId), nil\n\n}", "func (g *GPGKey) GetPrimaryKeyID() int64 {\n\tif g == nil || g.PrimaryKeyID == nil {\n\t\treturn 0\n\t}\n\treturn *g.PrimaryKeyID\n}" ]
[ "0.64741033", "0.64149576", "0.6027425", "0.5938452", "0.59127915", "0.588824", "0.5860908", "0.5822916", "0.579606", "0.5791429", "0.5788975", "0.5778923", "0.57776135", "0.5776322", "0.5768322", "0.5766646", "0.5741552", "0.5735442", "0.57068944", "0.56671613", "0.5661163", "0.565714", "0.56407416", "0.56166434", "0.56107646", "0.5608271", "0.56031156", "0.55953604", "0.55609757", "0.55604595", "0.5537299", "0.5527534", "0.5507149", "0.5490425", "0.5486863", "0.54812336", "0.54580975", "0.5452261", "0.545211", "0.54518473", "0.5450067", "0.5442877", "0.5441242", "0.5418139", "0.5405292", "0.53885597", "0.5381753", "0.53785557", "0.5370921", "0.5347351", "0.5339408", "0.53321666", "0.53319126", "0.5323546", "0.53203", "0.53203", "0.5319048", "0.52986044", "0.5296176", "0.5295048", "0.52556086", "0.52541065", "0.5252688", "0.52526414", "0.525192", "0.5249666", "0.52482295", "0.52431464", "0.524036", "0.5238722", "0.52315646", "0.52210414", "0.5206039", "0.5203624", "0.5193732", "0.5191842", "0.5188962", "0.5187099", "0.5184496", "0.5183655", "0.5182287", "0.5181662", "0.5176934", "0.5175469", "0.51746184", "0.5165758", "0.51635355", "0.5159767", "0.51592463", "0.5157066", "0.5152833", "0.51385474", "0.51380825", "0.5134645", "0.5129174", "0.51154333", "0.5111809", "0.5106252", "0.50918317", "0.5087263" ]
0.71526545
0
IsInnerMainlineModel judge if the object type is inner mainline model
IsInnerMainlineModel определяет, является ли тип объекта внутренней моделью mainline
func IsInnerMainlineModel(objType string) bool { switch objType { case BKInnerObjIDApp, BKInnerObjIDSet, BKInnerObjIDModule: return true default: return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t Type) IsModel() bool {\n\t_, isModel := t.impl.(*modelImpl)\n\treturn isModel\n}", "func (ref *UIElement) IsMain() bool {\n\tret, _ := ref.BoolAttr(MainAttribute)\n\treturn ret\n}", "func (c Category) IsMainSet() bool {\n\treturn c.Main != 0\n}", "func (o *LinkRouteTable) GetMainOk() (*bool, bool) {\n\tif o == nil || o.Main == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Main, true\n}", "func (bd *BlockDAG) isOnMainChain(h *hash.Hash) bool {\n\treturn bd.instance.IsOnMainChain(bd.getBlock(h))\n}", "func (a Ad) IsInline() bool {\n\treturn a.InLine != nil\n}", "func (s *BasePlSqlParserListener) EnterMain_model(ctx *Main_modelContext) {}", "func (e *Ex) Inner() error {\n\treturn e.inner\n}", "func (e *Ex) Inner() error {\n\treturn e.inner\n}", "func (meta MVCCMetadata) IsInline() bool {\n\treturn meta.RawBytes != nil\n}", "func (o *LinkRouteTable) HasMain() bool {\n\tif o != nil && o.Main != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (t *Thread) IsMain() bool {\n\treturn t == t.mainThread\n}", "func isRoot(e *yang.Entry) bool {\n\treturn e.Parent == nil\n}", "func isNativeInline(o fyne.CanvasObject) bool {\n\tswitch o.(type) {\n\tcase *canvas.Image, *canvas.Text, *widget.Label:\n\t\treturn true\n\t}\n\treturn false\n}", "func (o *LinkRouteTable) GetMain() bool {\n\tif o == nil || o.Main == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.Main\n}", "func (o *ForecastModelAllOf) HasModelType() bool {\n\tif o != nil && o.ModelType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ConvergedinfraServerComplianceDetailsAllOf) HasModel() bool {\n\tif o != nil && o.Model != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (bd *BlockDAG) IsOnMainChain(h *hash.Hash) bool {\n\tbd.stateLock.Lock()\n\tdefer bd.stateLock.Unlock()\n\n\treturn bd.isOnMainChain(h)\n}", "func (me TxsdFeConvolveMatrixTypeEdgeMode) IsWrap() bool { return me.String() == \"wrap\" }", "func (obj *content) IsNormal() bool {\n\treturn obj.normal != nil\n}", "func InnerBoundaryIs(value Element) *CompoundElement { return newCEElement(\"innerBoundaryIs\", value) }", "func isMain(graph *graph.DependencyGraph, pkg string) bool {\n\tfor _, name := range graph.PackageNames[pkg] {\n\t\tif name == \"main\" {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (m *Maps) OuterWall(c types.Coordinate) bool {\n\tif m.CurrentLevel() == homeLevel {\n\t\treturn false\n\t}\n\n\treturn c.X == 0 || c.X == width-1 || c.Y == 0 || c.Y == height-1\n}", "func (f *Field) IsInlined() bool {\n\tjsonTag := reflect.StructTag(f.Tag.Value[1 : len(f.Tag.Value)-1]).Get(\"json\") // Delete first and last quotation\n\treturn strings.Contains(jsonTag, \"inline\")\n}", "func (me TxsdRecordPatternSimpleContentExtensionOffsetunit) IsLine() bool {\n\treturn me.String() == \"line\"\n}", "func (s *BasePlSqlParserListener) EnterMain_model_name(ctx *Main_model_nameContext) {}", "func (q *QuestionnaireT) LabelIsOutline(s string) bool {\n\treturn outlineNumbering1.MatchString(s) || outlineNumbering2.MatchString(s)\n}", "func (me TxsdPresentationAttributesGraphicsDisplay) IsInline() bool { return me.String() == \"inline\" }", "func (s *layoutStack) atTopLevel() bool {\n\treturn len(s.data) == 1\n}", "func (testEntityInline_EntityInfo) AddToModel(model *objectbox.Model) {\n\tmodel.Entity(\"TestEntityInline\", 4, 7566870022778519807)\n\tmodel.Property(\"Date\", objectbox.PropertyType_Date, 1, 6052475349651303914)\n\tmodel.Property(\"Value\", objectbox.PropertyType_Double, 2, 7019205901062172310)\n\tmodel.Property(\"Id\", objectbox.PropertyType_Long, 3, 5298431058949014957)\n\tmodel.PropertyFlags(objectbox.PropertyFlags_UNSIGNED | objectbox.PropertyFlags_ID)\n\tmodel.EntityLastPropertyId(3, 5298431058949014957)\n}", "func (m *Model) IsClassification() bool { return m.target.IsNominal() }", "func (i IntransitiveActivity) IsObject() bool {\n\treturn true\n}", "func nestedFlag(typ uint16) bool {\n\treturn typ&netlink.Nested != 0\n}", "func (sb *SweetieBot) IsMainGuild(info *GuildInfo) bool {\n\treturn sb.MainGuildID.Equals(info.ID)\n}", "func isEdge(e *spb.Entry) bool { return e.Target != nil && e.EdgeKind != \"\" }", "func IsInline(t NodeType) bool {\n\treturn t&(NodeText|NodeURL|NodeImage|NodeButton) != 0\n}", "func (f BodyField) isRoot() bool {\n\treturn len(f.Keys) == 0\n}", "func (u *RootInfo) IsRootInfo() {}", "func (Master) IsAnAPIObject() {}", "func (s *BasePlSqlParserListener) ExitMain_model(ctx *Main_modelContext) {}", "func isMainBranch(br string) bool {\n\treturn br == \"master\" || strings.HasPrefix(br, \"dev.\")\n}", "func OuterBoundaryIs(value Element) *CompoundElement { return newCEElement(\"outerBoundaryIs\", value) }", "func TopLevelResource(r *Resource) bool {\n\treturn len(r.OwnerRefs) == 0\n}", "func (me TxsdPresentationAttributesGraphicsDisplay) IsInlineTable() bool {\n\treturn me.String() == \"inline-table\"\n}", "func (o *StorageNetAppHighAvailability) HasPartnerModel() bool {\n\tif o != nil && o.PartnerModel != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ForecastModelAllOf) GetModelTypeOk() (*string, bool) {\n\tif o == nil || o.ModelType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ModelType, true\n}", "func (me *XsdGoPkgHasElem_InnerBoundaryIs) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElem_InnerBoundaryIs; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif err = me.InnerBoundaryIs.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\treturn\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func hasEmbeddedObjectRecursive(structTypeInfo *types.Struct) bool {\n\tfor i := 0; i < structTypeInfo.NumFields(); i++ {\n\t\tfield := structTypeInfo.Field(i)\n\t\tfieldTypeInfo, ok := field.Type().(*types.Named)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tstructTypeInfo, ok := fieldTypeInfo.Underlying().(*types.Struct)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\t// Search for embedded \"gml.Object\" field\n\t\tif field.Embedded() {\n\t\t\tif fieldTypeInfo.String() == objectPath {\n\t\t\t\treturn true\n\t\t\t} else if hasEmbeddedObjectRecursive(structTypeInfo) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func (o *StorageNetAppHighAvailability) GetPartnerModelOk() (*string, bool) {\n\tif o == nil || o.PartnerModel == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PartnerModel, true\n}", "func (obj *cardinality) IsSpecific() bool {\n\treturn obj.specific != nil\n}", "func (me TAttlistArticlePubModel) IsElectronicECollection() bool {\n\treturn me.String() == \"Electronic-eCollection\"\n}", "func (t Type) ModelImpl() interface{} {\n\tm, isModel := t.impl.(*modelImpl)\n\tif !isModel {\n\t\treturn nil\n\t}\n\treturn m.pubImpl\n}", "func (s *layoutStack) topInBaseTypeCollection() bool {\n\treturn s.top().inBaseTypeCollection\n}", "func Inner(a, b Tensor) (retVal Tensor, err error) {\n\tif a.Dtype() != b.Dtype() {\n\t\terr = errors.Errorf(dtypeMismatch, a.Dtype(), b.Dtype())\n\t\treturn\n\t}\n\n\tswitch at := a.(type) {\n\tcase *Dense:\n\t\tbt := b.(*Dense)\n\t\treturn at.Inner(bt)\n\t}\n\tpanic(\"Unreachable\")\n}", "func (obj *operation) IsArythmetic() bool {\n\treturn obj.ary != nil\n}", "func isRoot(entry *yang.Entry) bool {\n\tif entry.Annotation != nil {\n\t\tif v, ok := entry.Annotation[\"isFakeRoot\"]; ok {\n\t\t\treturn v == true\n\t\t}\n\t}\n\treturn false\n}", "func (t *Dense) Inner(other Tensor) (retVal interface{}, err error) {\n\t// check that the data is a float\n\tif err = typeclassCheck(t.t, floatcmplxTypes); err != nil {\n\t\treturn nil, errors.Wrapf(err, unsupportedDtype, t.t, \"Inner\")\n\t}\n\n\t// check both are vectors\n\tif !t.Shape().IsVector() || !other.Shape().IsVector() {\n\t\treturn nil, errors.Errorf(\"Inner only works when there are two vectors. t's Shape: %v; other's Shape %v\", t.Shape(), other.Shape())\n\t}\n\n\t// we do this check instead of the more common t.Shape()[1] != other.Shape()[0],\n\t// basically to ensure a similarity with numpy's dot and vectors.\n\tif t.len() != other.DataSize() {\n\t\treturn nil, errors.Errorf(shapeMismatch, t.Shape(), other.Shape())\n\t}\n\n\te := t.e\n\tswitch ip := e.(type) {\n\tcase InnerProderF32:\n\t\treturn ip.Inner(t, other)\n\tcase InnerProderF64:\n\t\treturn ip.Inner(t, other)\n\tcase InnerProder:\n\t\treturn ip.Inner(t, other)\n\t}\n\n\treturn nil, errors.Errorf(\"Engine does not support Inner()\")\n}", "func (decode *decoder) ensureOutInnerType(outInnerType reflect.Type) error {\n\tswitch outInnerType.Kind() {\n\tcase reflect.Struct:\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"cannot use \" + outInnerType.String() + \", only struct supported\")\n}", "func (o *NetworkElementSummaryAllOf) HasModel() bool {\n\tif o != nil && o.Model != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func CfnDetectorModel_IsConstruct(x interface{}) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_iotevents.CfnDetectorModel\",\n\t\t\"isConstruct\",\n\t\t[]interface{}{x},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func UnmarshalEntityOutlineInterface(b []byte) (*EntityOutlineInterface, error) {\n\tvar err error\n\n\tvar rawMessageEntityOutline map[string]*json.RawMessage\n\terr = json.Unmarshal(b, &rawMessageEntityOutline)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Nothing to unmarshal\n\tif len(rawMessageEntityOutline) < 1 {\n\t\treturn nil, nil\n\t}\n\n\tvar typeName string\n\n\tif rawTypeName, ok := rawMessageEntityOutline[\"__typename\"]; ok {\n\t\terr = json.Unmarshal(*rawTypeName, &typeName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tswitch typeName {\n\t\tcase \"ApmApplicationEntityOutline\":\n\t\t\tvar interfaceType ApmApplicationEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"ApmDatabaseInstanceEntityOutline\":\n\t\t\tvar interfaceType ApmDatabaseInstanceEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"ApmExternalServiceEntityOutline\":\n\t\t\tvar interfaceType ApmExternalServiceEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"BrowserApplicationEntityOutline\":\n\t\t\tvar interfaceType BrowserApplicationEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"DashboardEntityOutline\":\n\t\t\tvar interfaceType DashboardEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"ExternalEntityOutline\":\n\t\t\tvar interfaceType ExternalEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"GenericEntityOutline\":\n\t\t\tvar interfaceType GenericEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"GenericInfrastructureEntityOutline\":\n\t\t\tvar interfaceType GenericInfrastructureEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"InfrastructureAwsLambdaFunctionEntityOutline\":\n\t\t\tvar interfaceType InfrastructureAwsLambdaFunctionEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"InfrastructureHostEntityOutline\":\n\t\t\tvar interfaceType InfrastructureHostEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"MobileApplicationEntityOutline\":\n\t\t\tvar interfaceType MobileApplicationEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"SecureCredentialEntityOutline\":\n\t\t\tvar interfaceType SecureCredentialEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"SyntheticMonitorEntityOutline\":\n\t\t\tvar interfaceType SyntheticMonitorEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"ThirdPartyServiceEntityOutline\":\n\t\t\tvar interfaceType ThirdPartyServiceEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"UnavailableEntityOutline\":\n\t\t\tvar interfaceType UnavailableEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"WorkloadEntityOutline\":\n\t\t\tvar interfaceType WorkloadEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx EntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\t}\n\t} else {\n\t\tkeys := []string{}\n\t\tfor k := range rawMessageEntityOutline {\n\t\t\tkeys = append(keys, k)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"interface EntityOutline did not include a __typename field for inspection: %s\", keys)\n\t}\n\n\treturn nil, fmt.Errorf(\"interface EntityOutline was not matched against all PossibleTypes: %s\", typeName)\n}", "func (s *BasePlSqlParserListener) EnterModel_rules_part(ctx *Model_rules_partContext) {}", "func (m *AttachmentItem) GetIsInline()(*bool) {\n return m.isInline\n}", "func (m *Immutable) MainType() string {\n\treturn m.contained.MainType()\n}", "func (ref Ref) IsNested() bool {\n\tfor _, x := range ref {\n\t\tif _, ok := x.Value.(Ref); ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func MessageIsEndOfLine(vm *VM, target, locals Interface, msg *Message) Interface {\n\treturn vm.IoBool(target.(*Message).IsTerminator())\n}", "func (o *ConvergedinfraServerComplianceDetailsAllOf) GetModelOk() (*string, bool) {\n\tif o == nil || o.Model == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Model, true\n}", "func (me *XsdGoPkgHasElem_OuterBoundaryIs) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElem_OuterBoundaryIs; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif err = me.OuterBoundaryIs.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\treturn\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func validateModel(model interface{}) error {\n\tvar hasID bool = false\n\tmodelData := reflect.ValueOf(model).Elem()\n\tmodelType := modelData.Type()\n\n\tif modelData.Kind().String() != `struct` {\n\t\treturn NoStructError\n\t}\n\n\tfor i := 0; i < modelData.NumField(); i++ {\n\t\tif !modelData.Field(i).CanSet() {\n\t\t\treturn NonExportedAttrError\n\t\t}\n\n\t\tif modelType.Field(i).Tag.Get(`ohm`) == `id` {\n\t\t\thasID = true\n\n if modelType.Field(i).Type.Name() != `string` {\n return NonStringIDError\n }\n }\n\t}\n\n\tif !hasID {\n\t\treturn NoIDError\n\t}\n\n\treturn nil\n}", "func (b *baseVisitor) IsEnteringRoot() bool {\n\treturn b.depth == 1\n}", "func (o *EditorPlugin) HasMainScreen() gdnative.Bool {\n\t//log.Println(\"Calling EditorPlugin.HasMainScreen()\")\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(\"EditorPlugin\", \"has_main_screen\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func (l *line) isTopIndent() bool {\n\treturn l.indent == indentTop\n}", "func InnerType(typ Type) Type {\n\tswitch typ := AliasOf(typ).(type) {\n\tcase *TypeSet:\n\t\treturn typ.Type\n\tcase *TypeArray:\n\t\treturn typ.Type\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (s *Db) MovieIsEdgeCollection() bool {\n\treturn false\n}", "func isRecordIntraNode(record entities.Record) bool {\n\tif srcIEWithValue, exist := record.GetInfoElementWithValue(\"sourcePodName\"); exist && srcIEWithValue.Value != \"\" {\n\t\tif dstIEWithValue, exist := record.GetInfoElementWithValue(\"destinationPodName\"); exist && dstIEWithValue.Value != \"\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (l *line) childOf(parent element) (bool, error) {\n\tvar ok bool\n\tvar err error\n\n\tswitch {\n\tcase l.isEmpty():\n\t\tok = true\n\tcase parent.ContainPlainText():\n\t\tswitch {\n\t\tcase parent.Base().ln.indent < l.indent:\n\t\t\tok = true\n\t\t}\n\tdefault:\n\t\tswitch {\n\t\tcase l.indent == parent.Base().ln.indent+1:\n\t\t\tok = true\n\t\tcase l.indent > parent.Base().ln.indent+1:\n\t\t\terr = fmt.Errorf(\"the indent is invalid [file: %s][line: %d]\", l.fileName(), l.no)\n\t\t}\n\t}\n\n\treturn ok, err\n}", "func (o *LinkRouteTable) SetMain(v bool) {\n\to.Main = &v\n}", "func (me TAttlistArticlePubModel) IsElectronic() bool { return me.String() == \"Electronic\" }", "func (t *osCinderCSITranslator) CanSupportInline(volume *v1.Volume) bool {\n\treturn volume != nil && volume.Cinder != nil\n}", "func isTopLevelComponent(component string) bool {\n\tfor _, entry := range TopLevelEntryNames {\n\t\tif entry == component {\n\t\t\treturn true\n\t\t}\n\t\tif strings.HasPrefix(component, \"validator.\") {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (me TAttlistLocationLabelType) IsPart() bool { return me.String() == \"part\" }", "func (d *Departure)IsForeignLine()bool{\n\treturn d.ForeignLine==TRUE\n}", "func (vc *client) IsVC() bool {\n\treturn vc.client.IsVC()\n}", "func (te *TreeEntry) IsSubModule() bool {\n\treturn te.entryMode == EntryModeCommit\n}", "func (obj *errorStruct) HasParent() bool {\n\treturn obj.parent != nil\n}", "func (me TAttlistArticlePubModel) IsPrint() bool { return me.String() == \"Print\" }", "func (me *XsdGoPkgHasElems_InnerBoundaryIs) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElems_InnerBoundaryIs; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor _, x := range me.InnerBoundaryIses {\r\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func (n *Declarator) isExternInline() bool {\n\treturn n.IsExtern() && n.Type() != nil && n.Type().Inline()\n}", "func UnmarshalInfrastructureIntegrationEntityOutlineInterface(b []byte) (*InfrastructureIntegrationEntityOutlineInterface, error) {\n\tvar err error\n\n\tvar rawMessageInfrastructureIntegrationEntityOutline map[string]*json.RawMessage\n\terr = json.Unmarshal(b, &rawMessageInfrastructureIntegrationEntityOutline)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Nothing to unmarshal\n\tif len(rawMessageInfrastructureIntegrationEntityOutline) < 1 {\n\t\treturn nil, nil\n\t}\n\n\tvar typeName string\n\n\tif rawTypeName, ok := rawMessageInfrastructureIntegrationEntityOutline[\"__typename\"]; ok {\n\t\terr = json.Unmarshal(*rawTypeName, &typeName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tswitch typeName {\n\t\tcase \"GenericInfrastructureEntityOutline\":\n\t\t\tvar interfaceType GenericInfrastructureEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx InfrastructureIntegrationEntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\tcase \"InfrastructureAwsLambdaFunctionEntityOutline\":\n\t\t\tvar interfaceType InfrastructureAwsLambdaFunctionEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx InfrastructureIntegrationEntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\t}\n\t} else {\n\t\tkeys := []string{}\n\t\tfor k := range rawMessageInfrastructureIntegrationEntityOutline {\n\t\t\tkeys = append(keys, k)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"interface InfrastructureIntegrationEntityOutline did not include a __typename field for inspection: %s\", keys)\n\t}\n\n\treturn nil, fmt.Errorf(\"interface InfrastructureIntegrationEntityOutline was not matched against all PossibleTypes: %s\", typeName)\n}", "func (o *NewData) HasModel() bool {\n\tif o != nil && o.Model != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *EquipmentIdentityAllOf) HasModel() bool {\n\tif o != nil && o.Model != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (outer outer) Visible() bool {\r\n\treturn false\r\n}", "func (te *TreeEntry) IsSubModule() bool {\n\treturn te.gogitTreeEntry.Mode == filemode.Submodule\n}", "func (s *BaseDMLListener) EnterModelParts(ctx *ModelPartsContext) {}", "func (o *CanvasItem) IsSetAsToplevel() gdnative.Bool {\n\t//log.Println(\"Calling CanvasItem.IsSetAsToplevel()\")\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(\"CanvasItem\", \"is_set_as_toplevel\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func UnmarshalApmBrowserApplicationEntityOutlineInterface(b []byte) (*ApmBrowserApplicationEntityOutlineInterface, error) {\n\tvar err error\n\n\tvar rawMessageApmBrowserApplicationEntityOutline map[string]*json.RawMessage\n\terr = json.Unmarshal(b, &rawMessageApmBrowserApplicationEntityOutline)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Nothing to unmarshal\n\tif len(rawMessageApmBrowserApplicationEntityOutline) < 1 {\n\t\treturn nil, nil\n\t}\n\n\tvar typeName string\n\n\tif rawTypeName, ok := rawMessageApmBrowserApplicationEntityOutline[\"__typename\"]; ok {\n\t\terr = json.Unmarshal(*rawTypeName, &typeName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tswitch typeName {\n\t\tcase \"ApmApplicationEntityOutline\":\n\t\t\tvar interfaceType ApmApplicationEntityOutline\n\t\t\terr = json.Unmarshal(b, &interfaceType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tvar xxx ApmBrowserApplicationEntityOutlineInterface = &interfaceType\n\n\t\t\treturn &xxx, nil\n\t\t}\n\t} else {\n\t\tkeys := []string{}\n\t\tfor k := range rawMessageApmBrowserApplicationEntityOutline {\n\t\t\tkeys = append(keys, k)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"interface ApmBrowserApplicationEntityOutline did not include a __typename field for inspection: %s\", keys)\n\t}\n\n\treturn nil, fmt.Errorf(\"interface ApmBrowserApplicationEntityOutline was not matched against all PossibleTypes: %s\", typeName)\n}", "func isLteCrossStructField(fl FieldLevel) bool {\n\tfield := fl.Field()\n\tkind := field.Kind()\n\n\ttopField, topKind, ok := fl.GetStructFieldOK()\n\tif !ok || topKind != kind {\n\t\treturn false\n\t}\n\n\tswitch kind {\n\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn field.Int() <= topField.Int()\n\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn field.Uint() <= topField.Uint()\n\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn field.Float() <= topField.Float()\n\n\tcase reflect.Slice, reflect.Map, reflect.Array:\n\t\treturn int64(field.Len()) <= int64(topField.Len())\n\n\tcase reflect.Struct:\n\n\t\tfieldType := field.Type()\n\n\t\tif fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {\n\n\t\t\tfieldTime := field.Convert(timeType).Interface().(time.Time)\n\t\t\ttopTime := topField.Convert(timeType).Interface().(time.Time)\n\n\t\t\treturn fieldTime.Before(topTime) || fieldTime.Equal(topTime)\n\t\t}\n\n\t\t// Not Same underlying type i.e. struct and time\n\t\tif fieldType != topField.Type() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// default reflect.String:\n\treturn field.String() <= topField.String()\n}", "func (w *MainWindow) IsUppermostLayer(c ContextLayer) bool {\n\t//TODO find correct answer\n\treturn true\n}", "func CfnDetectorModel_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_iotevents.CfnDetectorModel\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (fps *ListMyProjectInvitationsResponse_FieldSubPath) IsLeaf() bool {\n\treturn fps.subPath.IsLeaf()\n}" ]
[ "0.5549369", "0.54470146", "0.5239084", "0.5052032", "0.5040084", "0.5008778", "0.49941906", "0.49561843", "0.49561843", "0.49077177", "0.4892996", "0.48708993", "0.486818", "0.4856625", "0.48033246", "0.4745723", "0.47209913", "0.470247", "0.46628037", "0.4641946", "0.4635977", "0.46328887", "0.4594992", "0.45929724", "0.4581602", "0.45780778", "0.4577763", "0.45679373", "0.4556133", "0.45426992", "0.45363638", "0.45245132", "0.45163992", "0.4508588", "0.45064694", "0.45037344", "0.44965073", "0.44861385", "0.448398", "0.44765842", "0.44569063", "0.444329", "0.4439958", "0.44399565", "0.4437262", "0.44367677", "0.44259545", "0.4425651", "0.442386", "0.44162932", "0.4406178", "0.44058338", "0.43934333", "0.4378613", "0.43699947", "0.4368994", "0.43533942", "0.4352676", "0.43526593", "0.43500596", "0.434095", "0.43180776", "0.43177673", "0.43177128", "0.43123478", "0.43112314", "0.43047276", "0.4303436", "0.430291", "0.42979455", "0.42862284", "0.4283375", "0.42723233", "0.42670655", "0.42514497", "0.424355", "0.42356908", "0.42347187", "0.42323288", "0.4225553", "0.4220811", "0.4219507", "0.4214851", "0.42128494", "0.42092475", "0.42074785", "0.42030543", "0.42014983", "0.4198064", "0.41911188", "0.41864908", "0.41861442", "0.41838372", "0.4171942", "0.41710356", "0.41676265", "0.41629016", "0.41613838", "0.41599205", "0.41594124" ]
0.89547443
0
NewNodeResourceTopologies makes a CRD golang object representing NodeResourceTopology definition
NewNodeResourceTopologies создает CRD объект golang, представляющий определение NodeResourceTopology
func NewNodeResourceTopologies() (*apiextensionsv1.CustomResourceDefinition, error) { _, file, _, ok := runtime.Caller(0) if !ok { return nil, fmt.Errorf("cannot retrieve manifests directory") } baseDir := filepath.Dir(file) crdPath := filepath.Clean(filepath.Join(baseDir, "..", "..", "..", "deployment", "base", "noderesourcetopologies-crd", "noderesourcetopologies.yaml")) data, err := os.ReadFile(crdPath) if err != nil { return nil, err } decode := scheme.Codecs.UniversalDeserializer().Decode obj, _, err := decode(data, nil, nil) if err != nil { return nil, err } crd, ok := obj.(*apiextensionsv1.CustomResourceDefinition) if !ok { return nil, fmt.Errorf("unexpected type, got %t", obj) } return crd, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateNodeResourceTopologies(ctx context.Context, extClient extclient.Interface) (*apiextensionsv1.CustomResourceDefinition, error) {\n\tcrd, err := NewNodeResourceTopologies()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Delete existing CRD (if any) with this we also get rid of stale objects\n\terr = extClient.ApiextensionsV1().CustomResourceDefinitions().Delete(ctx, crd.Name, metav1.DeleteOptions{})\n\tif err != nil && !errors.IsNotFound(err) {\n\t\treturn nil, fmt.Errorf(\"failed to delete NodeResourceTopology CRD: %w\", err)\n\t}\n\n\t// It takes time for the delete operation, wait until the CRD completely gone\n\tif err = wait.PollUntilContextTimeout(ctx, 5*time.Second, 1*time.Minute, true, func(ctx context.Context) (bool, error) {\n\t\t_, err = extClient.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, crd.Name, metav1.GetOptions{})\n\t\tif err == nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, err\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get NodeResourceTopology CRD: %w\", err)\n\t}\n\treturn extClient.ApiextensionsV1().CustomResourceDefinitions().Create(ctx, crd, metav1.CreateOptions{})\n}", "func Topology(node uint32) (*TopologyConn, error) {\n\tsa := &unix.TIPCServiceName{\n\t\tType: unix.TIPC_TOP_SRV,\n\t\tInstance: unix.TIPC_TOP_SRV,\n\t\tDomain: node,\n\t}\n\n\tst := &unix.SockaddrTIPC{\n\t\tScope: unix.TIPC_CLUSTER_SCOPE,\n\t\tAddr: sa,\n\t}\n\n\tc, err := tipc.DialSequentialPacket(st)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &TopologyConn{conn: c}, nil\n}", "func GetNodeTopology(ctx context.Context, topologyClient *topologyclientset.Clientset, nodeName string) *v1alpha2.NodeResourceTopology {\n\tvar nodeTopology *v1alpha2.NodeResourceTopology\n\tvar err error\n\tgomega.EventuallyWithOffset(1, func() bool {\n\t\tnodeTopology, err = topologyClient.TopologyV1alpha2().NodeResourceTopologies().Get(ctx, nodeName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tframework.Logf(\"failed to get the node topology resource: %v\", err)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}, time.Minute, 5*time.Second).Should(gomega.BeTrue())\n\treturn nodeTopology\n}", "func IsValidNodeTopology(nodeTopology *v1alpha2.NodeResourceTopology, kubeletConfig *kubeletconfig.KubeletConfiguration) bool {\n\tif nodeTopology == nil || len(nodeTopology.TopologyPolicies) == 0 {\n\t\tframework.Logf(\"failed to get topology policy from the node topology resource\")\n\t\treturn false\n\t}\n\n\ttmPolicy := string(topologypolicy.DetectTopologyPolicy(kubeletConfig.TopologyManagerPolicy, kubeletConfig.TopologyManagerScope))\n\tif nodeTopology.TopologyPolicies[0] != tmPolicy {\n\t\tframework.Logf(\"topology policy mismatch got %q expected %q\", nodeTopology.TopologyPolicies[0], tmPolicy)\n\t\treturn false\n\t}\n\n\texpectedPolicyAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerPolicyAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerPolicy,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedPolicyAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerPolicy attribute expected %v attributeList %v\", expectedPolicyAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\texpectedScopeAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerScopeAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerScope,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedScopeAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerScope attribute expected %v attributeList %v\", expectedScopeAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\tif nodeTopology.Zones == nil || len(nodeTopology.Zones) == 0 {\n\t\tframework.Logf(\"failed to get topology zones from the node topology resource\")\n\t\treturn false\n\t}\n\n\tfoundNodes := 0\n\tfor _, zone := range nodeTopology.Zones {\n\t\t// TODO constant not in the APIs\n\t\tif !strings.HasPrefix(strings.ToUpper(zone.Type), \"NODE\") {\n\t\t\tcontinue\n\t\t}\n\t\tfoundNodes++\n\n\t\tif !isValidCostList(zone.Name, zone.Costs) {\n\t\t\tframework.Logf(\"invalid cost list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\n\t\tif !isValidResourceList(zone.Name, zone.Resources) {\n\t\t\tframework.Logf(\"invalid resource list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn foundNodes > 0\n}", "func AllocatableResourceListFromNodeResourceTopology(nodeTopo *v1alpha2.NodeResourceTopology) map[string]corev1.ResourceList {\n\tallocRes := make(map[string]corev1.ResourceList)\n\tfor _, zone := range nodeTopo.Zones {\n\t\tif zone.Type != \"Node\" {\n\t\t\tcontinue\n\t\t}\n\t\tresList := make(corev1.ResourceList)\n\t\tfor _, res := range zone.Resources {\n\t\t\tresList[corev1.ResourceName(res.Name)] = res.Allocatable.DeepCopy()\n\t\t}\n\t\tif len(resList) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tallocRes[zone.Name] = resList\n\t}\n\treturn allocRes\n}", "func newResource() *resource.Resource {\n\tr, _ := resource.Merge(\n\t\tresource.Default(),\n\t\tresource.NewWithAttributes(\n\t\t\tsemconv.SchemaURL,\n\t\t\tsemconv.ServiceNameKey.String(\"opentelemetry-server\"),\n\t\t\tsemconv.ServiceVersionKey.String(\"v0.1.0\"),\n\t\t\tattribute.String(\"environment\", \"demo\"),\n\t\t),\n\t)\n\treturn r\n}", "func NewTopology() Topology {\n\treturn &topologyS{\n\t\tTopology: &topology.Topo{},\n\t}\n}", "func (fm *FCFSModel)TaskNodeToResource(td *TaskDescriptor,rd *ResDescriptor)*ArcDescriptor{\n\t//ct := uint64(rand.Intn(100))\n\treturn &ArcDescriptor{\n\t\tcost: fm.TaskToResCost(td,rd),\n\t\tcapLower :0,\n\t\tcapUpper: 1,\n\t}\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\tnetworkId, err := util.ParseNetworkIDAnnotation(node, zic.GetNetworkName())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get the network id for the network %s on node %s: %v\", zic.GetNetworkName(), node.Name, err)\n\t}\n\n\ttransitSwitchTunnelKey := BaseTransitSwitchTunnelKey + networkId\n\tts := &nbdb.LogicalSwitch{\n\t\tName: zic.networkTransitSwitchName,\n\t\tOtherConfig: map[string]string{\n\t\t\t\"interconn-ts\": zic.networkTransitSwitchName,\n\t\t\t\"requested-tnl-key\": strconv.Itoa(transitSwitchTunnelKey),\n\t\t\t\"mcast_snoop\": \"true\",\n\t\t\t\"mcast_flood_unregistered\": \"true\",\n\t\t},\n\t}\n\n\t// Create transit switch if it doesn't exist\n\tif err := libovsdbops.CreateOrUpdateLogicalSwitch(zic.nbClient, ts); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update transit switch %s: %w\", zic.networkTransitSwitchName, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func newTopoClient(cfg ServiceConfig) (topoapi.TopoClient, error) {\n\topts := []grpc.DialOption{\n\t\tgrpc.WithStreamInterceptor(southbound.RetryingStreamClientInterceptor(100 * time.Millisecond)),\n\t}\n\tif cfg.Insecure {\n\t\topts = append(opts, grpc.WithInsecure())\n\t}\n\n\tconn, err := getTopoConn(\"onos-topo\", opts...)\n\tif err != nil {\n\t\tstat, ok := status.FromError(err)\n\t\tif ok {\n\t\t\tlog.Error(\"Unable to connect to topology service\", err)\n\t\t\treturn nil, errors.FromStatus(stat)\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn topoapi.NewTopoClient(conn), nil\n}", "func NewResourceNode(networkID string, pubKey crypto.PubKey, ownerAddr sdk.AccAddress,\n\tdescription Description, nodeType string, creationTime time.Time) ResourceNode {\n\treturn ResourceNode{\n\t\tNetworkID: networkID,\n\t\tPubKey: pubKey,\n\t\tSuspend: false,\n\t\tStatus: sdk.Unbonded,\n\t\tTokens: sdk.ZeroInt(),\n\t\tOwnerAddress: ownerAddr,\n\t\tDescription: description,\n\t\tNodeType: nodeType,\n\t\tCreationTime: creationTime,\n\t}\n}", "func NewNODES(config configuration.CONFIGURATION) *NODES_IMPL {\r\n client := new(NODES_IMPL)\r\n client.config = config\r\n return client\r\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func nodesToCreate(clusterName string, flags *CreateOptions) []nodeSpec {\n\tvar desiredNodes []nodeSpec\n\n\t// prepare nodes explicitly\n\tfor n := 0; n < flags.controlPlanes; n++ {\n\t\trole := constants.ControlPlaneNodeRoleValue\n\t\tdesiredNode := nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterName, role, n+1),\n\t\t\tRole: role,\n\t\t}\n\t\tdesiredNodes = append(desiredNodes, desiredNode)\n\t}\n\tfor n := 0; n < flags.workers; n++ {\n\t\trole := constants.WorkerNodeRoleValue\n\t\tdesiredNode := nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterName, role, n+1),\n\t\t\tRole: role,\n\t\t}\n\t\tdesiredNodes = append(desiredNodes, desiredNode)\n\t}\n\n\t// add an external load balancer if explicitly requested or if there are multiple control planes\n\tif flags.externalLoadBalancer || flags.controlPlanes > 1 {\n\t\trole := constants.ExternalLoadBalancerNodeRoleValue\n\t\tdesiredNodes = append(desiredNodes, nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-lb\", clusterName),\n\t\t\tRole: role,\n\t\t})\n\t}\n\n\treturn desiredNodes\n}", "func (p *Provider) initTopology() (*topology, func(), error) {\n\tif err := checkVersion(p.api); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ttopo, cleanup, err := p.api.newTopology()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tcleanup()\n\t\t}\n\t}()\n\n\tif err = topo.setFlags(); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif err = topo.load(); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn topo, cleanup, nil\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func Generate(topology *Topology, clusters, namespaces []string) *Topology {\n\tvar edges []Edge\n\tvar nodes []Node\n\tvar clusterNodes []Node\n\tvar namespaceNodes []Node\n\n\tfor _, clusterName := range clusters {\n\t\tfor _, namespace := range namespaces {\n\t\t\tfor _, edge := range topology.Edges {\n\t\t\t\tif (edge.Data.SourceCluster == clusterName && edge.Data.SourceNamespace == namespace) || (edge.Data.TargetCluster == clusterName && edge.Data.TargetNamespace == namespace) {\n\t\t\t\t\tedges = appendEdgeIfMissing(edges, edge)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, edge := range edges {\n\t\tfor _, node := range topology.Nodes {\n\t\t\tif node.Data.ID == edge.Data.Source || node.Data.ID == edge.Data.Target {\n\t\t\t\tnodes = appendNodeIfMissing(nodes, node)\n\n\t\t\t\tclusterNode := Node{\n\t\t\t\t\tData: NodeData{\n\t\t\t\t\t\tID: node.Data.Cluster,\n\t\t\t\t\t\tType: \"cluster\",\n\t\t\t\t\t\tLabel: node.Data.Cluster,\n\t\t\t\t\t\tParent: \"\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tclusterNodes = appendNodeIfMissing(clusterNodes, clusterNode)\n\n\t\t\t\tnamespaceNode := Node{\n\t\t\t\t\tData: NodeData{\n\t\t\t\t\t\tID: node.Data.Cluster + \"-\" + node.Data.Namespace,\n\t\t\t\t\t\tType: \"namespace\",\n\t\t\t\t\t\tLabel: node.Data.Namespace,\n\t\t\t\t\t\tParent: node.Data.Cluster,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tnamespaceNodes = append(namespaceNodes, namespaceNode)\n\t\t\t}\n\t\t}\n\t}\n\n\tnodes = append(nodes, clusterNodes...)\n\tnodes = append(nodes, namespaceNodes...)\n\n\treturn &Topology{\n\t\tEdges: edges,\n\t\tNodes: nodes,\n\t}\n}", "func NewTerraNodeResource(node db.Node) TerraNodeResource {\n\treturn TerraNodeResource{\n\t\tJAID: NewJAIDInt32(node.ID),\n\t\tName: node.Name,\n\t\tTerraChainID: node.TerraChainID,\n\t\tTendermintURL: node.TendermintURL,\n\t\tCreatedAt: node.CreatedAt,\n\t\tUpdatedAt: node.UpdatedAt,\n\t}\n}", "func TestNoTopo(t *testing.T) {\n\tkdlog.InitLogs()\n\n\tkubePod := &kubev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Pod0\",\n\t\t\tAnnotations: map[string]string{\n\t\t\t\t\"ABCD\": \"EFGH\",\n\t\t\t},\n\t\t},\n\t\tSpec: kubev1.PodSpec{\n\t\t\tContainers: []kubev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: \"Cont0\",\n\t\t\t\t\tResources: kubev1.ResourceRequirements{\n\t\t\t\t\t\tRequests: kubev1.ResourceList{\n\t\t\t\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(4, resource.DecimalSI),\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\tnodeInfo0 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node0\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(4, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(4, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo1 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node1\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo2 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node2\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(0, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(0, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo3 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node3\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{},\n\t}\n\tnodeInfo4 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node4\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\n\tds := DeviceScheduler\n\tds.RemoveAll()\n\tdev := &gpuschedulerplugin.NvidiaGPUScheduler{}\n\tds.AddDevice(dev)\n\n\tn0, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo0, nil)\n\tn1, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo1, nil)\n\tn2, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo2, nil)\n\tn3, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo3, nil)\n\tn4, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo4, nil)\n\tds.AddNode(nodeInfo0.ObjectMeta.Name, n0)\n\tds.AddNode(nodeInfo1.ObjectMeta.Name, n1)\n\tds.AddNode(nodeInfo2.ObjectMeta.Name, n2)\n\tds.AddNode(nodeInfo3.ObjectMeta.Name, n3)\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\tds.AddNode(nodeInfo4.ObjectMeta.Name, n4)\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\tfmt.Printf(\"Node: %+v\\n\", n0)\n\tfmt.Printf(\"Node: %+v\\n\", n1)\n\tmodReq := gpuschedulerplugin.TranslateGPUResources(n0.KubeAlloc[gpuplugintypes.ResourceGPU], types.ResourceList{\n\t\ttypes.DeviceGroupPrefix + \"/gpugrp1/A/gpugrp0/B/gpu/GPU0/cards\": int64(1),\n\t}, n0.Allocatable)\n\tif !reflect.DeepEqual(modReq, n0.Allocatable) {\n\t\tt.Errorf(\"Alloc not same, expect: %v, have: %v\", n0.Allocatable, modReq)\n\t}\n\tn0.Allocatable = modReq\n\t//fmt.Printf(\"Node: %+v\\n\", n0)\n\n\tp0, _ := kubeinterface.KubePodInfoToPodInfo(kubePod, false)\n\tfmt.Printf(\"Pod: %+v\\n\", p0)\n\n\tfits, failures, score := ds.PodFitsResources(p0, n0, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfits, failures, score = ds.PodFitsResources(p0, n1, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfits, failures, score = ds.PodFitsResources(p0, n2, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfits, failures, score = ds.PodFitsResources(p0, n3, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfmt.Printf(\"Scores: %+v\\n\", ds.score)\n\n\tpri0 := ds.PodPriority(p0, n0)\n\tfmt.Printf(\"PodPriority0: %v\\n\", pri0)\n\n\tpri1 := ds.PodPriority(p0, n1)\n\tfmt.Printf(\"PodPriority1: %v\\n\", pri1)\n\n\tds.RemoveNode(\"Node1\")\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\tds.RemoveNode(\"Node4\")\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\n\tkdlog.FlushLogs()\n}", "func NewNodeMap(client kube_client.Interface, nodes []*apiv1.Node) (Map, error) {\n\tnodeMap := Map{\n\t\tOnDemand: make([]*NodeInfo, 0),\n\t\tSpot: make([]*NodeInfo, 0),\n\t}\n\n\tfor _, node := range nodes {\n\t\tnodeInfo, err := newNodeInfo(client, node)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Sort pods with biggest CPU request first\n\t\tsort.Slice(nodeInfo.Pods, func(i, j int) bool {\n\t\t\tiCPU := getPodCPURequests(nodeInfo.Pods[i])\n\t\t\tjCPU := getPodCPURequests(nodeInfo.Pods[j])\n\t\t\treturn iCPU > jCPU\n\t\t})\n\n\t\tswitch true {\n\t\tcase isSpotNode(node):\n\t\t\tnodeMap[Spot] = append(nodeMap[Spot], nodeInfo)\n\t\t\tcontinue\n\t\tcase isOnDemandNode(node):\n\t\t\tnodeMap[OnDemand] = append(nodeMap[OnDemand], nodeInfo)\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t}\n\n\t// Sort spot nodes by most requested CPU first\n\tsort.Slice(nodeMap[Spot], func(i, j int) bool {\n\t\treturn nodeMap[Spot][i].RequestedCPU > nodeMap[Spot][j].RequestedCPU\n\t})\n\t// Sort on-demand nodes by least requested CPU first\n\tsort.Slice(nodeMap[OnDemand], func(i, j int) bool {\n\t\treturn nodeMap[OnDemand][i].RequestedCPU < nodeMap[OnDemand][j].RequestedCPU\n\t})\n\n\treturn nodeMap, nil\n}", "func NewTCPCluster(name string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error) {\n\tcluster := &envoy_config_cluster_v3.Cluster{\n\t\tName: name,\n\t\tClusterDiscoveryType: &envoy_config_cluster_v3.Cluster_Type{\n\t\t\tType: envoy_config_cluster_v3.Cluster_EDS,\n\t\t},\n\t}\n\n\t// Apply mutation functions for customizing the cluster.\n\tfor _, fn := range mutationFunc {\n\t\tcluster = fn(cluster)\n\t}\n\n\tclusterBytes, err := proto.Marshal(cluster)\n\tif err != nil {\n\t\treturn ciliumv2.XDSResource{}, err\n\t}\n\n\treturn ciliumv2.XDSResource{\n\t\tAny: &anypb.Any{\n\t\t\tTypeUrl: envoy.ClusterTypeURL,\n\t\t\tValue: clusterBytes,\n\t\t},\n\t}, nil\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\tnetworkId, err := util.ParseNetworkIDAnnotation(node, zic.GetNetworkName())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get the network id for the network %s on node %s: %v\", zic.GetNetworkName(), node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\ttransitSwitchTunnelKey := BaseTransitSwitchTunnelKey + networkId\n\tts := &nbdb.LogicalSwitch{\n\t\tName: zic.networkTransitSwitchName,\n\t\tOtherConfig: map[string]string{\n\t\t\t\"interconn-ts\": zic.networkTransitSwitchName,\n\t\t\t\"requested-tnl-key\": strconv.Itoa(transitSwitchTunnelKey),\n\t\t\t\"mcast_snoop\": \"true\",\n\t\t\t\"mcast_flood_unregistered\": \"true\",\n\t\t},\n\t}\n\n\t// Create transit switch if it doesn't exist\n\tif err := libovsdbops.CreateOrUpdateLogicalSwitch(zic.nbClient, ts); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update transit switch %s: %w\", zic.networkTransitSwitchName, err)\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func buildNormalizedNodeResourceMap(pods []*core_v1.Pod, nodes []*core_v1.Node) nodeResourceMap { // nolint: gocyclo\n\tnrm := nodeResourceMap{}\n\n\tfor _, n := range nodes {\n\t\tnrm[n.ObjectMeta.Name] = allocatedNodeResources{node: n}\n\t}\n\n\t// We sum the total allocated resources on every node from our list of pods.\n\t// Some strategies may wish to price pods based on their fraction of allocated\n\t// node resources, rather than the total resources available on a node. This\n\t// may punish lone pods that are initially scheduled onto large nodes, but this\n\t// may be desirable as it rightfully punishes applications that may cause\n\t// frequent node turnover.\n\tfor _, p := range pods {\n\t\tnr, ok := nrm[p.Spec.NodeName]\n\t\tif !ok {\n\t\t\tlog.Log.Warnw(\"unexpected missing node from NodeMap\", zap.String(\"nodeName\", p.Spec.NodeName))\n\t\t\tcontinue\n\t\t}\n\t\tnr.cpuUsed += sumPodResource(p, core_v1.ResourceCPU)\n\t\tnr.memoryUsed += sumPodResource(p, core_v1.ResourceMemory)\n\t\tnr.gpuUsed += sumPodResource(p, ResourceGPU)\n\t\tnrm[p.Spec.NodeName] = nr\n\t}\n\n\tfor k, v := range nrm {\n\t\tc := v.node.Status.Capacity.Cpu()\n\t\tif c != nil {\n\t\t\tv.cpuAvailable = c.MilliValue()\n\t\t}\n\n\t\tm := v.node.Status.Capacity.Memory()\n\t\tif m != nil {\n\t\t\tv.memoryAvailable = m.Value()\n\t\t}\n\n\t\tg := gpuCapacity(&v.node.Status.Capacity)\n\t\tif g != nil {\n\t\t\tv.gpuAvailable = g.Value()\n\t\t}\n\n\t\t// The ratio of cpuUsed / cpuAvailable is used for proportional scaling of\n\t\t// resources to \"normalize\" pod resource utilization to a full node. If\n\t\t// cpuUsed is 0 because the pods that are running have not made resource\n\t\t// requests, there's a possible divide by 0 in calling code so we default to\n\t\t// setting cpuUsed to cpuAvailable.\n\t\tif v.cpuUsed == 0 {\n\t\t\tv.cpuUsed = v.cpuAvailable\n\t\t}\n\n\t\tif v.memoryUsed == 0 {\n\t\t\tv.memoryUsed = v.memoryAvailable\n\t\t}\n\n\t\tif v.gpuUsed == 0 {\n\t\t\tv.gpuUsed = v.gpuAvailable\n\t\t}\n\n\t\tnrm[k] = v\n\t}\n\n\treturn nrm\n}", "func newResources(clusterID, clusterVPCID string, publicAccessFW publicAccessFirewall, gclient *godo.Client) *resources {\n\treturn &resources{\n\t\tclusterID: clusterID,\n\t\tclusterVPCID: clusterVPCID,\n\t\tfirewall: publicAccessFW,\n\n\t\tgclient: gclient,\n\t}\n}", "func NewTopologiesCommands() []Command {\n\treturn []Command{\n\t\t&changeTopologyCmd{},\n\t\t&bqlCmd{},\n\t}\n}", "func TestCreateLogicalRouter(t *testing.T) {\n\n\tnsxClient, teardown := setupTest()\n\tdefer teardown()\n\n\tclusters, err := nsxtapi.FindEdgeCluster(&nsxClient, nsxtapi.EdgeClusterCallback[\"name\"], \"edge-cluster\")\n\tif err != nil {\n\t\tt.Fatal(\"No cluster defined\")\n\t}\n\n\ttype args struct {\n\t\tnsxClient *nsxt.APIClient\n\t\trouterType string\n\t\tname string\n\t\tclusterUuid string\n\t\ttags []common.Tag\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twantErr bool\n\t}{\n\t\t{\n\t\t\t\"test create tier0\",\n\t\t\targs{\n\t\t\t\t&nsxClient,\n\t\t\t\t\"TIER0\",\n\t\t\t\t\"test\",\n\t\t\t\tclusters[0].Id,\n\t\t\t\tnil,\n\t\t\t},\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t\"test create tier1\",\n\t\t\targs{\n\t\t\t\t&nsxClient,\n\t\t\t\t\"TIER1\",\n\t\t\t\t\"test\",\n\t\t\t\tclusters[0].Id,\n\t\t\t\tnil,\n\t\t\t},\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t\"wrong type\",\n\t\t\targs{\n\t\t\t\t&nsxClient,\n\t\t\t\t\"TIER2\",\n\t\t\t\t\"test\",\n\t\t\t\tclusters[0].Id,\n\t\t\t\tnil,\n\t\t\t},\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t\"wrong cluster id\",\n\t\t\targs{\n\t\t\t\t&nsxClient,\n\t\t\t\t\"TIER0\",\n\t\t\t\t\"test\",\n\t\t\t\t\"1234\",\n\t\t\t\tnil,\n\t\t\t},\n\t\t\ttrue,\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\n\t\t\treq := nsxtapi.RouterCreateReq{}\n\n\t\t\treq.Name = tt.args.name\n\t\t\treq.RouterType = tt.args.routerType\n\t\t\treq.ClusterID = tt.args.clusterUuid\n\t\t\treq.Tags = tt.args.tags\n\n\t\t\tnsx := tt.args.nsxClient\n\t\t\tgot, err := nsxtapi.CreateLogicalRouter(nsx, req)\n\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\tt.Errorf(\"CreateLogicalRouter() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err != nil && tt.wantErr == true {\n\t\t\t\tt.Log(\" Expected error and go error\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err == nil && got == nil {\n\t\t\t\tt.Errorf(\"CreateLogicalRouter() error not nil but got back nil\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif got != nil {\n\n\t\t\t\t// read / delete / read after addition\n\t\t\t\t_, _, err = tt.args.nsxClient.LogicalRoutingAndServicesApi.ReadLogicalRouter(nsx.Context, got.Id)\n\t\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\t\tt.Errorf(\"CreateLogicalRouter() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t_, err = nsxtapi.DeleteLogicalRouter(tt.args.nsxClient, got.Id)\n\t\t\t\tif (err != nil) != tt.wantErr {\n\t\t\t\t\tt.Errorf(\"CreateLogicalRouter() error = %v, wantErr %v\", err, tt.wantErr)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t_, _, err = tt.args.nsxClient.LogicalRoutingAndServicesApi.ReadLogicalRouter(nsx.Context, got.Id)\n\t\t\t\tif err == nil {\n\t\t\t\t\tt.Errorf(\"Delete failed\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func NewElasticsearchTopology(topology []string) ([]ElasticsearchTopologyElement, error) {\n\tvar t = make([]ElasticsearchTopologyElement, 0, len(topology))\n\tfor _, rawElement := range topology {\n\t\tvar element ElasticsearchTopologyElement\n\t\telement.fillDefaults()\n\t\tif err := json.Unmarshal([]byte(rawElement), &element); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"depresourceapi: failed unpacking raw topology: %s\", err)\n\t\t}\n\n\t\tif err := element.Validate(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tt = append(t, element)\n\t}\n\treturn t, nil\n}", "func NewTreeTopology(fanout, nTasks uint64) *TreeTopology {\n\tm := &TreeTopology{\n\t\tfanout: fanout,\n\t\tnumOfTasks: nTasks,\n\t}\n\treturn m\n}", "func TopologyTree() CustomizeWorkItemLinkTypeFunc {\n\treturn Topology(link.TopologyTree)\n}", "func Get(ctx context.Context, clusters *clusters.Clusters) *Topology {\n\tvar edges []Edge\n\tvar nodes []Node\n\n\tfor _, c := range clusters.Clusters {\n\t\tapplications, err := c.GetApplications(ctx, \"\")\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, application := range applications {\n\t\t\tnodes = append(nodes, Node{\n\t\t\t\tData: NodeData{\n\t\t\t\t\tapplication.Cluster + \"-\" + application.Namespace + \"-\" + application.Name,\n\t\t\t\t\t\"application\",\n\t\t\t\t\tapplication.Name,\n\t\t\t\t\tapplication.Cluster + \"-\" + application.Namespace,\n\t\t\t\t\tapplication,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// The cluster and namespace field in the reference for a dependency is optional. So that we have to set the\n\t\t\t// cluster and namespace to the cluster and namespace of the current application, when it isn't defined in\n\t\t\t// the dependency reference.\n\t\t\tfor _, dependency := range application.Dependencies {\n\t\t\t\tdependencyCluster := dependency.Cluster\n\t\t\t\tif dependencyCluster == \"\" {\n\t\t\t\t\tdependencyCluster = application.Cluster\n\t\t\t\t}\n\n\t\t\t\tdependencyNamespace := dependency.Namespace\n\t\t\t\tif dependencyNamespace == \"\" {\n\t\t\t\t\tdependencyNamespace = application.Namespace\n\t\t\t\t}\n\n\t\t\t\tdependencyName := dependency.Name\n\n\t\t\t\tedges = append(edges, Edge{\n\t\t\t\t\tData: EdgeData{\n\t\t\t\t\t\tID: application.Cluster + \"-\" + application.Namespace + \"-\" + application.Name + \"-\" + dependencyCluster + \"-\" + dependencyNamespace + \"-\" + dependencyName,\n\t\t\t\t\t\tSource: application.Cluster + \"-\" + application.Namespace + \"-\" + application.Name,\n\t\t\t\t\t\tSourceCluster: application.Cluster,\n\t\t\t\t\t\tSourceNamespace: application.Namespace,\n\t\t\t\t\t\tSourceName: application.Name,\n\t\t\t\t\t\tTarget: dependencyCluster + \"-\" + dependencyNamespace + \"-\" + dependencyName,\n\t\t\t\t\t\tTargetCluster: dependencyCluster,\n\t\t\t\t\t\tTargetNamespace: dependencyNamespace,\n\t\t\t\t\t\tTargetName: dependencyName,\n\t\t\t\t\t\tDescription: dependency.Description,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t// Loop through all edges and remove the edge, when the source or target node doesn't exists. This is needed, so\n\t// that we only have edges were the source and target nodes exists, because the topology component in the React\n\t// UI will crash when it founds an edge but no corresponding node.\n\tvar filterEdges []Edge\n\tfor _, edge := range edges {\n\t\tif doesNodeExists(nodes, edge.Data.Source) && doesNodeExists(nodes, edge.Data.Target) {\n\t\t\tfilterEdges = append(filterEdges, edge)\n\t\t}\n\t}\n\n\treturn &Topology{\n\t\tEdges: filterEdges,\n\t\tNodes: nodes,\n\t}\n}", "func DescribeNodeResource(nodeNonTerminatedPodsList *corev1.PodList, node *corev1.Node) *NodeUsage {\n\tallocatable := node.Status.Capacity\n\tif len(node.Status.Allocatable) > 0 {\n\t\tallocatable = node.Status.Allocatable\n\t}\n\n\treqs, limits := getPodsTotalRequestsAndLimits(nodeNonTerminatedPodsList)\n\tcpuReqs, cpuLimits, memoryReqs, memoryLimits, ephemeralstorageReqs, ephemeralstorageLimits :=\n\t\treqs[corev1.ResourceCPU], limits[corev1.ResourceCPU], reqs[corev1.ResourceMemory], limits[corev1.ResourceMemory], reqs[corev1.ResourceEphemeralStorage], limits[corev1.ResourceEphemeralStorage]\n\tfractionCpuReqs := float64(0)\n\tfractionCpuLimits := float64(0)\n\tif allocatable.Cpu().MilliValue() != 0 {\n\t\tfractionCpuReqs = float64(cpuReqs.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t\tfractionCpuLimits = float64(cpuLimits.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t}\n\tfractionMemoryReqs := float64(0)\n\tfractionMemoryLimits := float64(0)\n\tif allocatable.Memory().Value() != 0 {\n\t\tfractionMemoryReqs = float64(memoryReqs.Value()) / float64(allocatable.Memory().Value()) * 100\n\t\tfractionMemoryLimits = float64(memoryLimits.Value()) / float64(allocatable.Memory().Value()) * 100\n\t}\n\tfractionEphemeralStorageReqs := float64(0)\n\tfractionEphemeralStorageLimits := float64(0)\n\tif allocatable.StorageEphemeral().Value() != 0 {\n\t\tfractionEphemeralStorageReqs = float64(ephemeralstorageReqs.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t\tfractionEphemeralStorageLimits = float64(ephemeralstorageLimits.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t}\n\n\treturn &NodeUsage{\n\t\tcpuReqs: cpuReqs.String(),\n\t\tmemoryReqs: memoryReqs.String(),\n\t\tephemeralStorageReqs: ephemeralstorageReqs.String(),\n\t\tfractionCpuReqs: fractionCpuReqs,\n\t\tfractionCpuLimits: fractionCpuLimits,\n\t\tfractionMemoryReqs: fractionMemoryReqs,\n\t\tfractionMemoryLimits: fractionMemoryLimits,\n\t\tfractionEphemeralStorageReqs: fractionEphemeralStorageReqs,\n\t\tfractionEphemeralStorageLimits: fractionEphemeralStorageLimits,\n\t}\n}", "func (m *ClusterService) getTopology(ctx context.Context, args struct{}) (*proto.GeneralResp, error) {\n\tif _, _, err := permissions(ctx, ADMIN); err != nil {\n\t\treturn nil, err\n\t}\n\ttv := &TopologyView{\n\t\tZones: make([]*ZoneView, 0),\n\t}\n\tzones := m.cluster.t.getAllZones()\n\tfor _, zone := range zones {\n\t\tcv := newZoneView(zone.name)\n\t\tcv.Status = zone.getStatusToString()\n\t\ttv.Zones = append(tv.Zones, cv)\n\t\tnsc := zone.getAllNodeSet()\n\t\tfor _, ns := range nsc {\n\t\t\tnsView := newNodeSetView(ns.dataNodeLen(), ns.metaNodeLen())\n\t\t\tcv.NodeSet[ns.ID] = nsView\n\t\t\tns.dataNodes.Range(func(key, value interface{}) bool {\n\t\t\t\tdataNode := value.(*DataNode)\n\t\t\t\tnsView.DataNodes = append(nsView.DataNodes, proto.NodeView{ID: dataNode.ID, Addr: dataNode.Addr, Status: dataNode.isActive, IsWritable: dataNode.isWriteAble()})\n\t\t\t\treturn true\n\t\t\t})\n\t\t\tns.metaNodes.Range(func(key, value interface{}) bool {\n\t\t\t\tmetaNode := value.(*MetaNode)\n\t\t\t\tnsView.MetaNodes = append(nsView.MetaNodes, proto.NodeView{ID: metaNode.ID, Addr: metaNode.Addr, Status: metaNode.IsActive, IsWritable: metaNode.isWritable()})\n\t\t\t\treturn true\n\t\t\t})\n\t\t}\n\t}\n\n\tbs, e := json.Marshal(tv)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn proto.Success(string(bs)), e\n}", "func NewResource() (Resource, error) {\n\t// Get cluster config\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error getting in cluster config: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup event source client\n\teventSrcClient, err := eventsrcclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building event source client: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup tektoncd client\n\ttektonClient, err := tektoncdclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building tekton clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup k8s client\n\tk8sClient, err := k8sclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building k8s clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\tr := Resource{\n\t\tK8sClient: k8sClient,\n\t\tTektonClient: tektonClient,\n\t\tEventSrcClient: eventSrcClient,\n\t}\n\treturn r, nil\n}", "func NewAreaTopology(areas ...*Area) *AreaTopology {\n\tt := &AreaTopology{areas: areas}\n\n\tcounter := 0\n\n\t// Initialization phase to create the topology for each individual area.\n\tfor _, area := range t.areas {\n\t\tarea.nodes = make(map[Node][]Link)\n\t\tnodes := make([]Node, area.N)\n\n\t\t// 1. Create the nodes of the area\n\t\tfor i := range nodes {\n\t\t\tnodes[i] = Node{Name: NodeID(fmt.Sprintf(\"node%d\", counter))}\n\t\t\tcounter++\n\t\t}\n\n\t\t// 2. Create the links to the area members with the given latency.\n\t\tfor i, node := range nodes {\n\t\t\tlinks := make([]Link, 0, area.N-1)\n\n\t\t\tfor j, peer := range nodes {\n\t\t\t\tif i != j {\n\t\t\t\t\tlinks = append(links, Link{\n\t\t\t\t\t\tDistant: peer,\n\t\t\t\t\t\tDelay: area.Latency,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tarea.nodes[node] = links\n\t\t}\n\t}\n\n\t// Then the links between the areas are calculated.\n\tfor i, from := range t.areas {\n\t\tfor j, to := range areas {\n\t\t\tif i != j {\n\t\t\t\tt.makeAreaLinks(from, to)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn t\n}", "func resourceNodeV1() *schema.Resource {\n\treturn &schema.Resource{\n\t\tCreate: resourceNodeV1Create,\n\t\tRead: resourceNodeV1Read,\n\t\tUpdate: resourceNodeV1Update,\n\t\tDelete: resourceNodeV1Delete,\n\n\t\tSchema: map[string]*schema.Schema{\n\t\t\t\"name\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"boot_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"clean\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"conductor_group\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"console_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"deploy_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"driver\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t},\n\t\t\t\"driver_info\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t\tDiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {\n\t\t\t\t\t/* FIXME: Password updates aren't considered. How can I know if the *local* data changed? */\n\t\t\t\t\t/* FIXME: Support drivers other than IPMI */\n\t\t\t\t\tif k == \"driver_info.ipmi_password\" && old == \"******\" {\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false\n\t\t\t\t},\n\n\t\t\t\t// driver_info could contain passwords\n\t\t\t\tSensitive: true,\n\t\t\t},\n\t\t\t\"properties\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"root_device\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"extra\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"inspect_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"instance_uuid\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"inspect\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"available\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"manage\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"management_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"network_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"power_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"raid_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"rescue_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"resource_class\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"storage_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"vendor_interface\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"owner\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"ports\": {\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\tType: schema.TypeMap,\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"provision_state\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"power_state\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"target_power_state\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\n\t\t\t\t// If power_state is same as target_power_state, we have no changes to apply\n\t\t\t\tDiffSuppressFunc: func(_, old, new string, d *schema.ResourceData) bool {\n\t\t\t\t\treturn new == d.Get(\"power_state\").(string)\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"power_state_timeout\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"raid_config\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t\t\"bios_settings\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tComputed: true,\n\t\t\t},\n\t\t},\n\t}\n}", "func resourceNodeV1Create(d *schema.ResourceData, meta interface{}) error {\n\tclient, err := meta.(*Clients).GetIronicClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create the node object in Ironic\n\tcreateOpts := schemaToCreateOpts(d)\n\tresult, err := nodes.Create(client, createOpts).Extract()\n\tif err != nil {\n\t\td.SetId(\"\")\n\t\treturn err\n\t}\n\n\t// Setting the ID is what tells terraform we were successful in creating the node\n\tlog.Printf(\"[DEBUG] Node created with ID %s\\n\", d.Id())\n\td.SetId(result.UUID)\n\n\t// Create ports as part of the node object - you may also use the native port resource\n\tportSet := d.Get(\"ports\").(*schema.Set)\n\tif portSet != nil {\n\t\tportList := portSet.List()\n\t\tfor _, portInterface := range portList {\n\t\t\tport := portInterface.(map[string]interface{})\n\n\t\t\t// Terraform map can't handle bool... seriously.\n\t\t\tvar pxeEnabled bool\n\t\t\tif port[\"pxe_enabled\"] != nil {\n\t\t\t\tif port[\"pxe_enabled\"] == \"true\" {\n\t\t\t\t\tpxeEnabled = true\n\t\t\t\t} else {\n\t\t\t\t\tpxeEnabled = false\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t// FIXME: All values other than address and pxe\n\t\t\tportCreateOpts := ports.CreateOpts{\n\t\t\t\tNodeUUID: d.Id(),\n\t\t\t\tAddress: port[\"address\"].(string),\n\t\t\t\tPXEEnabled: &pxeEnabled,\n\t\t\t}\n\t\t\t_, err := ports.Create(client, portCreateOpts).Extract()\n\t\t\tif err != nil {\n\t\t\t\t_ = resourcePortV1Read(d, meta)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Make node manageable\n\tif d.Get(\"manage\").(bool) || d.Get(\"clean\").(bool) || d.Get(\"inspect\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"manage\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not manage: %s\", err)\n\t\t}\n\t}\n\n\t// Clean node\n\tif d.Get(\"clean\").(bool) {\n\t\tif err := setRAIDConfig(client, d); err != nil {\n\t\t\treturn fmt.Errorf(\"fail to set raid config: %s\", err)\n\t\t}\n\n\t\tvar cleanSteps []nodes.CleanStep\n\t\tif cleanSteps, err = buildManualCleaningSteps(d.Get(\"raid_interface\").(string), d.Get(\"raid_config\").(string), d.Get(\"bios_settings\").(string)); err != nil {\n\t\t\treturn fmt.Errorf(\"fail to build raid clean steps: %s\", err)\n\t\t}\n\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"clean\", nil, nil, cleanSteps); err != nil {\n\t\t\treturn fmt.Errorf(\"could not clean: %s\", err)\n\t\t}\n\t}\n\n\t// Inspect node\n\tif d.Get(\"inspect\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"inspect\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not inspect: %s\", err)\n\t\t}\n\t}\n\n\t// Make node available\n\tif d.Get(\"available\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"provide\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not make node available: %s\", err)\n\t\t}\n\t}\n\n\t// Change power state, if required\n\tif targetPowerState := d.Get(\"target_power_state\").(string); targetPowerState != \"\" {\n\t\terr := changePowerState(client, d, nodes.TargetPowerState(targetPowerState))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not change power state: %s\", err)\n\t\t}\n\t}\n\n\treturn resourceNodeV1Read(d, meta)\n}", "func (router *Router) createResource(w http.ResponseWriter, r *http.Request) {\n\tclusterName := r.URL.Query().Get(\"cluster\")\n\tnamespace := r.URL.Query().Get(\"namespace\")\n\tname := r.URL.Query().Get(\"name\")\n\tresource := r.URL.Query().Get(\"resource\")\n\tsubResource := r.URL.Query().Get(\"subResource\")\n\tpath := r.URL.Query().Get(\"path\")\n\n\tlog.WithFields(logrus.Fields{\"cluster\": clusterName, \"namespace\": namespace, \"name\": name, \"path\": path, \"resource\": resource, \"subResource\": subResource}).Tracef(\"createResource\")\n\n\tcluster := router.clusters.GetCluster(clusterName)\n\tif cluster == nil {\n\t\terrresponse.Render(w, r, nil, http.StatusBadRequest, \"Invalid cluster name\")\n\t\treturn\n\t}\n\n\tif router.isForbidden(resource) {\n\t\terrresponse.Render(w, r, nil, http.StatusForbidden, fmt.Sprintf(\"Access for resource %s is forbidding\", resource))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not decode request body\")\n\t\treturn\n\t}\n\n\terr = cluster.CreateResource(r.Context(), namespace, name, path, resource, subResource, body)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not create resource\")\n\t\treturn\n\t}\n\n\trender.JSON(w, r, nil)\n}", "func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error) {\n\n\tvar (\n\t\tpassword, _ = utils.GenPassword(24)\n\t\treq = &CreateInstanceRequest{\n\t\t\tImageID: OsImage,\n\t\t\tPassword: password,\n\t\t\tInstanceName: NodeName,\n\t\t\tInstanceChargeType: \"PostPaid\", // require RMB 100+\n\t\t\tSecurityGroupID: \"whatever\", // will be automatic rewrite\n\t\t\tInternetChargeType: \"PayByTraffic\", // traffic payment\n\t\t\tInternetMaxBandwidthOut: \"100\", // 100M\n\t\t\tLabels: NodeLabels,\n\t\t}\n\t)\n\n\t// if prefered attributes set, use prefer region & instance-type\n\tif prefer != nil && prefer.Valid() == nil {\n\t\tvar (\n\t\t\treg = prefer.RegionOrZone\n\t\t\ttyp = prefer.InstanceType\n\t\t)\n\t\tlog.Printf(\"create aliyun ecs by using prefered region %s, instance type %s ...\", reg, typ)\n\n\t\treq.RegionID = reg // cn-beijing\n\t\treq.InstanceType = typ // ecs.n4.large\n\n\t\tcreated, err := sdk.createNode(req)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tlog.Printf(\"created prefered aliyun ecs succeed: %s\", created.ID)\n\t\treturn created, prefer, nil\n\t}\n\n\tlog.Infoln(\"creating aliyun ecs by trying all regions & types ...\")\n\n\t// if prefered created failed, or without prefer region & instance-type\n\t// try best on all region & instance-types to create the new aliyun ecs\n\tvar (\n\t\tregions []RegionType // all of aliyun regions\n\t\ttypes []InstanceTypeItemType // all of instance types within given range of mems & cpus\n\t\terr error\n\t\tcreated *cloudsvr.CloudNode\n\t)\n\n\t// list all regions\n\tregions, err = sdk.ListRegions()\n\tif err != nil {\n\t\tlog.Errorf(\"sdk.NewNode.ListRegions() error: %v\", err)\n\t\treturn nil, nil, err\n\t}\n\n\t// list specified range of instance types\n\ttypes, err = sdk.ListInstanceTypes(2, 4, 2, 8) // TODO range of given cpus/mems ranges\n\tif err != nil {\n\t\tlog.Errorf(\"sdk.NewNode.ListInstanceTypes() error: %v\", err)\n\t\treturn nil, nil, err\n\t}\n\n\tvar (\n\t\tuseRegionID, useInsType string\n\t)\n\t// range all regions & types to try to create ecs instance\n\tfor _, reg := range regions {\n\t\tfor _, typ := range types {\n\t\t\treq.RegionID = reg.RegionID // cn-beijing\n\t\t\treq.InstanceType = typ.InstanceTypeID // ecs.n4.large\n\n\t\t\t// if created succeed, directly return\n\t\t\tcreated, err = sdk.createNode(req)\n\t\t\tif err == nil {\n\t\t\t\tuseRegionID, useInsType = reg.RegionID, typ.InstanceTypeID\n\t\t\t\tgoto END\n\t\t\t}\n\n\t\t\tif sdk.isFatalError(err) {\n\t\t\t\tlog.Errorf(\"create aliyun ecs got fatal error, stop retry: %v\", err)\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\n\t\t\tlog.Warnf(\"create aliyun ecs failed: %v, will retry another region or type\", err)\n\t\t}\n\t}\n\nEND:\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tlog.Printf(\"created aliyun ecs %s at %s and type is %s\", created.ID, useRegionID, useInsType)\n\treturn created, &cloudsvr.PreferAttrs{RegionOrZone: useRegionID, InstanceType: useInsType}, nil\n}", "func TestNodeTopology(t *testing.T) {\n\ttestcases := map[string]struct {\n\t\tdriverName string\n\t\tinitialNodes []testNode\n\t\texpectedSegments []*Segment\n\t\tupdate func(t *testing.T, client *fakeclientset.Clientset)\n\t\texpectedUpdatedSegments []*Segment\n\t}{\n\t\t\"empty\": {},\n\t\t\"one-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t},\n\t\t\"missing-csi-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t\tskipCSINodeCreation: true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"missing-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t\tskipNodeCreation: true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"missing-node-labels\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"two-nodes\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode2,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1, localStorageNode2},\n\t\t},\n\t\t\"shared-storage\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t},\n\t\t\"other-shared-storage\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode2,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode2},\n\t\t},\n\t\t\"deep-topology\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{networkStorage},\n\t\t},\n\t\t\"mixed-topology\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1, networkStorage},\n\t\t},\n\t\t\"partial-match\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels2,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{networkStorage, networkStorage2},\n\t\t},\n\t\t\"unsorted-keys\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\t// This node reports keys in reverse order, which must not make a difference.\n\t\t\t\t\t\tdriverName: []string{networkStorageKeys[2], networkStorageKeys[1], networkStorageKeys[0]},\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: node2,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: networkStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: networkStorageLabels,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{networkStorage},\n\t\t},\n\t\t\"wrong-driver\": {\n\t\t\tdriverName: \"other-driver\",\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\"remove-csi-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t\tupdate: func(t *testing.T, client *fakeclientset.Clientset) {\n\t\t\t\tremoveCSINode(t, client, node1)\n\t\t\t},\n\t\t},\n\t\t\"remove-node\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t\tupdate: func(t *testing.T, client *fakeclientset.Clientset) {\n\t\t\t\tremoveNode(t, client, node1)\n\t\t\t},\n\t\t},\n\t\t\"remove-driver\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t\tupdate: func(t *testing.T, client *fakeclientset.Clientset) {\n\t\t\t\tcsiNode, err := client.StorageV1().CSINodes().Get(context.Background(), node1, metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\t\t\t\tcsiNode.Spec.Drivers = nil\n\t\t\t\tif _, err := client.StorageV1().CSINodes().Update(context.Background(), csiNode, metav1.UpdateOptions{}); err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t\"change-labels\": {\n\t\t\tinitialNodes: []testNode{\n\t\t\t\t{\n\t\t\t\t\tname: node1,\n\t\t\t\t\tdriverKeys: map[string][]string{\n\t\t\t\t\t\tdriverName: localStorageKeys,\n\t\t\t\t\t},\n\t\t\t\t\tlabels: localStorageLabelsNode1,\n\t\t\t\t},\n\t\t\t},\n\t\t\texpectedSegments: []*Segment{localStorageNode1},\n\t\t\tupdate: func(t *testing.T, client *fakeclientset.Clientset) {\n\t\t\t\tnode, err := client.CoreV1().Nodes().Get(context.Background(), node1, metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\t\t\t\t// This isn't a realistic test case because CSI drivers cannot change their topology?\n\t\t\t\t// We support it anyway.\n\t\t\t\tnode.Labels[localStorageKey] = node2\n\t\t\t\tif _, err := client.CoreV1().Nodes().Update(context.Background(), node, metav1.UpdateOptions{}); err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\t\t\t},\n\t\t\texpectedUpdatedSegments: []*Segment{localStorageNode2},\n\t\t},\n\t}\n\n\tfor name, tc := range testcases {\n\t\t// Not run in parallel. That doesn't work well in combination with global logging.\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\t// There is no good way to shut down the informers. They spawn\n\t\t\t// various goroutines and some of them (in particular shared informer)\n\t\t\t// become very unhappy (\"close on closed channel\") when using a context\n\t\t\t// that gets cancelled. Therefore we just keep everything running.\n\t\t\t//\n\t\t\t// The informers also catch up with changes made via the client API\n\t\t\t// asynchronously. To ensure expected input for sync(), we wait until\n\t\t\t// the content of the informers is identical to what is currently stored.\n\t\t\tctx := context.Background()\n\n\t\t\ttestDriverName := tc.driverName\n\t\t\tif testDriverName == \"\" {\n\t\t\t\ttestDriverName = driverName\n\t\t\t}\n\n\t\t\tvar objects []runtime.Object\n\t\t\tobjects = append(objects, makeNodes(tc.initialNodes)...)\n\t\t\tclientSet := fakeclientset.NewSimpleClientset(objects...)\n\t\t\tnt := fakeNodeTopology(ctx, testDriverName, clientSet)\n\t\t\tif err := waitForInformers(ctx, nt); err != nil {\n\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t}\n\t\t\tvalidate(t, nt, tc.expectedSegments, nil, tc.expectedSegments)\n\n\t\t\tif tc.update != nil {\n\t\t\t\ttc.update(t, clientSet)\n\t\t\t\tif err := waitForInformers(ctx, nt); err != nil {\n\t\t\t\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t\t\t\t}\n\n\t\t\t\t// Determine the expected changes based on the delta.\n\t\t\t\tvar expectedAdded, expectedRemoved []*Segment\n\t\t\t\tfor _, segment := range tc.expectedUpdatedSegments {\n\t\t\t\t\tif !containsSegment(tc.expectedSegments, segment) {\n\t\t\t\t\t\texpectedAdded = append(expectedAdded, segment)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, segment := range tc.expectedSegments {\n\t\t\t\t\tif !containsSegment(tc.expectedUpdatedSegments, segment) {\n\t\t\t\t\t\texpectedRemoved = append(expectedRemoved, segment)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvalidate(t, nt, expectedAdded, expectedRemoved, tc.expectedUpdatedSegments)\n\t\t\t}\n\t\t})\n\t}\n}", "func BuildNodeTrafficMap(o graph.TelemetryOptions, client *prometheus.Client, globalInfo *graph.AppenderGlobalInfo) graph.TrafficMap {\n\tn := graph.NewNode(o.NodeOptions.Namespace, o.NodeOptions.Service, o.NodeOptions.Namespace, o.NodeOptions.Workload, o.NodeOptions.App, o.NodeOptions.Version, o.GraphType)\n\n\tlog.Tracef(\"Build graph for node [%+v]\", n)\n\n\tappenders := appender.ParseAppenders(o)\n\ttrafficMap := buildNodeTrafficMap(o.NodeOptions.Namespace, n, o, client)\n\n\tnamespaceInfo := graph.NewAppenderNamespaceInfo(o.NodeOptions.Namespace)\n\n\tfor _, a := range appenders {\n\t\tappenderTimer := internalmetrics.GetGraphAppenderTimePrometheusTimer(a.Name())\n\t\ta.AppendGraph(trafficMap, globalInfo, namespaceInfo)\n\t\tappenderTimer.ObserveDuration()\n\t}\n\n\t// The appenders can add/remove/alter nodes. After the manipulations are complete\n\t// we can make some final adjustments:\n\t// - mark the outsiders (i.e. nodes not in the requested namespaces)\n\t// - mark the traffic generators\n\tmarkOutsideOrInaccessible(trafficMap, o)\n\tmarkTrafficGenerators(trafficMap)\n\n\t// Note that this is where we would call reduceToServiceGraph for graphTypeService but\n\t// the current decision is to not reduce the node graph to provide more detail. This may be\n\t// confusing to users, we'll see...\n\n\treturn trafficMap\n}", "func New() Nodetool {\n\treturn &nodetool{}\n}", "func (g genericPlugin) Create(yamlFilePath string, namespace string, client plugin.KubernetesConnector) (string, error) {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\t//Decode the yaml file to create a runtime.Object\n\tunstruct := &unstructured.Unstructured{}\n\t//Ignore the returned obj as we expect the data in unstruct\n\t_, err := utils.DecodeYAML(yamlFilePath, unstruct)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Decode deployment object error\")\n\t}\n\n\tdynClient := client.GetDynamicClient()\n\tmapper := client.GetMapper()\n\n\tgvk := unstruct.GroupVersionKind()\n\tmapping, err := mapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Mapping kind to resource error\")\n\t}\n\n\t//Add the tracking label to all resources created here\n\tlabels := unstruct.GetLabels()\n\t//Check if labels exist for this object\n\tif labels == nil {\n\t\tlabels = map[string]string{}\n\t}\n\tlabels[config.GetConfiguration().KubernetesLabelName] = client.GetInstanceID()\n\tunstruct.SetLabels(labels)\n\n\t// This checks if the resource we are creating has a podSpec in it\n\t// Eg: Deployment, StatefulSet, Job etc..\n\t// If a PodSpec is found, the label will be added to it too.\n\tplugin.TagPodsIfPresent(unstruct, client.GetInstanceID())\n\n\tgvr := mapping.Resource\n\tvar createdObj *unstructured.Unstructured\n\n\tswitch mapping.Scope.Name() {\n\tcase meta.RESTScopeNameNamespace:\n\t\tcreatedObj, err = dynClient.Resource(gvr).Namespace(namespace).Create(unstruct, metav1.CreateOptions{})\n\tcase meta.RESTScopeNameRoot:\n\t\tcreatedObj, err = dynClient.Resource(gvr).Create(unstruct, metav1.CreateOptions{})\n\tdefault:\n\t\treturn \"\", pkgerrors.New(\"Got an unknown RESTSCopeName for mapping: \" + gvk.String())\n\t}\n\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Create object error\")\n\t}\n\n\treturn createdObj.GetName(), nil\n}", "func createNodeClientMap(ctx context.Context, clients []provisioner.API) map[string]provisioner.API {\n\tresult := make(map[string]provisioner.API)\n\tfor _, c := range clients {\n\t\tif info, err := c.GetNodeInfo(ctx); err == nil {\n\t\t\tresult[info.NodeName] = c\n\t\t}\n\t}\n\treturn result\n}", "func CreateNodes(client *rancher.Client, rolesPerPool []string, quantityPerPool []int32) (ec2Nodes []*nodes.Node, err error) {\n\tec2Client, err := client.GetEC2Client()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trunningReservations := []*ec2.Reservation{}\n\treservationConfigs := []*rancherEc2.AWSEC2Config{}\n\t// provisioning instances in reverse order to allow windows instances time to become ready\n\tfor i := len(quantityPerPool) - 1; i >= 0; i-- {\n\t\tconfig := MatchRoleToConfig(rolesPerPool[i], ec2Client.ClientConfig.AWSEC2Config)\n\t\tif config == nil {\n\t\t\treturn nil, errors.New(\"No matching nodesAndRole for AWSEC2Config with role:\" + rolesPerPool[i])\n\t\t}\n\t\tsshName := getSSHKeyName(config.AWSSSHKeyName)\n\t\trunInstancesInput := &ec2.RunInstancesInput{\n\t\t\tImageId: aws.String(config.AWSAMI),\n\t\t\tInstanceType: aws.String(config.InstanceType),\n\t\t\tMinCount: aws.Int64(int64(quantityPerPool[i])),\n\t\t\tMaxCount: aws.Int64(int64(quantityPerPool[i])),\n\t\t\tKeyName: aws.String(sshName),\n\t\t\tBlockDeviceMappings: []*ec2.BlockDeviceMapping{\n\t\t\t\t{\n\t\t\t\t\tDeviceName: aws.String(\"/dev/sda1\"),\n\t\t\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\t\t\tVolumeSize: aws.Int64(int64(config.VolumeSize)),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tIamInstanceProfile: &ec2.IamInstanceProfileSpecification{\n\t\t\t\tName: aws.String(config.AWSIAMProfile),\n\t\t\t},\n\t\t\tPlacement: &ec2.Placement{\n\t\t\t\tAvailabilityZone: aws.String(config.AWSRegionAZ),\n\t\t\t},\n\t\t\tNetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{\n\t\t\t\t{\n\t\t\t\t\tDeviceIndex: aws.Int64(0),\n\t\t\t\t\tAssociatePublicIpAddress: aws.Bool(true),\n\t\t\t\t\tGroups: aws.StringSlice(config.AWSSecurityGroups),\n\t\t\t\t},\n\t\t\t},\n\t\t\tTagSpecifications: []*ec2.TagSpecification{\n\t\t\t\t{\n\t\t\t\t\tResourceType: aws.String(\"instance\"),\n\t\t\t\t\tTags: []*ec2.Tag{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: aws.String(\"Name\"),\n\t\t\t\t\t\t\tValue: aws.String(nodeBaseName),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: aws.String(\"CICD\"),\n\t\t\t\t\t\t\tValue: aws.String(config.AWSCICDInstanceTag),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\treservation, err := ec2Client.SVC.RunInstances(runInstancesInput)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// instead of waiting on each node pool to complete provisioning, add to a queue and check run status later\n\t\trunningReservations = append(runningReservations, reservation)\n\t\treservationConfigs = append(reservationConfigs, config)\n\t}\n\n\tfor i := 0; i < len(quantityPerPool); i++ {\n\t\tvar listOfInstanceIds []*string\n\n\t\tfor _, instance := range runningReservations[i].Instances {\n\t\t\tlistOfInstanceIds = append(listOfInstanceIds, instance.InstanceId)\n\t\t}\n\n\t\t//wait until instance is running\n\t\terr = ec2Client.SVC.WaitUntilInstanceRunning(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//wait until instance status is ok\n\t\terr = ec2Client.SVC.WaitUntilInstanceStatusOk(&ec2.DescribeInstanceStatusInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// describe instance to get attributes\n\t\tdescribe, err := ec2Client.SVC.DescribeInstances(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treadyInstances := describe.Reservations[0].Instances\n\n\t\tsshKey, err := nodes.GetSSHKey(reservationConfigs[i].AWSSSHKeyName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, readyInstance := range readyInstances {\n\t\t\tec2Node := &nodes.Node{\n\t\t\t\tNodeID: *readyInstance.InstanceId,\n\t\t\t\tPublicIPAddress: *readyInstance.PublicIpAddress,\n\t\t\t\tPrivateIPAddress: *readyInstance.PrivateIpAddress,\n\t\t\t\tSSHUser: reservationConfigs[i].AWSUser,\n\t\t\t\tSSHKey: sshKey,\n\t\t\t}\n\t\t\t// re-reverse the list so that the order is corrected\n\t\t\tec2Nodes = append([]*nodes.Node{ec2Node}, ec2Nodes...)\n\t\t}\n\t}\n\n\tclient.Session.RegisterCleanupFunc(func() error {\n\t\treturn DeleteNodes(client, ec2Nodes)\n\t})\n\n\treturn ec2Nodes, nil\n}", "func (config *AppConfig) CreateNodeAllocations(newNodeAllocations AllocationAttributes, nodeID int) (err error) {\n\tendpoint := fmt.Sprintf(\"nodes/%d/allocations\", nodeID)\n\n\tnewNodeAllocBytes, err := json.Marshal(newNodeAllocations)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// get json bytes from the panel.\n\t_, err = config.queryApplicationAPI(endpoint, \"post\", newNodeAllocBytes)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (r *Reconciler) createResource(ctx context.Context, resourceName string, serverClient k8sclient.Client) (runtime.Object, error) {\n\tif r.extraParams == nil {\n\t\tr.extraParams = map[string]string{}\n\t}\n\tr.extraParams[\"MonitoringKey\"] = r.Config.GetLabelSelector()\n\tr.extraParams[\"Namespace\"] = r.Config.GetOperatorNamespace()\n\n\ttemplateHelper := NewTemplateHelper(r.extraParams)\n\tresource, err := templateHelper.CreateResource(resourceName)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"createResource failed: %w\", err)\n\t}\n\n\tmetaObj, err := meta.Accessor(resource)\n\tif err == nil {\n\t\towner.AddIntegreatlyOwnerAnnotations(metaObj, r.installation)\n\t}\n\n\terr = serverClient.Create(ctx, resource)\n\tif err != nil {\n\t\tif !k8serr.IsAlreadyExists(err) {\n\t\t\treturn nil, fmt.Errorf(\"error creating resource: %w\", err)\n\t\t}\n\t}\n\n\treturn resource, nil\n}", "func (c *VrouterNode) Create(contrailClient contrailclient.ApiClient) error {\n\tvrouterInfoLog.Printf(\"Creating %s %s\", c.Hostname, nodeType)\n\tgscObjects := []*contrailtypes.GlobalSystemConfig{}\n\tgscObjectsList, err := contrailClient.List(\"global-system-config\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(gscObjectsList) == 0 {\n\t\tvrouterInfoLog.Println(\"no gscObject\")\n\t}\n\n\tfor _, gscObject := range gscObjectsList {\n\t\tobj, err := contrailClient.ReadListResult(\"global-system-config\", &gscObject)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgscObjects = append(gscObjects, obj.(*contrailtypes.GlobalSystemConfig))\n\t}\n\tfor _, gsc := range gscObjects {\n\t\tvirtualRouter := &contrailtypes.VirtualRouter{}\n\t\tvirtualRouter.SetVirtualRouterIpAddress(c.IPAddress)\n\t\tvirtualRouter.SetParent(gsc)\n\t\tvirtualRouter.SetName(c.Hostname)\n\t\tannotations := contrailclient.ConvertMapToContrailKeyValuePairs(c.Annotations)\n\t\tvirtualRouter.SetAnnotations(&annotations)\n\t\tif err := contrailClient.Create(virtualRouter); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn c.ensureVMIVhost0Interface(contrailClient)\n}", "func createLBRPNode(node *k8sNode) error {\n\tlog.Debugf(\"Creating %s\", k8switchName)\n\n\t// port connected to br0\n\ttoStack := k8switch.Ports{Name: \"toStack\"}\n\n\t// port connected to physical nic (through k8sfilter)\n\ttoNodePort := k8switch.Ports{Name: \"toNodePort\", Type_: \"NODEPORT\"}\n\n\tports := []k8switch.Ports{toStack, toNodePort}\n\n\tserviceClusterIPRange := os.Getenv(\"POLYCUBE_SERVICE_CLUSTERIP_RANGE\")\n\tif serviceClusterIPRange == \"\" {\n\t\tlog.Warningf(\"POLYCUBE_SERVICE_CLUSTERIP_RANGE not found, defaulting to %s\",\n\t\tserviceClusterIPRangeDefault)\n\t\t\tserviceClusterIPRange = serviceClusterIPRangeDefault\n\t}\n\n\tlb := k8switch.K8switch{\n\t\tName: k8switchName,\n\t\tPorts: ports,\n\t\tClusterIpSubnet: serviceClusterIPRange,\n\t\tClientSubnet: node.GetPodCIDR().String(),\n\t\tVirtualClientSubnet: node.GetVPodCIDR().String()}\n\n\tif _, err := k8switchAPI.CreateK8switchByID(k8switchName, lb); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Debugf(\"%s created\", k8switchName)\n\treturn nil\n}", "func (nc *NodeController) Create(r types.Resource) (err error) {\n\tn, err := assertNode(r)\n\tif err != nil {\n\t\treturn\n\t}\n\targs := make(map[string]interface{})\n\tq := \"WITH \" + nc.newNode(n, args) + \",\" + nc.newLinks(n, args) + \",\" + nc.newNodeMetric(n, args) + \" \" + selectNode(\"new_node\", nc.db.table(\"nodes\"), \"new_links\", \"new_node_metric\", \"\")\n\tstmt, err := nc.db.PrepareNamed(q)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = stmt.Get(n, args)\n\treturn\n}", "func (m *ManagedNodeGroupResourceSet) AddAllResources() error {\n\tm.resourceSet.template.Description = fmt.Sprintf(\n\t\t\"%s (SSH access: %v) %s\",\n\t\t\"EKS Managed Nodes\",\n\t\tapi.IsEnabled(m.nodeGroup.SSH.Allow),\n\t\t\"[created by eksctl]\")\n\n\tm.template.Mappings[servicePrincipalPartitionMapName] = servicePrincipalPartitionMappings\n\n\tvar nodeRole *gfnt.Value\n\tif m.nodeGroup.IAM.InstanceRoleARN == \"\" {\n\t\tif err := createRole(m.resourceSet, m.nodeGroup.IAM, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tnodeRole = gfnt.MakeFnGetAttString(cfnIAMInstanceRoleName, \"Arn\")\n\t} else {\n\t\tnodeRole = gfnt.NewString(m.nodeGroup.IAM.InstanceRoleARN)\n\t}\n\n\tsubnets, err := AssignSubnets(m.nodeGroup.AvailabilityZones, m.clusterStackName, m.clusterConfig, m.nodeGroup.PrivateNetworking)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tscalingConfig := gfneks.Nodegroup_ScalingConfig{}\n\tif m.nodeGroup.MinSize != nil {\n\t\tscalingConfig.MinSize = gfnt.NewInteger(*m.nodeGroup.MinSize)\n\t}\n\tif m.nodeGroup.MaxSize != nil {\n\t\tscalingConfig.MaxSize = gfnt.NewInteger(*m.nodeGroup.MaxSize)\n\t}\n\tif m.nodeGroup.DesiredCapacity != nil {\n\t\tscalingConfig.DesiredSize = gfnt.NewInteger(*m.nodeGroup.DesiredCapacity)\n\t}\n\tmanagedResource := &gfneks.Nodegroup{\n\t\tClusterName: gfnt.NewString(m.clusterConfig.Metadata.Name),\n\t\tNodegroupName: gfnt.NewString(m.nodeGroup.Name),\n\t\tScalingConfig: &scalingConfig,\n\t\tSubnets: subnets,\n\t\t// Currently the API supports specifying only one instance type\n\t\tInstanceTypes: gfnt.NewStringSlice(m.nodeGroup.InstanceType),\n\t\tAmiType: gfnt.NewString(getAMIType(m.nodeGroup.InstanceType)),\n\t\tNodeRole: nodeRole,\n\t\tLabels: m.nodeGroup.Labels,\n\t\tTags: m.nodeGroup.Tags,\n\t}\n\n\tif api.IsEnabled(m.nodeGroup.SSH.Allow) {\n\t\tmanagedResource.RemoteAccess = &gfneks.Nodegroup_RemoteAccess{\n\t\t\tEc2SshKey: gfnt.NewString(*m.nodeGroup.SSH.PublicKeyName),\n\t\t\tSourceSecurityGroups: gfnt.NewStringSlice(m.nodeGroup.SSH.SourceSecurityGroupIDs...),\n\t\t}\n\t}\n\tif m.nodeGroup.VolumeSize != nil {\n\t\tmanagedResource.DiskSize = gfnt.NewInteger(*m.nodeGroup.VolumeSize)\n\t}\n\n\tm.newResource(\"ManagedNodeGroup\", managedResource)\n\n\treturn nil\n}", "func newServiceNode(port int, httpport int, wsport int, modules ...string) (*node.Node, error) {\n\tcfg := &node.DefaultConfig\n\tcfg.P2P.ListenAddr = fmt.Sprintf(\":%d\", port)\n\tcfg.P2P.EnableMsgEvents = true\n\tcfg.P2P.NoDiscovery = true\n\tcfg.IPCPath = ipcpath\n\tcfg.DataDir = fmt.Sprintf(\"%s%d\", datadirPrefix, port)\n\tif httpport > 0 {\n\t\tcfg.HTTPHost = node.DefaultHTTPHost\n\t\tcfg.HTTPPort = httpport\n\t}\n\tif wsport > 0 {\n\t\tcfg.WSHost = node.DefaultWSHost\n\t\tcfg.WSPort = wsport\n\t\tcfg.WSOrigins = []string{\"*\"}\n\t\tfor i := 0; i < len(modules); i++ {\n\t\t\tcfg.WSModules = append(cfg.WSModules, modules[i])\n\t\t}\n\t}\n\tstack, err := node.New(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ServiceNode create fail: %v\", err)\n\t}\n\treturn stack, nil\n}", "func CreateDescribeNodeToolExecutionHistoriesRequest() (request *DescribeNodeToolExecutionHistoriesRequest) {\n\trequest = &DescribeNodeToolExecutionHistoriesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Cassandra\", \"2019-01-01\", \"DescribeNodeToolExecutionHistories\", \"Cassandra\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func newDeploymentNode(nodeName string, node v1alpha1.ElasticsearchNode, cluster *v1alpha1.Elasticsearch, roleMap map[v1alpha1.ElasticsearchNodeRole]bool) NodeTypeInterface {\n\tdeploymentNode := deploymentNode{}\n\n\tdeploymentNode.populateReference(nodeName, node, cluster, roleMap, int32(1))\n\n\treturn &deploymentNode\n}", "func MakeTopology() Topology {\n\treturn Topology{\n\t\tNodes: map[string]Node{},\n\t}\n}", "func makeTopologyList(rep Reporter) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar (\n\t\t\trpt = rep.Report()\n\t\t\ttopologies = []APITopologyDesc{}\n\t\t)\n\t\tfor name, def := range topologyRegistry {\n\t\t\tif def.parent != \"\" {\n\t\t\t\tcontinue // subtopology, don't show at top level\n\t\t\t}\n\t\t\tsubTopologies := []APITopologyDesc{}\n\t\t\tfor subName, subDef := range topologyRegistry {\n\t\t\t\tif subDef.parent == name {\n\t\t\t\t\tsubTopologies = append(subTopologies, APITopologyDesc{\n\t\t\t\t\t\tName: subDef.human,\n\t\t\t\t\t\tURL: \"/api/topology/\" + subName,\n\t\t\t\t\t\tStats: stats(subDef.renderer.Render(rpt)),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\ttopologies = append(topologies, APITopologyDesc{\n\t\t\t\tName: def.human,\n\t\t\t\tURL: \"/api/topology/\" + name,\n\t\t\t\tSubTopologies: subTopologies,\n\t\t\t\tStats: stats(def.renderer.Render(rpt)),\n\t\t\t})\n\t\t}\n\t\trespondWith(w, http.StatusOK, topologies)\n\t}\n}", "func testTrafficMapIssue2783() map[string]*graph.Node {\n\ttrafficMap := make(map[string]*graph.Node)\n\n\tn0, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"a\", \"testNamespace\", \"a-v1\", \"a\", \"v1\", graph.GraphTypeVersionedApp)\n\n\tn1, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", graph.Unknown, graph.Unknown, graph.Unknown, graph.Unknown, graph.GraphTypeVersionedApp)\n\n\tn2, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", \"testNamespace\", \"b-v1\", \"b\", \"v1\", graph.GraphTypeVersionedApp)\n\n\ttrafficMap[n0.ID] = n0\n\ttrafficMap[n1.ID] = n1\n\ttrafficMap[n2.ID] = n2\n\n\tn0.AddEdge(n1)\n\tn1.AddEdge(n2)\n\n\treturn trafficMap\n}", "func NewTapestryNode(node RemoteNode) *Node {\n\tserverOptions := []grpc.ServerOption{}\n\t// Uncomment for xtrace\n\t// serverOptions = append(serverOptions, grpc.UnaryInterceptor(util.XTraceServerInterceptor))\n\tn := new(Node)\n\n\tn.node = node\n\tn.table = NewRoutingTable(node)\n\tn.backpointers = NewBackpointers(node)\n\tn.locationsByKey = NewLocationMap()\n\tn.blobstore = NewBlobStore()\n\tn.server = grpc.NewServer(serverOptions...)\n\n\treturn n\n}", "func (r *registry) makeTopologyList(rep Reporter) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tvar (\n\t\t\trpt = rep.Report()\n\t\t\ttopologies = []APITopologyDesc{}\n\t\t)\n\t\tr.walk(func(desc APITopologyDesc) {\n\t\t\trenderer := renderedForRequest(req, desc)\n\t\t\tdesc.Stats = decorateWithStats(rpt, renderer)\n\t\t\tfor i := range desc.SubTopologies {\n\t\t\t\trenderer := renderedForRequest(req, desc.SubTopologies[i])\n\t\t\t\tdesc.SubTopologies[i].Stats = decorateWithStats(rpt, renderer)\n\t\t\t}\n\t\t\ttopologies = append(topologies, desc)\n\t\t})\n\t\trespondWith(w, http.StatusOK, topologies)\n\t}\n}", "func (ot *openTelemetryWrapper) newResource(\n\twebEngineName,\n\twebEngineVersion string,\n) (*resource.Resource, error) {\n\treturn resource.Merge(resource.Default(), resource.NewSchemaless(\n\t\tsemconv.WebEngineName(webEngineName),\n\t\tsemconv.WebEngineVersion(webEngineVersion),\n\t))\n}", "func newResource(tm unversioned.TypeMetadata) (unversioned.Resource, error) {\n\trh, ok := resourceToType[tm]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Unknown resource type (%s) and/or version (%s)\", tm.Kind, tm.APIVersion)\n\t}\n\tlog.Debugf(\"Found resource helper: %s\", rh)\n\n\t// Create new resource and fill in the type metadata.\n\tnew := reflect.New(rh)\n\telem := new.Elem()\n\telem.FieldByName(\"Kind\").SetString(tm.GetTypeMetadata().Kind)\n\telem.FieldByName(\"APIVersion\").SetString(tm.GetTypeMetadata().APIVersion)\n\n\treturn new.Interface().(unversioned.Resource), nil\n}", "func NewNode(ctx *pulumi.Context,\n\tname string, args *NodeArgs, opts ...pulumi.ResourceOption) (*Node, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AcceleratorType == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AcceleratorType'\")\n\t}\n\tif args.TensorflowVersion == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TensorflowVersion'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"location\",\n\t\t\"project\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Node\n\terr := ctx.RegisterResource(\"google-native:tpu/v1:Node\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (cm *ClusterManager) GetTopologyNodes(ctx context.Context,\n\treq *cmproto.GetTopologyNodesRequest, resp *cmproto.GetTopologyNodesResponse) error {\n\treqID, err := requestIDFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := time.Now()\n\tla := thirdparty.NewGetTopoNodesAction()\n\tla.Handle(ctx, req, resp)\n\tmetrics.ReportAPIRequestMetric(\"GetTopologyNodes\", \"grpc\", strconv.Itoa(int(resp.Code)), start)\n\tblog.V(3).Infof(\"reqID: %s, action: GetTopologyNodes, req %v\", reqID, req)\n\treturn nil\n}", "func NewResource(k8s *k8s.Client, res string) (Resource, error) {\n\tvar err error\n\tr := resource{\n\t\tk8s: k8s,\n\t\tNamespace: defaultNamespace,\n\t\tType: TypePod,\n\t}\n\tchunks := strings.Split(res, \"/\")\n\tnbc := len(chunks)\n\tif nbc == 1 {\n\t\t// Z: the pod \"Z\" in namespace \"default\"\n\t\tr.Name = chunks[0]\n\t} else if nbc == 2 {\n\t\t// Y/Z: all the pods of the resource \"Z\" of type \"Y\" in namespace \"default\"\n\t\tr.Type, err = strTypeToConst(chunks[0])\n\t\tr.Name = chunks[1]\n\t} else if nbc == 3 {\n\t\t// X/Y/Z: all the pods of the resource \"Z\" of type \"Y\" in namespace \"X\"\n\t\tr.Namespace = chunks[0]\n\t\tr.Type, err = strTypeToConst(chunks[1])\n\t\tr.Name = chunks[2]\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn types[r.Type](r), nil\n\t// var ret Resource\n\t// switch r.Type {\n\t// case TypePod:\n\t// \tret = &Pod{r}\n\t// case TypeDeploy:\n\t// \tret = &Deployment{r}\n\t// case TypeStatefulSet:\n\t// \tret = &StatefulSet{r}\n\t// }\n\t// return ret, nil\n}", "func NewNode(name string, w Worker) *Node {\n\tid := getID()\n\tn := &Node{id: id, w: w, name: name}\n\tn.chained = make(map[string]struct{})\n\tn.close = make(chan struct{})\n\treturn n\n}", "func CreateAllOperatorResources(args *FactoryArgs) ([]runtime.Object, error) {\n\tvar resources []runtime.Object\n\tfor group := range operatorFactoryFunctions {\n\t\trs, err := CreateOperatorResourceGroup(group, args)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, rs...)\n\t}\n\treturn resources, nil\n}", "func newNode() *topicNode {\n\treturn &topicNode{\n\t\tchildren: children{},\n\t\tclients: make(clientOpts),\n\t\tshared: make(map[string]clientOpts),\n\t}\n}", "func NewNodePool(n v1.Node) (*NodePool, error) {\n\tnp := &NodePool{}\n\tvar err error\n\tnp.project, err = metadata.ProjectID()\n\tif err != nil {\n\t\treturn np, errors.Wrap(err, \"Could not get project id from metadata\")\n\t}\n\n\tnp.zone, err = metadata.Zone()\n\tif err != nil {\n\t\treturn np, errors.Wrap(err, \"Could not get zone from metadata\")\n\t}\n\n\tctx := context.Background()\n\tclient, err := google.DefaultClient(ctx, compute.ComputeScope, container.CloudPlatformScope)\n\tif err != nil {\n\t\treturn np, errors.Wrap(err, \"Could not create google default client\")\n\t}\n\n\tig, err := np.nodeInstanceGroup(n, client)\n\tif err != nil {\n\t\treturn np, err\n\t}\n\tnp.instanceGroup = ig\n\n\tcmpService, err := compute.New(client)\n\tif err != nil {\n\t\treturn np, errors.Wrap(err, \"Could not create compute service\")\n\t}\n\tnp.instanceGroupService = compute.NewInstanceGroupManagersService(cmpService)\n\n\tlog.Printf(\"[Info][NewNodePool] Connected to nodepool: %#v\", np)\n\n\treturn np, nil\n}", "func NewNodeCommand(clientset kubernetes.Clientset) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"node\",\n\t\tShort: \"Manage Swarm nodes\",\n\t\tRunE: cmd.ShowHelp(),\n\t}\n\tcmd.AddCommand(\n\t\tnewListCommand(clientset),\n\t)\n\treturn cmd\n}", "func NewNode(ctx *pulumi.Context,\n\tname string, args *NodeArgs, opts ...pulumi.ResourceOption) (*Node, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AcceleratorType == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AcceleratorType'\")\n\t}\n\tif args.TensorflowVersion == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TensorflowVersion'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Node\n\terr := ctx.RegisterResource(\"gcp:tpu/node:Node\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func createNewNodeNetworkObject(writer *bufio.Writer, sourceOsmNode *osm.Node) {\n\ttags := sourceOsmNode.TagMap()\n\n\t// Punktnetzwerk 'Fahrrad'\n\tnewOsmNode := *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found := tags[\"icn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t} else {\n\t\trefValue, found = tags[\"ncn_ref\"]\n\t\tif found {\n\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t} else {\n\t\t\trefValue, found = tags[\"rcn_ref\"]\n\t\t\tif found {\n\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t} else {\n\t\t\t\trefValue, found = tags[\"lcn_ref\"]\n\t\t\t\tif found {\n\t\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Punktnetzwerk 'Wandern'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"iwn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t} else {\n\t\trefValue, found = tags[\"nwn_ref\"]\n\t\tif found {\n\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t} else {\n\t\t\trefValue, found = tags[\"rwn_ref\"]\n\t\t\tif found {\n\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t} else {\n\t\t\t\trefValue, found = tags[\"lwn_ref\"]\n\t\t\t\tif found {\n\t\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Punktnetzwerk 'Inline-Skaten'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rin_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_inline_skates\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Reiten'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rhn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_horse\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Kanu'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rpn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_canoe\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Motorboot'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rmn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_motorboat\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n}", "func newReplicaSet(name, namespace string, replicas int32, podLabels map[string]string, imageName, image string) *appsv1.ReplicaSet {\n\treturn &appsv1.ReplicaSet{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"ReplicaSet\",\n\t\t\tAPIVersion: \"apps/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t},\n\t\tSpec: appsv1.ReplicaSetSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: podLabels,\n\t\t\t},\n\t\t\tReplicas: &replicas,\n\t\t\tTemplate: apiv1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: podLabels,\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PodSpec{\n\t\t\t\t\tContainers: []apiv1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: imageName,\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tSecurityContext: &apiv1.SecurityContext{},\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}", "func resourceVolterraNetworkPolicyRule() *schema.Resource {\n\treturn &schema.Resource{\n\t\tCreate: resourceVolterraNetworkPolicyRuleCreate,\n\t\tRead: resourceVolterraNetworkPolicyRuleRead,\n\t\tUpdate: resourceVolterraNetworkPolicyRuleUpdate,\n\t\tDelete: resourceVolterraNetworkPolicyRuleDelete,\n\n\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\"annotations\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"description\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"disable\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"labels\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"name\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tForceNew: true,\n\t\t\t},\n\n\t\t\t\"namespace\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tForceNew: true,\n\t\t\t},\n\n\t\t\t\"action\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"advanced_action\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"action\": {\n\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\tOptional: true,\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\t\"label_matcher\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"keys\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t\"ports\": {\n\n\t\t\t\tType: schema.TypeList,\n\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t\"protocol\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"ip_prefix_set\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"ref\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\"kind\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tComputed: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"name\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"namespace\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"tenant\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\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\t\"prefix\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"ipv6_prefix\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"prefix\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t\"prefix_selector\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"expressions\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func (c *VrouterNode) Create(contrailClient ApiClient) error {\n\tgscObjects := []*contrailTypes.GlobalSystemConfig{}\n\tgscObjectsList, err := contrailClient.List(\"global-system-config\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(gscObjectsList) == 0 {\n\t\tfmt.Println(\"no gscObject\")\n\t}\n\n\tfor _, gscObject := range gscObjectsList {\n\t\tobj, err := contrailClient.ReadListResult(\"global-system-config\", &gscObject)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgscObjects = append(gscObjects, obj.(*contrailTypes.GlobalSystemConfig))\n\t}\n\tfor _, gsc := range gscObjects {\n\t\tvncNode := &contrailTypes.VirtualRouter{}\n\t\tvncNode.SetVirtualRouterIpAddress(c.IPAddress)\n\t\tvncNode.SetParent(gsc)\n\t\tvncNode.SetName(c.Hostname)\n\t\tif err := contrailClient.Create(vncNode); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\treturn nil\n}", "func resourceVolterraModifySite() *schema.Resource {\n\treturn &schema.Resource{\n\t\tCreate: resourceVolterraModifySiteCreate,\n\t\tRead: resourceVolterraModifySiteRead,\n\t\tUpdate: resourceVolterraModifySiteUpdate,\n\t\tDelete: resourceVolterraModifySiteDelete,\n\n\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\"annotations\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"description\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"disable\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"labels\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"name\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t},\n\n\t\t\t\"namespace\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t},\n\n\t\t\t\"address\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"bgp_peer_address\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"bgp_router_id\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"coordinates\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\t\t\t\t\t\t\"latitude\": {\n\t\t\t\t\t\t\tType: schema.TypeFloat,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"longitude\": {\n\t\t\t\t\t\t\tType: schema.TypeFloat,\n\t\t\t\t\t\t\tOptional: true,\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\t\"desired_pool_count\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"inside_nameserver\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"inside_vip\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"operating_system_version\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"volterra_software_version\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"outside_nameserver\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"outside_vip\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"site_to_site_network_type\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"site_to_site_tunnel_ip\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"tunnel_dead_timeout\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"tunnel_type\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"vip_vrrp_mode\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"volterra_software_overide\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\t\t\t\"retry\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t\tDefault: 1,\n\t\t\t},\n\t\t\t\"wait_time\": {\n\t\t\t\tType: schema.TypeInt,\n\t\t\t\tOptional: true,\n\t\t\t\tDefault: 1,\n\t\t\t},\n\t\t},\n\t}\n}", "func buildNodeTrafficMap(namespace string, n graph.Node, o graph.TelemetryOptions, client *prometheus.Client) graph.TrafficMap {\n\thttpMetric := \"istio_requests_total\"\n\tinterval := o.Namespaces[namespace].Duration\n\n\t// create map to aggregate traffic by response code\n\ttrafficMap := graph.NewTrafficMap()\n\n\t// query prometheus for request traffic in two queries:\n\t// 1) query for incoming traffic\n\tvar query string\n\tgroupBy := \"source_workload_namespace,source_workload,source_app,source_version,destination_service_namespace,destination_service_name,destination_workload_namespace,destination_workload,destination_app,destination_version,request_protocol,response_code,response_flags\"\n\tswitch n.NodeType {\n\tcase graph.NodeTypeWorkload:\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",destination_workload_namespace=\"%s\",destination_workload=\"%s\"} [%vs])) by (%s)`,\n\t\t\thttpMetric,\n\t\t\tnamespace,\n\t\t\tn.Workload,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\tgroupBy)\n\tcase graph.NodeTypeApp:\n\t\tif graph.IsOK(n.Version) {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",destination_service_namespace=\"%s\",destination_app=\"%s\",destination_version=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tn.Version,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\t} else {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",destination_service_namespace=\"%s\",destination_app=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\t}\n\tcase graph.NodeTypeService:\n\t\t// for service requests we want source reporting to capture source-reported errors. But unknown only generates destination telemetry. So\n\t\t// perform a special query just to capture [successful] request telemetry from unknown.\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",source_workload=\"unknown\",destination_service_namespace=\"%s\",destination_service_name=\"%s\"} [%vs])) by (%s)`,\n\t\t\thttpMetric,\n\t\t\tnamespace,\n\t\t\tn.Service,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\tgroupBy)\n\t\tvector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\t\tpopulateTrafficMap(trafficMap, &vector, o)\n\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_service_namespace=\"%s\",destination_service_name=\"%s\"} [%vs])) by (%s)`,\n\t\t\thttpMetric,\n\t\t\tnamespace,\n\t\t\tn.Service,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\tgroupBy)\n\tdefault:\n\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t}\n\tinVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\tpopulateTrafficMap(trafficMap, &inVector, o)\n\n\t// 2) query for outbound traffic\n\tswitch n.NodeType {\n\tcase graph.NodeTypeWorkload:\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_workload=\"%s\"} [%vs])) by (%s)`,\n\t\t\thttpMetric,\n\t\t\tnamespace,\n\t\t\tn.Workload,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\tgroupBy)\n\tcase graph.NodeTypeApp:\n\t\tif graph.IsOK(n.Version) {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_app=\"%s\",source_version=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tn.Version,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\t} else {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_app=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\t}\n\tcase graph.NodeTypeService:\n\t\tquery = \"\"\n\tdefault:\n\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t}\n\toutVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\tpopulateTrafficMap(trafficMap, &outVector, o)\n\n\t// istio component telemetry is only reported destination-side, so we must perform additional queries\n\n\tif appender.IncludeIstio(o) {\n\t\tistioNamespace := config.Get().IstioNamespace\n\n\t\t// 3) supplemental query for outbound traffic to the istio namespace\n\t\tswitch n.NodeType {\n\t\tcase graph.NodeTypeWorkload:\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",source_workload_namespace=\"%s\",source_workload=\"%s\",destination_service_namespace=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.Workload,\n\t\t\t\tistioNamespace,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\tcase graph.NodeTypeApp:\n\t\t\tif graph.IsOK(n.Version) {\n\t\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",source_workload_namespace=\"%s\",source_app=\"%s\",source_version=\"%s\",destination_service_namespace=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\t\thttpMetric,\n\t\t\t\t\tnamespace,\n\t\t\t\t\tn.App,\n\t\t\t\t\tn.Version,\n\t\t\t\t\tistioNamespace,\n\t\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\t\tgroupBy)\n\t\t\t} else {\n\t\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",source_workload_namespace=\"%s\",source_app=\"%s\",destination_service_namespace=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\t\thttpMetric,\n\t\t\t\t\tnamespace,\n\t\t\t\t\tn.App,\n\t\t\t\t\tistioNamespace,\n\t\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\t\tgroupBy)\n\t\t\t}\n\t\tcase graph.NodeTypeService:\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"destination\",destination_service_namespace=\"%s\",destination_service_name=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\thttpMetric,\n\t\t\t\tistioNamespace,\n\t\t\t\tn.Service,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\tgroupBy)\n\t\tdefault:\n\t\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t\t}\n\t\toutIstioVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\t\tpopulateTrafficMap(trafficMap, &outIstioVector, o)\n\t}\n\n\t// Section for TCP services\n\ttcpMetric := \"istio_tcp_sent_bytes_total\"\n\n\ttcpGroupBy := \"source_workload_namespace,source_workload,source_app,source_version,destination_service_namespace,destination_service_name,destination_workload_namespace,destination_workload,destination_app,destination_version,response_flags\"\n\tswitch n.NodeType {\n\tcase graph.NodeTypeWorkload:\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_workload_namespace=\"%s\",destination_workload=\"%s\"} [%vs])) by (%s)`,\n\t\t\ttcpMetric,\n\t\t\tnamespace,\n\t\t\tn.Workload,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\ttcpGroupBy)\n\tcase graph.NodeTypeApp:\n\t\tif graph.IsOK(n.Version) {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_service_namespace=\"%s\",destination_app=\"%s\",destination_version=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\ttcpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tn.Version,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\ttcpGroupBy)\n\t\t} else {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_service_namespace=\"%s\",destination_app=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\ttcpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\ttcpGroupBy)\n\t\t}\n\tcase graph.NodeTypeService:\n\t\t// TODO: Do we need to handle requests from unknown in a special way (like in HTTP above)? Not sure how tcp is reported from unknown.\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",destination_service_namespace=\"%s\",destination_service_name=\"%s\"} [%vs])) by (%s)`,\n\t\t\ttcpMetric,\n\t\t\tnamespace,\n\t\t\tn.Service,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\ttcpGroupBy)\n\tdefault:\n\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t}\n\ttcpInVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\tpopulateTrafficMapTcp(trafficMap, &tcpInVector, o)\n\n\t// 2) query for outbound traffic\n\tswitch n.NodeType {\n\tcase graph.NodeTypeWorkload:\n\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_workload=\"%s\"} [%vs])) by (%s)`,\n\t\t\ttcpMetric,\n\t\t\tnamespace,\n\t\t\tn.Workload,\n\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\ttcpGroupBy)\n\tcase graph.NodeTypeApp:\n\t\tif graph.IsOK(n.Version) {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_app=\"%s\",source_version=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\ttcpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tn.Version,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\ttcpGroupBy)\n\t\t} else {\n\t\t\tquery = fmt.Sprintf(`sum(rate(%s{reporter=\"source\",source_workload_namespace=\"%s\",source_app=\"%s\"} [%vs])) by (%s)`,\n\t\t\t\ttcpMetric,\n\t\t\t\tnamespace,\n\t\t\t\tn.App,\n\t\t\t\tint(interval.Seconds()), // range duration for the query\n\t\t\t\ttcpGroupBy)\n\t\t}\n\tcase graph.NodeTypeService:\n\t\tquery = \"\"\n\tdefault:\n\t\tgraph.Error(fmt.Sprintf(\"NodeType [%s] not supported\", n.NodeType))\n\t}\n\ttcpOutVector := promQuery(query, time.Unix(o.QueryTime, 0), client.API())\n\tpopulateTrafficMapTcp(trafficMap, &tcpOutVector, o)\n\n\treturn trafficMap\n}", "func testTrafficMapIssue2982() map[string]*graph.Node {\n\ttrafficMap := make(map[string]*graph.Node)\n\n\tn0, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"testPodsWithTraffic\", \"testNamespace\", \"testPodsWithTraffic-v1\", \"testPodsWithTraffic\", \"v1\", graph.GraphTypeVersionedApp)\n\tn0.Metadata[\"httpIn\"] = 0.8\n\n\tn1, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", graph.Unknown, graph.Unknown, graph.Unknown, graph.Unknown, graph.GraphTypeVersionedApp)\n\n\tn2, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", \"testNamespace\", \"b-v1\", \"b\", \"v1\", graph.GraphTypeVersionedApp)\n\n\ttrafficMap[n0.ID] = n0\n\ttrafficMap[n1.ID] = n1\n\ttrafficMap[n2.ID] = n2\n\n\tn0.AddEdge(n1)\n\tn1.AddEdge(n2)\n\n\treturn trafficMap\n}", "func newFindNodeProtocol(service service.Service, rt RoutingTable) *findNodeProtocol {\n\n\tp := &findNodeProtocol{\n\t\trt: rt,\n\t\tpending: make(map[crypto.UUID]chan findNodeResults),\n\t\tingressChannel: service.RegisterDirectProtocol(protocol),\n\t\tservice: service,\n\t}\n\n\tif srv, ok := service.(localService); ok {\n\t\tp.log = srv.LocalNode().Log\n\t} else {\n\t\tp.log = log.AppLog\n\t}\n\n\tgo p.readLoop()\n\n\treturn p\n}", "func (t TopologyResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"associations\", t.Associations)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\treturn json.Marshal(objectMap)\n}", "func newResource(r interface{}) corev2.Resource {\n\treturn reflect.New(reflect.ValueOf(r).Elem().Type()).Interface().(corev2.Resource)\n}", "func createNode(id int, myConf *Config, sm *State_Machine) cluster.Server {\n\tinitNode(id, myConf, sm)\n\t//Set up details about cluster nodes form json file.\n\tserver, err := cluster.New(id, \"config/cluster_config.json\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn server\n}", "func (cc *ContrailCommand) CreateNode(host vcenter.ESXIHost) error {\n\tlog.Debug(\"Create Node:\", cc.AuthToken)\n\tnodeResource := contrailCommandNodeSync{\n\t\tResources: []*nodeResources{\n\t\t\t{\n\t\t\t\tKind: \"node\",\n\t\t\t\tData: &nodeData{\n\t\t\t\t\tNodeType: \"esxi\",\n\t\t\t\t\tUUID: host.UUID,\n\t\t\t\t\tHostname: host.Hostname,\n\t\t\t\t\tFqName: []string{\"default-global-system-config\", host.Hostname},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tjsonData, err := json.Marshal(nodeResource)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Sending Request\")\n\tresp, _, err := cc.sendRequest(\"/sync\", string(jsonData), \"POST\") //nolint: bodyclose\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Got status : \", resp.StatusCode)\n\tswitch resp.StatusCode {\n\tdefault:\n\t\treturn fmt.Errorf(\"resource creation failed, %d\", resp.StatusCode)\n\tcase 200, 201:\n\t}\n\treturn nil\n}", "func newNodes(c *Client) *nodes {\n\treturn &nodes{c}\n}", "func (o Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func New(cells ...string) *MemoryTopo {\n\tmt := &MemoryTopo{\n\t\tcells: make(map[string]*node),\n\t}\n\tmt.cells[topo.GlobalCell] = mt.newDirectory(topo.GlobalCell, nil)\n\n\tctx := context.Background()\n\tts := topo.Server{Impl: mt}\n\tfor _, cell := range cells {\n\t\tif err := ts.CreateCellInfo(ctx, cell, &topodatapb.CellInfo{\n\t\t\tRoot: \"/\",\n\t\t}); err != nil {\n\t\t\tlog.Fatalf(\"ts.CreateCellInfo(%v) failed: %v\", cell, err)\n\t\t}\n\t\tmt.cells[cell] = mt.newDirectory(cell, nil)\n\t}\n\treturn mt\n}", "func CreateOrUpdate(ctx context.Context, client client.Interface, node *libapi.Node) (*libapi.Node, error) {\n\tif node.ResourceVersion != \"\" {\n\t\treturn client.Nodes().Update(ctx, node, options.SetOptions{})\n\t}\n\n\treturn client.Nodes().Create(ctx, node, options.SetOptions{})\n}", "func resourceVolterraNetworkPolicyRuleCreate(d *schema.ResourceData, meta interface{}) error {\n\tclient := meta.(*APIClient)\n\n\tcreateMeta := &ves_io_schema.ObjectCreateMetaType{}\n\tcreateSpec := &ves_io_schema_network_policy_rule.CreateSpecType{}\n\tcreateReq := &ves_io_schema_network_policy_rule.CreateRequest{\n\t\tMetadata: createMeta,\n\t\tSpec: createSpec,\n\t}\n\n\tif v, ok := d.GetOk(\"annotations\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tcreateMeta.Annotations = ms\n\t}\n\n\tif v, ok := d.GetOk(\"description\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Description =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"disable\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Disable =\n\t\t\tv.(bool)\n\t}\n\n\tif v, ok := d.GetOk(\"labels\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tcreateMeta.Labels = ms\n\t}\n\n\tif v, ok := d.GetOk(\"name\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Name =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"namespace\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Namespace =\n\t\t\tv.(string)\n\t}\n\n\t//action\n\tif v, ok := d.GetOk(\"action\"); ok && !isIntfNil(v) {\n\n\t\tcreateSpec.Action = ves_io_schema_network_policy_rule.NetworkPolicyRuleAction(ves_io_schema_network_policy_rule.NetworkPolicyRuleAction_value[v.(string)])\n\n\t}\n\n\t//advanced_action\n\tif v, ok := d.GetOk(\"advanced_action\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.(*schema.Set).List()\n\t\tadvancedAction := &ves_io_schema_network_policy_rule.NetworkPolicyRuleAdvancedAction{}\n\t\tcreateSpec.AdvancedAction = advancedAction\n\t\tfor _, set := range sl {\n\t\t\tadvancedActionMapStrToI := set.(map[string]interface{})\n\n\t\t\tif v, ok := advancedActionMapStrToI[\"action\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tadvancedAction.Action = ves_io_schema_network_policy_rule.LogAction(ves_io_schema_network_policy_rule.LogAction_value[v.(string)])\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//label_matcher\n\tif v, ok := d.GetOk(\"label_matcher\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.(*schema.Set).List()\n\t\tlabelMatcher := &ves_io_schema.LabelMatcherType{}\n\t\tcreateSpec.LabelMatcher = labelMatcher\n\t\tfor _, set := range sl {\n\t\t\tlabelMatcherMapStrToI := set.(map[string]interface{})\n\n\t\t\tif w, ok := labelMatcherMapStrToI[\"keys\"]; ok && !isIntfNil(w) {\n\t\t\t\tls := make([]string, len(w.([]interface{})))\n\t\t\t\tfor i, v := range w.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tlabelMatcher.Keys = ls\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//ports\n\tif v, ok := d.GetOk(\"ports\"); ok && !isIntfNil(v) {\n\n\t\tls := make([]string, len(v.([]interface{})))\n\t\tfor i, v := range v.([]interface{}) {\n\t\t\tls[i] = v.(string)\n\t\t}\n\t\tcreateSpec.Ports = ls\n\n\t}\n\n\t//protocol\n\tif v, ok := d.GetOk(\"protocol\"); ok && !isIntfNil(v) {\n\n\t\tcreateSpec.Protocol =\n\t\t\tv.(string)\n\n\t}\n\n\t//remote_endpoint\n\n\tremoteEndpointTypeFound := false\n\n\tif v, ok := d.GetOk(\"ip_prefix_set\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_IpPrefixSet{}\n\t\tremoteEndpointInt.IpPrefixSet = &ves_io_schema.IpPrefixSetRefType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"ref\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\trefInt := make([]*ves_io_schema.ObjectRefType, len(sl))\n\t\t\t\tremoteEndpointInt.IpPrefixSet.Ref = refInt\n\t\t\t\tfor i, ps := range sl {\n\n\t\t\t\t\trMapToStrVal := ps.(map[string]interface{})\n\t\t\t\t\trefInt[i] = &ves_io_schema.ObjectRefType{}\n\n\t\t\t\t\trefInt[i].Kind = \"ip_prefix_set\"\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"name\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Name = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"namespace\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Namespace = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"tenant\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Tenant = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"uid\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Uid = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"prefix\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_Prefix{}\n\t\tremoteEndpointInt.Prefix = &ves_io_schema.PrefixListType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"ipv6_prefix\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.Prefix.Ipv6Prefix = ls\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"prefix\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.Prefix.Prefix = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"prefix_selector\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_PrefixSelector{}\n\t\tremoteEndpointInt.PrefixSelector = &ves_io_schema.LabelSelectorType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.PrefixSelector.Expressions = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tlog.Printf(\"[DEBUG] Creating Volterra NetworkPolicyRule object with struct: %+v\", createReq)\n\n\tcreateNetworkPolicyRuleResp, err := client.CreateObject(context.Background(), ves_io_schema_network_policy_rule.ObjectType, createReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating NetworkPolicyRule: %s\", err)\n\t}\n\td.SetId(createNetworkPolicyRuleResp.GetObjSystemMetadata().GetUid())\n\n\treturn resourceVolterraNetworkPolicyRuleRead(d, meta)\n}", "func resourceComputeRouterNatPatchCreateEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) {\n\tcurrItems, err := resourceComputeRouterNatListForPatch(d, meta)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, found, err := resourceComputeRouterNatFindNestedObjectInList(d, meta, currItems)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return error if item already created.\n\tif found != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to create RouterNat, existing object already found: %+v\", found)\n\t}\n\n\t// Return list with the resource to create appended\n\tres := map[string]interface{}{\n\t\t\"nats\": append(currItems, obj),\n\t}\n\n\treturn res, nil\n}", "func CreateDescribeNodeToolExecutionHistoriesResponse() (response *DescribeNodeToolExecutionHistoriesResponse) {\n\tresponse = &DescribeNodeToolExecutionHistoriesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (n *NodeController) New() (r types.Resource) {\n\treturn new(types.Node)\n}", "func makeNodesReconciler(cniConfigWriter *CNIConfigWriter, hostIP string) func(*corev1.NodeList) error {\n\t// reconciles a node\n\treconcileNode := func(node corev1.Node) error {\n\t\t// first get this node's IP\n\t\tnodeIP := internalIP(node)\n\t\tfmt.Printf(\"Handling node with IP: %s\\n\", nodeIP)\n\n\t\t// This is our node. We don't need to add routes, but we might need to\n\t\t// update the cni config.\n\t\tif nodeIP == hostIP {\n\t\t\tfmt.Printf(\"handling current node\\n\")\n\t\t\t// compute the current cni config inputs\n\t\t\tif err := cniConfigWriter.Write(\n\t\t\t\tComputeCNIConfigInputs(node),\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// we're done handling this node\n\t\t\treturn nil\n\t\t}\n\n\t\t// don't do anything unless there is a PodCIDR\n\t\tpodCIDR := node.Spec.PodCIDR\n\t\tif podCIDR == \"\" {\n\t\t\tfmt.Printf(\"Node %v has no CIDR, ignoring\\n\", node.Name)\n\t\t\treturn nil\n\t\t}\n\n\t\t// parse subnet\n\t\tdst, err := netlink.ParseIPNet(podCIDR)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"Node %v has CIDR %s \\n\", node.Name, podCIDR)\n\n\t\t// Check if the route exists to the other node's PodCIDR\n\t\tip := net.ParseIP(nodeIP)\n\t\trouteToDst := netlink.Route{Dst: dst, Gw: ip}\n\t\troute, err := netlink.RouteListFiltered(nl.GetIPFamily(ip), &routeToDst, netlink.RT_FILTER_DST)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Add route if not present\n\t\tif len(route) == 0 {\n\t\t\tif err := netlink.RouteAdd(&routeToDst); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfmt.Printf(\"Adding route %v \\n\", routeToDst)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// return a reconciler for all the nodes\n\treturn func(nodes *corev1.NodeList) error {\n\t\tfor _, node := range nodes.Items {\n\t\t\tif err := reconcileNode(node); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func New(opts ...Option) (*Topology, error) {\n\tcfg, err := newConfig(opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt := &Topology{\n\t\tcfg: cfg,\n\t\tfsm: newFSM(),\n\t\tchanges: make(chan description.Server),\n\t\tsubscribers: make(map[uint64]chan description.Topology),\n\t\tservers: make(map[addr.Addr]*Server),\n\t}\n\n\tif cfg.replicaSetName != \"\" {\n\t\tt.fsm.SetName = cfg.replicaSetName\n\t\tt.fsm.Kind = description.ReplicaSetNoPrimary\n\t}\n\n\tif cfg.mode == SingleMode {\n\t\tt.fsm.Kind = description.Single\n\t}\n\n\treturn t, nil\n}", "func (c *Controller) NewTrafficRoutingReconciler(roCtx *rolloutContext) (trafficrouting.TrafficRoutingReconciler, error) {\n\trollout := roCtx.rollout\n\tif rollout.Spec.Strategy.Canary.TrafficRouting == nil {\n\t\treturn nil, nil\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.Istio != nil {\n\t\tif c.IstioController.VirtualServiceInformer.HasSynced() {\n\t\t\treturn istio.NewReconciler(rollout, c.IstioController.DynamicClientSet, c.recorder, c.IstioController.VirtualServiceLister, c.IstioController.DestinationRuleLister), nil\n\t\t} else {\n\t\t\treturn istio.NewReconciler(rollout, c.IstioController.DynamicClientSet, c.recorder, nil, nil), nil\n\t\t}\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.Nginx != nil {\n\t\treturn nginx.NewReconciler(nginx.ReconcilerConfig{\n\t\t\tRollout: rollout,\n\t\t\tClient: c.kubeclientset,\n\t\t\tRecorder: c.recorder,\n\t\t\tControllerKind: controllerKind,\n\t\t\tIngressLister: c.ingressesLister,\n\t\t}), nil\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.ALB != nil {\n\t\treturn alb.NewReconciler(alb.ReconcilerConfig{\n\t\t\tRollout: rollout,\n\t\t\tClient: c.kubeclientset,\n\t\t\tRecorder: c.recorder,\n\t\t\tControllerKind: controllerKind,\n\t\t\tIngressLister: c.ingressesLister,\n\t\t})\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.SMI != nil {\n\t\treturn smi.NewReconciler(smi.ReconcilerConfig{\n\t\t\tRollout: rollout,\n\t\t\tClient: c.smiclientset,\n\t\t\tRecorder: c.recorder,\n\t\t\tControllerKind: controllerKind,\n\t\t})\n\t}\n\tif rollout.Spec.Strategy.Canary.TrafficRouting.Ambassador != nil {\n\t\tac := ambassador.NewDynamicClient(c.dynamicclientset, rollout.GetNamespace())\n\t\treturn ambassador.NewReconciler(rollout, ac, c.recorder), nil\n\t}\n\treturn nil, nil\n}", "func createNodeRoute(w http.ResponseWriter, r *http.Request) {\n\troute := \"CreateNode\"\n\n\tquery := r.URL.Query()\n\tnodeID, initAmount := query.Get(\"nodeID\"), query.Get(\"initAmount\")\n\n\thandleRoute(route, nodeID, initAmount)\n}", "func New(client api.Client, callbacks api.SyncerCallbacks, node string, watchAllNodes bool) api.Syncer {\r\n\t// Create the set of ResourceTypes required for Felix. Since the update processors\r\n\t// also cache state, we need to create individual ones per syncer rather than create\r\n\t// a common global set.\r\n\t// For BGP we always only care about affinity blocks assigned to our own particuar node.\r\n\t// However, depending on whether we are in full-mesh mode or not changes whether we want\r\n\t// to watch all Node resources or just our own.\r\n\tnodeToWatch := node\r\n\tif watchAllNodes {\r\n\t\tnodeToWatch = \"\"\r\n\t}\r\n\tresourceTypes := []watchersyncer.ResourceType{\r\n\t\t{\r\n\t\t\tListInterface: model.ResourceListOptions{Kind: apiv3.KindIPPool},\r\n\t\t\tUpdateProcessor: updateprocessors.NewIPPoolUpdateProcessor(),\r\n\t\t},\r\n\t\t{\r\n\t\t\tListInterface: model.ResourceListOptions{Kind: apiv3.KindBGPConfiguration},\r\n\t\t\tUpdateProcessor: updateprocessors.NewBGPConfigUpdateProcessor(),\r\n\t\t},\r\n\t\t{\r\n\t\t\tListInterface: model.ResourceListOptions{\r\n\t\t\t\tKind: apiv3.KindNode,\r\n\t\t\t\tName: nodeToWatch,\r\n\t\t\t},\r\n\t\t\tUpdateProcessor: updateprocessors.NewBGPNodeUpdateProcessor(),\r\n\t\t},\r\n\t\t{\r\n\t\t\tListInterface: model.ResourceListOptions{Kind: apiv3.KindBGPPeer},\r\n\t\t\tUpdateProcessor: updateprocessors.NewBGPPeerUpdateProcessor(),\r\n\t\t},\r\n\t}\r\n\t// When this syncer is used (via confd) in calico/node, it needs to know the affinity blocks\r\n\t// for that node so that it can set up the blackhole routes; in that case,\r\n\t// node is non-empty. When this syncer is used (also via confd) in\r\n\t// calico/routereflector, it has no need for affinity block information, so we skip that\r\n\t// here; in that case, node is empty.\r\n\tif node != \"\" {\r\n\t\tresourceTypes = append(resourceTypes, watchersyncer.ResourceType{\r\n\t\t\tListInterface: model.BlockAffinityListOptions{Host: node},\r\n\t\t})\r\n\t}\r\n\r\n\treturn watchersyncer.New(\r\n\t\tclient,\r\n\t\tresourceTypes,\r\n\t\tcallbacks,\r\n\t)\r\n}", "func createTopo() *topo.Server {\n\tts := memorytopo.NewServer(testCell)\n\tctx := context.Background()\n\tif err := ts.CreateKeyspace(ctx, testKeyspace, &topodatapb.Keyspace{}); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := ts.CreateShard(ctx, testKeyspace, testShard); err != nil {\n\t\tpanic(err)\n\t}\n\treturn ts\n}", "func NewNodePool(nodes []Node, alloced []string) *nodePool {\n\tnodeMap := make(map[string]Node, len(nodes))\n\tfor _, node := range nodes {\n\t\tnodeMap[node.Addr()] = node\n\t}\n\tp := &nodePool{\n\t\tnodes: nodeMap,\n\t\tallocated: make(map[string]struct{}),\n\t}\n\tfor _, alloc := range alloced {\n\t\tp.allocated[alloc] = struct{}{}\n\t}\n\treturn p\n}", "func (o FioSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (o QperfSpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v QperfSpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (g *ServiceLevelObjectiveGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewServiceLevelObjectivesApi(datadogClient)\n\n\tvar slos []datadogV1.ServiceLevelObjective\n\tresp, _, err := api.ListSLOs(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tslos = append(slos, resp.GetData()...)\n\tg.Resources = g.createResources(slos)\n\treturn nil\n}" ]
[ "0.7307852", "0.5481046", "0.51689094", "0.51133436", "0.5092512", "0.5070375", "0.50654244", "0.50550437", "0.49681288", "0.4944798", "0.49046588", "0.48953402", "0.48414528", "0.48259762", "0.48138842", "0.4809819", "0.47841248", "0.47633776", "0.47466254", "0.47246203", "0.47053877", "0.4692237", "0.46719792", "0.46555617", "0.46460685", "0.46280834", "0.46251658", "0.46082118", "0.45979464", "0.45745367", "0.45743358", "0.45705885", "0.4567995", "0.45604703", "0.45443705", "0.45040536", "0.4503565", "0.44901952", "0.4476097", "0.44760644", "0.4475593", "0.4471096", "0.4468884", "0.4445672", "0.44290075", "0.44122237", "0.44071257", "0.43909314", "0.4378531", "0.4376446", "0.43747187", "0.43722045", "0.43589255", "0.43540743", "0.4347205", "0.43310854", "0.43234923", "0.43201268", "0.43172526", "0.43091342", "0.43062347", "0.4302825", "0.4302532", "0.4295766", "0.42812923", "0.42759305", "0.427049", "0.42586026", "0.4258441", "0.42563337", "0.4239556", "0.42365643", "0.4235389", "0.4234087", "0.42333797", "0.4232348", "0.42245764", "0.42237133", "0.42220673", "0.42141747", "0.4185856", "0.41804326", "0.41803828", "0.4177519", "0.417597", "0.41631785", "0.41625118", "0.4161989", "0.41594157", "0.41560537", "0.41542998", "0.41479447", "0.41448352", "0.4144777", "0.41444087", "0.41433752", "0.4135018", "0.41292253", "0.41215858", "0.41206205" ]
0.7762249
0
CreateNodeResourceTopologies creates the NodeResourceTopology in the cluster if the CRD doesn't exists already. Returns the CRD golang object present in the cluster.
CreateNodeResourceTopologies создает NodeResourceTopology в кластере, если CRD не существует. Возвращает CRD объект golang, находящийся в кластере.
func CreateNodeResourceTopologies(ctx context.Context, extClient extclient.Interface) (*apiextensionsv1.CustomResourceDefinition, error) { crd, err := NewNodeResourceTopologies() if err != nil { return nil, err } // Delete existing CRD (if any) with this we also get rid of stale objects err = extClient.ApiextensionsV1().CustomResourceDefinitions().Delete(ctx, crd.Name, metav1.DeleteOptions{}) if err != nil && !errors.IsNotFound(err) { return nil, fmt.Errorf("failed to delete NodeResourceTopology CRD: %w", err) } // It takes time for the delete operation, wait until the CRD completely gone if err = wait.PollUntilContextTimeout(ctx, 5*time.Second, 1*time.Minute, true, func(ctx context.Context) (bool, error) { _, err = extClient.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, crd.Name, metav1.GetOptions{}) if err == nil { return false, nil } if errors.IsNotFound(err) { return true, nil } return false, err }); err != nil { return nil, fmt.Errorf("failed to get NodeResourceTopology CRD: %w", err) } return extClient.ApiextensionsV1().CustomResourceDefinitions().Create(ctx, crd, metav1.CreateOptions{}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewNodeResourceTopologies() (*apiextensionsv1.CustomResourceDefinition, error) {\n\t_, file, _, ok := runtime.Caller(0)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"cannot retrieve manifests directory\")\n\t}\n\n\tbaseDir := filepath.Dir(file)\n\tcrdPath := filepath.Clean(filepath.Join(baseDir, \"..\", \"..\", \"..\", \"deployment\", \"base\", \"noderesourcetopologies-crd\", \"noderesourcetopologies.yaml\"))\n\n\tdata, err := os.ReadFile(crdPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdecode := scheme.Codecs.UniversalDeserializer().Decode\n\tobj, _, err := decode(data, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcrd, ok := obj.(*apiextensionsv1.CustomResourceDefinition)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected type, got %t\", obj)\n\t}\n\treturn crd, nil\n}", "func GetNodeTopology(ctx context.Context, topologyClient *topologyclientset.Clientset, nodeName string) *v1alpha2.NodeResourceTopology {\n\tvar nodeTopology *v1alpha2.NodeResourceTopology\n\tvar err error\n\tgomega.EventuallyWithOffset(1, func() bool {\n\t\tnodeTopology, err = topologyClient.TopologyV1alpha2().NodeResourceTopologies().Get(ctx, nodeName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tframework.Logf(\"failed to get the node topology resource: %v\", err)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}, time.Minute, 5*time.Second).Should(gomega.BeTrue())\n\treturn nodeTopology\n}", "func NewResourceNode(networkID string, pubKey crypto.PubKey, ownerAddr sdk.AccAddress,\n\tdescription Description, nodeType string, creationTime time.Time) ResourceNode {\n\treturn ResourceNode{\n\t\tNetworkID: networkID,\n\t\tPubKey: pubKey,\n\t\tSuspend: false,\n\t\tStatus: sdk.Unbonded,\n\t\tTokens: sdk.ZeroInt(),\n\t\tOwnerAddress: ownerAddr,\n\t\tDescription: description,\n\t\tNodeType: nodeType,\n\t\tCreationTime: creationTime,\n\t}\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\tnetworkId, err := util.ParseNetworkIDAnnotation(node, zic.GetNetworkName())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get the network id for the network %s on node %s: %v\", zic.GetNetworkName(), node.Name, err)\n\t}\n\n\ttransitSwitchTunnelKey := BaseTransitSwitchTunnelKey + networkId\n\tts := &nbdb.LogicalSwitch{\n\t\tName: zic.networkTransitSwitchName,\n\t\tOtherConfig: map[string]string{\n\t\t\t\"interconn-ts\": zic.networkTransitSwitchName,\n\t\t\t\"requested-tnl-key\": strconv.Itoa(transitSwitchTunnelKey),\n\t\t\t\"mcast_snoop\": \"true\",\n\t\t\t\"mcast_flood_unregistered\": \"true\",\n\t\t},\n\t}\n\n\t// Create transit switch if it doesn't exist\n\tif err := libovsdbops.CreateOrUpdateLogicalSwitch(zic.nbClient, ts); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update transit switch %s: %w\", zic.networkTransitSwitchName, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func (nc *NodeController) Create(r types.Resource) (err error) {\n\tn, err := assertNode(r)\n\tif err != nil {\n\t\treturn\n\t}\n\targs := make(map[string]interface{})\n\tq := \"WITH \" + nc.newNode(n, args) + \",\" + nc.newLinks(n, args) + \",\" + nc.newNodeMetric(n, args) + \" \" + selectNode(\"new_node\", nc.db.table(\"nodes\"), \"new_links\", \"new_node_metric\", \"\")\n\tstmt, err := nc.db.PrepareNamed(q)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = stmt.Get(n, args)\n\treturn\n}", "func (router *Router) createResource(w http.ResponseWriter, r *http.Request) {\n\tclusterName := r.URL.Query().Get(\"cluster\")\n\tnamespace := r.URL.Query().Get(\"namespace\")\n\tname := r.URL.Query().Get(\"name\")\n\tresource := r.URL.Query().Get(\"resource\")\n\tsubResource := r.URL.Query().Get(\"subResource\")\n\tpath := r.URL.Query().Get(\"path\")\n\n\tlog.WithFields(logrus.Fields{\"cluster\": clusterName, \"namespace\": namespace, \"name\": name, \"path\": path, \"resource\": resource, \"subResource\": subResource}).Tracef(\"createResource\")\n\n\tcluster := router.clusters.GetCluster(clusterName)\n\tif cluster == nil {\n\t\terrresponse.Render(w, r, nil, http.StatusBadRequest, \"Invalid cluster name\")\n\t\treturn\n\t}\n\n\tif router.isForbidden(resource) {\n\t\terrresponse.Render(w, r, nil, http.StatusForbidden, fmt.Sprintf(\"Access for resource %s is forbidding\", resource))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not decode request body\")\n\t\treturn\n\t}\n\n\terr = cluster.CreateResource(r.Context(), namespace, name, path, resource, subResource, body)\n\tif err != nil {\n\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not create resource\")\n\t\treturn\n\t}\n\n\trender.JSON(w, r, nil)\n}", "func (r *Reconciler) createResource(ctx context.Context, resourceName string, serverClient k8sclient.Client) (runtime.Object, error) {\n\tif r.extraParams == nil {\n\t\tr.extraParams = map[string]string{}\n\t}\n\tr.extraParams[\"MonitoringKey\"] = r.Config.GetLabelSelector()\n\tr.extraParams[\"Namespace\"] = r.Config.GetOperatorNamespace()\n\n\ttemplateHelper := NewTemplateHelper(r.extraParams)\n\tresource, err := templateHelper.CreateResource(resourceName)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"createResource failed: %w\", err)\n\t}\n\n\tmetaObj, err := meta.Accessor(resource)\n\tif err == nil {\n\t\towner.AddIntegreatlyOwnerAnnotations(metaObj, r.installation)\n\t}\n\n\terr = serverClient.Create(ctx, resource)\n\tif err != nil {\n\t\tif !k8serr.IsAlreadyExists(err) {\n\t\t\treturn nil, fmt.Errorf(\"error creating resource: %w\", err)\n\t\t}\n\t}\n\n\treturn resource, nil\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func NewTerraNodeResource(node db.Node) TerraNodeResource {\n\treturn TerraNodeResource{\n\t\tJAID: NewJAIDInt32(node.ID),\n\t\tName: node.Name,\n\t\tTerraChainID: node.TerraChainID,\n\t\tTendermintURL: node.TendermintURL,\n\t\tCreatedAt: node.CreatedAt,\n\t\tUpdatedAt: node.UpdatedAt,\n\t}\n}", "func (ktdm *MasterlessTurndownStrategy) CreateOrGetHostNode() (*v1.Node, error) {\n\t// Determine if there is autoscaling node pools\n\tnodePools, err := ktdm.provider.GetNodePools()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar autoScalingNodePool cp.NodePool = nil\n\tfor _, np := range nodePools {\n\t\tif np.AutoScaling() {\n\t\t\tautoScalingNodePool = np\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// The Target Node for deployment selection\n\tvar tnode *v1.Node\n\n\t// When AutoScaling is Not Enabled, Create a Turndown Node\n\tif autoScalingNodePool == nil {\n\t\tktdm.log.Log(\"Finite node backed cluster. Creating singleton nodepool for turndown.\")\n\n\t\t// There isn't a node pool for the turndown pod, so create one\n\t\tif !ktdm.provider.IsTurndownNodePool() {\n\t\t\t// Create a new singleton node pool with a small instance capable of hosting the turndown\n\t\t\t// pod -- this implementation will create and wait for the node to exist before returning\n\t\t\terr := ktdm.provider.CreateSingletonNodePool(ktdm.nodePoolLabels)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\t// Lookup the turndown node in the kubernetes API\n\t\tnodeList, err := ktdm.client.CoreV1().Nodes().List(metav1.ListOptions{\n\t\t\tLabelSelector: provider.TurndownNodeLabelSelector,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttnode = &nodeList.Items[0]\n\t} else {\n\t\t// Otherwise, have the current pod move to autoscaling node pool\n\t\tnodeList, err := ktdm.client.CoreV1().Nodes().List(metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar targetNode *v1.Node\n\t\tfor _, node := range nodeList.Items {\n\t\t\tpoolID := ktdm.provider.GetPoolID(&node)\n\t\t\tif poolID == autoScalingNodePool.Name() {\n\t\t\t\ttargetNode = &node\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif targetNode == nil {\n\t\t\treturn nil, fmt.Errorf(\"Target node was not located for autoscaling cluster.\")\n\t\t}\n\n\t\t// Patch and get the updated node\n\t\ttnode, err = patcher.UpdateNodeLabel(ktdm.client, *targetNode, provider.TurndownNodeLabel, \"true\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Patch Node with Taint\n\treturn patcher.PatchNode(ktdm.client, *tnode, func(n *v1.Node) error {\n\t\ttaints := n.Spec.Taints\n\t\tfor _, taint := range taints {\n\t\t\tif taint.Key == MasterlessTaintKey {\n\t\t\t\treturn patcher.NoUpdates\n\t\t\t}\n\t\t}\n\n\t\tn.Spec.Taints = append(taints, v1.Taint{\n\t\t\tKey: MasterlessTaintKey,\n\t\t\tValue: \"true\",\n\t\t\tEffect: v1.TaintEffectNoSchedule,\n\t\t})\n\n\t\treturn nil\n\t})\n}", "func (cc *ContrailCommand) CreateNode(host vcenter.ESXIHost) error {\n\tlog.Debug(\"Create Node:\", cc.AuthToken)\n\tnodeResource := contrailCommandNodeSync{\n\t\tResources: []*nodeResources{\n\t\t\t{\n\t\t\t\tKind: \"node\",\n\t\t\t\tData: &nodeData{\n\t\t\t\t\tNodeType: \"esxi\",\n\t\t\t\t\tUUID: host.UUID,\n\t\t\t\t\tHostname: host.Hostname,\n\t\t\t\t\tFqName: []string{\"default-global-system-config\", host.Hostname},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tjsonData, err := json.Marshal(nodeResource)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Sending Request\")\n\tresp, _, err := cc.sendRequest(\"/sync\", string(jsonData), \"POST\") //nolint: bodyclose\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debug(\"Got status : \", resp.StatusCode)\n\tswitch resp.StatusCode {\n\tdefault:\n\t\treturn fmt.Errorf(\"resource creation failed, %d\", resp.StatusCode)\n\tcase 200, 201:\n\t}\n\treturn nil\n}", "func resourceNodeV1Create(d *schema.ResourceData, meta interface{}) error {\n\tclient, err := meta.(*Clients).GetIronicClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create the node object in Ironic\n\tcreateOpts := schemaToCreateOpts(d)\n\tresult, err := nodes.Create(client, createOpts).Extract()\n\tif err != nil {\n\t\td.SetId(\"\")\n\t\treturn err\n\t}\n\n\t// Setting the ID is what tells terraform we were successful in creating the node\n\tlog.Printf(\"[DEBUG] Node created with ID %s\\n\", d.Id())\n\td.SetId(result.UUID)\n\n\t// Create ports as part of the node object - you may also use the native port resource\n\tportSet := d.Get(\"ports\").(*schema.Set)\n\tif portSet != nil {\n\t\tportList := portSet.List()\n\t\tfor _, portInterface := range portList {\n\t\t\tport := portInterface.(map[string]interface{})\n\n\t\t\t// Terraform map can't handle bool... seriously.\n\t\t\tvar pxeEnabled bool\n\t\t\tif port[\"pxe_enabled\"] != nil {\n\t\t\t\tif port[\"pxe_enabled\"] == \"true\" {\n\t\t\t\t\tpxeEnabled = true\n\t\t\t\t} else {\n\t\t\t\t\tpxeEnabled = false\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t// FIXME: All values other than address and pxe\n\t\t\tportCreateOpts := ports.CreateOpts{\n\t\t\t\tNodeUUID: d.Id(),\n\t\t\t\tAddress: port[\"address\"].(string),\n\t\t\t\tPXEEnabled: &pxeEnabled,\n\t\t\t}\n\t\t\t_, err := ports.Create(client, portCreateOpts).Extract()\n\t\t\tif err != nil {\n\t\t\t\t_ = resourcePortV1Read(d, meta)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Make node manageable\n\tif d.Get(\"manage\").(bool) || d.Get(\"clean\").(bool) || d.Get(\"inspect\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"manage\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not manage: %s\", err)\n\t\t}\n\t}\n\n\t// Clean node\n\tif d.Get(\"clean\").(bool) {\n\t\tif err := setRAIDConfig(client, d); err != nil {\n\t\t\treturn fmt.Errorf(\"fail to set raid config: %s\", err)\n\t\t}\n\n\t\tvar cleanSteps []nodes.CleanStep\n\t\tif cleanSteps, err = buildManualCleaningSteps(d.Get(\"raid_interface\").(string), d.Get(\"raid_config\").(string), d.Get(\"bios_settings\").(string)); err != nil {\n\t\t\treturn fmt.Errorf(\"fail to build raid clean steps: %s\", err)\n\t\t}\n\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"clean\", nil, nil, cleanSteps); err != nil {\n\t\t\treturn fmt.Errorf(\"could not clean: %s\", err)\n\t\t}\n\t}\n\n\t// Inspect node\n\tif d.Get(\"inspect\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"inspect\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not inspect: %s\", err)\n\t\t}\n\t}\n\n\t// Make node available\n\tif d.Get(\"available\").(bool) {\n\t\tif err := ChangeProvisionStateToTarget(client, d.Id(), \"provide\", nil, nil, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not make node available: %s\", err)\n\t\t}\n\t}\n\n\t// Change power state, if required\n\tif targetPowerState := d.Get(\"target_power_state\").(string); targetPowerState != \"\" {\n\t\terr := changePowerState(client, d, nodes.TargetPowerState(targetPowerState))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not change power state: %s\", err)\n\t\t}\n\t}\n\n\treturn resourceNodeV1Read(d, meta)\n}", "func NetworkResourceCreate(w http.ResponseWriter, r *http.Request) {\n\tvar req openapi.NetworkResourceCreateRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\thandleError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tnetwork, err := ctr.CreateNetworkResource(&req)\n\tif err != nil {\n\t\thandleError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\thandleResult(w, http.StatusCreated, network)\n\treturn\n}", "func CreateResource(kubedata *krd.GenericKubeResourceData, kubeclient *kubernetes.Clientset) (string, error) {\n\tif kubedata.Namespace == \"\" {\n\t\tkubedata.Namespace = \"default\"\n\t}\n\n\tif _, err := os.Stat(kubedata.YamlFilePath); err != nil {\n\t\treturn \"\", pkgerrors.New(\"File \" + kubedata.YamlFilePath + \" not found\")\n\t}\n\n\tlog.Println(\"Reading deployment YAML\")\n\trawBytes, err := ioutil.ReadFile(kubedata.YamlFilePath)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Deployment YAML file read error\")\n\t}\n\n\tlog.Println(\"Decoding deployment YAML\")\n\tdecode := scheme.Codecs.UniversalDeserializer().Decode\n\tobj, _, err := decode(rawBytes, nil, nil)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Deserialize deployment error\")\n\t}\n\n\tswitch o := obj.(type) {\n\tcase *appsV1.Deployment:\n\t\tkubedata.DeploymentData = o\n\tdefault:\n\t\treturn \"\", pkgerrors.New(kubedata.YamlFilePath + \" contains another resource different than Deployment\")\n\t}\n\n\tkubedata.DeploymentData.Namespace = kubedata.Namespace\n\tkubedata.DeploymentData.Name = kubedata.InternalVNFID + \"-\" + kubedata.DeploymentData.Name\n\n\tresult, err := kubeclient.AppsV1().Deployments(kubedata.Namespace).Create(kubedata.DeploymentData)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Create Deployment error\")\n\t}\n\n\treturn result.GetObjectMeta().GetName(), nil\n}", "func (h *httpCloud) GetNodeResources(instance string) (*api.NodeResources, error) {\n\tvar resp api.NodeResources\n\tif err := h.get(h.instancesURL+path.Join(InstancesPath, instance, InstanceResourcesPath), &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &resp, nil\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\tnetworkId, err := util.ParseNetworkIDAnnotation(node, zic.GetNetworkName())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get the network id for the network %s on node %s: %v\", zic.GetNetworkName(), node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\ttransitSwitchTunnelKey := BaseTransitSwitchTunnelKey + networkId\n\tts := &nbdb.LogicalSwitch{\n\t\tName: zic.networkTransitSwitchName,\n\t\tOtherConfig: map[string]string{\n\t\t\t\"interconn-ts\": zic.networkTransitSwitchName,\n\t\t\t\"requested-tnl-key\": strconv.Itoa(transitSwitchTunnelKey),\n\t\t\t\"mcast_snoop\": \"true\",\n\t\t\t\"mcast_flood_unregistered\": \"true\",\n\t\t},\n\t}\n\n\t// Create transit switch if it doesn't exist\n\tif err := libovsdbops.CreateOrUpdateLogicalSwitch(zic.nbClient, ts); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update transit switch %s: %w\", zic.networkTransitSwitchName, err)\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func getNode(ctx context.Context, client client.Interface, nodeName string) *libapi.Node {\n\tnode, err := client.Nodes().Get(ctx, nodeName, options.GetOptions{})\n\tif err != nil {\n\t\tif _, ok := err.(cerrors.ErrorResourceDoesNotExist); !ok {\n\t\t\tlog.WithError(err).WithField(\"Name\", nodeName).Info(\"Unable to query node configuration\")\n\t\t\tlog.Warn(\"Unable to access datastore to query node configuration\")\n\t\t\tutils.Terminate()\n\t\t}\n\n\t\tlog.WithField(\"Name\", nodeName).Info(\"Building new node resource\")\n\t\tnode = libapi.NewNode()\n\t\tnode.Name = nodeName\n\t}\n\n\treturn node\n}", "func (api *nodeAPI) Create(obj *cluster.Node) error {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = apicl.ClusterV1().Node().Create(context.Background(), obj)\n\t\tif err != nil && strings.Contains(err.Error(), \"AlreadyExists\") {\n\t\t\t_, err = apicl.ClusterV1().Node().Update(context.Background(), obj)\n\n\t\t}\n\t\treturn err\n\t}\n\n\tapi.ct.handleNodeEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Created})\n\treturn nil\n}", "func (rc *ResourceCache) GetNodeResources(nodeName string) []*Resource {\n\trc.lock.Lock()\n\tdefer rc.lock.Unlock()\n\tnode, ok := rc.Nodes[nodeName]\n\tif !ok {\n\t\treturn nil\n\t}\n\tretRes := make([]*Resource, 0)\n\tfor _, r := range node.Resources {\n\t\tretRes = append(retRes, r.DeepCopy())\n\t}\n\tsort.Slice(retRes, func(i, j int) bool {\n\t\treturn retRes[i].Key() < retRes[j].Key()\n\t})\n\treturn retRes\n}", "func GetNodeObject(clientset kubernetes.Interface, hostnameOverride string) (*apiv1.Node, error) {\n\t// assuming kube-router is running as pod, first check env NODE_NAME\n\tnodeName := os.Getenv(\"NODE_NAME\")\n\tif nodeName != \"\" {\n\t\tnode, err := clientset.CoreV1().Nodes().Get(context.Background(), nodeName, metav1.GetOptions{})\n\t\tif err == nil {\n\t\t\treturn node, nil\n\t\t}\n\t}\n\n\t// if env NODE_NAME is not set then check if node is register with hostname\n\thostName, _ := os.Hostname()\n\tnode, err := clientset.CoreV1().Nodes().Get(context.Background(), hostName, metav1.GetOptions{})\n\tif err == nil {\n\t\treturn node, nil\n\t}\n\n\t// if env NODE_NAME is not set and node is not registered with hostname, then use host name override\n\tif hostnameOverride != \"\" {\n\t\tnode, err = clientset.CoreV1().Nodes().Get(context.Background(), hostnameOverride, metav1.GetOptions{})\n\t\tif err == nil {\n\t\t\treturn node, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"Failed to identify the node by NODE_NAME, hostname or --hostname-override\")\n}", "func CreateOrUpdate(ctx context.Context, client client.Interface, node *libapi.Node) (*libapi.Node, error) {\n\tif node.ResourceVersion != \"\" {\n\t\treturn client.Nodes().Update(ctx, node, options.SetOptions{})\n\t}\n\n\treturn client.Nodes().Create(ctx, node, options.SetOptions{})\n}", "func (s *ResourcesService) Create(ctx context.Context, realm, clientID string, resource *Resource) (*Resource, *http.Response, error) {\n\tu := fmt.Sprintf(\"admin/realms/%s/clients/%s/authz/resource-server/resource\", realm, clientID)\n\treq, err := s.keycloak.NewRequest(http.MethodPost, u, resource)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar created Resource\n\tres, err := s.keycloak.Do(ctx, req, &created)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &created, res, nil\n}", "func (g genericPlugin) Create(yamlFilePath string, namespace string, client plugin.KubernetesConnector) (string, error) {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\t//Decode the yaml file to create a runtime.Object\n\tunstruct := &unstructured.Unstructured{}\n\t//Ignore the returned obj as we expect the data in unstruct\n\t_, err := utils.DecodeYAML(yamlFilePath, unstruct)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Decode deployment object error\")\n\t}\n\n\tdynClient := client.GetDynamicClient()\n\tmapper := client.GetMapper()\n\n\tgvk := unstruct.GroupVersionKind()\n\tmapping, err := mapper.RESTMapping(schema.GroupKind{Group: gvk.Group, Kind: gvk.Kind}, gvk.Version)\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Mapping kind to resource error\")\n\t}\n\n\t//Add the tracking label to all resources created here\n\tlabels := unstruct.GetLabels()\n\t//Check if labels exist for this object\n\tif labels == nil {\n\t\tlabels = map[string]string{}\n\t}\n\tlabels[config.GetConfiguration().KubernetesLabelName] = client.GetInstanceID()\n\tunstruct.SetLabels(labels)\n\n\t// This checks if the resource we are creating has a podSpec in it\n\t// Eg: Deployment, StatefulSet, Job etc..\n\t// If a PodSpec is found, the label will be added to it too.\n\tplugin.TagPodsIfPresent(unstruct, client.GetInstanceID())\n\n\tgvr := mapping.Resource\n\tvar createdObj *unstructured.Unstructured\n\n\tswitch mapping.Scope.Name() {\n\tcase meta.RESTScopeNameNamespace:\n\t\tcreatedObj, err = dynClient.Resource(gvr).Namespace(namespace).Create(unstruct, metav1.CreateOptions{})\n\tcase meta.RESTScopeNameRoot:\n\t\tcreatedObj, err = dynClient.Resource(gvr).Create(unstruct, metav1.CreateOptions{})\n\tdefault:\n\t\treturn \"\", pkgerrors.New(\"Got an unknown RESTSCopeName for mapping: \" + gvk.String())\n\t}\n\n\tif err != nil {\n\t\treturn \"\", pkgerrors.Wrap(err, \"Create object error\")\n\t}\n\n\treturn createdObj.GetName(), nil\n}", "func (builder clusterDTOBuilder) getNodeResourceCapacity(clusterName string, commodityType proto.CommodityDTO_CommodityType,\n\tnodeResourceCapacityMap map[proto.CommodityDTO_CommodityType]float64) float64 {\n\tresourceCapacity, ok := nodeResourceCapacityMap[commodityType]\n\tif !ok {\n\t\tglog.Errorf(\"%s commodity does not exist in nodeResourceCapacityMap\", commodityType)\n\t\treturn 0\n\t}\n\tif resourceCapacity == 0 {\n\t\tglog.Errorf(\"%s commodity capacity from all nodes in cluster %s is 0.\", commodityType, clusterName)\n\t\treturn 0\n\t}\n\treturn resourceCapacity\n}", "func (r *ReconcileKogitoInfra) createRequiredResources(instance *v1alpha1.KogitoInfra) (resources map[reflect.Type][]resource.KubernetesResource, err error) {\n\tresourcesInfinispan, err := infinispan.CreateRequiredResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKafka, err := kafka.CreateRequiredResources(instance)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKeycloak, err := keycloak.CreateRequiredResources(instance)\n\tif err != nil {\n\t\treturn\n\t}\n\tresources = make(map[reflect.Type][]resource.KubernetesResource, len(resourcesInfinispan)+len(resourcesKafka)+len(resourcesKeycloak))\n\tmergeResourceMaps(resources, resourcesKafka, resourcesInfinispan, resourcesKeycloak)\n\treturn\n}", "func (ktdm *StandardTurndownStrategy) CreateOrGetHostNode() (*v1.Node, error) {\n\t// Locate the master node using role labels\n\tnodeList, err := ktdm.client.CoreV1().Nodes().List(metav1.ListOptions{\n\t\tLabelSelector: MasterNodeLabelKey,\n\t})\n\tif err != nil || len(nodeList.Items) == 0 {\n\t\t// Try an alternate selector in case the first fails\n\t\tnodeList, err = ktdm.client.CoreV1().Nodes().List(metav1.ListOptions{\n\t\t\tLabelSelector: fmt.Sprintf(\"%s=master\", NodeRoleLabelKey),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(nodeList.Items) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"Failed to locate master node in standard turndown strategy.\")\n\t\t}\n\t}\n\n\t// Pick a master node\n\tmasterNode := &nodeList.Items[0]\n\n\t// Patch and get the updated node\n\treturn patcher.UpdateNodeLabel(ktdm.client, *masterNode, provider.TurndownNodeLabel, \"true\")\n}", "func (client RoverClusterClient) createRoverCluster(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodPost, \"/roverClusters\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response CreateRoverClusterResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/rover/20201210/RoverCluster/CreateRoverCluster\"\n\t\terr = common.PostProcessServiceError(err, \"RoverCluster\", \"CreateRoverCluster\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (r *ResourceInfo) Get(brief bool) (apistructs.ClusterResourceInfoData, error) {\n\tpodLi := &v1.PodList{Items: nil}\n\tif !brief {\n\t\tvar err error\n\t\tpodLi, err = r.podUtil.ListAllNamespace([]string{\"status.phase!=Succeeded\", \"status.phase!=Failed\"})\n\t\tif err != nil {\n\t\t\treturn apistructs.ClusterResourceInfoData{}, nil\n\t\t}\n\t}\n\n\tnodeList, err := r.cs.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})\n\tif err != nil {\n\t\tlogrus.Errorf(\"failed to list nodes: %v\", err)\n\t\treturn apistructs.ClusterResourceInfoData{}, nil\n\t}\n\n\tpodMap := splitPodsByNodeName(podLi)\n\tnodeResourceInfoMap := make(map[string]*apistructs.NodeResourceInfo)\n\n\tfor _, node := range nodeList.Items {\n\t\tvar ip net.IP\n\t\tfor _, addr := range node.Status.Addresses {\n\t\t\tif addr.Type == v1.NodeInternalIP {\n\t\t\t\tip = net.ParseIP(addr.Address)\n\t\t\t}\n\t\t}\n\t\tif ip == nil {\n\t\t\t// ignore, if internalIP not found\n\t\t\tcontinue\n\t\t}\n\t\tnodeResourceInfoMap[ip.String()] = &apistructs.NodeResourceInfo{}\n\t\tinfo := nodeResourceInfoMap[ip.String()]\n\t\tinfo.Labels = nodeLabels(&node)\n\t\tinfo.Ready = nodeReady(&node)\n\t\tcpuAllocatable, err := strconv.ParseFloat(fmt.Sprintf(\"%f\", node.Status.Allocatable.Cpu().AsDec()), 64)\n\t\tif err != nil {\n\t\t\treturn apistructs.ClusterResourceInfoData{}, err\n\t\t}\n\t\tmemAllocatable, _ := node.Status.Allocatable.Memory().AsInt64()\n\t\tinfo.CPUAllocatable = cpuAllocatable\n\t\tinfo.MemAllocatable = memAllocatable\n\t\tpods := podMap[node.Name]\n\t\tpodlist := &v1.PodList{Items: pods}\n\t\treqs, limits := getPodsTotalRequestsAndLimits(podlist)\n\t\tcpuReqs, cpuLimit, memReqs, memLimit := reqs[v1.ResourceCPU], limits[v1.ResourceCPU], reqs[v1.ResourceMemory], limits[v1.ResourceMemory]\n\t\tcpuReqsNum, err := strconv.ParseFloat(fmt.Sprintf(\"%f\", cpuReqs.AsDec()), 64)\n\t\tif err != nil {\n\t\t\treturn apistructs.ClusterResourceInfoData{}, err\n\t\t}\n\t\tmemReqsNum, _ := memReqs.AsInt64()\n\t\tcpuLimitNum, err := strconv.ParseFloat(fmt.Sprintf(\"%f\", cpuLimit.AsDec()), 64)\n\t\tif err != nil {\n\t\t\treturn apistructs.ClusterResourceInfoData{}, err\n\t\t}\n\t\tmemLimitNum, _ := memLimit.AsInt64()\n\t\tinfo.CPUReqsUsage = cpuReqsNum\n\t\tinfo.CPULimitUsage = cpuLimitNum\n\t\tinfo.MemReqsUsage = memReqsNum\n\t\tinfo.MemLimitUsage = memLimitNum\n\t}\n\n\treturn apistructs.ClusterResourceInfoData{Nodes: nodeResourceInfoMap}, nil\n}", "func DescribeNodeResource(nodeNonTerminatedPodsList *corev1.PodList, node *corev1.Node) *NodeUsage {\n\tallocatable := node.Status.Capacity\n\tif len(node.Status.Allocatable) > 0 {\n\t\tallocatable = node.Status.Allocatable\n\t}\n\n\treqs, limits := getPodsTotalRequestsAndLimits(nodeNonTerminatedPodsList)\n\tcpuReqs, cpuLimits, memoryReqs, memoryLimits, ephemeralstorageReqs, ephemeralstorageLimits :=\n\t\treqs[corev1.ResourceCPU], limits[corev1.ResourceCPU], reqs[corev1.ResourceMemory], limits[corev1.ResourceMemory], reqs[corev1.ResourceEphemeralStorage], limits[corev1.ResourceEphemeralStorage]\n\tfractionCpuReqs := float64(0)\n\tfractionCpuLimits := float64(0)\n\tif allocatable.Cpu().MilliValue() != 0 {\n\t\tfractionCpuReqs = float64(cpuReqs.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t\tfractionCpuLimits = float64(cpuLimits.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t}\n\tfractionMemoryReqs := float64(0)\n\tfractionMemoryLimits := float64(0)\n\tif allocatable.Memory().Value() != 0 {\n\t\tfractionMemoryReqs = float64(memoryReqs.Value()) / float64(allocatable.Memory().Value()) * 100\n\t\tfractionMemoryLimits = float64(memoryLimits.Value()) / float64(allocatable.Memory().Value()) * 100\n\t}\n\tfractionEphemeralStorageReqs := float64(0)\n\tfractionEphemeralStorageLimits := float64(0)\n\tif allocatable.StorageEphemeral().Value() != 0 {\n\t\tfractionEphemeralStorageReqs = float64(ephemeralstorageReqs.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t\tfractionEphemeralStorageLimits = float64(ephemeralstorageLimits.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t}\n\n\treturn &NodeUsage{\n\t\tcpuReqs: cpuReqs.String(),\n\t\tmemoryReqs: memoryReqs.String(),\n\t\tephemeralStorageReqs: ephemeralstorageReqs.String(),\n\t\tfractionCpuReqs: fractionCpuReqs,\n\t\tfractionCpuLimits: fractionCpuLimits,\n\t\tfractionMemoryReqs: fractionMemoryReqs,\n\t\tfractionMemoryLimits: fractionMemoryLimits,\n\t\tfractionEphemeralStorageReqs: fractionEphemeralStorageReqs,\n\t\tfractionEphemeralStorageLimits: fractionEphemeralStorageLimits,\n\t}\n}", "func createNode(cfg *meta.ClusterConfig, nodeUUID, nodeURL string) (*meta.Watcher, *meta.Node, *rpckit.RPCServer, error) {\n\t// create watcher\n\tw, err := meta.NewWatcher(nodeUUID, cfg)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\t// Start a rpc server\n\trpcSrv, err := rpckit.NewRPCServer(fmt.Sprintf(\"datanode-%s\", nodeUUID), nodeURL, rpckit.WithLoggerEnabled(false))\n\tif err != nil {\n\t\tlog.Errorf(\"failed to listen to %s: Err %v\", nodeURL, err)\n\t\treturn nil, nil, nil, err\n\t}\n\n\t// register RPC handlers\n\ttproto.RegisterDataNodeServer(rpcSrv.GrpcServer, &fakeDataNode{nodeUUID: nodeUUID})\n\trpcSrv.Start()\n\ttime.Sleep(time.Millisecond * 50)\n\n\t// create node\n\tnd, err := meta.NewNode(cfg, nodeUUID, nodeURL)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\treturn w, nd, rpcSrv, nil\n}", "func (r *ReconcileGrafana) createResource(cr *i8ly.Grafana, resourceName string) error {\n\tresourceHelper := newResourceHelper(cr)\n\tresource, err := resourceHelper.createResource(resourceName)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn r.deployResource(cr, resource, resourceName)\n}", "func NewTCPCluster(name string, mutationFunc ...ClusterMutator) (ciliumv2.XDSResource, error) {\n\tcluster := &envoy_config_cluster_v3.Cluster{\n\t\tName: name,\n\t\tClusterDiscoveryType: &envoy_config_cluster_v3.Cluster_Type{\n\t\t\tType: envoy_config_cluster_v3.Cluster_EDS,\n\t\t},\n\t}\n\n\t// Apply mutation functions for customizing the cluster.\n\tfor _, fn := range mutationFunc {\n\t\tcluster = fn(cluster)\n\t}\n\n\tclusterBytes, err := proto.Marshal(cluster)\n\tif err != nil {\n\t\treturn ciliumv2.XDSResource{}, err\n\t}\n\n\treturn ciliumv2.XDSResource{\n\t\tAny: &anypb.Any{\n\t\t\tTypeUrl: envoy.ClusterTypeURL,\n\t\t\tValue: clusterBytes,\n\t\t},\n\t}, nil\n}", "func (mg *CassandraKeySpace) GetTerraformResourceType() string {\n\treturn \"azurerm_cosmosdb_cassandra_keyspace\"\n}", "func createNode(id int, myConf *Config, sm *State_Machine) cluster.Server {\n\tinitNode(id, myConf, sm)\n\t//Set up details about cluster nodes form json file.\n\tserver, err := cluster.New(id, \"config/cluster_config.json\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn server\n}", "func nodesToCreate(clusterName string, flags *CreateOptions) []nodeSpec {\n\tvar desiredNodes []nodeSpec\n\n\t// prepare nodes explicitly\n\tfor n := 0; n < flags.controlPlanes; n++ {\n\t\trole := constants.ControlPlaneNodeRoleValue\n\t\tdesiredNode := nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterName, role, n+1),\n\t\t\tRole: role,\n\t\t}\n\t\tdesiredNodes = append(desiredNodes, desiredNode)\n\t}\n\tfor n := 0; n < flags.workers; n++ {\n\t\trole := constants.WorkerNodeRoleValue\n\t\tdesiredNode := nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-%s-%d\", clusterName, role, n+1),\n\t\t\tRole: role,\n\t\t}\n\t\tdesiredNodes = append(desiredNodes, desiredNode)\n\t}\n\n\t// add an external load balancer if explicitly requested or if there are multiple control planes\n\tif flags.externalLoadBalancer || flags.controlPlanes > 1 {\n\t\trole := constants.ExternalLoadBalancerNodeRoleValue\n\t\tdesiredNodes = append(desiredNodes, nodeSpec{\n\t\t\tName: fmt.Sprintf(\"%s-lb\", clusterName),\n\t\t\tRole: role,\n\t\t})\n\t}\n\n\treturn desiredNodes\n}", "func buildNormalizedNodeResourceMap(pods []*core_v1.Pod, nodes []*core_v1.Node) nodeResourceMap { // nolint: gocyclo\n\tnrm := nodeResourceMap{}\n\n\tfor _, n := range nodes {\n\t\tnrm[n.ObjectMeta.Name] = allocatedNodeResources{node: n}\n\t}\n\n\t// We sum the total allocated resources on every node from our list of pods.\n\t// Some strategies may wish to price pods based on their fraction of allocated\n\t// node resources, rather than the total resources available on a node. This\n\t// may punish lone pods that are initially scheduled onto large nodes, but this\n\t// may be desirable as it rightfully punishes applications that may cause\n\t// frequent node turnover.\n\tfor _, p := range pods {\n\t\tnr, ok := nrm[p.Spec.NodeName]\n\t\tif !ok {\n\t\t\tlog.Log.Warnw(\"unexpected missing node from NodeMap\", zap.String(\"nodeName\", p.Spec.NodeName))\n\t\t\tcontinue\n\t\t}\n\t\tnr.cpuUsed += sumPodResource(p, core_v1.ResourceCPU)\n\t\tnr.memoryUsed += sumPodResource(p, core_v1.ResourceMemory)\n\t\tnr.gpuUsed += sumPodResource(p, ResourceGPU)\n\t\tnrm[p.Spec.NodeName] = nr\n\t}\n\n\tfor k, v := range nrm {\n\t\tc := v.node.Status.Capacity.Cpu()\n\t\tif c != nil {\n\t\t\tv.cpuAvailable = c.MilliValue()\n\t\t}\n\n\t\tm := v.node.Status.Capacity.Memory()\n\t\tif m != nil {\n\t\t\tv.memoryAvailable = m.Value()\n\t\t}\n\n\t\tg := gpuCapacity(&v.node.Status.Capacity)\n\t\tif g != nil {\n\t\t\tv.gpuAvailable = g.Value()\n\t\t}\n\n\t\t// The ratio of cpuUsed / cpuAvailable is used for proportional scaling of\n\t\t// resources to \"normalize\" pod resource utilization to a full node. If\n\t\t// cpuUsed is 0 because the pods that are running have not made resource\n\t\t// requests, there's a possible divide by 0 in calling code so we default to\n\t\t// setting cpuUsed to cpuAvailable.\n\t\tif v.cpuUsed == 0 {\n\t\t\tv.cpuUsed = v.cpuAvailable\n\t\t}\n\n\t\tif v.memoryUsed == 0 {\n\t\t\tv.memoryUsed = v.memoryAvailable\n\t\t}\n\n\t\tif v.gpuUsed == 0 {\n\t\t\tv.gpuUsed = v.gpuAvailable\n\t\t}\n\n\t\tnrm[k] = v\n\t}\n\n\treturn nrm\n}", "func (api *nodeAPI) SyncCreate(obj *cluster.Node) error {\n\tnewObj := obj\n\tevtType := kvstore.Created\n\tvar writeErr error\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tnewObj, writeErr = apicl.ClusterV1().Node().Create(context.Background(), obj)\n\t\tif writeErr != nil && strings.Contains(writeErr.Error(), \"AlreadyExists\") {\n\t\t\tnewObj, writeErr = apicl.ClusterV1().Node().Update(context.Background(), obj)\n\t\t\tevtType = kvstore.Updated\n\t\t}\n\t}\n\n\tif writeErr == nil {\n\t\tapi.ct.handleNodeEvent(&kvstore.WatchEvent{Object: newObj, Type: evtType})\n\t}\n\treturn writeErr\n}", "func createNewNode(ctx context.Context, nodeName string, virtual bool, clientset kubernetes.Interface) (*corev1.Node, error) {\n\tresources := corev1.ResourceList{}\n\tresources[corev1.ResourceCPU] = *resource.NewScaledQuantity(5000, resource.Milli)\n\tresources[corev1.ResourceMemory] = *resource.NewScaledQuantity(5, resource.Mega)\n\tnode := &corev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: nodeName,\n\t\t},\n\t}\n\tif virtual {\n\t\tnode.Labels = map[string]string{\n\t\t\tconsts.TypeLabel: consts.TypeNode,\n\t\t}\n\t}\n\tnode.Status = corev1.NodeStatus{\n\t\tCapacity: resources,\n\t\tAllocatable: resources,\n\t\tConditions: []corev1.NodeCondition{\n\t\t\t0: {\n\t\t\t\tType: corev1.NodeReady,\n\t\t\t\tStatus: corev1.ConditionTrue,\n\t\t\t},\n\t\t},\n\t}\n\tnode, err := clientset.CoreV1().Nodes().Create(ctx, node, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn node, nil\n}", "func CreateChaosResource(testsDetails *types.TestDetails, fileData []byte, namespace string, clients environment.ClientSets) error {\n\n\tdecoder := yamlutil.NewYAMLOrJSONDecoder(bytes.NewReader(fileData), 100)\n\n\t// for loop to install all the resouces\n\tfor {\n\t\t//runtime defines conversions between generic types and structs to map query strings to struct objects.\n\t\tvar rawObj runtime.RawExtension\n\t\tif err = decoder.Decode(&rawObj); err != nil {\n\t\t\t// if the object is null, successfully installed all manifest\n\t\t\tif rawObj.Raw == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\t// NewDecodingSerializer adds YAML decoding support to a serializer that supports JSON.\n\t\tobj, gvk, _ := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme).Decode(rawObj.Raw, nil, nil)\n\t\tunstructuredMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tunstructuredObj := &unstructured.Unstructured{Object: unstructuredMap}\n\n\t\t// GetAPIGroupResources uses the provided discovery client to gather\n\t\t// discovery information and populate a slice of APIGroupResources.\n\t\tgr, err := restmapper.GetAPIGroupResources(clients.KubeClient.DiscoveryClient)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmapper := restmapper.NewDiscoveryRESTMapper(gr)\n\n\t\t// RESTMapping returns a struct representing the resource path and conversion interfaces a\n\t\t// RESTClient should use to operate on the provided group/kind in order of versions.\n\t\tmapping, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//ResourceInterface is an API interface to a specific resource under a dynamic client\n\t\tvar dri dynamic.ResourceInterface\n\t\tif mapping.Scope.Name() == meta.RESTScopeNameNamespace {\n\t\t\tunstructuredObj.SetNamespace(namespace)\n\t\t\tdri = clients.DynamicClient.Resource(mapping.Resource).Namespace(unstructuredObj.GetNamespace())\n\t\t} else {\n\t\t\tdri = clients.DynamicClient.Resource(mapping.Resource)\n\t\t}\n\n\t\t// Create Chaos Resource using dynamic resource interface\n\t\tif _, err := dri.Create(unstructuredObj, v1.CreateOptions{}); err != nil {\n\t\t\tif !k8serrors.IsAlreadyExists(err) {\n\t\t\t\treturn err\n\t\t\t} else {\n\t\t\t\tif unstructuredObj.GetKind() == \"ChaosEngine\" {\n\t\t\t\t\treturn UpdateEngine(testsDetails, clients)\n\t\t\t\t} else if unstructuredObj.GetKind() == \"ChaosExperiment\" {\n\t\t\t\t\treturn UpdateExperiment(testsDetails, clients)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (config *AppConfig) CreateNode(newNode NodeAttributes) (node Node, err error) {\n\tendpoint := fmt.Sprintf(\"nodes/\")\n\n\tnewNodeBytes, err := json.Marshal(newNode)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// get json bytes from the panel.\n\tnodeBytes, err := config.queryApplicationAPI(endpoint, \"post\", newNodeBytes)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Get server info from the panel\n\t// Unmarshal the bytes to a usable struct.\n\terr = json.Unmarshal(nodeBytes, &node)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func CreateCRD(clientset apiextensionsclient.Interface) error {\n\t// The CustomResourceDefinition is not found, create it now.\n\tsparkAppCrd := &apiextensionsv1beta1.CustomResourceDefinition{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: FullName,\n\t\t},\n\t\tSpec: apiextensionsv1beta1.CustomResourceDefinitionSpec{\n\t\t\tGroup: Group,\n\t\t\tVersion: Version,\n\t\t\tScope: apiextensionsv1beta1.NamespaceScoped,\n\t\t\tNames: apiextensionsv1beta1.CustomResourceDefinitionNames{\n\t\t\t\tPlural: Plural,\n\t\t\t\tSingular: Singular,\n\t\t\t\tShortNames: []string{ShortName},\n\t\t\t\tKind: reflect.TypeOf(v1alpha1.SparkApplication{}).Name(),\n\t\t\t},\n\t\t},\n\t}\n\t_, err := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(sparkAppCrd)\n\tif err != nil {\n\t\tif apierrors.IsAlreadyExists(err) {\n\t\t\tglog.Warningf(\"CustomResourceDefinition %s already exists\", FullName)\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\t// Wait for the CustomResourceDefinition to become registered.\n\terr = waitForCRDEstablishment(clientset)\n\t// Try deleting the CustomResourceDefinition if it fails to be registered on time.\n\tif err != nil {\n\t\tdeleteErr := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Delete(FullName, &metav1.DeleteOptions{})\n\t\tif deleteErr != nil {\n\t\t\treturn errors.NewAggregate([]error{err, deleteErr})\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func InitializeReplicaCreation(restclient *rest.RESTClient, clusterName,\n\tnamespace string) error {\n\n\tpgreplicaList := &crv1.PgreplicaList{}\n\tselector := config.LABEL_PG_CLUSTER + \"=\" + clusterName\n\terr := kubeapi.GetpgreplicasBySelector(restclient, pgreplicaList, selector, namespace)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\tfor _, pgreplica := range pgreplicaList.Items {\n\n\t\tif pgreplica.Annotations == nil {\n\t\t\tpgreplica.Annotations = make(map[string]string)\n\t\t}\n\n\t\tpgreplica.Annotations[config.ANNOTATION_PGHA_BOOTSTRAP_REPLICA] = \"true\"\n\n\t\tif err = kubeapi.Updatepgreplica(restclient, &pgreplica, pgreplica.Name,\n\t\t\tnamespace); err != nil {\n\n\t\t\tlog.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func NewNodeConfigCRD() *apiextensionsv1beta1.CustomResourceDefinition {\n\treturn &apiextensionsv1beta1.CustomResourceDefinition{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: apiextensionsv1beta1.SchemeGroupVersion.String(),\n\t\t\tKind: \"CustomResourceDefinition\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"nodeconfigs.core.giantswarm.io\",\n\t\t},\n\t\tSpec: apiextensionsv1beta1.CustomResourceDefinitionSpec{\n\t\t\tGroup: \"core.giantswarm.io\",\n\t\t\tScope: \"Namespaced\",\n\t\t\tVersion: \"v1alpha1\",\n\t\t\tNames: apiextensionsv1beta1.CustomResourceDefinitionNames{\n\t\t\t\tKind: \"NodeConfig\",\n\t\t\t\tPlural: \"nodeconfigs\",\n\t\t\t\tSingular: \"nodeconfig\",\n\t\t\t},\n\t\t},\n\t}\n}", "func (m *ManagedNodeGroupResourceSet) AddAllResources() error {\n\tm.resourceSet.template.Description = fmt.Sprintf(\n\t\t\"%s (SSH access: %v) %s\",\n\t\t\"EKS Managed Nodes\",\n\t\tapi.IsEnabled(m.nodeGroup.SSH.Allow),\n\t\t\"[created by eksctl]\")\n\n\tm.template.Mappings[servicePrincipalPartitionMapName] = servicePrincipalPartitionMappings\n\n\tvar nodeRole *gfnt.Value\n\tif m.nodeGroup.IAM.InstanceRoleARN == \"\" {\n\t\tif err := createRole(m.resourceSet, m.nodeGroup.IAM, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tnodeRole = gfnt.MakeFnGetAttString(cfnIAMInstanceRoleName, \"Arn\")\n\t} else {\n\t\tnodeRole = gfnt.NewString(m.nodeGroup.IAM.InstanceRoleARN)\n\t}\n\n\tsubnets, err := AssignSubnets(m.nodeGroup.AvailabilityZones, m.clusterStackName, m.clusterConfig, m.nodeGroup.PrivateNetworking)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tscalingConfig := gfneks.Nodegroup_ScalingConfig{}\n\tif m.nodeGroup.MinSize != nil {\n\t\tscalingConfig.MinSize = gfnt.NewInteger(*m.nodeGroup.MinSize)\n\t}\n\tif m.nodeGroup.MaxSize != nil {\n\t\tscalingConfig.MaxSize = gfnt.NewInteger(*m.nodeGroup.MaxSize)\n\t}\n\tif m.nodeGroup.DesiredCapacity != nil {\n\t\tscalingConfig.DesiredSize = gfnt.NewInteger(*m.nodeGroup.DesiredCapacity)\n\t}\n\tmanagedResource := &gfneks.Nodegroup{\n\t\tClusterName: gfnt.NewString(m.clusterConfig.Metadata.Name),\n\t\tNodegroupName: gfnt.NewString(m.nodeGroup.Name),\n\t\tScalingConfig: &scalingConfig,\n\t\tSubnets: subnets,\n\t\t// Currently the API supports specifying only one instance type\n\t\tInstanceTypes: gfnt.NewStringSlice(m.nodeGroup.InstanceType),\n\t\tAmiType: gfnt.NewString(getAMIType(m.nodeGroup.InstanceType)),\n\t\tNodeRole: nodeRole,\n\t\tLabels: m.nodeGroup.Labels,\n\t\tTags: m.nodeGroup.Tags,\n\t}\n\n\tif api.IsEnabled(m.nodeGroup.SSH.Allow) {\n\t\tmanagedResource.RemoteAccess = &gfneks.Nodegroup_RemoteAccess{\n\t\t\tEc2SshKey: gfnt.NewString(*m.nodeGroup.SSH.PublicKeyName),\n\t\t\tSourceSecurityGroups: gfnt.NewStringSlice(m.nodeGroup.SSH.SourceSecurityGroupIDs...),\n\t\t}\n\t}\n\tif m.nodeGroup.VolumeSize != nil {\n\t\tmanagedResource.DiskSize = gfnt.NewInteger(*m.nodeGroup.VolumeSize)\n\t}\n\n\tm.newResource(\"ManagedNodeGroup\", managedResource)\n\n\treturn nil\n}", "func (r *ServiceGraphReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"servicegraph\", req.NamespacedName)\n\n\t// your logic here\n\tservicegraph := &onlabv2.ServiceGraph{}\n\terr := r.Get(ctx, req.NamespacedName, servicegraph)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\tlog.Info(\"Servicegraph resource not found. Ignoring since object must be deleted\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Failed to get ServiceGraph resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\t// printServiceGraph(servicegraph)\n\n\tfor _, node := range servicegraph.Spec.Nodes {\n\t\t// Check if the deployment for the node already exists, if not create a new one\n\t\tfound := &appsv1.Deployment{}\n\n\t\terr = r.Get(ctx, types.NamespacedName{Name: node.Name, Namespace: \"default\"}, found)\n\t\tif err != nil && errors.IsNotFound(err) {\n\t\t\t//fmt.Printf(\"######### CREATE: %d node type: %T\\n\", i, node)\n\t\t\t// Define a new deployment for the node\n\t\t\tdep := r.deploymentForNode(node, servicegraph)\n\t\t\tlog.Info(\"Creating a new Deployment\", \"Deployment.Namespace\", dep.Namespace, \"Deployment.Name\", dep.Name)\n\n\t\t\terr = r.Create(ctx, dep)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create new Deployment\", \"Deployment.Namespace\", dep.Namespace, \"Deployment.Name\", dep.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Deployment created successfully - return and requeue\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t} else if err != nil {\n\t\t\tlog.Error(err, \"Failed to get Deployment\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Ensure the deployment size is the same as the spec\n\t\tsize := int32(node.Replicas)\n\t\tif *found.Spec.Replicas != size {\n\t\t\tfound.Spec.Replicas = &size\n\t\t\terr = r.Update(ctx, found)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to update Deployment\", \"Deployment.Namespace\", found.Namespace, \"Deployment.Name\", found.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Spec updated - return and requeue\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\n\t\t// // Update/create services\n\n\t\t// foundSvc := &corev1.Service{}\n\n\t\t// err = r.Get(ctx, client.ObjectKey{Namespace: \"default\", Name: \"name\"}, foundSvc)\n\n\t\t// if err != nil && errors.IsNotFound(err) {\n\t\t// \tsvc := r.serviceForNode(node, servicegraph)\n\t\t// \tlog.Info(\"Creating a new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t// \t// Yes. This is not awesome, but works\n\t\t// \t// \t_ = r.Delete(ctx, svc)\n\t\t// \t// err = r.Create(ctx, svc)\n\t\t// \terr = r.Create(ctx, svc)\n\t\t// \tif err != nil {\n\t\t// \t\tlog.Error(err, \"Failed to create new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t// \t\treturn ctrl.Result{}, err\n\t\t// \t}\n\t\t// \t// Deployment created successfully - return and requeue\n\t\t// \treturn ctrl.Result{Requeue: true}, nil\n\t\t// } else if err != nil {\n\t\t// \tlog.Error(err, \"Failed to get SVC\")\n\t\t// \treturn ctrl.Result{}, err\n\t\t// }\n\t}\n\n\t// Update/create services\n\tfor _, node := range servicegraph.Spec.Nodes {\n\t\tsvc := r.serviceForNode(node, servicegraph)\n\t\t// Yes. This is not awesome, but works\n\t\t//_ = r.Delete(ctx, svc)\n\t\terr = r.Create(ctx, svc)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to create new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\t// Deployment created successfully - return and requeue\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func (ng *NodeGroup) TemplateNodeInfo() (*schedulerframework.NodeInfo, error) {\n\t// Forge node template in a node group\n\tnode := &apiv1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: fmt.Sprintf(\"%s-node-%d\", ng.Id(), rand.Int63()),\n\t\t\tLabels: ng.Template.Metadata.Labels,\n\t\t\tAnnotations: ng.Template.Metadata.Annotations,\n\t\t\tFinalizers: ng.Template.Metadata.Finalizers,\n\t\t},\n\t\tSpec: apiv1.NodeSpec{\n\t\t\tTaints: ng.Template.Spec.Taints,\n\t\t},\n\t\tStatus: apiv1.NodeStatus{\n\t\t\tCapacity: apiv1.ResourceList{},\n\t\t\tConditions: cloudprovider.BuildReadyConditions(),\n\t\t},\n\t}\n\n\t// Add the nodepool label\n\tif node.ObjectMeta.Labels == nil {\n\t\tnode.ObjectMeta.Labels = make(map[string]string)\n\t}\n\tnode.ObjectMeta.Labels[NodePoolLabel] = ng.Id()\n\n\tflavor, err := ng.Manager.getFlavorByName(ng.Flavor)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get specs for flavor %q: %w\", ng.Flavor, err)\n\t}\n\n\tnode.Status.Capacity[apiv1.ResourcePods] = *resource.NewQuantity(110, resource.DecimalSI)\n\tnode.Status.Capacity[apiv1.ResourceCPU] = *resource.NewQuantity(int64(flavor.VCPUs), resource.DecimalSI)\n\tnode.Status.Capacity[gpu.ResourceNvidiaGPU] = *resource.NewQuantity(int64(flavor.GPUs), resource.DecimalSI)\n\tnode.Status.Capacity[apiv1.ResourceMemory] = *resource.NewQuantity(int64(flavor.RAM)*int64(math.Pow(1024, 3)), resource.DecimalSI)\n\n\tnode.Status.Allocatable = node.Status.Capacity\n\n\t// Setup node info template\n\tnodeInfo := schedulerframework.NewNodeInfo(cloudprovider.BuildKubeProxy(ng.Id()))\n\tnodeInfo.SetNode(node)\n\n\treturn nodeInfo, nil\n}", "func NewResource() (Resource, error) {\n\t// Get cluster config\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error getting in cluster config: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup event source client\n\teventSrcClient, err := eventsrcclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building event source client: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup tektoncd client\n\ttektonClient, err := tektoncdclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building tekton clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\t// Setup k8s client\n\tk8sClient, err := k8sclientset.NewForConfig(config)\n\tif err != nil {\n\t\tlog.Printf(\"Error building k8s clientset: %s\", err.Error())\n\t\treturn Resource{}, err\n\t}\n\n\tr := Resource{\n\t\tK8sClient: k8sClient,\n\t\tTektonClient: tektonClient,\n\t\tEventSrcClient: eventSrcClient,\n\t}\n\treturn r, nil\n}", "func createNodeClientMap(ctx context.Context, clients []provisioner.API) map[string]provisioner.API {\n\tresult := make(map[string]provisioner.API)\n\tfor _, c := range clients {\n\t\tif info, err := c.GetNodeInfo(ctx); err == nil {\n\t\t\tresult[info.NodeName] = c\n\t\t}\n\t}\n\treturn result\n}", "func CreateResources(f *os.File, cfg *rest.Config, dynamicClient dynamic.Interface) error {\n\tvar err error\n\tdata, err := os.ReadFile(f.Name())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdecoder := yamlutil.NewYAMLOrJSONDecoder(bytes.NewReader(data), 100)\n\tmapper, err := apiutil.NewDiscoveryRESTMapper(cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor {\n\t\tresource, unstructuredObj, err := getResource(decoder, mapper, dynamicClient)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t_, err = resource.Create(context.Background(), unstructuredObj, metav1.CreateOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Client) CreateResource(ctx context.Context, resource models.Resource) ([]*models.Object, error) {\n\tvar out models.WhoisResource\n\tif err := c.transport.Post(ctx, \"/\"+resource.TypeString(), &out, transport.WithJSONRequestBody(resource.RIPEWhoisResource())); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out.Objects.Object, nil\n}", "func CreateNode(p CreateParams, cmder runner.Cmder) (*Node, error) {\n\trunArgs := []string{\n\t\tfmt.Sprintf(\"--cpus=%s\", p.Cpus),\n\t\tfmt.Sprintf(\"--memory=%s\", p.Memory),\n\t\t\"-d\", // run the container detached\n\t\t\"-t\", // allocate a tty for entrypoint logs\n\t\t// running containers in a container requires privileged\n\t\t// NOTE: we could try to replicate this with --cap-add, and use less\n\t\t// privileges, but this flag also changes some mounts that are necessary\n\t\t// including some ones docker would otherwise do by default.\n\t\t// for now this is what we want. in the future we may revisit this.\n\t\t\"--privileged\",\n\t\t\"--security-opt\", \"seccomp=unconfined\", // also ignore seccomp\n\t\t\"--tmpfs\", \"/tmp\", // various things depend on working /tmp\n\t\t\"--tmpfs\", \"/run\", // systemd wants a writable /run\n\t\t// some k8s things want /lib/modules\n\t\t\"-v\", \"/lib/modules:/lib/modules:ro\",\n\t\t\"--hostname\", p.Name, // make hostname match container name\n\t\t\"--name\", p.Name, // ... and set the container name\n\t\t// label the node with the cluster ID\n\t\t\"--label\", p.ClusterLabel,\n\t\t// label the node with the role ID\n\t\t\"--label\", fmt.Sprintf(\"%s=%s\", NodeRoleKey, p.Role),\n\t}\n\n\tfor key, val := range p.Envs {\n\t\trunArgs = append(runArgs, \"-e\", fmt.Sprintf(\"%s=%s\", key, val))\n\t}\n\n\t// adds node specific args\n\trunArgs = append(runArgs, p.ExtraArgs...)\n\n\tif oci.UsernsRemap() {\n\t\t// We need this argument in order to make this command work\n\t\t// in systems that have userns-remap enabled on the docker daemon\n\t\trunArgs = append(runArgs, \"--userns=host\")\n\t}\n\n\t_, err := oci.CreateContainer(\n\t\tp.Image,\n\t\toci.WithRunArgs(runArgs...),\n\t\toci.WithMounts(p.Mounts),\n\t\toci.WithPortMappings(p.PortMappings),\n\t)\n\n\t// we should return a handle so the caller can clean it up\n\tnode := fromName(p.Name, cmder)\n\tif err != nil {\n\t\treturn node, fmt.Errorf(\"docker run error %v\", err)\n\t}\n\n\treturn node, nil\n}", "func (e *execution) deployNode(ctx context.Context, clientset kubernetes.Interface, generator *k8sGenerator, nbInstances int32) error {\n\tnamespace, err := defaultNamespace(e.deploymentID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = createNamespaceIfMissing(e.deploymentID, namespace, clientset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = e.checkRepository(ctx, clientset, generator)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.envInputs, _, err = operations.ResolveInputs(e.kv, e.deploymentID, e.nodeName, e.taskID, e.operation)\n\tif err != nil {\n\t\treturn err\n\t}\n\tinputs := e.parseEnvInputs()\n\n\tdeployment, service, err := generator.generateDeployment(e.deploymentID, e.nodeName, e.operation, e.nodeType, e.secretRepoName, inputs, nbInstances)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = clientset.ExtensionsV1beta1().Deployments(namespace).Create(&deployment)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to create deployment\")\n\t}\n\n\tif service.Name != \"\" {\n\t\tserv, err := clientset.CoreV1().Services(namespace).Create(&service)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to create service\")\n\t\t}\n\t\tvar s string\n\t\tnode, err := getHealthyNode(clientset)\n\t\tif err != nil {\n\t\t\tevents.WithContextOptionalFields(ctx).NewLogEntry(events.LogLevelWARN, e.deploymentID).Registerf(\"Not able to find an healthy node\")\n\t\t}\n\t\th, err := getExternalIPAdress(clientset, node)\n\t\tif err != nil {\n\t\t\tevents.WithContextOptionalFields(ctx).NewLogEntry(events.LogLevelWARN, e.deploymentID).Registerf(\"Error getting external ip of node %s\", node)\n\t\t}\n\t\tfor _, val := range serv.Spec.Ports {\n\t\t\tstr := fmt.Sprintf(\"http://%s:%d\", h, val.NodePort)\n\n\t\t\tlog.Printf(\"%s : %s: %d:%d mapped to %s\", serv.Name, val.Name, val.Port, val.TargetPort.IntVal, str)\n\n\t\t\ts = fmt.Sprintf(\"%s %d ==> %s \\n\", s, val.Port, str)\n\n\t\t\tif val.NodePort != 0 {\n\t\t\t\t// The service is accessible to an external IP address through\n\t\t\t\t// this port. Updating the corresponding public endpoints\n\t\t\t\t// kubernetes port mapping\n\t\t\t\terr := e.updatePortMappingPublicEndpoints(val.Port, h, val.NodePort)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"Failed to update endpoint capabilities port mapping\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\terr = deployments.SetAttributeForAllInstances(e.kv, e.deploymentID, e.nodeName, \"k8s_service_url\", s)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to set attribute\")\n\t\t}\n\n\t\t// Legacy\n\t\terr = deployments.SetAttributeForAllInstances(e.kv, e.deploymentID, e.nodeName, \"ip_address\", service.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to set attribute\")\n\t\t}\n\n\t\terr = deployments.SetAttributeForAllInstances(e.kv, e.deploymentID, e.nodeName, \"k8s_service_name\", service.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to set attribute\")\n\t\t}\n\t\t// TODO check that it is a good idea to use it as endpoint ip_address\n\t\terr = deployments.SetCapabilityAttributeForAllInstances(e.kv, e.deploymentID, e.nodeName, \"endpoint\", \"ip_address\", service.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to set capability attribute\")\n\t\t}\n\t}\n\n\t// TODO this is very bad but we need to add a hook in order to undeploy our pods we the tosca node stops\n\t// It will be better if we have a Kubernetes node type with a default stop implementation that will be inherited by\n\t// sub components.\n\t// So let's add an implementation of the stop operation in the node type\n\treturn e.setUnDeployHook()\n}", "func (fm *FCFSModel)TaskNodeToResource(td *TaskDescriptor,rd *ResDescriptor)*ArcDescriptor{\n\t//ct := uint64(rand.Intn(100))\n\treturn &ArcDescriptor{\n\t\tcost: fm.TaskToResCost(td,rd),\n\t\tcapLower :0,\n\t\tcapUpper: 1,\n\t}\n}", "func getRandomNode(c *calcium, podname string) (*types.Node, error) {\n\tnodes, err := c.ListPodNodes(podname, false)\n\tif err != nil {\n\t\tlog.Errorf(\"[getRandomNode] Error during ListPodNodes for %s: %v\", podname, err)\n\t\treturn nil, err\n\t}\n\tif len(nodes) == 0 {\n\t\terr = fmt.Errorf(\"No nodes available in pod %s\", podname)\n\t\tlog.Errorf(\"[getRandomNode] Error during getRandomNode from %s: %v\", podname, err)\n\t\treturn nil, err\n\t}\n\n\tnodemap := make(map[string]types.CPUMap)\n\tfor _, n := range nodes {\n\t\tnodemap[n.Name] = n.CPU\n\t}\n\tnodename, err := c.scheduler.RandomNode(nodemap)\n\tif err != nil {\n\t\tlog.Errorf(\"[getRandomNode] Error during getRandomNode from %s: %v\", podname, err)\n\t\treturn nil, err\n\t}\n\tif nodename == \"\" {\n\t\terr = fmt.Errorf(\"Got empty node during getRandomNode from %s\", podname)\n\t\treturn nil, err\n\t}\n\n\treturn c.GetNode(podname, nodename)\n}", "func createApplyCustomResource(resource, namespace, name string, crd *crd.TestCrd) error {\n\tginkgo.By(\"successfully create CR\")\n\tif _, err := e2ekubectl.RunKubectlInput(namespace, resource, \"create\", \"--validate=true\", \"-f\", \"-\"); err != nil {\n\t\treturn fmt.Errorf(\"failed to create CR %s in namespace %s: %w\", resource, namespace, err)\n\t}\n\tif _, err := e2ekubectl.RunKubectl(namespace, \"delete\", crd.Crd.Spec.Names.Plural, name); err != nil {\n\t\treturn fmt.Errorf(\"failed to delete CR %s: %w\", name, err)\n\t}\n\tginkgo.By(\"successfully apply CR\")\n\tif _, err := e2ekubectl.RunKubectlInput(namespace, resource, \"apply\", \"--validate=true\", \"-f\", \"-\"); err != nil {\n\t\treturn fmt.Errorf(\"failed to apply CR %s in namespace %s: %w\", resource, namespace, err)\n\t}\n\tif _, err := e2ekubectl.RunKubectl(namespace, \"delete\", crd.Crd.Spec.Names.Plural, name); err != nil {\n\t\treturn fmt.Errorf(\"failed to delete CR %s: %w\", name, err)\n\t}\n\treturn nil\n}", "func AllocatableResourceListFromNodeResourceTopology(nodeTopo *v1alpha2.NodeResourceTopology) map[string]corev1.ResourceList {\n\tallocRes := make(map[string]corev1.ResourceList)\n\tfor _, zone := range nodeTopo.Zones {\n\t\tif zone.Type != \"Node\" {\n\t\t\tcontinue\n\t\t}\n\t\tresList := make(corev1.ResourceList)\n\t\tfor _, res := range zone.Resources {\n\t\t\tresList[corev1.ResourceName(res.Name)] = res.Allocatable.DeepCopy()\n\t\t}\n\t\tif len(resList) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tallocRes[zone.Name] = resList\n\t}\n\treturn allocRes\n}", "func (c *VrouterNode) Create(contrailClient contrailclient.ApiClient) error {\n\tvrouterInfoLog.Printf(\"Creating %s %s\", c.Hostname, nodeType)\n\tgscObjects := []*contrailtypes.GlobalSystemConfig{}\n\tgscObjectsList, err := contrailClient.List(\"global-system-config\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(gscObjectsList) == 0 {\n\t\tvrouterInfoLog.Println(\"no gscObject\")\n\t}\n\n\tfor _, gscObject := range gscObjectsList {\n\t\tobj, err := contrailClient.ReadListResult(\"global-system-config\", &gscObject)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgscObjects = append(gscObjects, obj.(*contrailtypes.GlobalSystemConfig))\n\t}\n\tfor _, gsc := range gscObjects {\n\t\tvirtualRouter := &contrailtypes.VirtualRouter{}\n\t\tvirtualRouter.SetVirtualRouterIpAddress(c.IPAddress)\n\t\tvirtualRouter.SetParent(gsc)\n\t\tvirtualRouter.SetName(c.Hostname)\n\t\tannotations := contrailclient.ConvertMapToContrailKeyValuePairs(c.Annotations)\n\t\tvirtualRouter.SetAnnotations(&annotations)\n\t\tif err := contrailClient.Create(virtualRouter); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn c.ensureVMIVhost0Interface(contrailClient)\n}", "func (n *NodeServiceImpl) Create(tx interface{}, namespace string, node *specV1.Node) (*specV1.Node, error) {\n\tres, err := n.Node.CreateNode(tx, namespace, node)\n\tif err != nil {\n\t\tlog.L().Error(\"create node failed\", log.Error(err))\n\t\treturn nil, err\n\t}\n\n\t_, err = n.SysAppService.GenApps(tx, namespace, node)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = n.InsertOrUpdateNodeAndAppIndex(tx, namespace, res, models.NewShadowFromNode(res), true); err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, err\n}", "func (n *NodeController) New() (r types.Resource) {\n\treturn new(types.Node)\n}", "func (c *Client) GetNodeOperator() scheduler.NodeOperator {\n\treturn c.Node\n}", "func CreateResourceFromFile(config *rest.Config, filename string) error {\n\t// Create a restmapper to determine the resource type.\n\tdiscoveryClient, err := discovery.NewDiscoveryClientForConfig(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcacheClient := ksUtil.NewMemcachedDiscoveryClient(discoveryClient)\n\tmapper := discovery.NewDeferredDiscoveryRESTMapper(cacheClient, dynamic.VersionInterfaces)\n\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tobjects := bytes.Split(data, []byte(yamlSeparator))\n\tvar o map[string]interface{}\n\tfor _, object := range objects {\n\t\tif err = yaml.Unmarshal(object, &o); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ta := o[\"apiVersion\"]\n\t\tif a == nil {\n\t\t\tlog.Warnf(\"Unknown resource: %v\", object)\n\t\t\tcontinue\n\t\t}\n\t\tapiVersion := strings.Split(a.(string), \"/\")\n\t\tvar group, version string\n\t\tif len(apiVersion) == 1 {\n\t\t\t// core v1, no group. e.g. namespace\n\t\t\tgroup, version = \"\", apiVersion[0]\n\t\t} else {\n\t\t\tgroup, version = apiVersion[0], apiVersion[1]\n\t\t}\n\t\tkind := o[\"kind\"].(string)\n\t\tgk := schema.GroupKind{\n\t\t\tGroup: group,\n\t\t\tKind: kind,\n\t\t}\n\t\tresult, err := mapper.RESTMapping(gk, version)\n\t\t// result.resource is the resource we need (e.g. pods, services)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// build config for restClient\n\t\tc := rest.CopyConfig(config)\n\t\tc.GroupVersion = &schema.GroupVersion{\n\t\t\tGroup: group,\n\t\t\tVersion: version,\n\t\t}\n\t\tc.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}\n\t\tif group == \"\" {\n\t\t\tc.APIPath = \"/api\"\n\t\t} else {\n\t\t\tc.APIPath = \"/apis\"\n\t\t}\n\t\trestClient, err := rest.RESTClientFor(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// build the request\n\t\tmetadata := o[\"metadata\"].(map[string]interface{})\n\t\tname := metadata[\"name\"].(string)\n\t\tlog.Infof(\"creating %v\\n\", name)\n\n\t\tvar namespace string\n\t\tif metadata[\"namespace\"] != nil {\n\t\t\tnamespace = metadata[\"namespace\"].(string)\n\t\t} else {\n\t\t\tnamespace = \"default\"\n\t\t}\n\n\t\t// Get first to see if object already exists\n\t\tgetRequest := restClient.Get().Resource(result.Resource).Name(name)\n\t\tif result.Scope.Name() == \"namespace\" {\n\t\t\tgetRequest = getRequest.Namespace(namespace)\n\t\t}\n\t\t_, err = getRequest.DoRaw()\n\t\tif err == nil {\n\t\t\tlog.Infof(\"object already exists...\\n\")\n\t\t\tcontinue\n\t\t}\n\n\t\t// Post to create the resource.\n\t\tbody, err := json.Marshal(o)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trequest := restClient.Post().Resource(result.Resource).Body(body)\n\t\tif result.Scope.Name() == \"namespace\" {\n\t\t\trequest = request.Namespace(namespace)\n\t\t}\n\t\t_, err = request.DoRaw()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func IsValidNodeTopology(nodeTopology *v1alpha2.NodeResourceTopology, kubeletConfig *kubeletconfig.KubeletConfiguration) bool {\n\tif nodeTopology == nil || len(nodeTopology.TopologyPolicies) == 0 {\n\t\tframework.Logf(\"failed to get topology policy from the node topology resource\")\n\t\treturn false\n\t}\n\n\ttmPolicy := string(topologypolicy.DetectTopologyPolicy(kubeletConfig.TopologyManagerPolicy, kubeletConfig.TopologyManagerScope))\n\tif nodeTopology.TopologyPolicies[0] != tmPolicy {\n\t\tframework.Logf(\"topology policy mismatch got %q expected %q\", nodeTopology.TopologyPolicies[0], tmPolicy)\n\t\treturn false\n\t}\n\n\texpectedPolicyAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerPolicyAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerPolicy,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedPolicyAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerPolicy attribute expected %v attributeList %v\", expectedPolicyAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\texpectedScopeAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerScopeAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerScope,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedScopeAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerScope attribute expected %v attributeList %v\", expectedScopeAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\tif nodeTopology.Zones == nil || len(nodeTopology.Zones) == 0 {\n\t\tframework.Logf(\"failed to get topology zones from the node topology resource\")\n\t\treturn false\n\t}\n\n\tfoundNodes := 0\n\tfor _, zone := range nodeTopology.Zones {\n\t\t// TODO constant not in the APIs\n\t\tif !strings.HasPrefix(strings.ToUpper(zone.Type), \"NODE\") {\n\t\t\tcontinue\n\t\t}\n\t\tfoundNodes++\n\n\t\tif !isValidCostList(zone.Name, zone.Costs) {\n\t\t\tframework.Logf(\"invalid cost list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\n\t\tif !isValidResourceList(zone.Name, zone.Resources) {\n\t\t\tframework.Logf(\"invalid resource list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn foundNodes > 0\n}", "func GetNodeTypeInterface(nodeIndex int, node v1alpha1.ElasticsearchNode, cluster *v1alpha1.Elasticsearch) []NodeTypeInterface {\n\n\tnodes := []NodeTypeInterface{}\n\n\troleMap := getNodeRoleMap(node)\n\n\t// common spec => cluster.Spec.Spec\n\tnodeName := fmt.Sprintf(\"%s-%s\", cluster.Name, getNodeSuffix(nodeIndex, roleMap))\n\n\t// if we have a data node then we need to create one deployment per replica\n\tif isDataNode(node) {\n\t\t// for loop from 1 to replica as replicaIndex\n\t\t// it is 1 instead of 0 because of legacy code\n\t\tfor replicaIndex := int32(1); replicaIndex <= node.NodeCount; replicaIndex++ {\n\t\t\tdataNodeName := addDataNodeSuffix(nodeName, replicaIndex)\n\t\t\tnode := newDeploymentNode(dataNodeName, node, cluster, roleMap)\n\t\t\tnodes = append(nodes, node)\n\t\t}\n\t} else {\n\t\tnode := newStatefulSetNode(nodeName, node, cluster, roleMap)\n\t\tnodes = append(nodes, node)\n\t}\n\n\treturn nodes\n}", "func makeNodesReconciler(cniConfigWriter *CNIConfigWriter, hostIP string) func(*corev1.NodeList) error {\n\t// reconciles a node\n\treconcileNode := func(node corev1.Node) error {\n\t\t// first get this node's IP\n\t\tnodeIP := internalIP(node)\n\t\tfmt.Printf(\"Handling node with IP: %s\\n\", nodeIP)\n\n\t\t// This is our node. We don't need to add routes, but we might need to\n\t\t// update the cni config.\n\t\tif nodeIP == hostIP {\n\t\t\tfmt.Printf(\"handling current node\\n\")\n\t\t\t// compute the current cni config inputs\n\t\t\tif err := cniConfigWriter.Write(\n\t\t\t\tComputeCNIConfigInputs(node),\n\t\t\t); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// we're done handling this node\n\t\t\treturn nil\n\t\t}\n\n\t\t// don't do anything unless there is a PodCIDR\n\t\tpodCIDR := node.Spec.PodCIDR\n\t\tif podCIDR == \"\" {\n\t\t\tfmt.Printf(\"Node %v has no CIDR, ignoring\\n\", node.Name)\n\t\t\treturn nil\n\t\t}\n\n\t\t// parse subnet\n\t\tdst, err := netlink.ParseIPNet(podCIDR)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"Node %v has CIDR %s \\n\", node.Name, podCIDR)\n\n\t\t// Check if the route exists to the other node's PodCIDR\n\t\tip := net.ParseIP(nodeIP)\n\t\trouteToDst := netlink.Route{Dst: dst, Gw: ip}\n\t\troute, err := netlink.RouteListFiltered(nl.GetIPFamily(ip), &routeToDst, netlink.RT_FILTER_DST)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Add route if not present\n\t\tif len(route) == 0 {\n\t\t\tif err := netlink.RouteAdd(&routeToDst); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfmt.Printf(\"Adding route %v \\n\", routeToDst)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// return a reconciler for all the nodes\n\treturn func(nodes *corev1.NodeList) error {\n\t\tfor _, node := range nodes.Items {\n\t\t\tif err := reconcileNode(node); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func (n *Namespace) CreateNode(backend Backend, node *Node) error {\n\n\t// ensure the namespace exists\n\terr := n.checkOrCreateNamespace(backend)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn node.JoinCluster(backend)\n}", "func GetResourceRequest(pod *v1.Pod) *schedulernodeinfo.Resource {\n\tresult := &schedulernodeinfo.Resource{}\n\tfor _, container := range pod.Spec.Containers {\n\t\tresult.Add(container.Resources.Requests)\n\t}\n\n\t// take max_resource(sum_pod, any_init_container)\n\tfor _, container := range pod.Spec.InitContainers {\n\t\tresult.SetMaxResource(container.Resources.Requests)\n\t}\n\n\t// If Overhead is being utilized, add to the total requests for the pod\n\tif pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) {\n\t\tresult.Add(pod.Spec.Overhead)\n\t}\n\n\treturn result\n}", "func (c *nodes) Create(node *api.Node) (*api.Node, error) {\n\tresult := &api.Node{}\n\terr := c.r.Post().Resource(c.resourceName()).Body(node).Do().Into(result)\n\treturn result, err\n}", "func Create(kubeConfigFile string) (*kubernetes.Clientset, error) {\n\tkubeconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\t// If not in cluster, use kube config file\n\t\tkubeconfig, err = clientcmd.BuildConfigFromFlags(\"\", kubeConfigFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn kubernetes.NewForConfig(kubeconfig)\n}", "func (d *DryccCmd) ResourcesCreate(appID, plan string, name string, params []string) error {\n\ts, appID, err := load(d.ConfigFile, appID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.Printf(\"Creating %s to %s... \", name, appID)\n\n\tparamsMap, err := parseParams(params)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquit := progress(d.WOut)\n\tresource := api.Resource{\n\t\tName: name,\n\t\tPlan: plan,\n\t\tOptions: paramsMap,\n\t}\n\t_, err = resources.Create(s.Client, appID, resource)\n\tquit <- true\n\t<-quit\n\tif d.checkAPICompatibility(s.Client, err) != nil {\n\t\treturn err\n\t}\n\n\td.Println(\"done\")\n\treturn nil\n}", "func getRandomNode(c *calcium, podname string) (*types.Node, error) {\n\tnodes, err := c.ListPodNodes(podname, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(nodes) == 0 {\n\t\treturn nil, fmt.Errorf(\"No nodes available in pod %s\", podname)\n\t}\n\n\tnodemap := make(map[string]types.CPUMap)\n\tfor _, n := range nodes {\n\t\tnodemap[n.Name] = n.CPU\n\t}\n\tnodename, err := c.scheduler.RandomNode(nodemap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.GetNode(podname, nodename)\n}", "func Create(namespace string, resourceAndArgs ...string) (err error) {\n\tcreate := []string{\"create\", \"-n\", namespace}\n\t_, err = kubectl(append(create, resourceAndArgs...)...)\n\treturn\n}", "func (client RoverClusterClient) CreateRoverCluster(ctx context.Context, request CreateRoverClusterRequest) (response CreateRoverClusterResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.DefaultRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\n\tif !(request.OpcRetryToken != nil && *request.OpcRetryToken != \"\") {\n\t\trequest.OpcRetryToken = common.String(common.RetryToken())\n\t}\n\n\tociResponse, err = common.Retry(ctx, request, client.createRoverCluster, 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 = CreateRoverClusterResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = CreateRoverClusterResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(CreateRoverClusterResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into CreateRoverClusterResponse\")\n\t}\n\treturn\n}", "func (r *NodeReconciler) getNodeAffinity(node *ethereumv1alpha1.Node) *corev1.Affinity {\n\tif node.Spec.HighlyAvailable {\n\t\treturn &corev1.Affinity{\n\t\t\tPodAntiAffinity: &corev1.PodAntiAffinity{\n\t\t\t\tRequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{\n\t\t\t\t\t{\n\t\t\t\t\t\tLabelSelector: &metav1.LabelSelector{\n\t\t\t\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\t\t\t\t\"name\": \"node\",\n\t\t\t\t\t\t\t\t\"network\": node.Name,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tTopologyKey: node.Spec.TopologyKey,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\treturn nil\n}", "func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {\n\n\tvar node ethereumv1alpha1.Node\n\n\tif err = r.Client.Get(ctx, req.NamespacedName, &node); err != nil {\n\t\terr = client.IgnoreNotFound(err)\n\t\treturn\n\t}\n\n\t// default the node if webhooks are disabled\n\tif !shared.IsWebhookEnabled() {\n\t\tnode.Default()\n\t}\n\n\tr.updateLabels(&node)\n\tr.updateStaticNodes(&node)\n\n\tif err = r.reconcileNodeDataPVC(ctx, &node); err != nil {\n\t\treturn\n\t}\n\n\tif err = r.reconcileNodeConfigmap(ctx, &node); err != nil {\n\t\treturn\n\t}\n\n\tip, err := r.reconcileNodeService(ctx, &node)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif err = r.reconcileNodeStatefulSet(ctx, &node); err != nil {\n\t\treturn\n\t}\n\n\tif node.Spec.Nodekey == \"\" && node.Spec.Import == nil {\n\t\treturn\n\t}\n\n\tvar publicKey string\n\tif publicKey, err = r.reconcileNodeSecret(ctx, &node); err != nil {\n\t\treturn\n\t}\n\n\tif node.Spec.Bootnode != true {\n\t\treturn\n\t}\n\n\tenodeURL := fmt.Sprintf(\"enode://%s@%s:%d\", publicKey, ip, node.Spec.P2PPort)\n\n\tif err = r.updateStatus(ctx, &node, enodeURL); err != nil {\n\t\treturn\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func getNode(nd *wssdcloud.Node) *cloud.Node {\n\treturn &cloud.Node{\n\t\tName: &nd.Name,\n\t\tLocation: &nd.LocationName,\n\t\tNodeProperties: &cloud.NodeProperties{\n\t\t\tFQDN: &nd.Fqdn,\n\t\t\tPort: &nd.Port,\n\t\t\tAuthorizerPort: &nd.AuthorizerPort,\n\t\t\tCertificate: &nd.Certificate,\n\t\t\tStatuses: getNodeStatuses(nd),\n\t\t},\n\t\tVersion: &nd.Status.Version.Number,\n\t}\n}", "func (m *InstancesManager) CreateNode(obj *v2.CiliumNode, n *ipam.Node) ipam.NodeOperations {\n\treturn &Node{manager: m, node: n}\n}", "func computeClusterResources(nodes map[string]*repository.KubeNode) map[metrics.ResourceType]*repository.KubeDiscoveredResource {\n\t// sum the capacities of the node resources\n\tcomputeResources := make(map[metrics.ResourceType]float64)\n\tfor _, node := range nodes {\n\t\tnodeActive := util.NodeIsReady(node.Node) && util.NodeIsSchedulable(node.Node)\n\t\tif nodeActive {\n\t\t\t// Iterate over all ready and schedulable compute resource types\n\t\t\tfor _, rt := range metrics.KubeComputeResourceTypes {\n\t\t\t\t// get the compute resource if it exists\n\t\t\t\tnodeResource, exists := node.ComputeResources[rt]\n\t\t\t\tif !exists {\n\t\t\t\t\tglog.Errorf(\"Missing %s resource in node %s\", rt, node.Name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// add the capacity to the cluster compute resource map\n\t\t\t\tcomputeCap, exists := computeResources[rt]\n\t\t\t\tif !exists {\n\t\t\t\t\tcomputeCap = nodeResource.Capacity\n\t\t\t\t} else {\n\t\t\t\t\tcomputeCap = computeCap + nodeResource.Capacity\n\t\t\t\t}\n\t\t\t\tcomputeResources[rt] = computeCap\n\t\t\t}\n\t\t}\n\t}\n\n\t// create KubeDiscoveredResource object for each compute resource type\n\tclusterResources := make(map[metrics.ResourceType]*repository.KubeDiscoveredResource)\n\tfor _, rt := range metrics.KubeComputeResourceTypes {\n\t\tcapacity := computeResources[rt]\n\t\tr := &repository.KubeDiscoveredResource{\n\t\t\tType: rt,\n\t\t\tCapacity: capacity,\n\t\t}\n\t\tclusterResources[rt] = r\n\t}\n\treturn clusterResources\n}", "func (w *ClusterDynamicClient) Create(obj *unstructured.Unstructured, options metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error) {\n\treturn w.dClient.Resource(w.resource).Namespace(w.namespace).Create(w.ctx, obj, options, subresources...)\n}", "func (pub *Publisher) CreateNode(nodeHWID string, nodeType types.NodeType) *types.NodeDiscoveryMessage {\n\tnode := pub.registeredNodes.CreateNode(nodeHWID, nodeType)\n\treturn node\n}", "func CreateNodes(client *rancher.Client, rolesPerPool []string, quantityPerPool []int32) (ec2Nodes []*nodes.Node, err error) {\n\tec2Client, err := client.GetEC2Client()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trunningReservations := []*ec2.Reservation{}\n\treservationConfigs := []*rancherEc2.AWSEC2Config{}\n\t// provisioning instances in reverse order to allow windows instances time to become ready\n\tfor i := len(quantityPerPool) - 1; i >= 0; i-- {\n\t\tconfig := MatchRoleToConfig(rolesPerPool[i], ec2Client.ClientConfig.AWSEC2Config)\n\t\tif config == nil {\n\t\t\treturn nil, errors.New(\"No matching nodesAndRole for AWSEC2Config with role:\" + rolesPerPool[i])\n\t\t}\n\t\tsshName := getSSHKeyName(config.AWSSSHKeyName)\n\t\trunInstancesInput := &ec2.RunInstancesInput{\n\t\t\tImageId: aws.String(config.AWSAMI),\n\t\t\tInstanceType: aws.String(config.InstanceType),\n\t\t\tMinCount: aws.Int64(int64(quantityPerPool[i])),\n\t\t\tMaxCount: aws.Int64(int64(quantityPerPool[i])),\n\t\t\tKeyName: aws.String(sshName),\n\t\t\tBlockDeviceMappings: []*ec2.BlockDeviceMapping{\n\t\t\t\t{\n\t\t\t\t\tDeviceName: aws.String(\"/dev/sda1\"),\n\t\t\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\t\t\tVolumeSize: aws.Int64(int64(config.VolumeSize)),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tIamInstanceProfile: &ec2.IamInstanceProfileSpecification{\n\t\t\t\tName: aws.String(config.AWSIAMProfile),\n\t\t\t},\n\t\t\tPlacement: &ec2.Placement{\n\t\t\t\tAvailabilityZone: aws.String(config.AWSRegionAZ),\n\t\t\t},\n\t\t\tNetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{\n\t\t\t\t{\n\t\t\t\t\tDeviceIndex: aws.Int64(0),\n\t\t\t\t\tAssociatePublicIpAddress: aws.Bool(true),\n\t\t\t\t\tGroups: aws.StringSlice(config.AWSSecurityGroups),\n\t\t\t\t},\n\t\t\t},\n\t\t\tTagSpecifications: []*ec2.TagSpecification{\n\t\t\t\t{\n\t\t\t\t\tResourceType: aws.String(\"instance\"),\n\t\t\t\t\tTags: []*ec2.Tag{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: aws.String(\"Name\"),\n\t\t\t\t\t\t\tValue: aws.String(nodeBaseName),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tKey: aws.String(\"CICD\"),\n\t\t\t\t\t\t\tValue: aws.String(config.AWSCICDInstanceTag),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\treservation, err := ec2Client.SVC.RunInstances(runInstancesInput)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// instead of waiting on each node pool to complete provisioning, add to a queue and check run status later\n\t\trunningReservations = append(runningReservations, reservation)\n\t\treservationConfigs = append(reservationConfigs, config)\n\t}\n\n\tfor i := 0; i < len(quantityPerPool); i++ {\n\t\tvar listOfInstanceIds []*string\n\n\t\tfor _, instance := range runningReservations[i].Instances {\n\t\t\tlistOfInstanceIds = append(listOfInstanceIds, instance.InstanceId)\n\t\t}\n\n\t\t//wait until instance is running\n\t\terr = ec2Client.SVC.WaitUntilInstanceRunning(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//wait until instance status is ok\n\t\terr = ec2Client.SVC.WaitUntilInstanceStatusOk(&ec2.DescribeInstanceStatusInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// describe instance to get attributes\n\t\tdescribe, err := ec2Client.SVC.DescribeInstances(&ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: listOfInstanceIds,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treadyInstances := describe.Reservations[0].Instances\n\n\t\tsshKey, err := nodes.GetSSHKey(reservationConfigs[i].AWSSSHKeyName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, readyInstance := range readyInstances {\n\t\t\tec2Node := &nodes.Node{\n\t\t\t\tNodeID: *readyInstance.InstanceId,\n\t\t\t\tPublicIPAddress: *readyInstance.PublicIpAddress,\n\t\t\t\tPrivateIPAddress: *readyInstance.PrivateIpAddress,\n\t\t\t\tSSHUser: reservationConfigs[i].AWSUser,\n\t\t\t\tSSHKey: sshKey,\n\t\t\t}\n\t\t\t// re-reverse the list so that the order is corrected\n\t\t\tec2Nodes = append([]*nodes.Node{ec2Node}, ec2Nodes...)\n\t\t}\n\t}\n\n\tclient.Session.RegisterCleanupFunc(func() error {\n\t\treturn DeleteNodes(client, ec2Nodes)\n\t})\n\n\treturn ec2Nodes, nil\n}", "func getNodeClient() corev1.NodeInterface {\n\tlog.Debug(\"Creating Node client.\")\n\treturn client.CoreV1().Nodes()\n}", "func (r *Resource) EnsureCreated(ctx context.Context, obj interface{}) error {\n\tcr, err := key.ToCustomResource(obj)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\tvar tcVnet network.VirtualNetwork\n\t{\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"Checking if TC virtual network %#q exists in resource group %#q\", key.VnetName(cr), key.ResourceGroupName(cr)))\n\n\t\tvirtualNetworksClient, err := r.clientFactory.GetVirtualNetworksClient(ctx, cr.ObjectMeta)\n\t\tif err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\n\t\ttcVnet, err = virtualNetworksClient.Get(ctx, key.ResourceGroupName(cr), key.VnetName(cr), \"\")\n\t\tif IsNotFound(err) {\n\t\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"TC Virtual network does not exist in resource group\")\n\t\t\treconciliationcanceledcontext.SetCanceled(ctx)\n\t\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"canceling reconciliation\")\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"TC Virtual network exists in resource group\")\n\t}\n\n\tvar cpVnet network.VirtualNetwork\n\t{\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"Checking if CP virtual network %#q exists in resource group %#q\", r.mcVirtualNetworkName, r.mcResourceGroup))\n\n\t\tcpVnet, err = r.cpAzureClientSet.VirtualNetworkClient.Get(ctx, r.mcResourceGroup, r.mcVirtualNetworkName, \"\")\n\t\tif IsNotFound(err) {\n\t\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"CP Virtual network does not exist in resource group\")\n\t\t\treconciliationcanceledcontext.SetCanceled(ctx)\n\t\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"canceling reconciliation\")\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", \"CP Virtual network exists\")\n\t}\n\n\t{\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"Ensuring vnet peering %#q exists on the tenant cluster vnet %#q in resource group %#q\", r.mcVirtualNetworkName, key.VnetName(cr), key.ResourceGroupName(cr)))\n\n\t\tvnetPeeringsClient, err := r.clientFactory.GetVnetPeeringsClient(ctx, cr.ObjectMeta)\n\t\tif err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\n\t\ttcPeering := r.getTCVnetPeering(*cpVnet.ID)\n\t\t_, err = vnetPeeringsClient.CreateOrUpdate(ctx, key.ResourceGroupName(cr), key.VnetName(cr), r.mcVirtualNetworkName, tcPeering)\n\t\tif err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\t}\n\n\t{\n\t\tr.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"Ensuring vnet peering %#q exists on the control plane vnet %#q in resource group %#q\", key.ResourceGroupName(cr), r.mcVirtualNetworkName, r.mcResourceGroup))\n\t\tcpPeering := r.getCPVnetPeering(*tcVnet.ID)\n\t\t_, err = r.cpAzureClientSet.VnetPeeringClient.CreateOrUpdate(ctx, r.mcResourceGroup, r.mcVirtualNetworkName, key.ResourceGroupName(cr), cpPeering)\n\t\tif err != nil {\n\t\t\treturn microerror.Mask(err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func CreatePodResourceRecommender() PodResourceRecommender {\n\ttargetCPUPercentile := 0.9\n\tlowerBoundCPUPercentile := 0.5\n\tupperBoundCPUPercentile := 0.95\n\n\ttargetMemoryPeaksPercentile := 0.9\n\tlowerBoundMemoryPeaksPercentile := 0.5\n\tupperBoundMemoryPeaksPercentile := 0.95\n\n\ttargetEstimator := NewPercentileEstimator(targetCPUPercentile, targetMemoryPeaksPercentile)\n\tlowerBoundEstimator := NewPercentileEstimator(lowerBoundCPUPercentile, lowerBoundMemoryPeaksPercentile)\n\tupperBoundEstimator := NewPercentileEstimator(upperBoundCPUPercentile, upperBoundMemoryPeaksPercentile)\n\n\ttargetEstimator = WithMargin(*safetyMarginFraction, targetEstimator)\n\tlowerBoundEstimator = WithMargin(*safetyMarginFraction, lowerBoundEstimator)\n\tupperBoundEstimator = WithMargin(*safetyMarginFraction, upperBoundEstimator)\n\n\t// Apply confidence multiplier to the upper bound estimator. This means\n\t// that the updater will be less eager to evict pods with short history\n\t// in order to reclaim unused resources.\n\t// Using the confidence multiplier 1 with exponent +1 means that\n\t// the upper bound is multiplied by (1 + 1/history-length-in-days).\n\t// See estimator.go to see how the history length and the confidence\n\t// multiplier are determined. The formula yields the following multipliers:\n\t// No history : *INF (do not force pod eviction)\n\t// 12h history : *3 (force pod eviction if the request is > 3 * upper bound)\n\t// 24h history : *2\n\t// 1 week history : *1.14\n\tupperBoundEstimator = WithConfidenceMultiplier(1.0, 1.0, upperBoundEstimator)\n\n\t// Apply confidence multiplier to the lower bound estimator. This means\n\t// that the updater will be less eager to evict pods with short history\n\t// in order to provision them with more resources.\n\t// Using the confidence multiplier 0.001 with exponent -2 means that\n\t// the lower bound is multiplied by the factor (1 + 0.001/history-length-in-days)^-2\n\t// (which is very rapidly converging to 1.0).\n\t// See estimator.go to see how the history length and the confidence\n\t// multiplier are determined. The formula yields the following multipliers:\n\t// No history : *0 (do not force pod eviction)\n\t// 5m history : *0.6 (force pod eviction if the request is < 0.6 * lower bound)\n\t// 30m history : *0.9\n\t// 60m history : *0.95\n\tlowerBoundEstimator = WithConfidenceMultiplier(0.001, -2.0, lowerBoundEstimator)\n\n\treturn &podResourceRecommender{\n\t\ttargetEstimator,\n\t\tlowerBoundEstimator,\n\t\tupperBoundEstimator}\n}", "func CreateResource(clientset apiextcs.Interface) error {\n\tresource := &apiextv1beta1.CustomResourceDefinition{\n\t\tObjectMeta: meta_v1.ObjectMeta{Name: ResourcePlural + \".\" + ResourceGroup},\n\t\tSpec: apiextv1beta1.CustomResourceDefinitionSpec{\n\t\t\tGroup: ResourceGroup,\n\t\t\tVersion: ResourceVersion,\n\t\t\tScope: apiextv1beta1.NamespaceScoped,\n\t\t\tNames: apiextv1beta1.CustomResourceDefinitionNames{\n\t\t\t\tPlural: ResourcePlural,\n\t\t\t\tKind: reflect.TypeOf(Resource{}).Name(),\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err := clientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(resource)\n\tif err != nil && apierrors.IsAlreadyExists(err) {\n\t\treturn nil\n\t}\n\treturn err\n\n\t// TODO: add logic to wait for creation and exception handling\n}", "func createCRD(apiclient apiextensionsclient.Interface, resource CustomResource) error {\n\tcrdName := fmt.Sprintf(\"%s.%s\", resource.Plural, resource.Group)\n\tcrd := &apiextensionsv1beta1.CustomResourceDefinition{\n\t\tObjectMeta: metav1.ObjectMeta{Name: crdName},\n\t\tSpec: apiextensionsv1beta1.CustomResourceDefinitionSpec{\n\t\t\tGroup: resource.Group,\n\t\t\tVersion: resource.Version,\n\t\t\tScope: resource.Scope,\n\t\t\tNames: apiextensionsv1beta1.CustomResourceDefinitionNames{\n\t\t\t\tSingular: resource.Name,\n\t\t\t\tPlural: resource.Plural,\n\t\t\t\tKind: resource.Kind,\n\t\t\t\tShortNames: resource.ShortNames,\n\t\t\t},\n\t\t},\n\t}\n\n\t_, err := apiclient.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd)\n\tif err != nil {\n\t\tif !errors.IsAlreadyExists(err) {\n\t\t\treturn fmt.Errorf(\"failed to create %s CRD. %+v\", resource.Name, err)\n\t\t}\n\t}\n\treturn nil\n}", "func resourceVolterraNetworkPolicyRuleCreate(d *schema.ResourceData, meta interface{}) error {\n\tclient := meta.(*APIClient)\n\n\tcreateMeta := &ves_io_schema.ObjectCreateMetaType{}\n\tcreateSpec := &ves_io_schema_network_policy_rule.CreateSpecType{}\n\tcreateReq := &ves_io_schema_network_policy_rule.CreateRequest{\n\t\tMetadata: createMeta,\n\t\tSpec: createSpec,\n\t}\n\n\tif v, ok := d.GetOk(\"annotations\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tcreateMeta.Annotations = ms\n\t}\n\n\tif v, ok := d.GetOk(\"description\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Description =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"disable\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Disable =\n\t\t\tv.(bool)\n\t}\n\n\tif v, ok := d.GetOk(\"labels\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tcreateMeta.Labels = ms\n\t}\n\n\tif v, ok := d.GetOk(\"name\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Name =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"namespace\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Namespace =\n\t\t\tv.(string)\n\t}\n\n\t//action\n\tif v, ok := d.GetOk(\"action\"); ok && !isIntfNil(v) {\n\n\t\tcreateSpec.Action = ves_io_schema_network_policy_rule.NetworkPolicyRuleAction(ves_io_schema_network_policy_rule.NetworkPolicyRuleAction_value[v.(string)])\n\n\t}\n\n\t//advanced_action\n\tif v, ok := d.GetOk(\"advanced_action\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.(*schema.Set).List()\n\t\tadvancedAction := &ves_io_schema_network_policy_rule.NetworkPolicyRuleAdvancedAction{}\n\t\tcreateSpec.AdvancedAction = advancedAction\n\t\tfor _, set := range sl {\n\t\t\tadvancedActionMapStrToI := set.(map[string]interface{})\n\n\t\t\tif v, ok := advancedActionMapStrToI[\"action\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tadvancedAction.Action = ves_io_schema_network_policy_rule.LogAction(ves_io_schema_network_policy_rule.LogAction_value[v.(string)])\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//label_matcher\n\tif v, ok := d.GetOk(\"label_matcher\"); ok && !isIntfNil(v) {\n\n\t\tsl := v.(*schema.Set).List()\n\t\tlabelMatcher := &ves_io_schema.LabelMatcherType{}\n\t\tcreateSpec.LabelMatcher = labelMatcher\n\t\tfor _, set := range sl {\n\t\t\tlabelMatcherMapStrToI := set.(map[string]interface{})\n\n\t\t\tif w, ok := labelMatcherMapStrToI[\"keys\"]; ok && !isIntfNil(w) {\n\t\t\t\tls := make([]string, len(w.([]interface{})))\n\t\t\t\tfor i, v := range w.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tlabelMatcher.Keys = ls\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//ports\n\tif v, ok := d.GetOk(\"ports\"); ok && !isIntfNil(v) {\n\n\t\tls := make([]string, len(v.([]interface{})))\n\t\tfor i, v := range v.([]interface{}) {\n\t\t\tls[i] = v.(string)\n\t\t}\n\t\tcreateSpec.Ports = ls\n\n\t}\n\n\t//protocol\n\tif v, ok := d.GetOk(\"protocol\"); ok && !isIntfNil(v) {\n\n\t\tcreateSpec.Protocol =\n\t\t\tv.(string)\n\n\t}\n\n\t//remote_endpoint\n\n\tremoteEndpointTypeFound := false\n\n\tif v, ok := d.GetOk(\"ip_prefix_set\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_IpPrefixSet{}\n\t\tremoteEndpointInt.IpPrefixSet = &ves_io_schema.IpPrefixSetRefType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"ref\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\trefInt := make([]*ves_io_schema.ObjectRefType, len(sl))\n\t\t\t\tremoteEndpointInt.IpPrefixSet.Ref = refInt\n\t\t\t\tfor i, ps := range sl {\n\n\t\t\t\t\trMapToStrVal := ps.(map[string]interface{})\n\t\t\t\t\trefInt[i] = &ves_io_schema.ObjectRefType{}\n\n\t\t\t\t\trefInt[i].Kind = \"ip_prefix_set\"\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"name\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Name = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"namespace\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Namespace = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"tenant\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Tenant = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rMapToStrVal[\"uid\"]; ok && !isIntfNil(v) {\n\t\t\t\t\t\trefInt[i].Uid = v.(string)\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"prefix\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_Prefix{}\n\t\tremoteEndpointInt.Prefix = &ves_io_schema.PrefixListType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"ipv6_prefix\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.Prefix.Ipv6Prefix = ls\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"prefix\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.Prefix.Prefix = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"prefix_selector\"); ok && !remoteEndpointTypeFound {\n\n\t\tremoteEndpointTypeFound = true\n\t\tremoteEndpointInt := &ves_io_schema_network_policy_rule.CreateSpecType_PrefixSelector{}\n\t\tremoteEndpointInt.PrefixSelector = &ves_io_schema.LabelSelectorType{}\n\t\tcreateSpec.RemoteEndpoint = remoteEndpointInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tremoteEndpointInt.PrefixSelector.Expressions = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tlog.Printf(\"[DEBUG] Creating Volterra NetworkPolicyRule object with struct: %+v\", createReq)\n\n\tcreateNetworkPolicyRuleResp, err := client.CreateObject(context.Background(), ves_io_schema_network_policy_rule.ObjectType, createReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating NetworkPolicyRule: %s\", err)\n\t}\n\td.SetId(createNetworkPolicyRuleResp.GetObjSystemMetadata().GetUid())\n\n\treturn resourceVolterraNetworkPolicyRuleRead(d, meta)\n}", "func (ac *AWSCluster) CreateAWSKubernetesCluster() {\n\tsess := session.Must(session.NewSession())\n\tiamClient := iam.New(sess)\n\teksClient := eks.New(sess)\n\tcfClient := cloudformation.New(sess)\n\tec2Client := ec2.New(sess)\n\n\t// Creating Amazon EKS Role\n\teksRoleName := awsRolePrefix + ac.serviceSuffix\n\teksRoleArn := ac.createEksRole(iamClient, &eksRoleName)\n\n\t// Creating Amazon EKS Cluster VPC\n\tclusterStackName := awsClusterStackPrefix + ac.serviceSuffix\n\tclusterStackOutputs := ac.createEksClusterVpc(cfClient, &clusterStackName)\n\n\t// Creating Amazon EKS Cluster\n\tclusterName := awsClusterPrefix + ac.serviceSuffix\n\tcluster := ac.createEksCluster(eksClient, &clusterName, eksRoleArn, clusterStackOutputs)\n\n\t// Creating kubeconfig file\n\tac.createKubeConfigFile(cluster)\n\n\t// Creating Amazon EKS Worker Nodes\n\tkeyPairName := awsKeyPairPrefix + ac.serviceSuffix\n\tac.createEksEc2KeyPair(ec2Client, &keyPairName)\n\n\tnodesStackName := awsNodesStackPrefix + ac.serviceSuffix\n\tnodeGroupName := awsNodeGroupPrefix + ac.serviceSuffix\n\tnodeSequrityGroup, nodeInstanceRole := ac.createEksWorkerNodes(cfClient, &nodesStackName, &nodeGroupName, &clusterName, &keyPairName, clusterStackOutputs)\n\n\tac.authorizeSecurityGroupIngress(ec2Client, nodeSequrityGroup)\n\n\t// Enable worker nodes to join the cluster\n\tsf, err := ioutil.ReadFile(path.Join(ac.configPath, \"aws-auth-cm-temp.yaml\"))\n\tac.checkError(err)\n\n\tf, err := ioutil.TempFile(os.TempDir(), \"aws-auth-cm-temp-*.yaml\")\n\tac.checkError(err)\n\n\ts := string(sf)\n\t_, err = f.Write([]byte(strings.Replace(s, \"<NodeInstanceRole>\", *nodeInstanceRole, -1)))\n\tac.checkError(err)\n\n\t_ = f.Close()\n\n\tac.execCommand(\"kubectl\", \"apply\", \"-f\", f.Name())\n\t_ = os.Remove(f.Name())\n\n\tac.createSSHConfig(ec2Client, clusterStackOutputs.VpcId, \"scp-config\"+ac.serviceSuffix)\n\n\tac.execCommand(\"kubectl\", \"apply\", \"-f\", \"aws-k8s-cni.yaml\")\n}", "func (s *K8sSvc) CreateReplicaSet(ctx context.Context, opts *containersvc.CreateServiceOptions) error {\n\trequuid := utils.GetReqIDFromContext(ctx)\n\n\t// set replicaset resource limits and requests\n\tres := s.createResource(opts)\n\tglog.Infoln(\"create replicaset resource\", res, \"requuid\", requuid, opts.Common)\n\n\t// set env\n\tenvs := make([]corev1.EnvVar, len(opts.Envkvs))\n\tfor i, e := range opts.Envkvs {\n\t\tenvs[i] = corev1.EnvVar{\n\t\t\tName: e.Name,\n\t\t\tValue: e.Value,\n\t\t}\n\t}\n\n\tlabels := make(map[string]string)\n\tlabels[serviceNameLabel] = opts.Common.ServiceName\n\tlabels[serviceUUIDLabel] = opts.Common.ServiceUUID\n\n\treplicaset := &appsv1.ReplicaSet{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: opts.Common.ServiceName,\n\t\t\tNamespace: s.namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: appsv1.ReplicaSetSpec{\n\t\t\tReplicas: utils.Int32Ptr(int32(opts.Replicas)),\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tNamespace: s.namespace,\n\t\t\t\t\tLabels: labels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: opts.Common.ServiceName,\n\t\t\t\t\t\t\tImage: opts.Common.ContainerImage,\n\t\t\t\t\t\t\tResources: res,\n\t\t\t\t\t\t\tImagePullPolicy: corev1.PullAlways,\n\t\t\t\t\t\t\tEnv: envs,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tRestartPolicy: corev1.RestartPolicyAlways,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// set port exposing\n\tif len(opts.PortMappings) != 0 {\n\t\tglog.Infoln(\"expose port\", opts.PortMappings, \"requuid\", requuid, opts.Common)\n\n\t\tports := make([]corev1.ContainerPort, len(opts.PortMappings))\n\t\tfor i, p := range opts.PortMappings {\n\t\t\tports[i] = corev1.ContainerPort{\n\t\t\t\tContainerPort: int32(p.ContainerPort),\n\t\t\t}\n\t\t\tif opts.ExternalDNS {\n\t\t\t\t// TODO current needs to expose the host port for ExternalDNS, so replicas could talk with each other.\n\t\t\t\t// refactor it when using the k8s external dns project.\n\t\t\t\tports[i].HostPort = int32(p.HostPort)\n\t\t\t}\n\t\t}\n\n\t\treplicaset.Spec.Template.Spec.Containers[0].Ports = ports\n\n\t\t// use host network by default for better performance.\n\t\t// k8s requires \"If this option is set, the ports that will be used must be specified.\"\n\t\treplicaset.Spec.Template.Spec.HostNetwork = true\n\t}\n\n\t_, err := s.cliset.AppsV1beta2().ReplicaSets(s.namespace).Create(replicaset)\n\treturn err\n}", "func Create(ctx context.Context, client *v1.ServiceClient, clusterID string, opts *CreateOpts) (*v1.ResponseResult, error) {\n\tcreateNodegroupOpts := struct {\n\t\tNodegroup *CreateOpts `json:\"nodegroup\"`\n\t}{\n\t\tNodegroup: opts,\n\t}\n\trequestBody, err := json.Marshal(createNodegroupOpts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turl := strings.Join([]string{client.Endpoint, v1.ResourceURLCluster, clusterID, v1.ResourceURLNodegroup}, \"/\")\n\tresponseResult, err := client.DoRequest(ctx, http.MethodPost, url, bytes.NewReader(requestBody))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif responseResult.Err != nil {\n\t\terr = responseResult.Err\n\t}\n\n\treturn responseResult, err\n}", "func (sm *Statemgr) CreateNode(node *cluster.Node) (*NodeState, error) {\n\t// see if we already have it\n\tehs, err := sm.FindNode(node.ObjectMeta.Name)\n\tif err == nil {\n\t\t// Object exists in cache, but we got a watcher event with event-type:Created\n\t\t// and this can happen if there is a watcher error/reset and we need to update\n\t\t// the cache to handle it gracefully as an Update.\n\t\tlog.Infof(\"Objects exists, updating Node OldState: {%+v}. New state: {%+v}\", ehs, node)\n\t\tehs.Lock()\n\t\tdefer ehs.Unlock()\n\t\treturn ehs, sm.UpdateNode(node, false)\n\t}\n\n\t// create new Node state\n\tnodeState, err := NewNodeState(node)\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating new Node state. Err: %v\", err)\n\t\treturn nil, err\n\t}\n\n\t// store it in local DB\n\terr = sm.memDB.AddObject(nodeState)\n\tif err != nil {\n\t\tlog.Errorf(\"Error storing the Node state in memdb. Err: %v\", err)\n\t\treturn nil, err\n\t}\n\n\t// Node creates are never written back to ApiServer\n\tlog.Infof(\"Created Node state {%+v}\", node.ObjectMeta)\n\treturn nodeState, nil\n}", "func (az *Cloud) GetNodeResourceGroup(nodeName string) (string, error) {\n\t// Kubelet won't set az.nodeInformerSynced, always return configured resourceGroup.\n\tif az.nodeInformerSynced == nil {\n\t\treturn az.ResourceGroup, nil\n\t}\n\n\taz.nodeCachesLock.RLock()\n\tdefer az.nodeCachesLock.RUnlock()\n\tif !az.nodeInformerSynced() {\n\t\treturn \"\", fmt.Errorf(\"node informer is not synced when trying to GetNodeResourceGroup\")\n\t}\n\n\t// Return external resource group if it has been cached.\n\tif cachedRG, ok := az.nodeResourceGroups[nodeName]; ok {\n\t\treturn cachedRG, nil\n\t}\n\n\t// Return resource group from cloud provider options.\n\treturn az.ResourceGroup, nil\n}", "func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) {\n\tlistenersToNotify := []nodeNetworkConfigListener{}\n\tnnc, err := r.nnccli.Get(ctx, req.NamespacedName)\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tlogger.Printf(\"[cns-rc] CRD not found, ignoring %v\", err)\n\t\t\treturn reconcile.Result{}, errors.Wrapf(client.IgnoreNotFound(err), \"NodeNetworkConfig %v not found\", req.NamespacedName)\n\t\t}\n\t\tlogger.Errorf(\"[cns-rc] Error retrieving CRD from cache : %v\", err)\n\t\treturn reconcile.Result{}, errors.Wrapf(err, \"failed to get NodeNetworkConfig %v\", req.NamespacedName)\n\t}\n\n\tlogger.Printf(\"[cns-rc] CRD Spec: %+v\", nnc.Spec)\n\n\tipAssignments := 0\n\n\t// for each NC, parse it in to a CreateNCRequest and forward it to the appropriate Listener\n\tfor i := range nnc.Status.NetworkContainers {\n\t\t// check if this NC matches the Node IP if we have one to check against\n\t\tif r.nodeIP != \"\" {\n\t\t\tif r.nodeIP != nnc.Status.NetworkContainers[i].NodeIP {\n\t\t\t\t// skip this NC since it was created for a different node\n\t\t\t\tlogger.Printf(\"[cns-rc] skipping network container %s found in NNC because node IP doesn't match, got %s, expected %s\",\n\t\t\t\t\tnnc.Status.NetworkContainers[i].ID, nnc.Status.NetworkContainers[i].NodeIP, r.nodeIP)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tvar req *cns.CreateNetworkContainerRequest\n\t\tvar err error\n\t\tswitch nnc.Status.NetworkContainers[i].AssignmentMode { //nolint:exhaustive // skipping dynamic case\n\t\t// For Overlay and Vnet Scale Scenarios\n\t\tcase v1alpha.Static:\n\t\t\treq, err = CreateNCRequestFromStaticNC(nnc.Status.NetworkContainers[i])\n\t\t// For Pod Subnet scenario\n\t\tdefault: // For backward compatibility, default will be treated as Dynamic too.\n\t\t\treq, err = CreateNCRequestFromDynamicNC(nnc.Status.NetworkContainers[i])\n\t\t\t// in dynamic, we will also push this NNC to the IPAM Pool Monitor when we're done.\n\t\t\tlistenersToNotify = append(listenersToNotify, r.ipampoolmonitorcli)\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"[cns-rc] failed to generate CreateNCRequest from NC: %v, assignmentMode %s\", err,\n\t\t\t\tnnc.Status.NetworkContainers[i].AssignmentMode)\n\t\t\treturn reconcile.Result{}, errors.Wrapf(err, \"failed to generate CreateNCRequest from NC \"+\n\t\t\t\t\"assignmentMode %s\", nnc.Status.NetworkContainers[i].AssignmentMode)\n\t\t}\n\n\t\tresponseCode := r.cnscli.CreateOrUpdateNetworkContainerInternal(req)\n\t\tif err := restserver.ResponseCodeToError(responseCode); err != nil {\n\t\t\tlogger.Errorf(\"[cns-rc] Error creating or updating NC in reconcile: %v\", err)\n\t\t\treturn reconcile.Result{}, errors.Wrap(err, \"failed to create or update network container\")\n\t\t}\n\t\tipAssignments += len(req.SecondaryIPConfigs)\n\t}\n\n\t// record assigned IPs metric\n\tallocatedIPs.Set(float64(ipAssignments))\n\n\t// push the NNC to the registered NNC listeners.\n\tfor _, l := range listenersToNotify {\n\t\tif err := l.Update(nnc); err != nil {\n\t\t\treturn reconcile.Result{}, errors.Wrap(err, \"nnc listener return error during update\")\n\t\t}\n\t}\n\n\t// we have received and pushed an NNC update, we are \"Started\"\n\tr.once.Do(func() {\n\t\tclose(r.started)\n\t\tlogger.Printf(\"[cns-rc] CNS NNC Reconciler Started\")\n\t})\n\treturn reconcile.Result{}, nil\n}", "func (ph *phaseHandler) createResource(sso *v1alpha1.Keycloak, resourceName string) (bool, error) {\n\tkc := sso.DeepCopy()\n\tresourceHelper := newResourceHelper(kc)\n\tresource, err := resourceHelper.createResource(resourceName)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tgvk := resource.GetObjectKind().GroupVersionKind()\n\tapiVersion, kind := gvk.ToAPIVersionAndKind()\n\tresourceClient, _, err := ph.dynamicResourceClientFactory(apiVersion, kind, kc.Namespace)\n\tif err != nil {\n\t\t// The resource cannot be created because the CRD is not installed in the cluster.\n\t\t// We can try again later.\n\t\treturn false, nil\n\t}\n\n\tresource, err = resourceClient.Create(resource)\n\tif err != nil && !errors2.IsAlreadyExists(err) {\n\t\treturn false, errors.Wrap(err, \"failed to create unstructured object\")\n\t}\n\n\treturn true, nil\n}", "func getRCWithInterPodAffinityNodeSelector(name string, labelsMap map[string]string, replica int, affinity *v1.Affinity, image string, nodeSelector map[string]string) *v1.ReplicationController {\n\treplicaInt32 := int32(replica)\n\treturn &v1.ReplicationController{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t},\n\t\tSpec: v1.ReplicationControllerSpec{\n\t\t\tReplicas: &replicaInt32,\n\t\t\tSelector: labelsMap,\n\t\t\tTemplate: &v1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: labelsMap,\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tAffinity: affinity,\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: name,\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tDNSPolicy: v1.DNSDefault,\n\t\t\t\t\tNodeSelector: nodeSelector,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func GetNodePoolTemplate() (string, error) {\n\treturn internalcloudformation.GetCloudFormationTemplate(\n\t\tglobal.Config.Distribution.EKS.TemplateLocation, eksNodePoolTemplateName,\n\t)\n}", "func (a *ConfluentCloudApi) CreateConfluentResource(ctx _context.Context, accountId string, body ConfluentResourceRequest) (ConfluentResourceResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarReturnValue ConfluentResourceResponse\n\t)\n\n\tlocalBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, \"v2.ConfluentCloudApi.CreateConfluentResource\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v2/integrations/confluent-cloud/accounts/{account_id}/resources\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"account_id\"+\"}\", _neturl.PathEscape(datadog.ParameterToString(accountId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tlocalVarHeaderParams[\"Content-Type\"] = \"application/json\"\n\tlocalVarHeaderParams[\"Accept\"] = \"application/json\"\n\n\t// body params\n\tlocalVarPostBody = &body\n\tdatadog.SetAuthKeys(\n\t\tctx,\n\t\t&localVarHeaderParams,\n\t\t[2]string{\"apiKeyAuth\", \"DD-API-KEY\"},\n\t\t[2]string{\"appKeyAuth\", \"DD-APPLICATION-KEY\"},\n\t)\n\treq, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.Client.CallAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := datadog.ReadBody(localVarHTTPResponse)\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := datadog.GenericOpenAPIError{\n\t\t\tErrorBody: localVarBody,\n\t\t\tErrorMessage: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.ErrorModel = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := datadog.GenericOpenAPIError{\n\t\t\tErrorBody: localVarBody,\n\t\t\tErrorMessage: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (client OpenShiftManagedClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters v20180930preview.OpenShiftManagedCluster) (*http.Request, error) {\n\tpathParameters := map[string]interface{}{\n\t\t\"resourceGroupName\": autorest.Encode(\"path\", resourceGroupName),\n\t\t\"resourceName\": autorest.Encode(\"path\", resourceName),\n\t\t\"subscriptionId\": autorest.Encode(\"path\", client.SubscriptionID),\n\t}\n\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": v20180930preview.APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPathParameters(\"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}\", pathParameters),\n\t\tautorest.WithJSON(parameters),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (c *APIGateway) CreateResourceRequest(input *CreateResourceInput) (req *request.Request, output *Resource) {\n\top := &request.Operation{\n\t\tName: opCreateResource,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/restapis/{restapi_id}/resources/{parent_id}\",\n\t}\n\n\tif input == nil {\n\t\tinput = &CreateResourceInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &Resource{}\n\treq.Data = output\n\treturn\n}", "func (r *Resource) createReadAllClusterRole(ctx context.Context) error {\n\n\tlists, err := r.K8sClient().Discovery().ServerPreferredResources()\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\n\tvar policyRules []rbacv1.PolicyRule\n\t{\n\t\tfor _, list := range lists {\n\t\t\tif len(list.APIResources) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgv, err := schema.ParseGroupVersion(list.GroupVersion)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, resource := range list.APIResources {\n\t\t\t\tif len(resource.Verbs) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif isRestrictedResource(resource.Name) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpolicyRule := rbacv1.PolicyRule{\n\t\t\t\t\tAPIGroups: []string{gv.Group},\n\t\t\t\t\tResources: []string{resource.Name},\n\t\t\t\t\tVerbs: []string{\"get\", \"list\", \"watch\"},\n\t\t\t\t}\n\t\t\t\tpolicyRules = append(policyRules, policyRule)\n\t\t\t}\n\t\t}\n\t}\n\n\t// ServerPreferredResources explicitely ignores any resource containing a '/'\n\t// but we require this for enabling pods/logs for customer access to\n\t// kubernetes pod logging. This is appended as a specific rule instead.\n\tpolicyRule := rbacv1.PolicyRule{\n\t\tAPIGroups: []string{\"\"},\n\t\tResources: []string{\"pods/log\"},\n\t\tVerbs: []string{\"get\", \"list\"},\n\t}\n\tpolicyRules = append(policyRules, policyRule)\n\n\treadOnlyClusterRole := &rbacv1.ClusterRole{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: pkgkey.DefaultReadAllPermissionsName,\n\t\t\tLabels: map[string]string{\n\t\t\t\tlabel.ManagedBy: project.Name(),\n\t\t\t\tlabel.DisplayInUserInterface: \"true\",\n\t\t\t},\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tannotation.Notes: \"Grants read-only (get, list, watch) permissions to almost all resource types known on the management cluster, with exception of ConfigMap and Secret.\",\n\t\t\t},\n\t\t},\n\t\tRules: policyRules,\n\t}\n\n\treturn rbac.CreateOrUpdateClusterRole(r, ctx, readOnlyClusterRole)\n}" ]
[ "0.76723534", "0.56957585", "0.5255607", "0.52420557", "0.5161676", "0.51323014", "0.51153105", "0.5114872", "0.51094985", "0.50911283", "0.50660753", "0.5031809", "0.50017095", "0.49854472", "0.49768355", "0.49335805", "0.49045685", "0.48949906", "0.48829058", "0.4836229", "0.47845647", "0.47814444", "0.4772862", "0.47690067", "0.4766219", "0.47438952", "0.46845406", "0.46693474", "0.46602583", "0.4656761", "0.46531802", "0.46361092", "0.46097073", "0.45974606", "0.45932958", "0.45862812", "0.45681697", "0.4563888", "0.4553754", "0.4533314", "0.4530141", "0.45221964", "0.45202425", "0.45173743", "0.45150152", "0.45090434", "0.4504507", "0.44962138", "0.4494682", "0.44926536", "0.44881374", "0.4487703", "0.44808802", "0.44786954", "0.44718102", "0.44697562", "0.4462198", "0.4452288", "0.444802", "0.44438487", "0.44340524", "0.4433146", "0.44284296", "0.44244948", "0.44216114", "0.44147718", "0.4412288", "0.44097692", "0.44018888", "0.43954247", "0.43878362", "0.4387403", "0.43872783", "0.43831387", "0.43818253", "0.43763995", "0.4375229", "0.43729588", "0.43602747", "0.4358433", "0.435558", "0.4351317", "0.4351061", "0.4349946", "0.4342458", "0.43403167", "0.43402493", "0.4339511", "0.43377727", "0.43362677", "0.4332552", "0.4331112", "0.43267825", "0.43204704", "0.43171397", "0.43156573", "0.4311378", "0.43093958", "0.43088225", "0.43086216" ]
0.80550957
0
AllocatableResourceListFromNodeResourceTopology extract the map zone:allocatableResources from the given NodeResourceTopology instance.
AllocatableResourceListFromNodeResourceTopology извлекает карту zone:allocatableResources из заданного экземпляра NodeResourceTopology.
func AllocatableResourceListFromNodeResourceTopology(nodeTopo *v1alpha2.NodeResourceTopology) map[string]corev1.ResourceList { allocRes := make(map[string]corev1.ResourceList) for _, zone := range nodeTopo.Zones { if zone.Type != "Node" { continue } resList := make(corev1.ResourceList) for _, res := range zone.Resources { resList[corev1.ResourceName(res.Name)] = res.Allocatable.DeepCopy() } if len(resList) == 0 { continue } allocRes[zone.Name] = resList } return allocRes }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetMemoryResources(reservedMemory map[int]int64, getAvailableMemory func() ([]*topology.Node, []*rtesysinfo.Hugepages, error)) (map[string]PerNUMACounters, error) {\n\tnumaMemory := make(map[string]PerNUMACounters)\n\tnodes, hugepages, err := getAvailableMemory()\n\tif err != nil {\n\t\treturn numaMemory, err\n\t}\n\n\tcounters := make(PerNUMACounters)\n\tfor _, node := range nodes {\n\t\tcounters[node.ID] += node.Memory.TotalUsableBytes\n\t}\n\tmemCounters := make(PerNUMACounters)\n\tfor numaID, amount := range counters {\n\t\treserved := reservedMemory[numaID]\n\t\tif reserved > amount {\n\t\t\t// TODO log\n\t\t\tmemCounters[numaID] = 0\n\t\t}\n\t\tmemCounters[numaID] = amount - reserved\n\t}\n\tnumaMemory[string(corev1.ResourceMemory)] = memCounters\n\n\tfor _, hp := range hugepages {\n\t\tname := rtesysinfo.HugepageResourceNameFromSize(hp.SizeKB)\n\t\thpCounters, ok := numaMemory[name]\n\t\tif !ok {\n\t\t\thpCounters = make(PerNUMACounters)\n\t\t}\n\t\thpCounters[hp.NodeID] += int64(hp.Total)\n\t\tnumaMemory[name] = hpCounters\n\t}\n\n\treturn numaMemory, nil\n}", "func CompareAllocatableResources(expected, got map[string]corev1.ResourceList) (string, string, int, bool) {\n\tif len(got) != len(expected) {\n\t\tframework.Logf(\"-> expected=%v (len=%d) got=%v (len=%d)\", expected, len(expected), got, len(got))\n\t\treturn \"\", \"\", 0, false\n\t}\n\tfor expZoneName, expResList := range expected {\n\t\tgotResList, ok := got[expZoneName]\n\t\tif !ok {\n\t\t\treturn expZoneName, \"\", 0, false\n\t\t}\n\t\tif resName, cmp, ok := CompareResourceList(expResList, gotResList); !ok || cmp != 0 {\n\t\t\treturn expZoneName, resName, cmp, ok\n\t\t}\n\t}\n\treturn \"\", \"\", 0, true\n}", "func (config *AppConfig) GetNodeAllocations(nodeID int) (allocations NodeAllocations, err error) {\n\t// Get allocation info from the panel\n\tallocBytes, err := config.queryApplicationAPI(fmt.Sprintf(\"nodes/%d/allocations?page=%d\", nodeID), \"get\", nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Unmarshal the bytes to a usable struct.\n\terr = json.Unmarshal(allocBytes, &allocations)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor i := 1; i >= allocations.Meta.Pagination.TotalPages; i++ {\n\t\tallocations, err := config.getNodeAllocationsByPage(nodeID, i)\n\t\tif err != nil {\n\t\t\treturn allocations, err\n\t\t}\n\t\tfor _, allocation := range allocations.Allocations {\n\t\t\tallocations.Allocations = append(allocations.Allocations, allocation)\n\t\t}\n\t}\n\n\treturn\n}", "func (a *ResourcepoolApiService) GetResourcepoolLeaseResourceList(ctx context.Context) ApiGetResourcepoolLeaseResourceListRequest {\n\treturn ApiGetResourcepoolLeaseResourceListRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (rc *ResourceCache) GetNodeResources(nodeName string) []*Resource {\n\trc.lock.Lock()\n\tdefer rc.lock.Unlock()\n\tnode, ok := rc.Nodes[nodeName]\n\tif !ok {\n\t\treturn nil\n\t}\n\tretRes := make([]*Resource, 0)\n\tfor _, r := range node.Resources {\n\t\tretRes = append(retRes, r.DeepCopy())\n\t}\n\tsort.Slice(retRes, func(i, j int) bool {\n\t\treturn retRes[i].Key() < retRes[j].Key()\n\t})\n\treturn retRes\n}", "func (p *ResourcePool) Allocs(ctx context.Context) ([]Alloc, error) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tallocs := make([]Alloc, len(p.allocs))\n\ti := 0\n\tfor _, a := range p.allocs {\n\t\tallocs[i] = a\n\t\ti++\n\t}\n\treturn allocs, nil\n}", "func resourcesNode(node *yaml.Node) yit.Iterator {\n\treturn yit.FromNode(node).\n\t\t// Access nested 'resources' attribute\n\t\tValuesForMap(\n\t\t\tyit.WithStringValue(\"resources\"),\n\t\t\tyit.WithKind(yaml.SequenceNode),\n\t\t)\n}", "func buildNodeCapacityMap(acs []accrd.AvailableCapacity) NodeCapacityMap {\n\tcapMap := NodeCapacityMap{}\n\tfor _, ac := range acs {\n\t\tac := ac\n\t\tif _, ok := capMap[ac.Spec.NodeId]; !ok {\n\t\t\tcapMap[ac.Spec.NodeId] = ACMap{}\n\t\t}\n\t\tcapMap[ac.Spec.NodeId][ac.Name] = &ac\n\t}\n\treturn capMap\n}", "func (n *resPool) GetTotalAllocatedResources() *scalar.Resources {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.allocation.GetByType(scalar.TotalAllocation)\n}", "func buildNormalizedNodeResourceMap(pods []*core_v1.Pod, nodes []*core_v1.Node) nodeResourceMap { // nolint: gocyclo\n\tnrm := nodeResourceMap{}\n\n\tfor _, n := range nodes {\n\t\tnrm[n.ObjectMeta.Name] = allocatedNodeResources{node: n}\n\t}\n\n\t// We sum the total allocated resources on every node from our list of pods.\n\t// Some strategies may wish to price pods based on their fraction of allocated\n\t// node resources, rather than the total resources available on a node. This\n\t// may punish lone pods that are initially scheduled onto large nodes, but this\n\t// may be desirable as it rightfully punishes applications that may cause\n\t// frequent node turnover.\n\tfor _, p := range pods {\n\t\tnr, ok := nrm[p.Spec.NodeName]\n\t\tif !ok {\n\t\t\tlog.Log.Warnw(\"unexpected missing node from NodeMap\", zap.String(\"nodeName\", p.Spec.NodeName))\n\t\t\tcontinue\n\t\t}\n\t\tnr.cpuUsed += sumPodResource(p, core_v1.ResourceCPU)\n\t\tnr.memoryUsed += sumPodResource(p, core_v1.ResourceMemory)\n\t\tnr.gpuUsed += sumPodResource(p, ResourceGPU)\n\t\tnrm[p.Spec.NodeName] = nr\n\t}\n\n\tfor k, v := range nrm {\n\t\tc := v.node.Status.Capacity.Cpu()\n\t\tif c != nil {\n\t\t\tv.cpuAvailable = c.MilliValue()\n\t\t}\n\n\t\tm := v.node.Status.Capacity.Memory()\n\t\tif m != nil {\n\t\t\tv.memoryAvailable = m.Value()\n\t\t}\n\n\t\tg := gpuCapacity(&v.node.Status.Capacity)\n\t\tif g != nil {\n\t\t\tv.gpuAvailable = g.Value()\n\t\t}\n\n\t\t// The ratio of cpuUsed / cpuAvailable is used for proportional scaling of\n\t\t// resources to \"normalize\" pod resource utilization to a full node. If\n\t\t// cpuUsed is 0 because the pods that are running have not made resource\n\t\t// requests, there's a possible divide by 0 in calling code so we default to\n\t\t// setting cpuUsed to cpuAvailable.\n\t\tif v.cpuUsed == 0 {\n\t\t\tv.cpuUsed = v.cpuAvailable\n\t\t}\n\n\t\tif v.memoryUsed == 0 {\n\t\t\tv.memoryUsed = v.memoryAvailable\n\t\t}\n\n\t\tif v.gpuUsed == 0 {\n\t\t\tv.gpuUsed = v.gpuAvailable\n\t\t}\n\n\t\tnrm[k] = v\n\t}\n\n\treturn nrm\n}", "func (p *mockPolicy) GetAllocatableMemory(s state.State) []state.Block {\n\treturn []state.Block{}\n}", "func computeClusterResources(nodes map[string]*repository.KubeNode) map[metrics.ResourceType]*repository.KubeDiscoveredResource {\n\t// sum the capacities of the node resources\n\tcomputeResources := make(map[metrics.ResourceType]float64)\n\tfor _, node := range nodes {\n\t\tnodeActive := util.NodeIsReady(node.Node) && util.NodeIsSchedulable(node.Node)\n\t\tif nodeActive {\n\t\t\t// Iterate over all ready and schedulable compute resource types\n\t\t\tfor _, rt := range metrics.KubeComputeResourceTypes {\n\t\t\t\t// get the compute resource if it exists\n\t\t\t\tnodeResource, exists := node.ComputeResources[rt]\n\t\t\t\tif !exists {\n\t\t\t\t\tglog.Errorf(\"Missing %s resource in node %s\", rt, node.Name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// add the capacity to the cluster compute resource map\n\t\t\t\tcomputeCap, exists := computeResources[rt]\n\t\t\t\tif !exists {\n\t\t\t\t\tcomputeCap = nodeResource.Capacity\n\t\t\t\t} else {\n\t\t\t\t\tcomputeCap = computeCap + nodeResource.Capacity\n\t\t\t\t}\n\t\t\t\tcomputeResources[rt] = computeCap\n\t\t\t}\n\t\t}\n\t}\n\n\t// create KubeDiscoveredResource object for each compute resource type\n\tclusterResources := make(map[metrics.ResourceType]*repository.KubeDiscoveredResource)\n\tfor _, rt := range metrics.KubeComputeResourceTypes {\n\t\tcapacity := computeResources[rt]\n\t\tr := &repository.KubeDiscoveredResource{\n\t\t\tType: rt,\n\t\t\tCapacity: capacity,\n\t\t}\n\t\tclusterResources[rt] = r\n\t}\n\treturn clusterResources\n}", "func ConvertToResmgrResource(resource *task.ResourceConfig) *Resources {\n\treturn &Resources{\n\t\tCPU: resource.GetCpuLimit(),\n\t\tDISK: resource.GetDiskLimitMb(),\n\t\tGPU: resource.GetGpuLimit(),\n\t\tMEMORY: resource.GetMemLimitMb(),\n\t}\n}", "func DescribeNodeResource(nodeNonTerminatedPodsList *corev1.PodList, node *corev1.Node) *NodeUsage {\n\tallocatable := node.Status.Capacity\n\tif len(node.Status.Allocatable) > 0 {\n\t\tallocatable = node.Status.Allocatable\n\t}\n\n\treqs, limits := getPodsTotalRequestsAndLimits(nodeNonTerminatedPodsList)\n\tcpuReqs, cpuLimits, memoryReqs, memoryLimits, ephemeralstorageReqs, ephemeralstorageLimits :=\n\t\treqs[corev1.ResourceCPU], limits[corev1.ResourceCPU], reqs[corev1.ResourceMemory], limits[corev1.ResourceMemory], reqs[corev1.ResourceEphemeralStorage], limits[corev1.ResourceEphemeralStorage]\n\tfractionCpuReqs := float64(0)\n\tfractionCpuLimits := float64(0)\n\tif allocatable.Cpu().MilliValue() != 0 {\n\t\tfractionCpuReqs = float64(cpuReqs.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t\tfractionCpuLimits = float64(cpuLimits.MilliValue()) / float64(allocatable.Cpu().MilliValue()) * 100\n\t}\n\tfractionMemoryReqs := float64(0)\n\tfractionMemoryLimits := float64(0)\n\tif allocatable.Memory().Value() != 0 {\n\t\tfractionMemoryReqs = float64(memoryReqs.Value()) / float64(allocatable.Memory().Value()) * 100\n\t\tfractionMemoryLimits = float64(memoryLimits.Value()) / float64(allocatable.Memory().Value()) * 100\n\t}\n\tfractionEphemeralStorageReqs := float64(0)\n\tfractionEphemeralStorageLimits := float64(0)\n\tif allocatable.StorageEphemeral().Value() != 0 {\n\t\tfractionEphemeralStorageReqs = float64(ephemeralstorageReqs.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t\tfractionEphemeralStorageLimits = float64(ephemeralstorageLimits.Value()) / float64(allocatable.StorageEphemeral().Value()) * 100\n\t}\n\n\treturn &NodeUsage{\n\t\tcpuReqs: cpuReqs.String(),\n\t\tmemoryReqs: memoryReqs.String(),\n\t\tephemeralStorageReqs: ephemeralstorageReqs.String(),\n\t\tfractionCpuReqs: fractionCpuReqs,\n\t\tfractionCpuLimits: fractionCpuLimits,\n\t\tfractionMemoryReqs: fractionMemoryReqs,\n\t\tfractionMemoryLimits: fractionMemoryLimits,\n\t\tfractionEphemeralStorageReqs: fractionEphemeralStorageReqs,\n\t\tfractionEphemeralStorageLimits: fractionEphemeralStorageLimits,\n\t}\n}", "func (builder clusterDTOBuilder) getNodeResourceCapacity(clusterName string, commodityType proto.CommodityDTO_CommodityType,\n\tnodeResourceCapacityMap map[proto.CommodityDTO_CommodityType]float64) float64 {\n\tresourceCapacity, ok := nodeResourceCapacityMap[commodityType]\n\tif !ok {\n\t\tglog.Errorf(\"%s commodity does not exist in nodeResourceCapacityMap\", commodityType)\n\t\treturn 0\n\t}\n\tif resourceCapacity == 0 {\n\t\tglog.Errorf(\"%s commodity capacity from all nodes in cluster %s is 0.\", commodityType, clusterName)\n\t\treturn 0\n\t}\n\treturn resourceCapacity\n}", "func getTotalAllocatableMemory(f *framework.Framework) *resource.Quantity {\n\tselector := labels.Set{\"beta.kubernetes.io/os\": \"windows\"}.AsSelector()\n\tnodeList, err := f.ClientSet.CoreV1().Nodes().List(metav1.ListOptions{\n\t\tLabelSelector: selector.String(),\n\t})\n\tframework.ExpectNoError(err)\n\n\tginkgo.By(\"Summing allocatable memory across all agent nodes\")\n\n\ttotalAllocatable := resource.NewQuantity(0, resource.BinarySI)\n\n\tfor _, node := range nodeList.Items {\n\t\tstatus := node.Status\n\n\t\ttotalAllocatable.Add(status.Allocatable[v1.ResourceMemory])\n\t}\n\n\treturn totalAllocatable\n}", "func (p *ResourcePool) Available() reflow.Resources {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tvar reserved reflow.Resources\n\tfor _, alloc := range p.allocs {\n\t\tif !AllocExpired(alloc) {\n\t\t\treserved.Add(reserved, alloc.Resources())\n\t\t}\n\t}\n\tvar avail reflow.Resources\n\tavail.Sub(p.resources, reserved)\n\treturn avail\n}", "func GetTaskAllocation(rmTask *resmgr.Task) *Allocation {\n\talloc := initializeZeroAlloc()\n\n\ttaskResource := ConvertToResmgrResource(rmTask.Resource)\n\n\t// check if the task is non-preemptible\n\tif rmTask.GetPreemptible() {\n\t\talloc.Value[PreemptibleAllocation] = taskResource\n\t} else {\n\t\talloc.Value[NonPreemptibleAllocation] = taskResource\n\t}\n\n\t// check if its a controller task\n\tif rmTask.GetController() {\n\t\talloc.Value[ControllerAllocation] = taskResource\n\t}\n\n\tif rmTask.GetRevocable() {\n\t\talloc.Value[SlackAllocation] = taskResource\n\t} else {\n\t\talloc.Value[NonSlackAllocation] = taskResource\n\t}\n\n\t// every task account for total allocation\n\talloc.Value[TotalAllocation] = taskResource\n\n\treturn alloc\n}", "func (n *resPool) AggregatedChildrenReservations() (map[string]float64, error) {\n\ttotalReservation := make(map[string]float64)\n\tn.RLock()\n\tdefer n.RUnlock()\n\n\tnodes := n.children\n\t// We need to find out the total reservation\n\tfor e := nodes.Front(); e != nil; e = e.Next() {\n\t\tn, ok := e.Value.(ResPool)\n\t\tif !ok {\n\t\t\treturn totalReservation, errors.Errorf(\n\t\t\t\t\"failed to type assert child resource pool %v\",\n\t\t\t\te.Value)\n\t\t}\n\t\tresources := n.Resources()\n\t\tfor kind, resource := range resources {\n\t\t\ttotalReservation[kind] =\n\t\t\t\ttotalReservation[kind] + resource.Reservation\n\t\t}\n\t}\n\treturn totalReservation, nil\n}", "func checkNodeAllocatableTest(f *framework.Framework) {\n\n\tnodeMem := getNodeMemory(f)\n\tframework.Logf(\"nodeMem says: %+v\", nodeMem)\n\n\t// calculate the allocatable mem based on capacity - reserved amounts\n\tcalculatedNodeAlloc := nodeMem.capacity.Copy()\n\tcalculatedNodeAlloc.Sub(nodeMem.systemReserve)\n\tcalculatedNodeAlloc.Sub(nodeMem.kubeReserve)\n\tcalculatedNodeAlloc.Sub(nodeMem.softEviction)\n\tcalculatedNodeAlloc.Sub(nodeMem.hardEviction)\n\n\tginkgo.By(fmt.Sprintf(\"Checking stated allocatable memory %v against calculated allocatable memory %v\", &nodeMem.allocatable, calculatedNodeAlloc))\n\n\t// sanity check against stated allocatable\n\tgomega.Expect(calculatedNodeAlloc.Cmp(nodeMem.allocatable)).To(gomega.Equal(0))\n}", "func Allocs(nomad *NomadServer) []Alloc {\n\tallocs := make([]Alloc, 0)\n\tdecodeJSON(url(nomad)+\"/v1/allocations\", &allocs)\n\treturn allocs\n}", "func (n *resPool) CalculateTotalAllocatedResources() *scalar.Resources {\n\tn.Lock()\n\tdefer n.Unlock()\n\treturn n.calculateAllocation().GetByType(scalar.TotalAllocation)\n}", "func getValidTopology(topologyMap map[string][]string) ([]string, []string) {\n\tvar regionValues []string\n\tvar zoneValues []string\n\tfor region, zones := range topologyMap {\n\t\tregionValues = append(regionValues, region)\n\t\tzoneValues = append(zoneValues, zones...)\n\t}\n\treturn regionValues, zoneValues\n}", "func (r *ReconcileKogitoInfra) getDeployedResources(instance *v1alpha1.KogitoInfra) (resources map[reflect.Type][]resource.KubernetesResource, err error) {\n\tresourcesInfinispan, err := infinispan.GetDeployedResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKafka, err := kafka.GetDeployedResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKeycloak, err := keycloak.GetDeployedResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresources = make(map[reflect.Type][]resource.KubernetesResource, len(resourcesInfinispan)+len(resourcesKafka)+len(resourcesKeycloak))\n\tmergeResourceMaps(resources, resourcesKafka, resourcesInfinispan, resourcesKeycloak)\n\treturn\n}", "func (config *AppConfig) getNodeAllocationsByPage(nodeID int, pageID int) (NodeAllocations, error) {\n\tvar allocations NodeAllocations\n\tendpoint := fmt.Sprintf(\"nodes/%d/allocations?page=%d\", nodeID, pageID)\n\n\tnodeAllocBytes, err := config.queryApplicationAPI(endpoint, \"get\", nil)\n\tif err != nil {\n\t\treturn allocations, err\n\t}\n\n\t// Get node info from the panel\n\t// Unmarshal the bytes to a usable struct.\n\terr = json.Unmarshal(nodeAllocBytes, &allocations)\n\tif err != nil {\n\t\treturn allocations, err\n\t}\n\treturn allocations, nil\n}", "func getDeviceResourcesForNode(deviceGroupStats []*api.DeviceGroupStats, node *api.Node) []string {\n\tstatsSummaryMap := buildDeviceStatsSummaryMap(deviceGroupStats)\n\n\tdevices := []string{}\n\tfor _, dg := range node.NodeResources.Devices {\n\t\tfor _, inst := range dg.Instances {\n\t\t\tid := deviceQualifiedID(dg.Vendor, dg.Type, dg.Name, inst.ID)\n\t\t\tstatStr := \"\"\n\t\t\tif stats, ok := statsSummaryMap[id]; ok && stats != nil {\n\t\t\t\tstatStr = stats.String()\n\t\t\t}\n\n\t\t\tdevices = append(devices, fmt.Sprintf(\"%v|%v\", id, statStr))\n\t\t}\n\t}\n\n\tsort.Strings(devices)\n\n\treturn devices\n}", "func MapsToResources(resources map[string]string) map[ResourceName]string {\n\tif resources == nil {\n\t\treturn nil\n\t}\n\trns := make(map[ResourceName]string, 0)\n\tfor k, data := range resources {\n\t\tname := stringToResourceName(k)\n\t\tif name == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\trns[name] = data\n\t}\n\treturn rns\n}", "func (n *resPool) GetNonSlackAllocatedResources() *scalar.Resources {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.allocation.GetByType(scalar.NonSlackAllocation)\n}", "func MapToResourceTags(tagMap map[string]string) []interface{} {\n\tvar tags []interface{}\n\tfor eachKey, eachValue := range tagMap {\n\t\ttags = append(tags, map[string]interface{}{\n\t\t\t\"Key\": eachKey,\n\t\t\t\"Value\": eachValue,\n\t\t})\n\t}\n\treturn tags\n}", "func IsValidNodeTopology(nodeTopology *v1alpha2.NodeResourceTopology, kubeletConfig *kubeletconfig.KubeletConfiguration) bool {\n\tif nodeTopology == nil || len(nodeTopology.TopologyPolicies) == 0 {\n\t\tframework.Logf(\"failed to get topology policy from the node topology resource\")\n\t\treturn false\n\t}\n\n\ttmPolicy := string(topologypolicy.DetectTopologyPolicy(kubeletConfig.TopologyManagerPolicy, kubeletConfig.TopologyManagerScope))\n\tif nodeTopology.TopologyPolicies[0] != tmPolicy {\n\t\tframework.Logf(\"topology policy mismatch got %q expected %q\", nodeTopology.TopologyPolicies[0], tmPolicy)\n\t\treturn false\n\t}\n\n\texpectedPolicyAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerPolicyAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerPolicy,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedPolicyAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerPolicy attribute expected %v attributeList %v\", expectedPolicyAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\texpectedScopeAttribute := v1alpha2.AttributeInfo{\n\t\tName: nfdtopologyupdater.TopologyManagerScopeAttributeName,\n\t\tValue: kubeletConfig.TopologyManagerScope,\n\t}\n\tif !containsAttribute(nodeTopology.Attributes, expectedScopeAttribute) {\n\t\tframework.Logf(\"topology policy attributes don't have correct topologyManagerScope attribute expected %v attributeList %v\", expectedScopeAttribute, nodeTopology.Attributes)\n\t\treturn false\n\t}\n\n\tif nodeTopology.Zones == nil || len(nodeTopology.Zones) == 0 {\n\t\tframework.Logf(\"failed to get topology zones from the node topology resource\")\n\t\treturn false\n\t}\n\n\tfoundNodes := 0\n\tfor _, zone := range nodeTopology.Zones {\n\t\t// TODO constant not in the APIs\n\t\tif !strings.HasPrefix(strings.ToUpper(zone.Type), \"NODE\") {\n\t\t\tcontinue\n\t\t}\n\t\tfoundNodes++\n\n\t\tif !isValidCostList(zone.Name, zone.Costs) {\n\t\t\tframework.Logf(\"invalid cost list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\n\t\tif !isValidResourceList(zone.Name, zone.Resources) {\n\t\t\tframework.Logf(\"invalid resource list for zone %q\", zone.Name)\n\t\t\treturn false\n\t\t}\n\t}\n\treturn foundNodes > 0\n}", "func newKubeNodeStatusAllocatableMemoryBytesMetric(fqname, node string, value float64) KubeNodeStatusAllocatableMemoryBytesMetric {\n\treturn KubeNodeStatusAllocatableMemoryBytesMetric{\n\t\tfqName: fqname,\n\t\thelp: \"kube_node_status_allocatable_memory_bytes node allocatable memory in bytes\",\n\t\tnode: node,\n\t\tvalue: value,\n\t}\n}", "func (c *AgonesDiscoverAllocator) Allocate(ctx context.Context, req *pb.AssignTicketsRequest) error {\n\tlogger := runtime.Logger().WithField(\"component\", \"allocator\")\n\n\tfor _, assignmentGroup := range req.Assignments {\n\t\tif err := IsAssignmentGroupValidForAllocation(assignmentGroup); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfilter, err := extensions.ExtractFilterFromExtensions(assignmentGroup.Assignment.Extensions)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"the assignment does not have a valid filter extension\")\n\t\t}\n\n\t\tgameservers, err := c.ListGameServers(ctx, filter)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\treturn err\n\t\t}\n\n\t\tif len(gameservers) == 0 {\n\t\t\tlogger.Debugf(\"gameservers not found for request with filter %v\", filter.Map())\n\t\t\tcontinue\n\t\t}\n\n\t\t// NiceToHave: Filter GameServers by Capacity and Count\n\t\t// Remove not assigned tickets based on playersCapacity - Count\n\t\t// strategy: allTogether, CapacityBased FallBack\n\t\tfor _, gs := range gameservers {\n\t\t\tif HasCapacity(assignmentGroup, gs) {\n\t\t\t\tassignmentGroup.Assignment.Connection = gs.Status.Address\n\t\t\t\t//logger.Debugf(\"extension %v\", assignmentGroup.Assignment.Extensions)\n\t\t\t\tlogger.Infof(\"gameserver %s connection %s assigned to request, total tickets: %d\", gs.Name, assignmentGroup.Assignment.Connection, len(assignmentGroup.TicketIds))\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func GetReservationsforNodeInstanceIds(ec2Client ec2iface.EC2API, nodeInstanceIds []string) ([]*ec2.Reservation, error) {\n\toutput, err := ec2Client.DescribeInstances(&ec2.DescribeInstancesInput{\n\t\tInstanceIds: aws.StringSlice(nodeInstanceIds),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn output.Reservations, nil\n}", "func (o *DeviceNode) GetResources() []map[string]interface{} {\n\tif o == nil || o.Resources == nil {\n\t\tvar ret []map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Resources\n}", "func (dc *dataCenter) allocateServers(n int, totalGb float64, filterFunc func(*pb.StoreResource) bool) (stores []*pb.StoreResource, err error) {\n\tvar servers []*pb.StoreResource\n\n\teachRequiredGb := uint32(math.Ceil(totalGb / float64(n)))\n\n\t// 1. select servers that has all the requiredTags and enough disk\n\tdc.RLock()\n\tfor _, server := range dc.servers {\n\t\tif filterFunc(server) && (server.DiskSizeGb-server.AllocatedSizeGb) > eachRequiredGb {\n\t\t\tservers = append(servers, server)\n\t\t}\n\t}\n\tdc.RUnlock()\n\n\tif len(servers) < n {\n\t\treturn nil, fmt.Errorf(\"only has %d servers meet the requirement\", len(servers))\n\t}\n\n\t// 2. sort by free capacity desc\n\tsort.Slice(servers, func(i, j int) bool {\n\t\treturn (servers[i].DiskSizeGb - servers[i].AllocatedSizeGb) >= (servers[j].DiskSizeGb - servers[j].AllocatedSizeGb)\n\t})\n\n\t// 3. pick the top n\n\treturn servers[:n], nil\n}", "func GetResourceRequest(pod *v1.Pod) *schedulernodeinfo.Resource {\n\tresult := &schedulernodeinfo.Resource{}\n\tfor _, container := range pod.Spec.Containers {\n\t\tresult.Add(container.Resources.Requests)\n\t}\n\n\t// take max_resource(sum_pod, any_init_container)\n\tfor _, container := range pod.Spec.InitContainers {\n\t\tresult.SetMaxResource(container.Resources.Requests)\n\t}\n\n\t// If Overhead is being utilized, add to the total requests for the pod\n\tif pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) {\n\t\tresult.Add(pod.Spec.Overhead)\n\t}\n\n\treturn result\n}", "func (fm *FCFSModel)TaskNodeToResource(td *TaskDescriptor,rd *ResDescriptor)*ArcDescriptor{\n\t//ct := uint64(rand.Intn(100))\n\treturn &ArcDescriptor{\n\t\tcost: fm.TaskToResCost(td,rd),\n\t\tcapLower :0,\n\t\tcapUpper: 1,\n\t}\n}", "func (p *staticPolicy) GetAllocatableCPUs(s state.State) cpuset.CPUSet {\n\treturn p.topology.CPUDetails.CPUs().Difference(p.reservedCPUs)\n}", "func calculateResources(numNodes uint64, resources []Resource) api.ResourceList {\n\tresourceList := make(api.ResourceList)\n\tfor _, r := range resources {\n\t\t// Since we want to enable passing values smaller than e.g. 1 millicore per node,\n\t\t// we need to have some more hacky solution here than operating on MilliValues.\n\t\tperNodeString := r.ExtraPerNode.String()\n\t\tvar perNode float64\n\t\tread, _ := fmt.Sscanf(perNodeString, \"%f\", &perNode)\n\t\toverhead := resource.MustParse(fmt.Sprintf(\"%f%s\", perNode*float64(numNodes), perNodeString[read:]))\n\n\t\tnewRes := r.Base\n\t\tnewRes.Add(overhead)\n\n\t\tlog.V(4).Infof(\"New requirement for resource %s with %d nodes is %s\", r.Name, numNodes, newRes.String())\n\n\t\tresourceList[r.Name] = newRes\n\t}\n\treturn resourceList\n}", "func (n *resPool) SetTotalAllocatedResources(allocation *scalar.Resources) {\n\tn.Lock()\n\tdefer n.Unlock()\n\tn.allocation.Value[scalar.TotalAllocation] = allocation\n}", "func newKubeNodeStatusAllocatableMetric(fqname, node, resource, unit string, value float64) KubeNodeStatusAllocatableMetric {\n\treturn KubeNodeStatusAllocatableMetric{\n\t\tfqName: fqname,\n\t\thelp: \"kube_node_status_allocatable node allocatable\",\n\t\tnode: node,\n\t\tresource: resource,\n\t\tunit: unit,\n\t\tvalue: value,\n\t}\n}", "func (n *resPool) Resources() map[string]*respool.ResourceConfig {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.resourceConfigs\n}", "func (p *president) EvaluateAllocationRequests(resourceRequest map[shared.ClientID]shared.Resources, availCommonPool shared.Resources) shared.PresidentReturnContent {\n\tp.c.clientPrint(\"Evaluating allocations...\")\n\tvar avgResource, avgRequest shared.Resources\n\tvar allocSum, commonPoolThreshold, sumRequest float64\n\n\t// Make sure resource skew is greater than 1\n\tresourceSkew := math.Max(float64(p.c.params.resourcesSkew), 1)\n\n\tresources := make(map[shared.ClientID]shared.Resources)\n\tallocations := make(map[shared.ClientID]float64)\n\tallocWeights := make(map[shared.ClientID]float64)\n\tfinalAllocations := make(map[shared.ClientID]shared.Resources)\n\n\tfor island, req := range resourceRequest {\n\t\tsumRequest += float64(req)\n\t\tresources[island] = shared.Resources(float64(p.c.declaredResources[island]) * math.Pow(resourceSkew, ((100-p.c.trustScore[island])/100)))\n\t}\n\n\tp.c.clientPrint(\"Resource requests: %+v\\n\", resourceRequest)\n\tp.c.clientPrint(\"Their resource estimation: %+v\\n\", p.c.declaredResources)\n\tp.c.clientPrint(\"Our estimation: %+v\\n\", resources)\n\tp.c.clientPrint(\"Trust Scores: %+v\\n\", p.c.trustScore)\n\n\tavgRequest = findAvgNoTails(resourceRequest)\n\tavgResource = findAvgNoTails(resources)\n\n\tfor island, resource := range resources {\n\t\tallocations[island] = float64(avgRequest) + p.c.params.equity*(float64(avgResource-resource)+float64(resourceRequest[island]-avgRequest))\n\t\t// p.c.clientPrint(\"Allocation for island %v: %f\", island, allocations[island])\n\t\tif island == p.c.GetID() {\n\t\t\tallocations[island] += math.Max(float64(resourceRequest[island])-allocations[island]*p.c.params.selfishness, 0)\n\t\t} else {\n\t\t\tallocations[island] = math.Min(float64(resourceRequest[island]), allocations[island]) // to prevent overallocating\n\t\t\tallocations[island] = math.Max(allocations[island], 0)\n\t\t}\n\t}\n\n\t// Collect weights\n\tfor _, alloc := range allocations {\n\t\tallocSum += alloc\n\t}\n\t// Normalise\n\tfor island, alloc := range allocations {\n\t\tallocWeights[island] = alloc / allocSum\n\t}\n\t// p.c.clientPrint(\"Allocation wieghts: %+v\\n\", allocWeights)\n\n\tcommonPoolThreshold = math.Min(float64(availCommonPool)*(1.0-p.c.params.riskFactor), sumRequest)\n\tif p.c.params.saveCriticalIsland {\n\t\tfor island := range resourceRequest {\n\t\t\tif resources[island] < p.c.criticalThreshold {\n\t\t\t\tfinalAllocations[island] = shared.Resources(math.Max((allocWeights[island] * commonPoolThreshold), float64(p.c.criticalThreshold-resources[island])))\n\t\t\t} else {\n\t\t\t\tfinalAllocations[island] = 0\n\t\t\t}\n\t\t}\n\t}\n\n\tfor island := range resourceRequest {\n\t\tif finalAllocations[island] == 0 {\n\t\t\tif sumRequest < commonPoolThreshold {\n\t\t\t\tfinalAllocations[island] = shared.Resources(math.Max(allocWeights[island]*float64(sumRequest), 0))\n\t\t\t} else {\n\t\t\t\tfinalAllocations[island] = shared.Resources(math.Max(allocWeights[island]*commonPoolThreshold, 0))\n\t\t\t}\n\t\t}\n\t}\n\n\tp.c.clientPrint(\"Final allocations: %+v\\n\", finalAllocations)\n\n\t// Curently always evaluate, would there be a time when we don't want to?\n\treturn shared.PresidentReturnContent{\n\t\tContentType: shared.PresidentAllocation,\n\t\tResourceMap: finalAllocations,\n\t\tActionTaken: true,\n\t}\n}", "func getRequestedResources(container corev1.Container) (map[string]int64, error) {\n\tfor _, v := range container.Env {\n\t\tif strings.HasPrefix(v.Name, \"FPGA_REGION\") || strings.HasPrefix(v.Name, \"FPGA_AFU\") {\n\t\t\treturn nil, errors.Errorf(\"environment variable '%s' is not allowed\", v.Name)\n\t\t}\n\t}\n\n\t// Container may happen to have Requests, but not Limits. Check Requests first,\n\t// then in the next loop iterate over Limits.\n\tfor resourceName, resourceQuantity := range container.Resources.Requests {\n\t\trname := strings.ToLower(string(resourceName))\n\t\tif !strings.HasPrefix(rname, namespace) {\n\t\t\t// Skip non-FPGA resources in Requests.\n\t\t\tcontinue\n\t\t}\n\n\t\tif container.Resources.Limits[resourceName] != resourceQuantity {\n\t\t\treturn nil, errors.Errorf(\n\t\t\t\t\"'limits' and 'requests' for %q must be equal as extended resources cannot be overcommitted\",\n\t\t\t\trname)\n\t\t}\n\t}\n\n\tresources := make(map[string]int64)\n\tfor resourceName, resourceQuantity := range container.Resources.Limits {\n\t\trname := strings.ToLower(string(resourceName))\n\t\tif !strings.HasPrefix(rname, namespace) {\n\t\t\t// Skip non-FPGA resources in Limits.\n\t\t\tcontinue\n\t\t}\n\n\t\tif container.Resources.Requests[resourceName] != resourceQuantity {\n\t\t\treturn nil, errors.Errorf(\n\t\t\t\t\"'limits' and 'requests' for %q must be equal as extended resources cannot be overcommitted\",\n\t\t\t\trname)\n\t\t}\n\n\t\tquantity, ok := resourceQuantity.AsInt64()\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"resource quantity isn't of integral type for %q\", rname)\n\t\t}\n\n\t\tresources[rname] = quantity\n\t}\n\n\treturn resources, nil\n}", "func VertexaiBetaModelDeploymentDedicatedResourcesToProto(o *beta.ModelDeploymentDedicatedResources) *betapb.VertexaiBetaModelDeploymentDedicatedResources {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &betapb.VertexaiBetaModelDeploymentDedicatedResources{}\n\tp.SetMachineSpec(VertexaiBetaModelDeploymentDedicatedResourcesMachineSpecToProto(o.MachineSpec))\n\tp.SetMinReplicaCount(dcl.ValueOrEmptyInt64(o.MinReplicaCount))\n\tp.SetMaxReplicaCount(dcl.ValueOrEmptyInt64(o.MaxReplicaCount))\n\treturn p\n}", "func GetRequestsResourceListFromPipeline(pipelineInfo *pps.PipelineInfo) (*v1.ResourceList, error) {\n\treturn getResourceListFromSpec(pipelineInfo.ResourceRequests, pipelineInfo.CacheSize)\n}", "func MustMarshalResourceNode(cdc *codec.Codec, resourceNode ResourceNode) []byte {\n\treturn cdc.MustMarshalBinaryLengthPrefixed(resourceNode)\n}", "func (c *Client) MetricResourcesPerNode() (result float64, err error) {\n\tret := ValueMetricJSON{}\n\treturn ret.Value, c.Metric(&ret, \"com.puppetlabs.puppetdb.query.population:type=default,name=avg-resources-per-node\")\n}", "func GetResourceListFromPipeline(pipelineInfo *pps.PipelineInfo) (*api.ResourceList, error) {\n\tvar result api.ResourceList = make(map[api.ResourceName]resource.Quantity)\n\tresources, cacheSize := pipelineInfo.ResourceSpec, pipelineInfo.CacheSize\n\tcpuStr := fmt.Sprintf(\"%f\", resources.Cpu)\n\tcpuQuantity, err := resource.ParseQuantity(cpuStr)\n\tif err != nil {\n\t\tlog.Warnf(\"error parsing cpu string: %s: %+v\", cpuStr, err)\n\t} else {\n\t\tresult[api.ResourceCPU] = cpuQuantity\n\t}\n\n\tmemQuantity, err := resource.ParseQuantity(resources.Memory)\n\tif err != nil {\n\t\tlog.Warnf(\"error parsing memory string: %s: %+v\", resources.Memory, err)\n\t} else {\n\t\tresult[api.ResourceMemory] = memQuantity\n\t}\n\n\t// Here we are sanity checking. A pipeline should request at least\n\t// as much memory as it needs for caching.\n\tcacheQuantity, err := resource.ParseQuantity(cacheSize)\n\tif err != nil {\n\t\tlog.Warnf(\"error parsing cache string: %s: %+v\", cacheSize, err)\n\t} else if cacheQuantity.Cmp(memQuantity) > 0 {\n\t\tresult[api.ResourceMemory] = cacheQuantity\n\t}\n\n\tgpuStr := fmt.Sprintf(\"%d\", resources.Gpu)\n\tgpuQuantity, err := resource.ParseQuantity(gpuStr)\n\tif err != nil {\n\t\tlog.Warnf(\"error parsing gpu string: %s: %+v\", gpuStr, err)\n\t} else {\n\t\tresult[api.ResourceNvidiaGPU] = gpuQuantity\n\t}\n\treturn &result, nil\n}", "func resourceComputeRouterNatListForPatch(d *schema.ResourceData, meta interface{}) ([]interface{}, error) {\n\tconfig := meta.(*transport_tpg.Config)\n\turl, err := tpgresource.ReplaceVars(d, config, \"{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/routers/{{router}}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tproject, err := tpgresource.GetProject(d, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tuserAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{\n\t\tConfig: config,\n\t\tMethod: \"GET\",\n\t\tProject: project,\n\t\tRawURL: url,\n\t\tUserAgent: userAgent,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar v interface{}\n\tvar ok bool\n\n\tv, ok = res[\"nats\"]\n\tif ok && v != nil {\n\t\tls, lsOk := v.([]interface{})\n\t\tif !lsOk {\n\t\t\treturn nil, fmt.Errorf(`expected list for nested field \"nats\"`)\n\t\t}\n\t\treturn ls, nil\n\t}\n\treturn nil, nil\n}", "func GetResourceMapping() map[string][]Resource { return resourceMapping.ResourceIDToResource }", "func NewStakingInfoByResourceNodeAddr(\n\tresourceNode types.ResourceNode,\n\tunbondingStake sdk.Int,\n\tunbondedStake sdk.Int,\n\tbondedStake sdk.Int,\n\n) StakingInfoByResourceNodeAddr {\n\treturn StakingInfoByResourceNodeAddr{\n\t\tResourceNode: resourceNode,\n\t\tUnbondingStake: sdk.NewCoin(defaultDenom, unbondingStake),\n\t\tUnbondedStake: sdk.NewCoin(defaultDenom, unbondedStake),\n\t\tBondedStake: sdk.NewCoin(defaultDenom, bondedStake),\n\t}\n}", "func (n *resPool) GetSlackAllocatedResources() *scalar.Resources {\n\tn.RLock()\n\tdefer n.RUnlock()\n\treturn n.allocation.GetByType(scalar.SlackAllocation)\n}", "func InitResourceMapping(m *ResourceMapping) { resourceMapping = m }", "func collectPreferredResources(discovery discovery.DiscoveryInterface) ([]*metav1.APIResourceList, error) {\n\tresources, err := discovery.ServerPreferredNamespacedResources()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, res := range resources {\n\t\tres.APIResources = excludeSubresources(res.APIResources)\n\t\t// Some resources appear not to have permissions to list, need to exclude those.\n\t\tres.APIResources = listAllowed(res.APIResources)\n\t}\n\n\treturn resources, nil\n}", "func _dirtySeriesMapAlloc(opts _dirtySeriesMapOptions) *dirtySeriesMap {\n\tm := &dirtySeriesMap{_dirtySeriesMapOptions: opts}\n\tm.Reallocate()\n\treturn m\n}", "func parseResources(resources []ResourceCache) map[envoy_xds.ResponseType]ResourceCache {\n\n\tresourceMap := make(map[envoy_xds.ResponseType]ResourceCache, len(resources))\n\n\tfor _, r := range resources {\n\t\tswitch r.TypeURL() {\n\t\tcase resource.ClusterType:\n\t\t\tresourceMap[envoy_xds.Cluster] = r\n\t\tcase resource.RouteType:\n\t\t\tresourceMap[envoy_xds.Route] = r\n\t\tcase resource.ListenerType:\n\t\t\tresourceMap[envoy_xds.Listener] = r\n\t\tcase resource.SecretType:\n\t\t\tresourceMap[envoy_xds.Secret] = r\n\t\tcase resource.EndpointType:\n\t\t\tresourceMap[envoy_xds.Endpoint] = r\n\t\t}\n\t}\n\treturn resourceMap\n}", "func (zic *ZoneInterconnectHandler) createLocalZoneNodeResources(node *corev1.Node, nodeID int) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port ips for node %s: %w\", node.Name, err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\t// Connect transit switch to the cluster router by creating a pair of logical switch port - logical router port\n\tlogicalRouterPortName := zic.GetNetworkScopedName(types.RouterToTransitSwitchPrefix + node.Name)\n\tlogicalRouterPort := nbdb.LogicalRouterPort{\n\t\tName: logicalRouterPortName,\n\t\tMAC: transitRouterPortMac.String(),\n\t\tNetworks: transitRouterPortNetworks,\n\t\tOptions: map[string]string{\n\t\t\t\"mcast_flood\": \"true\",\n\t\t},\n\t}\n\tlogicalRouter := nbdb.LogicalRouter{\n\t\tName: zic.networkClusterRouterName,\n\t}\n\n\tif err := libovsdbops.CreateOrUpdateLogicalRouterPort(zic.nbClient, &logicalRouter, &logicalRouterPort, nil); err != nil {\n\t\treturn fmt.Errorf(\"failed to create/update cluster router %s to add transit switch port %s for the node %s: %w\", zic.networkClusterRouterName, logicalRouterPortName, node.Name, err)\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"router-port\": logicalRouterPortName,\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\terr = zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix+node.Name),\n\t\tlportTypeRouter, []string{lportTypeRouterAddr}, lspOptions, externalIDs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Its possible that node is moved from a remote zone to the local zone. Check and delete the remote zone routes\n\t// for this node as it's no longer needed.\n\treturn zic.deleteLocalNodeStaticRoutes(node, nodeID, nodeTransitSwitchPortIPs)\n}", "func ComputePodResourceRequest(pod *v1.Pod) *Resource {\n\tresource := &Resource{}\n\tfor _, container := range pod.Spec.Containers {\n\t\tresource.Add(container.Resources.Requests)\n\t}\n\n\t// take max_resource(sum_pod, any_init_container)\n\tfor _, container := range pod.Spec.InitContainers {\n\t\tresource.SetMaxResource(container.Resources.Requests)\n\t}\n\n\t// If Overhead is being utilized, add to the total requests for the pod\n\tif pod.Spec.Overhead != nil {\n\t\tresource.Add(pod.Spec.Overhead)\n\t}\n\n\treturn resource\n}", "func VertexaiEndpointDeployedModelsDedicatedResourcesToProto(o *vertexai.EndpointDeployedModelsDedicatedResources) *vertexaipb.VertexaiEndpointDeployedModelsDedicatedResources {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &vertexaipb.VertexaiEndpointDeployedModelsDedicatedResources{}\n\tp.SetMachineSpec(VertexaiEndpointDeployedModelsDedicatedResourcesMachineSpecToProto(o.MachineSpec))\n\tp.SetMinReplicaCount(dcl.ValueOrEmptyInt64(o.MinReplicaCount))\n\tp.SetMaxReplicaCount(dcl.ValueOrEmptyInt64(o.MaxReplicaCount))\n\tsAutoscalingMetricSpecs := make([]*vertexaipb.VertexaiEndpointDeployedModelsDedicatedResourcesAutoscalingMetricSpecs, len(o.AutoscalingMetricSpecs))\n\tfor i, r := range o.AutoscalingMetricSpecs {\n\t\tsAutoscalingMetricSpecs[i] = VertexaiEndpointDeployedModelsDedicatedResourcesAutoscalingMetricSpecsToProto(&r)\n\t}\n\tp.SetAutoscalingMetricSpecs(sAutoscalingMetricSpecs)\n\treturn p\n}", "func NewResourceCacheMap() *ResourceCacheMap {\n\treturn &ResourceCacheMap{\n\t\tcache: make(map[object.ObjMetadata]*unstructured.Unstructured),\n\t}\n}", "func (zic *ZoneInterconnectHandler) createRemoteZoneNodeResources(node *corev1.Node, nodeID int, chassisId string) error {\n\tnodeTransitSwitchPortIPs, err := util.ParseNodeTransitSwitchPortAddrs(node)\n\tif err != nil || len(nodeTransitSwitchPortIPs) == 0 {\n\t\treturn fmt.Errorf(\"failed to get the node transit switch port Ips : %w\", err)\n\t}\n\n\ttransitRouterPortMac := util.IPAddrToHWAddr(nodeTransitSwitchPortIPs[0].IP)\n\tvar transitRouterPortNetworks []string\n\tfor _, ip := range nodeTransitSwitchPortIPs {\n\t\ttransitRouterPortNetworks = append(transitRouterPortNetworks, ip.String())\n\t}\n\n\tremotePortAddr := transitRouterPortMac.String()\n\tfor _, tsNetwork := range transitRouterPortNetworks {\n\t\tremotePortAddr = remotePortAddr + \" \" + tsNetwork\n\t}\n\n\tlspOptions := map[string]string{\n\t\t\"requested-tnl-key\": strconv.Itoa(nodeID),\n\t}\n\t// Store the node name in the external_ids column for book keeping\n\texternalIDs := map[string]string{\n\t\t\"node\": node.Name,\n\t}\n\n\tremotePortName := zic.GetNetworkScopedName(types.TransitSwitchToRouterPrefix + node.Name)\n\tif err := zic.addNodeLogicalSwitchPort(zic.networkTransitSwitchName, remotePortName, lportTypeRemote, []string{remotePortAddr}, lspOptions, externalIDs); err != nil {\n\t\treturn err\n\t}\n\t// Set the port binding chassis.\n\tif err := zic.setRemotePortBindingChassis(node.Name, remotePortName, chassisId); err != nil {\n\t\treturn err\n\t}\n\n\tif err := zic.addRemoteNodeStaticRoutes(node, nodeTransitSwitchPortIPs); err != nil {\n\t\treturn err\n\t}\n\n\t// Cleanup the logical router port connecting to the transit switch for the remote node (if present)\n\t// Cleanup would be required when a local zone node moves to a remote zone.\n\treturn zic.cleanupNodeClusterRouterPort(node.Name)\n}", "func GetResourceLimits(pod *api.Pod) (cpuCapacity float64, memCapacity float64, err error) {\n\tif pod == nil {\n\t\terr = errors.New(\"pod passed in is nil.\")\n\t\treturn\n\t}\n\n\tfor _, container := range pod.Spec.Containers {\n\t\tlimits := container.Resources.Limits\n\n\t\tmemCap := limits.Memory().Value()\n\t\tcpuCap := limits.Cpu().MilliValue()\n\t\tmemCapacity += float64(memCap) / 1024\n\t\tcpuCapacity += float64(cpuCap) / 1000\n\t}\n\treturn\n}", "func InitAllocator(addr uint32) {\n\t// Warning: Lot of unsafe pointer usage and manipulation ahead.\n\t// This function basically initializes memory at given address, so that\n\t// _buddyAllocator, and it's members, point to this address.\n\n\t// create freeBuddiesList\n\tvar _freeBuddiesList *[MaxOrder + 1]freeBuddiesList\n\t_freeBuddiesList = (*[MaxOrder + 1]freeBuddiesList)(pointer.Get(addr))\n\taddr += (MaxOrder + 1) * uint32(unsafe.Sizeof(freeBuddiesList{}))\n\n\t// set freeBuddiesList in buddyAllocator\n\t_buddyAllocator.buddies = (*_freeBuddiesList)[:MaxOrder+1]\n\n\t// create bigPagesBitmap\n\t// _nBigPages size for array is way more than needed. this is done since\n\t// array sizes need to be constant.\n\tvar _bigPagesBitmap *[_nBigPages]uint32\n\t_bigPagesBitmap = (*[_nBigPages]uint32)(pointer.Get(addr))\n\taddr += nMaps(_nBigPages) * 4\n\n\t// set bigPagesBitmap in buddyAllocator\n\t_buddyAllocator.buddies[MaxOrder].freeMap.maps = (*_bigPagesBitmap)[:nMaps(_nBigPages)]\n\n\t// mark all big pages as free\n\tfor i := uint32(0); i < nMaps(_nBigPages); i++ {\n\t\t_buddyAllocator.buddies[MaxOrder].freeMap.maps[i] = _allSet\n\t}\n\n\t// create the individual freeBuddiesList\n\tfor i := 0; i < MaxOrder; i++ {\n\t\t// maxOrder - 1 pages of order i, further divide by 2 since we use 1 bit\n\t\t// for buddy pair.\n\t\tvar nBuddies uint32 = _nBigPages * (1 << uint32(MaxOrder-i-1))\n\t\tnMaps := nMaps(nBuddies)\n\n\t\t// set address for this freeBuddiesList\n\t\t// we are addressing way more memory than needed, because array sizes need\n\t\t// to be constant. this will be more than enough for largest freeBuddiesList\n\t\tvar maps *[_nBigPages * _nBigPages]uint32\n\t\tmaps = (*[_nBigPages * _nBigPages]uint32)(pointer.Get(addr))\n\t\taddr += nMaps * 4\n\n\t\t// set the freeBuddiesList\n\t\t_buddyAllocator.buddies[i].freeMap.maps = (*maps)[:nMaps]\n\n\t\t// zero out the freeBuddiesList\n\t\tfor j := uint32(0); j < nMaps; j++ {\n\t\t\t_buddyAllocator.buddies[i].freeMap.maps[j] = 0\n\t\t}\n\t}\n\n\tinitNodePool(addr)\n}", "func SpaceMapAllocate() (* SpaceMap) {\n return &SpaceMap{}\n}", "func (o ArgoCDSpecServerResourcesOutput) Requests() ArgoCDSpecServerResourcesRequestsMapOutput {\n\treturn o.ApplyT(func(v ArgoCDSpecServerResources) map[string]ArgoCDSpecServerResourcesRequests { return v.Requests }).(ArgoCDSpecServerResourcesRequestsMapOutput)\n}", "func allResources(container *api.Container) map[api.ResourceName]bool {\n\tresources := map[api.ResourceName]bool{}\n\tfor _, resource := range supportedComputeResources {\n\t\tresources[resource] = false\n\t}\n\tfor resource := range container.Resources.Requests {\n\t\tresources[resource] = true\n\t}\n\tfor resource := range container.Resources.Limits {\n\t\tresources[resource] = true\n\t}\n\treturn resources\n}", "func (a *appRuntimeStore) GetTenantResourceList() []TenantResource {\n\treturn a.resourceCache.GetAllTenantResource()\n}", "func (o LookupRegionCommitmentResultOutput) Resources() ResourceCommitmentResponseArrayOutput {\n\treturn o.ApplyT(func(v LookupRegionCommitmentResult) []ResourceCommitmentResponse { return v.Resources }).(ResourceCommitmentResponseArrayOutput)\n}", "func initializeZeroAlloc() *Allocation {\n\talloc := &Allocation{\n\t\tValue: make(map[AllocationType]*Resources),\n\t}\n\n\talloc.Value[TotalAllocation] = ZeroResource\n\talloc.Value[NonPreemptibleAllocation] = ZeroResource\n\talloc.Value[ControllerAllocation] = ZeroResource\n\talloc.Value[PreemptibleAllocation] = ZeroResource\n\talloc.Value[SlackAllocation] = ZeroResource\n\talloc.Value[NonSlackAllocation] = ZeroResource\n\n\treturn alloc\n}", "func toOCIResources(r *pb.LinuxContainerResources) *rspec.LinuxResources {\n\tvar swap int64\n\tmemory := r.GetMemoryLimitInBytes()\n\tif cgroupHasMemorySwap() {\n\t\tswap = memory\n\t}\n\treturn &rspec.LinuxResources{\n\t\tCPU: &rspec.LinuxCPU{\n\t\t\tShares: proto.Uint64(uint64(r.GetCpuShares())),\n\t\t\tQuota: proto.Int64(r.GetCpuQuota()),\n\t\t\tPeriod: proto.Uint64(uint64(r.GetCpuPeriod())),\n\t\t\tCpus: r.GetCpusetCpus(),\n\t\t\tMems: r.GetCpusetMems(),\n\t\t},\n\t\tMemory: &rspec.LinuxMemory{\n\t\t\tLimit: proto.Int64(memory),\n\t\t\tSwap: proto.Int64(swap),\n\t\t},\n\t\t// TODO(runcom): OOMScoreAdj is missing\n\t}\n}", "func (o PgbenchSpecPodConfigOutput) Resources() PgbenchSpecPodConfigResourcesPtrOutput {\n\treturn o.ApplyT(func(v PgbenchSpecPodConfig) *PgbenchSpecPodConfigResources { return v.Resources }).(PgbenchSpecPodConfigResourcesPtrOutput)\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *IngressGatewayConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (o SysbenchSpecOutput) Resources() SysbenchSpecResourcesPtrOutput {\n\treturn o.ApplyT(func(v SysbenchSpec) *SysbenchSpecResources { return v.Resources }).(SysbenchSpecResourcesPtrOutput)\n}", "func (parser *Parser) parseResourceTable() {\n\tchunk := parser.getLEWord(parser.ParserOffset + (1 * WORD_SIZE))\n\tparser.ResCount = (chunk / 4) - 2\n\n\tparser.ResourcesIds = make([]int, parser.ResCount)\n\tfor i := 0; i < parser.ResCount; i++ {\n\t\tparser.ResourcesIds[i] = parser.getLEWord(parser.ParserOffset + ((i + 2) * WORD_SIZE))\n\t}\n\n\tparser.ParserOffset += chunk\n}", "func parseReplsetResourceRequirements(replset *v1alpha1.ReplsetSpec) (corev1.ResourceRequirements, error) {\n\tvar err error\n\trr := corev1.ResourceRequirements{\n\t\tLimits: corev1.ResourceList{},\n\t\tRequests: corev1.ResourceList{},\n\t}\n\n\trr.Limits, err = parseResourceRequirementsList(replset.Limits)\n\tif err != nil {\n\t\treturn rr, err\n\t}\n\n\t// only set cpu+memory resource requests if limits are set\n\t// https://jira.percona.com/browse/CLOUD-44\n\trequests, err := parseResourceRequirementsList(replset.Requests)\n\tif err != nil {\n\t\treturn rr, err\n\t}\n\tif _, ok := rr.Limits[corev1.ResourceCPU]; ok {\n\t\trr.Requests[corev1.ResourceCPU] = requests[corev1.ResourceCPU]\n\t}\n\tif _, ok := rr.Limits[corev1.ResourceMemory]; ok {\n\t\trr.Requests[corev1.ResourceMemory] = requests[corev1.ResourceMemory]\n\t}\n\n\treturn rr, nil\n}", "func (o ArgoCDSpecServerResourcesPtrOutput) Requests() ArgoCDSpecServerResourcesRequestsMapOutput {\n\treturn o.ApplyT(func(v *ArgoCDSpecServerResources) map[string]ArgoCDSpecServerResourcesRequests {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Requests\n\t}).(ArgoCDSpecServerResourcesRequestsMapOutput)\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (m *TracingOpencensusConfig) GetResources() map[string]interface{} {\n\tif m != nil {\n\t\treturn m.Resources\n\t}\n\treturn nil\n}", "func (r *ReconcileKogitoInfra) createRequiredResources(instance *v1alpha1.KogitoInfra) (resources map[reflect.Type][]resource.KubernetesResource, err error) {\n\tresourcesInfinispan, err := infinispan.CreateRequiredResources(instance, r.client)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKafka, err := kafka.CreateRequiredResources(instance)\n\tif err != nil {\n\t\treturn\n\t}\n\tresourcesKeycloak, err := keycloak.CreateRequiredResources(instance)\n\tif err != nil {\n\t\treturn\n\t}\n\tresources = make(map[reflect.Type][]resource.KubernetesResource, len(resourcesInfinispan)+len(resourcesKafka)+len(resourcesKeycloak))\n\tmergeResourceMaps(resources, resourcesKafka, resourcesInfinispan, resourcesKeycloak)\n\treturn\n}", "func newKubeNodeStatusAllocatableCPUCoresMetric(fqname, node string, value float64) KubeNodeStatusAllocatableCPUCoresMetric {\n\treturn KubeNodeStatusAllocatableCPUCoresMetric{\n\t\tfqName: fqname,\n\t\thelp: \"kube_node_status_allocatable_cpu_cores node allocatable cpu cores\",\n\t\tnode: node,\n\t\tvalue: value,\n\t}\n}", "func (p *ResourcePool) New(ctx context.Context, meta AllocMeta) (Alloc, error) {\n\tif meta.Want.Equal(nil) {\n\t\treturn nil, errors.E(\"ResourcePool.New\", errors.Precondition, fmt.Errorf(\"illegal request for an empty resources: %s\", meta.Want))\n\t}\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tif p.stopped {\n\t\treturn nil, errors.Errorf(\"alloc %v: shutting down\", meta)\n\t}\n\tvar (\n\t\ttotal = p.resources\n\t\tused reflow.Resources\n\t\texpired []Alloc\n\t)\n\tfor _, alloc := range p.allocs {\n\t\tused.Add(used, alloc.Resources())\n\t\tif AllocExpired(alloc) {\n\t\t\texpired = append(expired, alloc)\n\t\t}\n\t}\n\t// ACHTUNG N²! (But n is small.)\n\tn := 0\n\tcollect := expired[:]\n\t// TODO: preferentially prefer those allocs which will give us the\n\t// resource types we need.\n\tp.log.Printf(\"alloc total%s used%s want%s\", total, used, meta.Want)\n\tvar free reflow.Resources\n\tfor {\n\t\tfree.Sub(total, used)\n\t\tif free.Available(meta.Want) || len(expired) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tmax := 0\n\t\tfor i := 1; i < len(expired); i++ {\n\t\t\tif AllocExpiredBy(expired[i]) > AllocExpiredBy(expired[max]) {\n\t\t\t\tmax = i\n\t\t\t}\n\t\t}\n\t\talloc := expired[max]\n\t\texpired[0], expired[max] = expired[max], expired[0]\n\t\texpired = expired[1:]\n\t\tused.Sub(used, alloc.Resources())\n\t\tn++\n\t}\n\tcollect = collect[:n]\n\tif !free.Available(meta.Want) {\n\t\treturn nil, errors.E(\"alloc\", errors.NotExist, errOfferExpired)\n\t}\n\tremainingIds := map[string]bool{}\n\tfor id := range p.allocs {\n\t\tremainingIds[id] = true\n\t}\n\tfor _, alloc := range collect {\n\t\tdelete(remainingIds, alloc.ID())\n\t}\n\tvar remaining []Alloc\n\tfor id, alloc := range p.allocs {\n\t\tif _, ok := remainingIds[id]; ok {\n\t\t\tremaining = append(remaining, alloc)\n\t\t}\n\t}\n\tid := newID()\n\talloc, err := p.manager.New(ctx, id, meta, keepaliveInterval, remaining)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.allocs[id] = alloc\n\tfor _, alloc := range collect {\n\t\tdelete(p.allocs, alloc.ID())\n\t\tif err := p.manager.Kill(alloc); err != nil {\n\t\t\tp.log.Errorf(\"error killing alloc: %s\", err)\n\t\t} else {\n\t\t\tp.log.Printf(\"alloc reclaim %s\", alloc.ID())\n\t\t}\n\t}\n\treturn alloc, nil\n}", "func (c *Clients) GetKubeResources(r *ReleaseData) (map[string]interface{}, error) {\n\tlog.Printf(\"Getting resources for %s\", r.Name)\n\tif r.Manifest == \"\" {\n\t\treturn nil, errors.New(\"manifest not provided in the request\")\n\t}\n\tresources := map[string]interface{}{}\n\tinfos, err := c.getManifestDetails(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnamespace := \"default\"\n\tfor _, info := range infos {\n\t\tvar spec interface{}\n\t\tkind := info.Object.GetObjectKind().GroupVersionKind().GroupKind().Kind\n\t\tv := kube.AsVersioned(info)\n\t\tif checkSize(resources, ResourcesOutputSize) {\n\t\t\tbreak\n\t\t}\n\n\t\tif stringInSlice(reflect.TypeOf(v).String(), ResourcesOutputIgnoredTypes) {\n\t\t\tcontinue\n\t\t}\n\t\tinner := make(map[string]interface{})\n\t\tname, ok := ScanFromStruct(v, \"ObjectMeta.Name\")\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tns, ok := ScanFromStruct(v, \"ObjectMeta.Namespace\")\n\t\tif ok {\n\t\t\tnamespace = fmt.Sprint(ns)\n\t\t}\n\t\tif stringInSlice(reflect.TypeOf(v).String(), ResourcesOutputIncludedSpec) {\n\t\t\tspec, ok = ScanFromStruct(v, \"Spec\")\n\t\t\tif ok {\n\t\t\t\tspec = structToMap(spec)\n\t\t\t}\n\t\t}\n\t\tstatus, ok := ScanFromStruct(v, \"Status\")\n\t\tif ok {\n\t\t\tstatus = structToMap(status)\n\t\t}\n\t\tinner = map[string]interface{}{\n\t\t\tfmt.Sprint(name): map[string]interface{}{\n\t\t\t\t\"Namespace\": namespace,\n\t\t\t\t\"Spec\": spec,\n\t\t\t\t\"Status\": status,\n\t\t\t},\n\t\t}\n\t\tif IsZero(resources[kind]) {\n\t\t\tresources[kind] = map[string]interface{}{}\n\t\t}\n\t\ttemp := resources[kind].(map[string]interface{})\n\t\tresources[kind] = mergeMaps(temp, inner)\n\t}\n\treturn resources, nil\n}", "func (o SysbenchSpecPtrOutput) Resources() SysbenchSpecResourcesPtrOutput {\n\treturn o.ApplyT(func(v *SysbenchSpec) *SysbenchSpecResources {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Resources\n\t}).(SysbenchSpecResourcesPtrOutput)\n}", "func (o ApplicationMetricDescriptionResponseOutput) ReservationCapacity() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v ApplicationMetricDescriptionResponse) *float64 { return v.ReservationCapacity }).(pulumi.Float64PtrOutput)\n}", "func newUnstructuredResourceMap(unstructured *unstructured.Unstructured) *UnstructuredResourceMap {\n\treturn &UnstructuredResourceMap{\n\t\tValues: unstructured.UnstructuredContent(),\n\t}\n}", "func (config *AppConfig) CreateNodeAllocations(newNodeAllocations AllocationAttributes, nodeID int) (err error) {\n\tendpoint := fmt.Sprintf(\"nodes/%d/allocations\", nodeID)\n\n\tnewNodeAllocBytes, err := json.Marshal(newNodeAllocations)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// get json bytes from the panel.\n\t_, err = config.queryApplicationAPI(endpoint, \"post\", newNodeAllocBytes)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (s *SchedulerSpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowCluster)\n\trsrcInfos := []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.serviceaccount(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.rb(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t}\n\n\tif r.Spec.DAGs != nil {\n\t\tgit := r.Spec.DAGs.Git\n\t\tif git != nil && git.CredSecretRef != nil {\n\t\t\trsrcInfos = append(rsrcInfos,\n\t\t\t\tResourceInfo{LifecycleReferred,\n\t\t\t\t\t&resources.Secret{\n\t\t\t\t\t\tSecret: &corev1.Secret{\n\t\t\t\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\t\t\t\tNamespace: r.Namespace,\n\t\t\t\t\t\t\t\tName: git.CredSecretRef.Name,\n\t\t\t\t\t\t\t}}},\n\t\t\t\t\t\"\"})\n\t\t}\n\t}\n\n\treturn rsrcInfos\n}" ]
[ "0.5364796", "0.50617653", "0.5001727", "0.4769316", "0.47181323", "0.4706976", "0.46147397", "0.4606428", "0.45965248", "0.45897478", "0.45863438", "0.45834994", "0.45776933", "0.45581096", "0.45503893", "0.4532366", "0.45284724", "0.45280227", "0.45074448", "0.45017514", "0.44999886", "0.44834998", "0.44781455", "0.44741762", "0.4465793", "0.4437779", "0.44334468", "0.43932492", "0.43895382", "0.4384445", "0.4381486", "0.4375834", "0.4350357", "0.43499005", "0.43254673", "0.43205452", "0.43168655", "0.43108317", "0.4310188", "0.42976826", "0.42919666", "0.4268014", "0.4264607", "0.42624584", "0.42537066", "0.4227662", "0.42260298", "0.42155516", "0.42130893", "0.42034942", "0.41992792", "0.41820672", "0.41684532", "0.41522512", "0.41410953", "0.4129822", "0.4123427", "0.41079575", "0.4097854", "0.40956327", "0.4082428", "0.40791067", "0.4076077", "0.40714467", "0.4063384", "0.40620002", "0.4061962", "0.40524742", "0.40408853", "0.40395823", "0.40354556", "0.40307948", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.4021607", "0.40171707", "0.40171063", "0.4013267", "0.40128037", "0.40126944", "0.40126944", "0.40126944", "0.40126944", "0.40126944", "0.40126944", "0.40126944", "0.40059823", "0.40041333", "0.40032664", "0.39942688", "0.39923197", "0.39910674", "0.39862433", "0.39725223", "0.39712763" ]
0.8464234
0
CompareAllocatableResources compares `expected` and `got` map zone:allocatableResources respectively (see: AllocatableResourceListFromNodeResourceTopology), and informs the caller if the maps are equal. Here `equal` means the same zoneNames with the same resources, where the resources are equal if they have the same resources with the same quantities. Returns the name of the different zone, the name of the different resources within the zone, the comparison result (same semantic as strings.Compare) and a boolean that reports if the resourceLists are consistent. See `CompareResourceList`.
CompareAllocatableResources сравнивает `expected` и `got` map zone:allocatableResources соответственно (см.: AllocatableResourceListFromNodeResourceTopology), и информирует вызывающего, равны ли карты. Здесь `равно` означает одинаковые zoneNames с одинаковыми ресурсами, где ресурсы считаются равными, если у них одинаковые ресурсы с одинаковыми количествами. Возвращает имя различающейся зоны, имя различающегося ресурса внутри зоны, результат сравнения (тот же семантический смысл, что и у strings.Compare) и булево значение, которое отчетливо указывает, являются ли resourceLists согласованными. См. `CompareResourceList`.
func CompareAllocatableResources(expected, got map[string]corev1.ResourceList) (string, string, int, bool) { if len(got) != len(expected) { framework.Logf("-> expected=%v (len=%d) got=%v (len=%d)", expected, len(expected), got, len(got)) return "", "", 0, false } for expZoneName, expResList := range expected { gotResList, ok := got[expZoneName] if !ok { return expZoneName, "", 0, false } if resName, cmp, ok := CompareResourceList(expResList, gotResList); !ok || cmp != 0 { return expZoneName, resName, cmp, ok } } return "", "", 0, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CompareResourceList(expected, got corev1.ResourceList) (string, int, bool) {\n\tif len(got) != len(expected) {\n\t\tframework.Logf(\"-> expected=%v (len=%d) got=%v (len=%d)\", expected, len(expected), got, len(got))\n\t\treturn \"\", 0, false\n\t}\n\tfor expResName, expResQty := range expected {\n\t\tgotResQty, ok := got[expResName]\n\t\tif !ok {\n\t\t\treturn string(expResName), 0, false\n\t\t}\n\t\tif cmp := gotResQty.Cmp(expResQty); cmp != 0 {\n\t\t\tframework.Logf(\"-> resource=%q cmp=%d expected=%v got=%v\", expResName, cmp, expResQty, gotResQty)\n\t\t\treturn string(expResName), cmp, true\n\t\t}\n\t}\n\treturn \"\", 0, true\n}", "func CompareResources(resA, resB types.Resource) int {\n\tequal := cmp.Equal(resA, resB,\n\t\tignoreProtoXXXFields(),\n\t\tcmpopts.IgnoreFields(types.Metadata{}, \"ID\"),\n\t\tcmpopts.IgnoreFields(types.DatabaseV3{}, \"Status\"),\n\t\tcmpopts.EquateEmpty(),\n\t)\n\tif equal {\n\t\treturn Equal\n\t}\n\treturn Different\n}", "func ResourcesEqual(a, b map[string]envoy.Resource) bool {\n\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\n\tfor name, resource := range a {\n\t\tif !proto.Equal(resource, b[name]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (r *Compare) Compare() (map[string][]schema.GroupVersionResource, error) {\n\tpreferredSrcResourceList, err := collectPreferredResources(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsrcCRDResource, err := collectPreferredCRDResource(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdstResourceList, err := collectNamespacedResources(r.DstDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpreferredSrcResourceList, err = r.excludeCRDs(preferredSrcResourceList, srcCRDResource, r.SrcClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresourcesDiff := r.compareResources(preferredSrcResourceList, dstResourceList)\n\tincompatibleGVKs, err := convertToGVRList(resourcesDiff)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't report an incompatibleGVK if user settings will skip resource anyways\n\texcludedResources := toStringSlice(settings.ExcludedInitialResources.Union(toSet(r.Plan.Status.ExcludedResources)))\n\tfilteredGVKs := []schema.GroupVersionResource{}\n\tfor _, gvr := range incompatibleGVKs {\n\t\tskip := false\n\t\tfor _, resource := range excludedResources {\n\t\t\tif strings.EqualFold(gvr.Resource, resource) {\n\t\t\t\tskip = true\n\t\t\t}\n\t\t}\n\t\tif !skip {\n\t\t\tfilteredGVKs = append(filteredGVKs, gvr)\n\t\t}\n\t}\n\n\treturn r.collectIncompatibleMapping(filteredGVKs)\n}", "func (r *Compare) CompareCRDs() (map[string][]schema.GroupVersionResource, error) {\n\tsrcCRDResource, err := collectPreferredCRDResource(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdstCRDResourceList, err := collectCRDResources(r.DstDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcrdGVDiff := r.compareResources(srcCRDResource, dstCRDResourceList)\n\t// if len(crdGVDiff)>0, then CRD APIVersion is incompatible between src and dest\n\tif len(crdGVDiff) > 0 {\n\t\tsrcCRDs, err := collectPreferredResources(r.SrcDiscovery)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsrcCRDs, err = r.includeCRDsOnly(srcCRDs, srcCRDResource, r.SrcClient)\n\n\t\tdstCRDs, err := collectNamespacedResources(r.DstDiscovery)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdstCRDs, err = r.includeCRDsOnly(dstCRDs, dstCRDResourceList, r.DstClient)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcrdsDiff := r.compareResources(srcCRDs, dstCRDs)\n\t\tincompatibleGVKs, err := convertToGVRList(crdsDiff)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Don't report an incompatibleGVK if user settings will skip resource anyways\n\t\texcludedResources := toStringSlice(settings.ExcludedInitialResources.Union(toSet(r.Plan.Status.ExcludedResources)))\n\t\tfilteredGVKs := []schema.GroupVersionResource{}\n\t\tfor _, gvr := range incompatibleGVKs {\n\t\t\tskip := false\n\t\t\tfor _, resource := range excludedResources {\n\t\t\t\tif strings.EqualFold(gvr.Resource, resource) {\n\t\t\t\t\tskip = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !skip {\n\t\t\t\tfilteredGVKs = append(filteredGVKs, gvr)\n\t\t\t}\n\t\t}\n\n\t\treturn r.collectIncompatibleMapping(filteredGVKs)\n\t}\n\treturn nil, nil\n}", "func (s *SchedulerSpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowCluster)\n\trsrcInfos := []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.serviceaccount(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.rb(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t}\n\n\tif r.Spec.DAGs != nil {\n\t\tgit := r.Spec.DAGs.Git\n\t\tif git != nil && git.CredSecretRef != nil {\n\t\t\trsrcInfos = append(rsrcInfos,\n\t\t\t\tResourceInfo{LifecycleReferred,\n\t\t\t\t\t&resources.Secret{\n\t\t\t\t\t\tSecret: &corev1.Secret{\n\t\t\t\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\t\t\t\tNamespace: r.Namespace,\n\t\t\t\t\t\t\t\tName: git.CredSecretRef.Name,\n\t\t\t\t\t\t\t}}},\n\t\t\t\t\t\"\"})\n\t\t}\n\t}\n\n\treturn rsrcInfos\n}", "func (s *AirflowUISpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowCluster)\n\treturn []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.secret(r), \"\"},\n\t}\n}", "func (s *NFSStoreSpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowBase)\n\treturn []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.service(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.podDisruption(r), \"\"},\n\t}\n}", "func (s *FlowerSpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowCluster)\n\treturn []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t}\n}", "func (p *Plan) CompareResultSets(regressDir string, expectedDir string, t *tap.T) {\n\tfor i, rs := range p.ResultSets {\n\t\ttestName := strings.TrimPrefix(rs.Filename, regressDir+\"/out/\")\n\t\texpectedFilename := filepath.Join(expectedDir,\n\t\t\tfilepath.Base(rs.Filename))\n\t\tdiff, err := DiffFiles(expectedFilename, rs.Filename, 3)\n\n\t\tif err != nil {\n\t\t\tt.Diagnostic(\n\t\t\t\tfmt.Sprintf(`Query File: '%s'\nBindings File: '%s'\nBindings Name: '%s'\nQuery Parameters: '%v'\nExpected Result File: '%s'\nActual Result File: '%s'\n\nFailed to compare results: %s`,\n\t\t\t\t\tp.Query.Path,\n\t\t\t\t\tp.Path,\n\t\t\t\t\tp.Names[i],\n\t\t\t\t\tp.Bindings[i],\n\t\t\t\t\texpectedFilename,\n\t\t\t\t\trs.Filename,\n\t\t\t\t\terr.Error()))\n\t\t}\n\n\t\tif diff != \"\" {\n\t\t\tt.Diagnostic(\n\t\t\t\tfmt.Sprintf(`Query File: '%s'\nBindings File: '%s'\nBindings Name: '%s'\nQuery Parameters: '%v'\nExpected Result File: '%s'\nActual Result File: '%s'\n\n%s`,\n\t\t\t\t\tp.Query.Path,\n\t\t\t\t\tp.Path,\n\t\t\t\t\tp.Names[i],\n\t\t\t\t\tp.Bindings[i],\n\t\t\t\t\texpectedFilename,\n\t\t\t\t\trs.Filename,\n\t\t\t\t\tdiff))\n\t\t}\n\t\tt.Ok(diff == \"\", testName)\n\t}\n}", "func (rm *RsrcManager) SpecDiffers(expected, observed *reconciler.Object) bool {\n\te := expected.Obj.(*Object).Bucket\n\to := observed.Obj.(*Object).Bucket\n\treturn !reflect.DeepEqual(e.Acl, o.Acl) ||\n\t\t!reflect.DeepEqual(e.Billing, o.Billing) ||\n\t\t!reflect.DeepEqual(e.Cors, o.Cors) ||\n\t\t!reflect.DeepEqual(e.DefaultEventBasedHold, o.DefaultEventBasedHold) ||\n\t\t!reflect.DeepEqual(e.Encryption, o.Encryption) ||\n\t\t!reflect.DeepEqual(e.Labels, o.Labels) ||\n\t\t!reflect.DeepEqual(e.Lifecycle, o.Lifecycle) ||\n\t\t!strings.EqualFold(e.Location, o.Location) ||\n\t\t!reflect.DeepEqual(e.Logging, o.Logging) ||\n\t\t!reflect.DeepEqual(e.Name, o.Name) ||\n\t\t!reflect.DeepEqual(e.Owner, o.Owner) ||\n\t\t!reflect.DeepEqual(e.StorageClass, o.StorageClass) ||\n\t\t!reflect.DeepEqual(e.Versioning, o.Versioning) ||\n\t\t!reflect.DeepEqual(e.Website, o.Website)\n}", "func assertZonesMatch(t *testing.T, expected, actual time.Time) {\n\tt.Helper()\n\texpectedName, expectedOffset := expected.Zone()\n\tactualName, actualOffset := actual.Zone()\n\tif expectedOffset != actualOffset {\n\t\tt.Errorf(\"Expected Zone '%s' with offset %d. Got Zone '%s' with offset %d\", expectedName, expectedOffset, actualName, actualOffset)\n\t}\n}", "func (s *SQLProxySpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowBase)\n\tname, _, _ := nameAndLabels(r, ValueAirflowComponentSQL, \"\", false)\n\treturn []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.service(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t\tResourceInfo{LifecycleReferred,\n\t\t\t&resources.Secret{\n\t\t\t\tSecret: &corev1.Secret{\n\t\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\t\tNamespace: r.Namespace,\n\t\t\t\t\t\tName: name,\n\t\t\t\t\t}}},\n\t\t\t\"\"},\n\t}\n}", "func (s *RedisSpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowCluster)\n\trsrcInfos := []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.secret(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.service(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.podDisruption(r), \"\"},\n\t}\n\t//if s.VolumeClaimTemplate != nil {\n\t//\t\trsrcInfos = append(rsrcInfos, ResourceInfo{LifecycleReferred, s.VolumeClaimTemplate, \"\"})\n\t//\t}\n\treturn rsrcInfos\n}", "func Compare(expected, actual io.Reader) error {\n\texpScan := bufio.NewScanner(expected)\n\tactScan := bufio.NewScanner(actual)\n\n\tfor line := 1; ; line++ {\n\t\texp, hasExp := scanTrimRight(expScan)\n\t\tact, hasAct := scanTrimRight(actScan)\n\n\t\t// EOF at the same time\n\t\tif !hasExp && !hasAct {\n\t\t\treturn nil\n\t\t}\n\t\t// they are not equal\n\t\tif exp != act {\n\t\t\treturn newErr(line, exp, act)\n\t\t}\n\t\t// they are all exists and equal\n\t\tif hasExp && hasAct {\n\t\t\tcontinue\n\t\t}\n\t\t// verify all empty line lefts\n\t\tif err := verifyEOFSpace(\"actual\", actScan); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := verifyEOFSpace(\"expected\", expScan); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// at this point, they should all be same\n\t\treturn nil\n\t}\n}", "func (s *WorkerSpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowCluster)\n\trsrcInfos := []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t}\n\t// TODO storage spec ?\n\treturn rsrcInfos\n}", "func (s *MySQLSpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowBase)\n\tif s.Operator {\n\t\treturn nil\n\t}\n\trsrcInfos := []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.secret(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.service(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.podDisruption(r), \"\"},\n\t}\n\t//if s.VolumeClaimTemplate != nil {\n\t//\trsrcInfos = append(rsrcInfos, ResourceInfo{LifecycleReferred, s.VolumeClaimTemplate, \"\"})\n\t//}\n\treturn rsrcInfos\n}", "func (r Resources) Equal(o Resources) bool {\n\tLog.Vomit.Printf(\"Comparing resources: %+ v ?= %+ v\", r, o)\n\tif len(r) != len(o) {\n\t\tLog.Vomit.Println(\"Lengths differ\")\n\t\treturn false\n\t}\n\n\tif r.Ports() != o.Ports() {\n\t\tLog.Vomit.Println(\"Ports differ\")\n\t\treturn false\n\t}\n\n\tif math.Abs(r.Cpus()-o.Cpus()) > 0.001 {\n\t\tLog.Vomit.Println(\"Cpus differ\")\n\t\treturn false\n\t}\n\n\tif math.Abs(r.Memory()-o.Memory()) > 0.001 {\n\t\tLog.Vomit.Println(\"Memory differ\")\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (r *Resources) Equal(other *Resources) bool {\n\treturn equal(r.CPU, other.CPU) &&\n\t\tequal(r.MEMORY, other.MEMORY) &&\n\t\tequal(r.DISK, other.DISK) &&\n\t\tequal(r.GPU, other.GPU)\n}", "func (s *SQLProxySpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\tswitch expected.Obj.(type) {\n\tcase *resources.Service:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t\texpected.Obj.(*resources.Service).Spec.ClusterIP = observed.Obj.(*resources.Service).Spec.ClusterIP\n\t}\n\treturn true\n}", "func compareRes(a, b []byte) error {\n\tvar am, bm interface{}\n\tif err := json.Unmarshal(a, &am); err != nil {\n\t\treturn fmt.Errorf(\"%s: %v\", a, err)\n\t}\n\tif err := json.Unmarshal(b, &bm); err != nil {\n\t\treturn fmt.Errorf(\"%s: %v\", b, err)\n\t}\n\n\treturn cmp(am, bm)\n}", "func VerifyResources(resources string) error {\n\tif resources != \"\" {\n\t\tvar r map[string]interface{}\n\t\tif e := json.Unmarshal([]byte(resources), &r); e != nil {\n\t\t\treturn fmt.Errorf(\"%s: %s should be JSON format\", envResource, resources)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *PostgresSpec) ExpectedResources(rsrc interface{}) []ResourceInfo {\n\tr := rsrc.(*AirflowBase)\n\tif s.Operator {\n\t\treturn nil\n\t}\n\trsrcInfos := []ResourceInfo{\n\t\tResourceInfo{LifecycleManaged, s.secret(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.service(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.sts(r), \"\"},\n\t\tResourceInfo{LifecycleManaged, s.podDisruption(r), \"\"},\n\t}\n\t//if s.VolumeClaimTemplate != nil {\n\t//\trsrcInfos = append(rsrcInfos, ResourceInfo{LifecycleReferred, s.VolumeClaimTemplate, \"\"})\n\t//}\n\treturn rsrcInfos\n}", "func compareDevices(expected *model.Device, actual *model.Device, t *testing.T) {\n\tassert.Equal(t, expected.Id, actual.Id)\n\tassert.Equal(t, expected.PubKey, actual.PubKey)\n\tassert.Equal(t, expected.IdData, actual.IdData)\n\tassert.Equal(t, expected.IdDataStruct, actual.IdDataStruct)\n\tassert.Equal(t, expected.IdDataSha256, actual.IdDataSha256)\n\tassert.Equal(t, expected.Status, actual.Status)\n\tassert.Equal(t, expected.ApiLimits, actual.ApiLimits)\n\tcompareTime(expected.CreatedTs, actual.CreatedTs, t)\n\tcompareTime(expected.UpdatedTs, actual.UpdatedTs, t)\n}", "func cmp(a, b planv1.Plan) bool {\n\tif a.Namespace != b.Namespace {\n\t\treturn false\n\t}\n\n\tif a.Spec.Version != b.Spec.Version {\n\t\treturn false\n\t}\n\n\tif a.Spec.Concurrency != b.Spec.Concurrency {\n\t\treturn false\n\t}\n\n\t//TODO Refactor to not use reflection\n\tif !reflect.DeepEqual(a.Spec, b.Spec) {\n\t\treturn false\n\t}\n\tif !reflect.DeepEqual(a.ObjectMeta, b.ObjectMeta) {\n\t\treturn false\n\t}\n\tif !reflect.DeepEqual(a.TypeMeta, b.TypeMeta) {\n\t\treturn false\n\t}\n\treturn true\n}", "func newResourceDelta(\n\ta *resource,\n\tb *resource,\n) *ackcompare.Delta {\n\tdelta := ackcompare.NewDelta()\n\tif (a == nil && b != nil) ||\n\t\t(a != nil && b == nil) {\n\t\tdelta.Add(\"\", a, b)\n\t\treturn delta\n\t}\n\n\tif ackcompare.HasNilDifference(a.ko.Spec.Constraints, b.ko.Spec.Constraints) {\n\t\tdelta.Add(\"Spec.Constraints\", a.ko.Spec.Constraints, b.ko.Spec.Constraints)\n\t} else if a.ko.Spec.Constraints != nil && b.ko.Spec.Constraints != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.Constraints.EncryptionContextEquals, b.ko.Spec.Constraints.EncryptionContextEquals) {\n\t\t\tdelta.Add(\"Spec.Constraints.EncryptionContextEquals\", a.ko.Spec.Constraints.EncryptionContextEquals, b.ko.Spec.Constraints.EncryptionContextEquals)\n\t\t} else if a.ko.Spec.Constraints.EncryptionContextEquals != nil && b.ko.Spec.Constraints.EncryptionContextEquals != nil {\n\t\t\tif !ackcompare.MapStringStringPEqual(a.ko.Spec.Constraints.EncryptionContextEquals, b.ko.Spec.Constraints.EncryptionContextEquals) {\n\t\t\t\tdelta.Add(\"Spec.Constraints.EncryptionContextEquals\", a.ko.Spec.Constraints.EncryptionContextEquals, b.ko.Spec.Constraints.EncryptionContextEquals)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.Constraints.EncryptionContextSubset, b.ko.Spec.Constraints.EncryptionContextSubset) {\n\t\t\tdelta.Add(\"Spec.Constraints.EncryptionContextSubset\", a.ko.Spec.Constraints.EncryptionContextSubset, b.ko.Spec.Constraints.EncryptionContextSubset)\n\t\t} else if a.ko.Spec.Constraints.EncryptionContextSubset != nil && b.ko.Spec.Constraints.EncryptionContextSubset != nil {\n\t\t\tif !ackcompare.MapStringStringPEqual(a.ko.Spec.Constraints.EncryptionContextSubset, b.ko.Spec.Constraints.EncryptionContextSubset) {\n\t\t\t\tdelta.Add(\"Spec.Constraints.EncryptionContextSubset\", a.ko.Spec.Constraints.EncryptionContextSubset, b.ko.Spec.Constraints.EncryptionContextSubset)\n\t\t\t}\n\t\t}\n\t}\n\tif !ackcompare.SliceStringPEqual(a.ko.Spec.GrantTokens, b.ko.Spec.GrantTokens) {\n\t\tdelta.Add(\"Spec.GrantTokens\", a.ko.Spec.GrantTokens, b.ko.Spec.GrantTokens)\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.GranteePrincipal, b.ko.Spec.GranteePrincipal) {\n\t\tdelta.Add(\"Spec.GranteePrincipal\", a.ko.Spec.GranteePrincipal, b.ko.Spec.GranteePrincipal)\n\t} else if a.ko.Spec.GranteePrincipal != nil && b.ko.Spec.GranteePrincipal != nil {\n\t\tif *a.ko.Spec.GranteePrincipal != *b.ko.Spec.GranteePrincipal {\n\t\t\tdelta.Add(\"Spec.GranteePrincipal\", a.ko.Spec.GranteePrincipal, b.ko.Spec.GranteePrincipal)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.KeyID, b.ko.Spec.KeyID) {\n\t\tdelta.Add(\"Spec.KeyID\", a.ko.Spec.KeyID, b.ko.Spec.KeyID)\n\t} else if a.ko.Spec.KeyID != nil && b.ko.Spec.KeyID != nil {\n\t\tif *a.ko.Spec.KeyID != *b.ko.Spec.KeyID {\n\t\t\tdelta.Add(\"Spec.KeyID\", a.ko.Spec.KeyID, b.ko.Spec.KeyID)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.Name, b.ko.Spec.Name) {\n\t\tdelta.Add(\"Spec.Name\", a.ko.Spec.Name, b.ko.Spec.Name)\n\t} else if a.ko.Spec.Name != nil && b.ko.Spec.Name != nil {\n\t\tif *a.ko.Spec.Name != *b.ko.Spec.Name {\n\t\t\tdelta.Add(\"Spec.Name\", a.ko.Spec.Name, b.ko.Spec.Name)\n\t\t}\n\t}\n\tif !ackcompare.SliceStringPEqual(a.ko.Spec.Operations, b.ko.Spec.Operations) {\n\t\tdelta.Add(\"Spec.Operations\", a.ko.Spec.Operations, b.ko.Spec.Operations)\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.RetiringPrincipal, b.ko.Spec.RetiringPrincipal) {\n\t\tdelta.Add(\"Spec.RetiringPrincipal\", a.ko.Spec.RetiringPrincipal, b.ko.Spec.RetiringPrincipal)\n\t} else if a.ko.Spec.RetiringPrincipal != nil && b.ko.Spec.RetiringPrincipal != nil {\n\t\tif *a.ko.Spec.RetiringPrincipal != *b.ko.Spec.RetiringPrincipal {\n\t\t\tdelta.Add(\"Spec.RetiringPrincipal\", a.ko.Spec.RetiringPrincipal, b.ko.Spec.RetiringPrincipal)\n\t\t}\n\t}\n\n\treturn delta\n}", "func (s *RedisSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\tswitch expected.Obj.(type) {\n\tcase *resources.Secret:\n\t\t// Dont update a secret\n\t\treturn false\n\tcase *resources.Service:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t\texpected.Obj.(*resources.Service).Spec.ClusterIP = observed.Obj.(*resources.Service).Spec.ClusterIP\n\tcase *resources.PodDisruptionBudget:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t}\n\treturn true\n}", "func (s *PostgresSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\tswitch expected.Obj.(type) {\n\tcase *resources.Secret:\n\t\t// Dont update a secret\n\t\treturn false\n\tcase *resources.Service:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t\texpected.Obj.(*resources.Service).Spec.ClusterIP = observed.Obj.(*resources.Service).Spec.ClusterIP\n\tcase *resources.PodDisruptionBudget:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t}\n\treturn true\n}", "func compareMaps(t *testing.T, a, b map[string]string) {\n\tif len(a) != len(b) {\n\t\tt.Error(\"Maps different sizes\", a, b)\n\t}\n\tfor ka, va := range a {\n\t\tif vb, ok := b[ka]; !ok || va != vb {\n\t\t\tt.Error(\"Difference in key\", ka, va, b[ka])\n\t\t}\n\t}\n\tfor kb, vb := range b {\n\t\tif va, ok := a[kb]; !ok || vb != va {\n\t\t\tt.Error(\"Difference in key\", kb, vb, a[kb])\n\t\t}\n\t}\n}", "func (s *WorkerSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\t// TODO\n\treturn true\n}", "func CompareJSON(expected string, actual string, topDir string) (string, error) {\n\n\tvar fActual, fExpected *os.File\n\tvar err error\n\tif fActual, err = writeTempFile(\"tmp_actual\", actual); err != nil {\n\t\treturn \"\", err\n\t}\n\tif fExpected, err = writeTempFile(\"tmp_expected\", expected); err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer func() {\n\t\t_ = os.Remove(fActual.Name())\n\t\t_ = os.Remove(fExpected.Name())\n\t}()\n\n\tscript := path.Join(topDir, diffExecutable)\n\tcompareCmd := exec.Command(\n\t\t\"python\",\n\t\tscript,\n\t\tfActual.Name(),\n\t\tfExpected.Name())\n\tdiffCmd := exec.Command(\n\t\t\"python\",\n\t\tscript,\n\t\t\"--diff\",\n\t\tfActual.Name(),\n\t\tfExpected.Name())\n\treturn runJSONDiff(compareCmd, diffCmd)\n}", "func CompareStorageRequests(initial corev1.ResourceRequirements, updated corev1.ResourceRequirements) StorageComparison {\n\tinitialSize := initial.Requests.Storage()\n\tupdatedSize := updated.Requests.Storage()\n\tif initialSize.IsZero() || updatedSize.IsZero() {\n\t\treturn StorageComparison{}\n\t}\n\tswitch updatedSize.Cmp(*initialSize) {\n\tcase -1: // decrease\n\t\treturn StorageComparison{Decrease: true}\n\tcase 1: // increase\n\t\treturn StorageComparison{Increase: true}\n\tdefault: // same size\n\t\treturn StorageComparison{}\n\t}\n}", "func compareRequests(want []interface{}, got []interface{}) error {\n\tif len(got) != len(want) {\n\t\tvar gotMsg string\n\t\tfor _, r := range got {\n\t\t\tgotMsg += fmt.Sprintf(\"%v: %+v]\\n\", reflect.TypeOf(r), r)\n\t\t}\n\n\t\tvar wantMsg string\n\t\tfor _, r := range want {\n\t\t\twantMsg += fmt.Sprintf(\"%v: %+v]\\n\", reflect.TypeOf(r), r)\n\t\t}\n\n\t\treturn fmt.Errorf(\"got %d requests, want %d requests:\\ngot:\\n%s\\nwant:\\n%s\", len(got), len(want), gotMsg, wantMsg)\n\t}\n\n\tfor i, want := range want {\n\t\tif reflect.TypeOf(got[i]) != reflect.TypeOf(want) {\n\t\t\treturn fmt.Errorf(\"request %d: got %+v, want %+v\", i, reflect.TypeOf(got[i]), reflect.TypeOf(want))\n\t\t}\n\t}\n\treturn nil\n}", "func Compare(t *testing.T, expected string, out string) {\n\tif out != expected {\n\t\tt.Error(Warn(`FAIL!`), \"\\n\\n\"+\n\t\t\t`Got: `+quoted(out)+\"\\n\"+\n\t\t\t`Expected: `+quoted(expected)+\"\\n\",\n\t\t)\n\t} else {\n\t\tt.Log(Okay(`PASS:`), quoted(strings.TrimSuffix(out, \"\\n\")))\n\t}\n}", "func (s *NFSStoreSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\t// TODO\n\tswitch expected.Obj.(type) {\n\tcase *resources.Service:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t\texpected.Obj.(*resources.Service).Spec.ClusterIP = observed.Obj.(*resources.Service).Spec.ClusterIP\n\tcase *resources.PodDisruptionBudget:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t}\n\treturn true\n}", "func routerCAConfigMapsEqual(a, b *corev1.ConfigMap) bool {\n\tif a.Data[\"ca-bundle.crt\"] != b.Data[\"ca-bundle.crt\"] {\n\t\treturn false\n\t}\n\treturn true\n}", "func AssertEqualStringMap(expected map[string]string, result map[string]string) {\n\tAssertType(expected, result)\n\tif expected == nil && result == nil {\n\t\treturn\n\t}\n\tif len(expected) != len(result) {\n\t\tpanic(fmt.Sprintf(\"Error: [] Different count of items\\nExpected Value: %v\\nResult: %v\", expected, result))\n\t}\n\tfor expectedKey := range expected {\n\t\tif result[expectedKey] != expected[expectedKey] {\n\t\t\tpanic(fmt.Sprintf(\"Error: [] Item missing: %v.\\nExpected Value: %v\\nResult: %v\", expected[expectedKey], expected, result))\n\t\t}\n\t}\n}", "func compare_clocks(new_clock ClockVector, last_clock ClockVector) bool {\n\treturn new_clock.X >= last_clock.X && new_clock.Y >= last_clock.Y && new_clock.Z >= last_clock.Z\n}", "func compareObservations(expected v1alpha1.NodeResult, actual v1alpha1.NodeResult, t *testing.T) error {\n\tif expected.Node != actual.Node {\n\t\treturn fmt.Errorf(\"NodeResult should be on %s, but is on %s\", expected.Node, actual.Node)\n\t}\n\texObs := expected.Observations\n\tacObs := actual.Observations\n\tif len(exObs) != len(acObs) {\n\t\treturn fmt.Errorf(\"Observations should be %v, but got %v\", exObs, acObs)\n\t}\n\tfor i := 0; i < len(exObs); i++ {\n\t\tif exObs[i].Component != acObs[i].Component ||\n\t\t\texObs[i].ComponentInfo != acObs[i].ComponentInfo ||\n\t\t\texObs[i].Action != acObs[i].Action {\n\t\t\treturn fmt.Errorf(\"Observations should be %v, but got %v\", exObs, acObs)\n\t\t}\n\t}\n\treturn nil\n}", "func Compare(resultPaths []string) {\n\t// m maps names like \"baseline\" and \"instrumented\" to textual data in\n\t// the Go Benchmark Data Format. See https://golang.org/issue/14313.\n\tm := make(map[string][]byte)\n\n\t// Walk each directory from resultPaths and collect benchmark data from\n\t// all result.json files.\n\tfor _, root := range resultPaths {\n\t\t_ = filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tif !d.IsDir() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tdefer func() {\n\t\t\t\t// ignore panics from readTestResult\n\t\t\t\t_ = recover()\n\t\t\t}()\n\t\t\ttr := readTestResult(filepath.Join(path, \"result.json\"))\n\t\t\tm[d.Name()] = append(m[d.Name()], toGoBenchFormat(tr)...)\n\t\t\treturn nil\n\t\t})\n\t}\n\n\t// Sort names to make output deterministic.\n\tvar names []string\n\tfor name := range m {\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\tvar c benchstat.Collection\n\tfor _, name := range names {\n\t\tc.AddConfig(name, m[name])\n\t}\n\n\t// Print comparison.\n\tbenchstat.FormatText(os.Stdout, c.Tables())\n}", "func VerifyResourcesProvisionedForSpace(t *testing.T, awaitilities wait.Awaitilities, spaceName string, additionalCriteria ...wait.SpaceWaitCriterion) (*toolchainv1alpha1.Space, *toolchainv1alpha1.NSTemplateSet) {\n\tspace, err := awaitilities.Host().WaitForSpace(t, spaceName,\n\t\tappend(additionalCriteria,\n\t\t\twait.UntilSpaceHasAnyTargetClusterSet(),\n\t\t\twait.UntilSpaceHasAnyTierNameSet())...)\n\trequire.NoError(t, err)\n\ttargetCluster := getSpaceTargetMember(t, awaitilities, space)\n\ttier, err := awaitilities.Host().WaitForNSTemplateTier(t, space.Spec.TierName)\n\trequire.NoError(t, err)\n\tchecks, err := tiers.NewChecksForTier(tier)\n\trequire.NoError(t, err)\n\n\tt.Logf(\"verifying resources provisioned for space '%s' with tier '%s'\", space.Name, space.Spec.TierName)\n\treturn verifyResourcesProvisionedForSpace(t, awaitilities.Host(), targetCluster, spaceName, tier, checks)\n}", "func compareDiagrams(t *testing.T, result string, expected string) {\n\tdec := json.NewDecoder(strings.NewReader(result))\n\tvar resData, expData diagramData\n\tif err := dec.Decode(&resData); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdec = json.NewDecoder(strings.NewReader(expected))\n\tif err := dec.Decode(&expData); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !reflect.DeepEqual(resData, expData) {\n\t\tt.Errorf(\"\\ngot:\\n%s\\nwant:\\n%s\", result, expected)\n\t}\n}", "func (s *SchedulerSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\tswitch expected.Obj.(type) {\n\tcase *resources.ServiceAccount:\n\t\t// Dont update a SA\n\t\treturn false\n\t}\n\treturn true\n}", "func checkNodeAllocatableTest(f *framework.Framework) {\n\n\tnodeMem := getNodeMemory(f)\n\tframework.Logf(\"nodeMem says: %+v\", nodeMem)\n\n\t// calculate the allocatable mem based on capacity - reserved amounts\n\tcalculatedNodeAlloc := nodeMem.capacity.Copy()\n\tcalculatedNodeAlloc.Sub(nodeMem.systemReserve)\n\tcalculatedNodeAlloc.Sub(nodeMem.kubeReserve)\n\tcalculatedNodeAlloc.Sub(nodeMem.softEviction)\n\tcalculatedNodeAlloc.Sub(nodeMem.hardEviction)\n\n\tginkgo.By(fmt.Sprintf(\"Checking stated allocatable memory %v against calculated allocatable memory %v\", &nodeMem.allocatable, calculatedNodeAlloc))\n\n\t// sanity check against stated allocatable\n\tgomega.Expect(calculatedNodeAlloc.Cmp(nodeMem.allocatable)).To(gomega.Equal(0))\n}", "func CompareArgv(expected, got []string) error {\n\tif len(expected) != len(got) {\n\t\treturn fmt.Errorf(\"expected %d entries but got %d (%+v)\", len(expected), len(got), got)\n\t}\n\truntimex.Assert(len(got) >= 1, \"too few entries\")\n\tif !strings.HasSuffix(got[0], expected[0]) {\n\t\treturn fmt.Errorf(\"expected %s suffix but got %s\", expected[0], got[0])\n\t}\n\tfor idx := 1; idx < len(got); idx++ {\n\t\tif got[idx] != expected[idx] {\n\t\t\treturn fmt.Errorf(\"entry %d of %+v: expected %s, but got %s\", idx, expected, expected[idx], got[idx])\n\t\t}\n\t}\n\treturn nil\n}", "func TestCompare(t *testing.T, first Block, second Block) {\n\tjs, err := json.Marshal(first)\n\tif err != nil {\n\t\tt.Errorf(\"the error was expected to be nil, error returned: %s\", err.Error())\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(js, second)\n\tif err != nil {\n\t\tt.Errorf(\"the error was expected to be nil, error returned: %s\", err.Error())\n\t\treturn\n\t}\n\n\treJS, err := json.Marshal(second)\n\tif err != nil {\n\t\tt.Errorf(\"the error was expected to be nil, error returned: %s\", err.Error())\n\t\treturn\n\t}\n\n\tif bytes.Compare(js, reJS) != 0 {\n\t\tt.Errorf(\"the transformed javascript is different.\\n%s\\n%s\", js, reJS)\n\t\treturn\n\t}\n\n\tif !first.Hash().Compare(second.Hash()) {\n\t\tt.Errorf(\"the instance conversion failed\")\n\t\treturn\n\t}\n}", "func Compare(t *testing.T, got, expected string) {\n\tCompareCallDepth(t, got, expected, 2)\n}", "func newResourceDelta(\n\ta *resource,\n\tb *resource,\n) *ackcompare.Delta {\n\tdelta := ackcompare.NewDelta()\n\tif (a == nil && b != nil) ||\n\t\t(a != nil && b == nil) {\n\t\tdelta.Add(\"\", a, b)\n\t\treturn delta\n\t}\n\n\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig, b.ko.Spec.MonitoringScheduleConfig) {\n\t\tdelta.Add(\"Spec.MonitoringScheduleConfig\", a.ko.Spec.MonitoringScheduleConfig, b.ko.Spec.MonitoringScheduleConfig)\n\t} else if a.ko.Spec.MonitoringScheduleConfig != nil && b.ko.Spec.MonitoringScheduleConfig != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition) {\n\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition)\n\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig)\n\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig != nil {\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName != nil {\n\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.BaseliningJobName)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource != nil {\n\t\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI) {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI)\n\t\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI != nil {\n\t\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI {\n\t\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.ConstraintsResource.S3URI)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource != nil {\n\t\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI) {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI)\n\t\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI != nil {\n\t\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI {\n\t\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.BaselineConfig.StatisticsResource.S3URI)\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 ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment)\n\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment != nil {\n\t\t\t\tif !ackcompare.MapStringStringPEqual(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.Environment)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification)\n\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification != nil {\n\t\t\t\tif !ackcompare.SliceStringPEqual(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerArguments, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerArguments) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerArguments\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerArguments, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerArguments)\n\t\t\t\t}\n\t\t\t\tif !ackcompare.SliceStringPEqual(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerEntrypoint, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerEntrypoint) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerEntrypoint\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerEntrypoint, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ContainerEntrypoint)\n\t\t\t\t}\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI != nil {\n\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.ImageURI)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI != nil {\n\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.PostAnalyticsProcessorSourceURI)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI != nil {\n\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringAppSpecification.RecordPreprocessorSourceURI)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringInputs, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringInputs) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringInputs\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringInputs, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringInputs)\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig)\n\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig != nil {\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID != nil {\n\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.KMSKeyID)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !reflect.DeepEqual(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.MonitoringOutputs, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.MonitoringOutputs) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.MonitoringOutputs\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.MonitoringOutputs, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringOutputConfig.MonitoringOutputs)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources)\n\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources != nil {\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig != nil {\n\t\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount) {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount)\n\t\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount != nil {\n\t\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount {\n\t\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceCount)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType) {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType)\n\t\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType != nil {\n\t\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType {\n\t\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.InstanceType)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID) {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID)\n\t\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID != nil {\n\t\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID {\n\t\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeKMSKeyID)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB) {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB)\n\t\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB != nil {\n\t\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB {\n\t\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.MonitoringResources.ClusterConfig.VolumeSizeInGB)\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 ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig)\n\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig != nil {\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption != nil {\n\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableInterContainerTrafficEncryption)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation != nil {\n\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.EnableNetworkIsolation)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig != nil {\n\t\t\t\t\tif !ackcompare.SliceStringPEqual(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.SecurityGroupIDs, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.SecurityGroupIDs) {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.SecurityGroupIDs\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.SecurityGroupIDs, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.SecurityGroupIDs)\n\t\t\t\t\t}\n\t\t\t\t\tif !ackcompare.SliceStringPEqual(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.Subnets, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.Subnets) {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.Subnets\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.Subnets, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.NetworkConfig.VPCConfig.Subnets)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN)\n\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN != nil {\n\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.RoleARN)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition)\n\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition != nil {\n\t\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds) {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds)\n\t\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds != nil {\n\t\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds {\n\t\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinition.StoppingCondition.MaxRuntimeInSeconds)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName) {\n\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName)\n\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName != nil {\n\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName != *b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName\", a.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName, b.ko.Spec.MonitoringScheduleConfig.MonitoringJobDefinitionName)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.MonitoringType, b.ko.Spec.MonitoringScheduleConfig.MonitoringType) {\n\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringType\", a.ko.Spec.MonitoringScheduleConfig.MonitoringType, b.ko.Spec.MonitoringScheduleConfig.MonitoringType)\n\t\t} else if a.ko.Spec.MonitoringScheduleConfig.MonitoringType != nil && b.ko.Spec.MonitoringScheduleConfig.MonitoringType != nil {\n\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.MonitoringType != *b.ko.Spec.MonitoringScheduleConfig.MonitoringType {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.MonitoringType\", a.ko.Spec.MonitoringScheduleConfig.MonitoringType, b.ko.Spec.MonitoringScheduleConfig.MonitoringType)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.ScheduleConfig, b.ko.Spec.MonitoringScheduleConfig.ScheduleConfig) {\n\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.ScheduleConfig\", a.ko.Spec.MonitoringScheduleConfig.ScheduleConfig, b.ko.Spec.MonitoringScheduleConfig.ScheduleConfig)\n\t\t} else if a.ko.Spec.MonitoringScheduleConfig.ScheduleConfig != nil && b.ko.Spec.MonitoringScheduleConfig.ScheduleConfig != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression, b.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression) {\n\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression\", a.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression, b.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression)\n\t\t\t} else if a.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression != nil && b.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression != nil {\n\t\t\t\tif *a.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression != *b.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression {\n\t\t\t\t\tdelta.Add(\"Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression\", a.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression, b.ko.Spec.MonitoringScheduleConfig.ScheduleConfig.ScheduleExpression)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.MonitoringScheduleName, b.ko.Spec.MonitoringScheduleName) {\n\t\tdelta.Add(\"Spec.MonitoringScheduleName\", a.ko.Spec.MonitoringScheduleName, b.ko.Spec.MonitoringScheduleName)\n\t} else if a.ko.Spec.MonitoringScheduleName != nil && b.ko.Spec.MonitoringScheduleName != nil {\n\t\tif *a.ko.Spec.MonitoringScheduleName != *b.ko.Spec.MonitoringScheduleName {\n\t\t\tdelta.Add(\"Spec.MonitoringScheduleName\", a.ko.Spec.MonitoringScheduleName, b.ko.Spec.MonitoringScheduleName)\n\t\t}\n\t}\n\n\treturn delta\n}", "func (s *MySQLSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\tswitch expected.Obj.(type) {\n\tcase *resources.Secret:\n\t\t// Dont update a secret\n\t\treturn false\n\tcase *resources.Service:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t\texpected.Obj.(*resources.Service).Spec.ClusterIP = observed.Obj.(*resources.Service).Spec.ClusterIP\n\tcase *resources.PodDisruptionBudget:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t}\n\treturn true\n}", "func TestRunDiff(t *testing.T) {\n\tcases := map[string]struct {\n\t\tcomparers compare.ComparerSet\n\t\tresourceChange []plan.ResourcePlan\n\t\tpreHook func()\n\t\texpected int\n\t\texpectedOutput []string\n\t}{\n\t\t\"create returns false with create resource\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer fail\"},\n\t\t},\n\t\t\"create returns true with create resource\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer ok\"},\n\t\t},\n\t\t\"no matching comparer\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tAddressReturns: \"address\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"\"},\n\t\t},\n\t\t\"no matching comparer with strict enabled\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tAddressReturns: \"address\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tpreHook: func() {\n\t\t\t\tstrict = true\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"?\", \"address (no matching comparer)\"},\n\t\t},\n\t\t\"create returns true with multiple resources\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address1\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address2\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer ok\\ncomparer ok\"},\n\t\t},\n\t\t\"fails if there is at least 1 failure\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t\tDestroyComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address1\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tDeleteReturns: true,\n\t\t\t\t\tAddressReturns: \"address2\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer fail\", \"comparer ok\"},\n\t\t},\n\t\t\"returns 1 if there is at least 1 failure and errorOnFail is set\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t\tDestroyComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address1\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tDeleteReturns: true,\n\t\t\t\t\tAddressReturns: \"address2\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tpreHook: func() {\n\t\t\t\terrorOnFail = true\n\t\t\t},\n\t\t\texpected: 1,\n\t\t\texpectedOutput: []string{\"comparer fail\", \"comparer ok\"},\n\t\t},\n\t\t\"only outputs failed with failedOnly\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t\tDestroyComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address1\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tDeleteReturns: true,\n\t\t\t\t\tAddressReturns: \"address2\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tpreHook: func() {\n\t\t\t\tfailedOnly = true\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer fail\"},\n\t\t},\n\t\t// TODO: test case to ensure comparers are called correctly(matching type and number of calls)\n\t}\n\n\tfor name, tc := range cases {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\t// set default vars\n\t\t\terrorOnFail = false\n\t\t\tstrict = false\n\t\t\tfailedOnly = false\n\n\t\t\tif tc.preHook != nil {\n\t\t\t\ttc.preHook()\n\t\t\t}\n\n\t\t\tvar output bytes.Buffer\n\t\t\tif got := runDiff(&output, tc.resourceChange, tc.comparers); got != tc.expected {\n\t\t\t\tt.Errorf(\"Expected: %v but got %v\", tc.expected, got)\n\t\t\t}\n\n\t\t\tfor _, s := range tc.expectedOutput {\n\t\t\t\tif !strings.Contains(output.String(), s) {\n\t\t\t\t\tt.Errorf(\"Result string did not contain %v\", s)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func verifyExpectedRequests(ctx context.Context, fc *fakeclient.Client, resourceNames ...string) error {\n\tfor _, name := range resourceNames {\n\t\tif name == \"\" {\n\t\t\t// ResourceName empty string indicates a cancel.\n\t\t\tif _, err := fc.WaitForCancelEDSWatch(ctx); err != nil {\n\t\t\t\treturn fmt.Errorf(\"timed out when expecting resource %q\", name)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tresName, err := fc.WaitForWatchEDS(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"timed out when expecting resource %q, %p\", name, fc)\n\t\t}\n\t\tif resName != name {\n\t\t\treturn fmt.Errorf(\"got EDS request for resource %q, expected: %q\", resName, name)\n\t\t}\n\t}\n\treturn nil\n}", "func (d *portworx) comparePoolsAndDisks(srcNode *api.StorageNode,\n\tdstNode *api.StorageNode) bool {\n\tsrcPools := srcNode.Pools\n\tdstPools := dstNode.Pools\n\n\t// Comparing pool ids\n\tif len(srcPools) != len(dstPools) {\n\t\treturn false\n\t}\n\n\tfor x, pool := range srcPools {\n\t\tif pool.Uuid != dstPools[x].Uuid {\n\t\t\tlog.Errorf(\"Source pools: [%v] not macthing with Destination pools: [%v]\", srcPools, dstPools)\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Comparing disks\n\tsrcDisks := srcNode.Disks\n\tdstDisks := dstNode.Disks\n\n\tfor disk, value := range srcDisks {\n\t\tif !srcDisks[disk].Metadata && !dstDisks[disk].Metadata {\n\t\t\tif value.Id != dstDisks[disk].Id {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else if srcDisks[disk].Metadata && dstDisks[disk].Metadata {\n\t\t\tif value.Id != dstDisks[disk].Id {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "func TestResourceListSorting(t *testing.T) {\n\tsortedResourceList := make([]string, len(resourceList))\n\tcopy(sortedResourceList, resourceList)\n\tsort.Strings(sortedResourceList)\n\tfor i := 0; i < len(resourceList); i++ {\n\t\tif resourceList[i] != sortedResourceList[i] {\n\t\t\tt.Errorf(\"Expected resourceList[%d] = \\\"%s\\\", resourceList is not correctly sorted.\", i, sortedResourceList[i])\n\t\t\tbreak\n\t\t}\n\t}\n}", "func compare(a, b *Record) bool {\n\tif a == nil || b == nil {\n\t\treturn false\n\t}\n\tif a.Name != b.Name {\n\t\treturn false\n\t}\n\tif a.Type != b.Type {\n\t\treturn false\n\t}\n\tif a.TTL != b.TTL {\n\t\treturn false\n\t}\n\tif len(a.Data) != len(b.Data) {\n\t\treturn false\n\t}\n\tfor i := 0; i < len(a.Data); i++ {\n\t\tif a.Data[i] != b.Data[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func compareTeamMaps(a, b Teams) bool {\n\tfor teamIndex, team := range a.Teams {\n\t\tif team.Name != b.Teams[teamIndex].Name {\n\t\t\treturn false\n\t\t}\n\t\tfor acctIndex, acct := range team.Accounts {\n\t\t\tif acct != b.Teams[teamIndex].Accounts[acctIndex] {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n}", "func AssertStringsAreEqualJSON(t testing.TB, expected, got string) {\n\treplacer := strings.NewReplacer(\"\\n\", \"\", \"\\t\", \"\")\n\n\texpected = replacer.Replace(expected)\n\tgot = replacer.Replace(got)\n\n\tvar obj1, obj2 interface{}\n\n\terr := json.Unmarshal([]byte(expected), &obj1)\n\tif err != nil {\n\t\terr = fmt.Errorf(`expected is not JSON. value = \"%v\", err = \"%v\"`, expected, err)\n\t}\n\tFailOnError(t, err)\n\n\terr = json.Unmarshal([]byte(got), &obj2)\n\tif err != nil {\n\t\terr = fmt.Errorf(`got is not JSON. value = \"%v\", err = \"%v\"`, got, err)\n\t}\n\tFailOnError(t, err)\n\n\tassert.Equal(\n\t\tt,\n\t\tobj1,\n\t\tobj2,\n\t\tfmt.Sprintf(`%v\nand\n%v\nshould represent the same json`, expected, got),\n\t)\n}", "func Compare[T any](t testing.TB, x, y T) bool {\n\treturn objectsAreEqual(x, y)\n}", "func compareMaps(info string, a, b map[int]bool) {\n\tif len(a) != len(b) {\n\t\tpanic(errors.Bug(\"%s - a.len:%d != b.len:%d\", info, len(a), len(b)))\n\t}\n\tfor k, v := range a {\n\t\tif _, ok := b[k]; !ok {\n\t\t\tpanic(fmt.Sprintf(\"%s - k:%d (%t)\\n\", info, k, v))\n\t\t}\n\t}\n}", "func gatherAndCompare(c prometheus.Collector, expected string, metricNames []string) error {\n\texpected = removeUnusedWhitespace(expected)\n\n\treg := prometheus.NewPedanticRegistry()\n\tif err := reg.Register(c); err != nil {\n\t\treturn fmt.Errorf(\"registering collector failed: %s\", err)\n\t}\n\tmetrics, err := reg.Gather()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"gathering metrics failed: %s\", err)\n\t}\n\tif metricNames != nil {\n\t\tmetrics = filterMetrics(metrics, metricNames)\n\t}\n\tvar tp expfmt.TextParser\n\texpectedMetrics, err := tp.TextToMetricFamilies(bytes.NewReader([]byte(expected)))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing expected metrics failed: %s\", err)\n\t}\n\n\tif !reflect.DeepEqual(metrics, normalizeMetricFamilies(expectedMetrics)) {\n\t\t// Encode the gathered output to the readbale text format for comparison.\n\t\tvar buf1 bytes.Buffer\n\t\tenc := expfmt.NewEncoder(&buf1, expfmt.FmtText)\n\t\tfor _, mf := range metrics {\n\t\t\tif err := enc.Encode(mf); err != nil {\n\t\t\t\treturn fmt.Errorf(\"encoding result failed: %s\", err)\n\t\t\t}\n\t\t}\n\t\t// Encode normalized expected metrics again to generate them in the same ordering\n\t\t// the registry does to spot differences more easily.\n\t\tvar buf2 bytes.Buffer\n\t\tenc = expfmt.NewEncoder(&buf2, expfmt.FmtText)\n\t\tfor _, mf := range normalizeMetricFamilies(expectedMetrics) {\n\t\t\tif err := enc.Encode(mf); err != nil {\n\t\t\t\treturn fmt.Errorf(\"encoding result failed: %s\", err)\n\t\t\t}\n\t\t}\n\n\t\treturn fmt.Errorf(`\nmetric output does not match expectation; want:\n\n%s\n\ngot:\n\n%s\n`, buf2.String(), buf1.String())\n\t}\n\treturn nil\n}", "func CmpResources(a, b *v1.ResourceRequirements) bool {\n\treturn CmpResourceList(&a.Limits, &b.Limits) && CmpResourceList(&a.Requests, &b.Requests)\n}", "func AssertPlannedReparentShardResponsesEqual(t *testing.T, expected *vtctldatapb.PlannedReparentShardResponse, actual *vtctldatapb.PlannedReparentShardResponse) {\n\tt.Helper()\n\n\texpected = proto.Clone(expected).(*vtctldatapb.PlannedReparentShardResponse)\n\texpected.Events = nil\n\n\tactual = proto.Clone(actual).(*vtctldatapb.PlannedReparentShardResponse)\n\tactual.Events = nil\n\n\tutils.MustMatch(t, expected, actual)\n}", "func AssertPlannedReparentShardResponsesEqual(t *testing.T, expected *vtctldatapb.PlannedReparentShardResponse, actual *vtctldatapb.PlannedReparentShardResponse) {\n\tt.Helper()\n\n\texpected = proto.Clone(expected).(*vtctldatapb.PlannedReparentShardResponse)\n\texpected.Events = nil\n\n\tactual = proto.Clone(actual).(*vtctldatapb.PlannedReparentShardResponse)\n\tactual.Events = nil\n\n\tutils.MustMatch(t, expected, actual)\n}", "func shouldResembleByteMap(actual interface{}, expected ...interface{}) string {\n\tact, ok := actual.(map[string]*bytes.Buffer)\n\tif !ok {\n\t\treturn \"actual is not a map[string]*bytes.Buffer\"\n\t}\n\tif len(expected) != 1 {\n\t\treturn \"expected is not a map[string][]byte\"\n\t}\n\texp, ok := expected[0].(map[string][]byte)\n\tif !ok {\n\t\treturn \"expected is not a map[string][]byte\"\n\t}\n\n\tif len(act) != len(exp) {\n\t\treturn fmt.Sprintf(\"len(actual) != len(expected): %v != %v\", len(act), len(exp))\n\t}\n\n\tfor k, v := range act {\n\t\tif got, want := v.Bytes(), exp[k]; !reflect.DeepEqual(got, want) {\n\t\t\treturn fmt.Sprintf(\"actual[%q] != expected[%q]: %q != %q\", k, k, got, want)\n\t\t}\n\t}\n\treturn \"\"\n}", "func diffUrlMap(c *Client, desired, actual *UrlMap, opts ...dcl.ApplyOption) ([]urlMapDiff, error) {\n\tif desired == nil || actual == nil {\n\t\treturn nil, fmt.Errorf(\"nil resource passed to diff - always a programming error: %#v, %#v\", desired, actual)\n\t}\n\n\tvar diffs []urlMapDiff\n\tif compareUrlMapDefaultRouteAction(c, desired.DefaultRouteAction, actual.DefaultRouteAction) {\n\t\tc.Config.Logger.Infof(\"Detected diff in DefaultRouteAction.\\nDESIRED: %v\\nACTUAL: %v\", desired.DefaultRouteAction, actual.DefaultRouteAction)\n\n\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\tUpdateOp: &updateUrlMapUpdateOperation{},\n\t\t\tFieldName: \"DefaultRouteAction\",\n\t\t})\n\n\t}\n\tif !dcl.IsZeroValue(desired.DefaultService) && !dcl.StringCanonicalize(desired.DefaultService, actual.DefaultService) {\n\t\tc.Config.Logger.Infof(\"Detected diff in DefaultService.\\nDESIRED: %v\\nACTUAL: %v\", desired.DefaultService, actual.DefaultService)\n\n\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\tUpdateOp: &updateUrlMapUpdateOperation{},\n\t\t\tFieldName: \"DefaultService\",\n\t\t})\n\n\t}\n\tif compareUrlMapDefaultUrlRedirect(c, desired.DefaultUrlRedirect, actual.DefaultUrlRedirect) {\n\t\tc.Config.Logger.Infof(\"Detected diff in DefaultUrlRedirect.\\nDESIRED: %v\\nACTUAL: %v\", desired.DefaultUrlRedirect, actual.DefaultUrlRedirect)\n\n\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\tUpdateOp: &updateUrlMapUpdateOperation{},\n\t\t\tFieldName: \"DefaultUrlRedirect\",\n\t\t})\n\n\t}\n\tif !dcl.IsZeroValue(desired.Description) && !dcl.StringCanonicalize(desired.Description, actual.Description) {\n\t\tc.Config.Logger.Infof(\"Detected diff in Description.\\nDESIRED: %v\\nACTUAL: %v\", desired.Description, actual.Description)\n\n\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\tUpdateOp: &updateUrlMapUpdateOperation{},\n\t\t\tFieldName: \"Description\",\n\t\t})\n\n\t}\n\tif compareUrlMapHeaderAction(c, desired.HeaderAction, actual.HeaderAction) {\n\t\tc.Config.Logger.Infof(\"Detected diff in HeaderAction.\\nDESIRED: %v\\nACTUAL: %v\", desired.HeaderAction, actual.HeaderAction)\n\n\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\tUpdateOp: &updateUrlMapUpdateOperation{},\n\t\t\tFieldName: \"HeaderAction\",\n\t\t})\n\n\t}\n\tif compareUrlMapHostRuleSlice(c, desired.HostRule, actual.HostRule) {\n\t\tc.Config.Logger.Infof(\"Detected diff in HostRule.\\nDESIRED: %v\\nACTUAL: %v\", desired.HostRule, actual.HostRule)\n\n\t\ttoAdd, toRemove := compareUrlMapHostRuleSets(c, desired.HostRule, actual.HostRule)\n\t\tc.Config.Logger.Infof(\"diff in HostRule is a set field - recomparing with set logic. \\nto add: %#v\\nto remove: %#v\", toAdd, toRemove)\n\t\tif len(toAdd) != 0 || len(toRemove) != 0 {\n\t\t\tc.Config.Logger.Info(\"diff in HostRule persists after set logic analysis.\")\n\t\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\t\tUpdateOp: &updateUrlMapUpdateOperation{},\n\t\t\t\tFieldName: \"HostRule\",\n\t\t\t})\n\t\t}\n\n\t}\n\tif !dcl.IsZeroValue(desired.Name) && !dcl.StringCanonicalize(desired.Name, actual.Name) {\n\t\tc.Config.Logger.Infof(\"Detected diff in Name.\\nDESIRED: %v\\nACTUAL: %v\", desired.Name, actual.Name)\n\n\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\tUpdateOp: &updateUrlMapUpdateOperation{},\n\t\t\tFieldName: \"Name\",\n\t\t})\n\n\t}\n\tif compareUrlMapPathMatcherSlice(c, desired.PathMatcher, actual.PathMatcher) {\n\t\tc.Config.Logger.Infof(\"Detected diff in PathMatcher.\\nDESIRED: %v\\nACTUAL: %v\", desired.PathMatcher, actual.PathMatcher)\n\n\t\ttoAdd, toRemove := compareUrlMapPathMatcherSets(c, desired.PathMatcher, actual.PathMatcher)\n\t\tc.Config.Logger.Infof(\"diff in PathMatcher is a set field - recomparing with set logic. \\nto add: %#v\\nto remove: %#v\", toAdd, toRemove)\n\t\tif len(toAdd) != 0 || len(toRemove) != 0 {\n\t\t\tc.Config.Logger.Info(\"diff in PathMatcher persists after set logic analysis.\")\n\t\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\t\tUpdateOp: &updateUrlMapUpdateOperation{},\n\t\t\t\tFieldName: \"PathMatcher\",\n\t\t\t})\n\t\t}\n\n\t}\n\tif !dcl.IsZeroValue(desired.Region) && !dcl.StringCanonicalize(desired.Region, actual.Region) {\n\t\tc.Config.Logger.Infof(\"Detected diff in Region.\\nDESIRED: %v\\nACTUAL: %v\", desired.Region, actual.Region)\n\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\tRequiresRecreate: true,\n\t\t\tFieldName: \"Region\",\n\t\t})\n\t}\n\tif compareUrlMapTestSlice(c, desired.Test, actual.Test) {\n\t\tc.Config.Logger.Infof(\"Detected diff in Test.\\nDESIRED: %v\\nACTUAL: %v\", desired.Test, actual.Test)\n\n\t\tdiffs = append(diffs, urlMapDiff{\n\t\t\tUpdateOp: &updateUrlMapUpdateOperation{},\n\t\t\tFieldName: \"Test\",\n\t\t})\n\n\t}\n\t// We need to ensure that this list does not contain identical operations *most of the time*.\n\t// There may be some cases where we will need multiple copies of the same operation - for instance,\n\t// if a resource has multiple prerequisite-containing fields. For now, we don't know of any\n\t// such examples and so we deduplicate unconditionally.\n\n\t// The best way for us to do this is to iterate through the list\n\t// and remove any copies of operations which are identical to a previous operation.\n\t// This is O(n^2) in the number of operations, but n will always be very small,\n\t// even 10 would be an extremely high number.\n\tvar opTypes []string\n\tvar deduped []urlMapDiff\n\tfor _, d := range diffs {\n\t\t// Two operations are considered identical if they have the same type.\n\t\t// The type of an operation is derived from the name of the update method.\n\t\tif !dcl.StringSliceContains(fmt.Sprintf(\"%T\", d.UpdateOp), opTypes) {\n\t\t\tdeduped = append(deduped, d)\n\t\t\topTypes = append(opTypes, fmt.Sprintf(\"%T\", d.UpdateOp))\n\t\t} else {\n\t\t\tc.Config.Logger.Infof(\"Omitting planned operation of type %T since once is already scheduled.\", d.UpdateOp)\n\t\t}\n\t}\n\n\treturn deduped, nil\n}", "func CmpResourceList(a, b *v1.ResourceList) bool {\n\treturn a.Cpu().Cmp(*b.Cpu()) == 0 &&\n\t\ta.Memory().Cmp(*b.Memory()) == 0 &&\n\t\tb.Pods().Cmp(*b.Pods()) == 0 &&\n\t\tb.StorageEphemeral().Cmp(*b.StorageEphemeral()) == 0\n}", "func RunResourceConversionTestForDnsZonesCAARecord(subject DnsZonesCAARecord) string {\n\t// Copy subject to make sure conversion doesn't modify it\n\tcopied := subject.DeepCopy()\n\n\t// Convert to our hub version\n\tvar hub v20180501s.DnsZonesCAARecord\n\terr := copied.ConvertTo(&hub)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Convert from our hub version\n\tvar actual DnsZonesCAARecord\n\terr = actual.ConvertFrom(&hub)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Compare actual with what we started with\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 (s *AirflowUISpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\t// TODO\n\tswitch expected.Obj.(type) {\n\tcase *resources.Secret:\n\t\t// Dont update a secret\n\t\treturn false\n\t}\n\treturn true\n}", "func SortResources(resources []*metav1.APIResourceList) {\n\tsort.SliceStable(resources, func(i, j int) bool {\n\t\tleft := resources[i]\n\t\tleftGV, _ := schema.ParseGroupVersion(left.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif leftGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"greater\"\n\t\t\treturn false\n\t\t}\n\n\t\tright := resources[j]\n\t\trightGV, _ := schema.ParseGroupVersion(right.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif rightGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"less\"\n\t\t\treturn true\n\t\t}\n\n\t\treturn i < j\n\t})\n}", "func TestRedpandaResourceRequirements(t *testing.T) {\n\ttype test struct {\n\t\tname string\n\t\tsetRequestsCPU resource.Quantity\n\t\tsetRequestsMem resource.Quantity\n\t\tsetRedpandaCPU resource.Quantity\n\t\tsetRedpandaMem resource.Quantity\n\t\texpectedRedpandaCPU resource.Quantity\n\t\texpectedRedpandaMem resource.Quantity\n\t}\n\tmakeResources := func(t test) v1alpha1.RedpandaResourceRequirements {\n\t\treturn v1alpha1.RedpandaResourceRequirements{\n\t\t\tResourceRequirements: corev1.ResourceRequirements{\n\t\t\t\tRequests: corev1.ResourceList{\n\t\t\t\t\tcorev1.ResourceMemory: t.setRequestsMem,\n\t\t\t\t\tcorev1.ResourceCPU: t.setRequestsCPU,\n\t\t\t\t},\n\t\t\t},\n\t\t\tRedpanda: corev1.ResourceList{\n\t\t\t\tcorev1.ResourceMemory: t.setRedpandaMem,\n\t\t\t\tcorev1.ResourceCPU: t.setRedpandaCPU,\n\t\t\t},\n\t\t}\n\t}\n\n\tt.Run(\"Memory\", func(t *testing.T) {\n\t\ttests := []test{\n\t\t\t{\n\t\t\t\tname: \"RedpandaMemory is set from requests.memory\",\n\t\t\t\tsetRequestsMem: resource.MustParse(\"3000Mi\"),\n\t\t\t\texpectedRedpandaMem: resource.MustParse(\"2700Mi\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaMemory is set from lower redpanda.memory\",\n\t\t\t\tsetRequestsMem: resource.MustParse(\"4000Mi\"),\n\t\t\t\tsetRedpandaMem: resource.MustParse(\"3000Mi\"),\n\t\t\t\texpectedRedpandaMem: resource.MustParse(\"3000Mi\"),\n\t\t\t},\n\t\t}\n\t\tfor _, tt := range tests {\n\t\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\t\trrr := makeResources(tt)\n\t\t\t\tassert.Equal(t, tt.expectedRedpandaMem.Value(), rrr.RedpandaMemory().Value())\n\t\t\t})\n\t\t}\n\t})\n\n\tt.Run(\"CPU\", func(t *testing.T) {\n\t\ttests := []test{\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is set from integer requests.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is set from milli requests.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1000m\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is rounded up from milli requests.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1001m\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is set from lower redpanda.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"2\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\tsetRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is set from higher redpanda.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\tsetRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is rounded up from milli redpanda.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\tsetRedpandaCPU: resource.MustParse(\"1001m\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is limited by 2GiB/core\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"10\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"4Gi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU has a minimum if requests >0\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"100m\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"100Mi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU not set if no request\",\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"0\"),\n\t\t\t},\n\t\t}\n\t\tfor _, tt := range tests {\n\t\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\t\trrr := makeResources(tt)\n\t\t\t\tassert.Equal(t, tt.expectedRedpandaCPU.Value(), rrr.RedpandaCPU().Value())\n\t\t\t})\n\t\t}\n\t})\n}", "func equalNetworks(net1, net2 string) bool {\n\tif strings.HasPrefix(net1, netalloc_api.AllocRefPrefix) ||\n\t\tstrings.HasPrefix(net2, netalloc_api.AllocRefPrefix) {\n\t\treturn net1 == net2\n\t}\n\t_, n1, err1 := net.ParseCIDR(net1)\n\t_, n2, err2 := net.ParseCIDR(net2)\n\tif err1 != nil || err2 != nil {\n\t\t// if parsing fails, compare as strings\n\t\treturn strings.EqualFold(net1, net2)\n\t}\n\treturn n1.IP.Equal(n2.IP) && bytes.Equal(n1.Mask, n2.Mask)\n}", "func TestEqual(t *testing.T) {\n\ttables := []struct {\n\t\tx []string\n\t\ty []string\n\t\texpected bool\n\t}{\n\t\t{[]string{}, []string{}, true},\n\t\t{[]string{}, []string{\"\"}, false},\n\t\t{[]string{\"\"}, []string{\"\"}, true},\n\t\t{[]string{\"\"}, []string{\"a\"}, false},\n\t\t{[]string{\"a\"}, []string{\"a\", \"a\"}, false},\n\t\t{[]string{\"b\"}, []string{\"a\"}, false},\n\t\t{[]string{\"\", \"\", \"\"}, []string{\"\", \"\", \"\"}, true},\n\t\t{[]string{\"a\", \"b\", \"c\"}, []string{\"a\", \"b\", \"e\"}, false},\n\t}\n\n\tfor _, table := range tables {\n\t\tresult := Equal(table.x, table.y)\n\t\tif result != table.expected {\n\t\t\tt.Errorf(\"Match failed for (%s, %s). Expected %t, got %t\",\n\t\t\t\ttable.x, table.y, table.expected, result)\n\t\t}\n\t}\n}", "func compareAuthSet(expected *model.AuthSet, actual *model.AuthSet, t *testing.T) {\n\tassert.Equal(t, expected.IdData, actual.IdData)\n\tassert.Equal(t, expected.PubKey, actual.PubKey)\n\tassert.Equal(t, expected.DeviceId, actual.DeviceId)\n\tassert.Equal(t, expected.IdDataStruct, actual.IdDataStruct)\n\tassert.Equal(t, expected.IdDataSha256, actual.IdDataSha256)\n\tassert.Equal(t, expected.Status, actual.Status)\n\tcompareTime(uto.Time(expected.Timestamp), uto.Time(actual.Timestamp), t)\n}", "func (s *StorageSuite) TestServersEquality(c *check.C) {\n\tservers := Servers{{\n\t\tAdvertiseIP: \"192.168.1.1\",\n\t\tHostname: \"node-1\",\n\t\tRole: \"worker\",\n\t}}\n\ttestCases := []struct {\n\t\tservers Servers\n\t\tresult bool\n\t\tcomment string\n\t}{\n\t\t{\n\t\t\tservers: Servers{{\n\t\t\t\tAdvertiseIP: \"192.168.1.1\",\n\t\t\t\tHostname: \"node-1\",\n\t\t\t\tRole: \"worker\",\n\t\t\t}},\n\t\t\tresult: true,\n\t\t\tcomment: \"Servers should be equal\",\n\t\t},\n\t\t{\n\t\t\tservers: Servers{\n\t\t\t\t{\n\t\t\t\t\tAdvertiseIP: \"192.168.1.1\",\n\t\t\t\t\tHostname: \"node-1\",\n\t\t\t\t\tRole: \"worker\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tAdvertiseIP: \"192.168.1.2\",\n\t\t\t\t\tHostname: \"node-2\",\n\t\t\t\t\tRole: \"worker\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresult: false,\n\t\t\tcomment: \"Servers should not be equal: different number of servers\",\n\t\t},\n\t\t{\n\t\t\tservers: Servers{{\n\t\t\t\tAdvertiseIP: \"192.168.1.2\",\n\t\t\t\tHostname: \"node-1\",\n\t\t\t\tRole: \"worker\",\n\t\t\t}},\n\t\t\tresult: false,\n\t\t\tcomment: \"Servers should not be equal: different IPs\",\n\t\t},\n\t\t{\n\t\t\tservers: Servers{{\n\t\t\t\tAdvertiseIP: \"192.168.1.1\",\n\t\t\t\tHostname: \"node-2\",\n\t\t\t\tRole: \"worker\",\n\t\t\t}},\n\t\t\tresult: false,\n\t\t\tcomment: \"Servers should not be equal: different hostnames\",\n\t\t},\n\t\t{\n\t\t\tservers: Servers{{\n\t\t\t\tAdvertiseIP: \"192.168.1.1\",\n\t\t\t\tHostname: \"node-1\",\n\t\t\t\tRole: \"db\",\n\t\t\t}},\n\t\t\tresult: false,\n\t\t\tcomment: \"Servers should not be equal: different roles\",\n\t\t},\n\t}\n\tfor _, tc := range testCases {\n\t\tc.Assert(servers.IsEqualTo(tc.servers), check.Equals, tc.result,\n\t\t\tcheck.Commentf(tc.comment))\n\t}\n}", "func (p *Profile) Compare(a, b string) bool {\n\tvar buf buffers\n\n\takey, err := buf.enforce(p, []byte(a), true)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tbuf = buffers{}\n\tbkey, err := buf.enforce(p, []byte(b), true)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn bytes.Equal(akey, bkey)\n}", "func AllocatableResourceListFromNodeResourceTopology(nodeTopo *v1alpha2.NodeResourceTopology) map[string]corev1.ResourceList {\n\tallocRes := make(map[string]corev1.ResourceList)\n\tfor _, zone := range nodeTopo.Zones {\n\t\tif zone.Type != \"Node\" {\n\t\t\tcontinue\n\t\t}\n\t\tresList := make(corev1.ResourceList)\n\t\tfor _, res := range zone.Resources {\n\t\t\tresList[corev1.ResourceName(res.Name)] = res.Allocatable.DeepCopy()\n\t\t}\n\t\tif len(resList) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tallocRes[zone.Name] = resList\n\t}\n\treturn allocRes\n}", "func CompareJSON(a, b map[string]interface{}, skip []string) ([]string, []string, []string, bool) {\n\tvar missKeys []string\n\tvar leftKeys []string\n\tvar diffKeys []string\n\tisSame := true\n\n\tfor k, v := range a {\n\t\tvb, ok := b[k]\n\t\tif ok {\n\t\t\tdelete(b, k)\n\t\t}\n\t\tif contains(skip, k) {\n\t\t\tcontinue\n\t\t}\n\t\tif !ok {\n\t\t\tmissKeys = append(missKeys, k)\n\t\t\tisSame = false\n\t\t\tcontinue\n\t\t}\n\t\tif reflect.TypeOf(v) != reflect.TypeOf(vb) {\n\t\t\tif reflect.TypeOf(v) == nil && reflect.ValueOf(vb).Len() == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif reflect.TypeOf(vb) == nil && reflect.ValueOf(v).Len() == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdiffKeys = append(diffKeys, diffDebug(k, v, vb))\n\t\t\tisSame = false\n\t\t\tcontinue\n\t\t}\n\t\tswitch v.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tnextSkip := skip\n\t\t\tfor _, s := range skip {\n\t\t\t\tif strings.Contains(s, \":\") {\n\t\t\t\t\ttmp := strings.Split(s, \":\")\n\t\t\t\t\tif tmp[0] == k {\n\t\t\t\t\t\tnextSkip = append(nextSkip, strings.Join(tmp[1:], \":\"))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tsubmiss, subleft, subdiff, ok := CompareJSON(v.(map[string]interface{}),\n\t\t\t\tvb.(map[string]interface{}), nextSkip)\n\t\t\tmissKeys = append(missKeys, addPrefix(submiss, k)...)\n\t\t\tleftKeys = append(leftKeys, addPrefix(subleft, k)...)\n\t\t\tdiffKeys = append(diffKeys, addPrefix(subdiff, k)...)\n\t\t\tif !ok {\n\t\t\t\tisSame = false\n\t\t\t}\n\t\tcase []interface{}:\n\t\t\ttmpa := v.([]interface{})\n\t\t\ttmpb := vb.([]interface{})\n\t\t\tif len(tmpa) != len(tmpb) {\n\t\t\t\tdiffKeys = append(diffKeys, diffDebug(k, v, vb))\n\t\t\t\tisSame = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tm := make(map[interface{}]bool)\n\t\t\tfor i := 0; i < len(tmpb); i++ {\n\t\t\t\tm[tmpb[i]] = true\n\t\t\t}\n\n\t\t\tfor i := 0; i < len(tmpa); i++ {\n\t\t\t\tif _, ok := m[tmpa[i]]; !ok {\n\t\t\t\t\tdiffKeys = append(diffKeys, diffDebug(k, v, vb))\n\t\t\t\t\tisSame = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tif !reflect.DeepEqual(v, vb) {\n\t\t\t\tdiffKeys = append(diffKeys, diffDebug(k, v, vb))\n\t\t\t\tisSame = false\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(b) > 0 {\n\t\tfor k := range b {\n\t\t\tleftKeys = append(leftKeys, k)\n\t\t}\n\t}\n\n\treturn missKeys, leftKeys, diffKeys, isSame\n}", "func EqualContainers(expected corev1.Container, found corev1.Container) bool {\n\tlogger := log.WithValues(\"func\", \"EqualContainers\")\n\tif !reflect.DeepEqual(found.Name, expected.Name) {\n\t\tlogger.Info(\"Container name not equal\", \"Found\", found.Name, \"Expected\", expected.Name)\n\t\treturn false\n\t}\n\tif !reflect.DeepEqual(found.Image, expected.Image) {\n\t\tlogger.Info(\"Image not equal\", \"Found\", found.Image, \"Expected\", expected.Image)\n\t\treturn false\n\t}\n\tif !reflect.DeepEqual(found.ImagePullPolicy, expected.ImagePullPolicy) {\n\t\tlogger.Info(\"ImagePullPolicy not equal\", \"Found\", found.ImagePullPolicy, \"Expected\", expected.ImagePullPolicy)\n\t\treturn false\n\t}\n\tif !reflect.DeepEqual(found.VolumeMounts, expected.VolumeMounts) {\n\t\tlogger.Info(\"VolumeMounts not equal\", \"Found\", found.VolumeMounts, \"Expected\", expected.VolumeMounts)\n\t\treturn false\n\t}\n\tif !reflect.DeepEqual(found.SecurityContext, expected.SecurityContext) {\n\t\tlogger.Info(\"SecurityContext not equal\", \"Found\", found.SecurityContext, \"Expected\", expected.SecurityContext)\n\t\treturn false\n\t}\n\tif !equalResources(found.Resources, expected.Resources) {\n\t\tlogger.Info(\"Resources not equal\", \"Found\", found.Resources, \"Expected\", expected.Resources)\n\t\treturn false\n\t}\n\treturn true\n}", "func newResourceDelta(\n\ta *resource,\n\tb *resource,\n) *ackcompare.Delta {\n\tdelta := ackcompare.NewDelta()\n\tif (a == nil && b != nil) ||\n\t\t(a != nil && b == nil) {\n\t\tdelta.Add(\"\", a, b)\n\t\treturn delta\n\t}\n\tcustomSetDefaults(a, b)\n\n\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig, b.ko.Spec.HyperParameterTuningJobConfig) {\n\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig\", a.ko.Spec.HyperParameterTuningJobConfig, b.ko.Spec.HyperParameterTuningJobConfig)\n\t} else if a.ko.Spec.HyperParameterTuningJobConfig != nil && b.ko.Spec.HyperParameterTuningJobConfig != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective, b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective) {\n\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective\", a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective, b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective)\n\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective != nil && b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName, b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName) {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName\", a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName, b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName)\n\t\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName != nil && b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName != nil {\n\t\t\t\tif *a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName != *b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName {\n\t\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName\", a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName, b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.MetricName)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type, b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type) {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type\", a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type, b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type)\n\t\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type != nil && b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type != nil {\n\t\t\t\tif *a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type != *b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type {\n\t\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type\", a.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type, b.ko.Spec.HyperParameterTuningJobConfig.HyperParameterTuningJobObjective.Type)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges, b.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges) {\n\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.ParameterRanges\", a.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges, b.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges)\n\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges != nil && b.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges != nil {\n\t\t\tif !reflect.DeepEqual(a.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.CategoricalParameterRanges, b.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.CategoricalParameterRanges) {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.ParameterRanges.CategoricalParameterRanges\", a.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.CategoricalParameterRanges, b.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.CategoricalParameterRanges)\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(a.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.ContinuousParameterRanges, b.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.ContinuousParameterRanges) {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.ParameterRanges.ContinuousParameterRanges\", a.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.ContinuousParameterRanges, b.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.ContinuousParameterRanges)\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(a.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.IntegerParameterRanges, b.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.IntegerParameterRanges) {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.ParameterRanges.IntegerParameterRanges\", a.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.IntegerParameterRanges, b.ko.Spec.HyperParameterTuningJobConfig.ParameterRanges.IntegerParameterRanges)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits, b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits) {\n\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.ResourceLimits\", a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits, b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits)\n\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits != nil && b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs, b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs) {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs\", a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs, b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs)\n\t\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs != nil && b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs != nil {\n\t\t\t\tif *a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs != *b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs {\n\t\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs\", a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs, b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxNumberOfTrainingJobs)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs, b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs) {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs\", a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs, b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs)\n\t\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs != nil && b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs != nil {\n\t\t\t\tif *a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs != *b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs {\n\t\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs\", a.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs, b.ko.Spec.HyperParameterTuningJobConfig.ResourceLimits.MaxParallelTrainingJobs)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.Strategy, b.ko.Spec.HyperParameterTuningJobConfig.Strategy) {\n\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.Strategy\", a.ko.Spec.HyperParameterTuningJobConfig.Strategy, b.ko.Spec.HyperParameterTuningJobConfig.Strategy)\n\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.Strategy != nil && b.ko.Spec.HyperParameterTuningJobConfig.Strategy != nil {\n\t\t\tif *a.ko.Spec.HyperParameterTuningJobConfig.Strategy != *b.ko.Spec.HyperParameterTuningJobConfig.Strategy {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.Strategy\", a.ko.Spec.HyperParameterTuningJobConfig.Strategy, b.ko.Spec.HyperParameterTuningJobConfig.Strategy)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType, b.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType) {\n\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType\", a.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType, b.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType)\n\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType != nil && b.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType != nil {\n\t\t\tif *a.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType != *b.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType\", a.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType, b.ko.Spec.HyperParameterTuningJobConfig.TrainingJobEarlyStoppingType)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria, b.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria) {\n\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria\", a.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria, b.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria)\n\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria != nil && b.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue, b.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue) {\n\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue\", a.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue, b.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue)\n\t\t\t} else if a.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue != nil && b.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue != nil {\n\t\t\t\tif *a.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue != *b.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue {\n\t\t\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue\", a.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue, b.ko.Spec.HyperParameterTuningJobConfig.TuningJobCompletionCriteria.TargetObjectiveMetricValue)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.HyperParameterTuningJobName, b.ko.Spec.HyperParameterTuningJobName) {\n\t\tdelta.Add(\"Spec.HyperParameterTuningJobName\", a.ko.Spec.HyperParameterTuningJobName, b.ko.Spec.HyperParameterTuningJobName)\n\t} else if a.ko.Spec.HyperParameterTuningJobName != nil && b.ko.Spec.HyperParameterTuningJobName != nil {\n\t\tif *a.ko.Spec.HyperParameterTuningJobName != *b.ko.Spec.HyperParameterTuningJobName {\n\t\t\tdelta.Add(\"Spec.HyperParameterTuningJobName\", a.ko.Spec.HyperParameterTuningJobName, b.ko.Spec.HyperParameterTuningJobName)\n\t\t}\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition, b.ko.Spec.TrainingJobDefinition) {\n\t\tdelta.Add(\"Spec.TrainingJobDefinition\", a.ko.Spec.TrainingJobDefinition, b.ko.Spec.TrainingJobDefinition)\n\t} else if a.ko.Spec.TrainingJobDefinition != nil && b.ko.Spec.TrainingJobDefinition != nil {\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.AlgorithmSpecification\", a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification != nil && b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName\", a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName != nil && b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName != *b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName\", a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.AlgorithmName)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.MetricDefinitions, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.MetricDefinitions) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.AlgorithmSpecification.MetricDefinitions\", a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.MetricDefinitions, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.MetricDefinitions)\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage\", a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage != nil && b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage != *b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage\", a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingImage)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode\", a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode != nil && b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode != *b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode\", a.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode, b.ko.Spec.TrainingJobDefinition.AlgorithmSpecification.TrainingInputMode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.CheckpointConfig, b.ko.Spec.TrainingJobDefinition.CheckpointConfig) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.CheckpointConfig\", a.ko.Spec.TrainingJobDefinition.CheckpointConfig, b.ko.Spec.TrainingJobDefinition.CheckpointConfig)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.CheckpointConfig != nil && b.ko.Spec.TrainingJobDefinition.CheckpointConfig != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath, b.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.CheckpointConfig.LocalPath\", a.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath, b.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath != nil && b.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath != *b.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.CheckpointConfig.LocalPath\", a.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath, b.ko.Spec.TrainingJobDefinition.CheckpointConfig.LocalPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI, b.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.CheckpointConfig.S3URI\", a.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI, b.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI != nil && b.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI != *b.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.CheckpointConfig.S3URI\", a.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI, b.ko.Spec.TrainingJobDefinition.CheckpointConfig.S3URI)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.DefinitionName, b.ko.Spec.TrainingJobDefinition.DefinitionName) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.DefinitionName\", a.ko.Spec.TrainingJobDefinition.DefinitionName, b.ko.Spec.TrainingJobDefinition.DefinitionName)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.DefinitionName != nil && b.ko.Spec.TrainingJobDefinition.DefinitionName != nil {\n\t\t\tif *a.ko.Spec.TrainingJobDefinition.DefinitionName != *b.ko.Spec.TrainingJobDefinition.DefinitionName {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.DefinitionName\", a.ko.Spec.TrainingJobDefinition.DefinitionName, b.ko.Spec.TrainingJobDefinition.DefinitionName)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption, b.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption\", a.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption, b.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption != nil && b.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption != nil {\n\t\t\tif *a.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption != *b.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption\", a.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption, b.ko.Spec.TrainingJobDefinition.EnableInterContainerTrafficEncryption)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining, b.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.EnableManagedSpotTraining\", a.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining, b.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining != nil && b.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining != nil {\n\t\t\tif *a.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining != *b.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.EnableManagedSpotTraining\", a.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining, b.ko.Spec.TrainingJobDefinition.EnableManagedSpotTraining)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation, b.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.EnableNetworkIsolation\", a.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation, b.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation != nil && b.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation != nil {\n\t\t\tif *a.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation != *b.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.EnableNetworkIsolation\", a.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation, b.ko.Spec.TrainingJobDefinition.EnableNetworkIsolation)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.HyperParameterRanges, b.ko.Spec.TrainingJobDefinition.HyperParameterRanges) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.HyperParameterRanges\", a.ko.Spec.TrainingJobDefinition.HyperParameterRanges, b.ko.Spec.TrainingJobDefinition.HyperParameterRanges)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.HyperParameterRanges != nil && b.ko.Spec.TrainingJobDefinition.HyperParameterRanges != nil {\n\t\t\tif !reflect.DeepEqual(a.ko.Spec.TrainingJobDefinition.HyperParameterRanges.CategoricalParameterRanges, b.ko.Spec.TrainingJobDefinition.HyperParameterRanges.CategoricalParameterRanges) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.HyperParameterRanges.CategoricalParameterRanges\", a.ko.Spec.TrainingJobDefinition.HyperParameterRanges.CategoricalParameterRanges, b.ko.Spec.TrainingJobDefinition.HyperParameterRanges.CategoricalParameterRanges)\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(a.ko.Spec.TrainingJobDefinition.HyperParameterRanges.ContinuousParameterRanges, b.ko.Spec.TrainingJobDefinition.HyperParameterRanges.ContinuousParameterRanges) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.HyperParameterRanges.ContinuousParameterRanges\", a.ko.Spec.TrainingJobDefinition.HyperParameterRanges.ContinuousParameterRanges, b.ko.Spec.TrainingJobDefinition.HyperParameterRanges.ContinuousParameterRanges)\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(a.ko.Spec.TrainingJobDefinition.HyperParameterRanges.IntegerParameterRanges, b.ko.Spec.TrainingJobDefinition.HyperParameterRanges.IntegerParameterRanges) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.HyperParameterRanges.IntegerParameterRanges\", a.ko.Spec.TrainingJobDefinition.HyperParameterRanges.IntegerParameterRanges, b.ko.Spec.TrainingJobDefinition.HyperParameterRanges.IntegerParameterRanges)\n\t\t\t}\n\t\t}\n\t\tif !reflect.DeepEqual(a.ko.Spec.TrainingJobDefinition.InputDataConfig, b.ko.Spec.TrainingJobDefinition.InputDataConfig) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.InputDataConfig\", a.ko.Spec.TrainingJobDefinition.InputDataConfig, b.ko.Spec.TrainingJobDefinition.InputDataConfig)\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.OutputDataConfig, b.ko.Spec.TrainingJobDefinition.OutputDataConfig) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.OutputDataConfig\", a.ko.Spec.TrainingJobDefinition.OutputDataConfig, b.ko.Spec.TrainingJobDefinition.OutputDataConfig)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.OutputDataConfig != nil && b.ko.Spec.TrainingJobDefinition.OutputDataConfig != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID, b.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID\", a.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID, b.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID != nil && b.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID != *b.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID\", a.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID, b.ko.Spec.TrainingJobDefinition.OutputDataConfig.KMSKeyID)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath, b.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath\", a.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath, b.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath != nil && b.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath != *b.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath\", a.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath, b.ko.Spec.TrainingJobDefinition.OutputDataConfig.S3OutputPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.ResourceConfig, b.ko.Spec.TrainingJobDefinition.ResourceConfig) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.ResourceConfig\", a.ko.Spec.TrainingJobDefinition.ResourceConfig, b.ko.Spec.TrainingJobDefinition.ResourceConfig)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.ResourceConfig != nil && b.ko.Spec.TrainingJobDefinition.ResourceConfig != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount, b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.ResourceConfig.InstanceCount\", a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount, b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount != nil && b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount != *b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.ResourceConfig.InstanceCount\", a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount, b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceCount)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType, b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.ResourceConfig.InstanceType\", a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType, b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType != nil && b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType != *b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.ResourceConfig.InstanceType\", a.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType, b.ko.Spec.TrainingJobDefinition.ResourceConfig.InstanceType)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID, b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID\", a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID, b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID != nil && b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID != *b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID\", a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID, b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeKMSKeyID)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB, b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB\", a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB, b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB != nil && b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB != *b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB\", a.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB, b.ko.Spec.TrainingJobDefinition.ResourceConfig.VolumeSizeInGB)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.RoleARN, b.ko.Spec.TrainingJobDefinition.RoleARN) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.RoleARN\", a.ko.Spec.TrainingJobDefinition.RoleARN, b.ko.Spec.TrainingJobDefinition.RoleARN)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.RoleARN != nil && b.ko.Spec.TrainingJobDefinition.RoleARN != nil {\n\t\t\tif *a.ko.Spec.TrainingJobDefinition.RoleARN != *b.ko.Spec.TrainingJobDefinition.RoleARN {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.RoleARN\", a.ko.Spec.TrainingJobDefinition.RoleARN, b.ko.Spec.TrainingJobDefinition.RoleARN)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.StaticHyperParameters, b.ko.Spec.TrainingJobDefinition.StaticHyperParameters) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.StaticHyperParameters\", a.ko.Spec.TrainingJobDefinition.StaticHyperParameters, b.ko.Spec.TrainingJobDefinition.StaticHyperParameters)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.StaticHyperParameters != nil && b.ko.Spec.TrainingJobDefinition.StaticHyperParameters != nil {\n\t\t\tif !ackcompare.MapStringStringPEqual(a.ko.Spec.TrainingJobDefinition.StaticHyperParameters, b.ko.Spec.TrainingJobDefinition.StaticHyperParameters) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.StaticHyperParameters\", a.ko.Spec.TrainingJobDefinition.StaticHyperParameters, b.ko.Spec.TrainingJobDefinition.StaticHyperParameters)\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.StoppingCondition, b.ko.Spec.TrainingJobDefinition.StoppingCondition) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.StoppingCondition\", a.ko.Spec.TrainingJobDefinition.StoppingCondition, b.ko.Spec.TrainingJobDefinition.StoppingCondition)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.StoppingCondition != nil && b.ko.Spec.TrainingJobDefinition.StoppingCondition != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds, b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds\", a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds, b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds != nil && b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds != *b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds\", a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds, b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxRuntimeInSeconds)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds, b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds\", a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds, b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds != nil && b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds != *b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds\", a.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds, b.ko.Spec.TrainingJobDefinition.StoppingCondition.MaxWaitTimeInSeconds)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.TuningObjective, b.ko.Spec.TrainingJobDefinition.TuningObjective) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.TuningObjective\", a.ko.Spec.TrainingJobDefinition.TuningObjective, b.ko.Spec.TrainingJobDefinition.TuningObjective)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.TuningObjective != nil && b.ko.Spec.TrainingJobDefinition.TuningObjective != nil {\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName, b.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.TuningObjective.MetricName\", a.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName, b.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName != nil && b.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName != *b.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.TuningObjective.MetricName\", a.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName, b.ko.Spec.TrainingJobDefinition.TuningObjective.MetricName)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.TuningObjective.Type, b.ko.Spec.TrainingJobDefinition.TuningObjective.Type) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.TuningObjective.Type\", a.ko.Spec.TrainingJobDefinition.TuningObjective.Type, b.ko.Spec.TrainingJobDefinition.TuningObjective.Type)\n\t\t\t} else if a.ko.Spec.TrainingJobDefinition.TuningObjective.Type != nil && b.ko.Spec.TrainingJobDefinition.TuningObjective.Type != nil {\n\t\t\t\tif *a.ko.Spec.TrainingJobDefinition.TuningObjective.Type != *b.ko.Spec.TrainingJobDefinition.TuningObjective.Type {\n\t\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.TuningObjective.Type\", a.ko.Spec.TrainingJobDefinition.TuningObjective.Type, b.ko.Spec.TrainingJobDefinition.TuningObjective.Type)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.TrainingJobDefinition.VPCConfig, b.ko.Spec.TrainingJobDefinition.VPCConfig) {\n\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.VPCConfig\", a.ko.Spec.TrainingJobDefinition.VPCConfig, b.ko.Spec.TrainingJobDefinition.VPCConfig)\n\t\t} else if a.ko.Spec.TrainingJobDefinition.VPCConfig != nil && b.ko.Spec.TrainingJobDefinition.VPCConfig != nil {\n\t\t\tif !ackcompare.SliceStringPEqual(a.ko.Spec.TrainingJobDefinition.VPCConfig.SecurityGroupIDs, b.ko.Spec.TrainingJobDefinition.VPCConfig.SecurityGroupIDs) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.VPCConfig.SecurityGroupIDs\", a.ko.Spec.TrainingJobDefinition.VPCConfig.SecurityGroupIDs, b.ko.Spec.TrainingJobDefinition.VPCConfig.SecurityGroupIDs)\n\t\t\t}\n\t\t\tif !ackcompare.SliceStringPEqual(a.ko.Spec.TrainingJobDefinition.VPCConfig.Subnets, b.ko.Spec.TrainingJobDefinition.VPCConfig.Subnets) {\n\t\t\t\tdelta.Add(\"Spec.TrainingJobDefinition.VPCConfig.Subnets\", a.ko.Spec.TrainingJobDefinition.VPCConfig.Subnets, b.ko.Spec.TrainingJobDefinition.VPCConfig.Subnets)\n\t\t\t}\n\t\t}\n\t}\n\tif !reflect.DeepEqual(a.ko.Spec.TrainingJobDefinitions, b.ko.Spec.TrainingJobDefinitions) {\n\t\tdelta.Add(\"Spec.TrainingJobDefinitions\", a.ko.Spec.TrainingJobDefinitions, b.ko.Spec.TrainingJobDefinitions)\n\t}\n\tif ackcompare.HasNilDifference(a.ko.Spec.WarmStartConfig, b.ko.Spec.WarmStartConfig) {\n\t\tdelta.Add(\"Spec.WarmStartConfig\", a.ko.Spec.WarmStartConfig, b.ko.Spec.WarmStartConfig)\n\t} else if a.ko.Spec.WarmStartConfig != nil && b.ko.Spec.WarmStartConfig != nil {\n\t\tif !reflect.DeepEqual(a.ko.Spec.WarmStartConfig.ParentHyperParameterTuningJobs, b.ko.Spec.WarmStartConfig.ParentHyperParameterTuningJobs) {\n\t\t\tdelta.Add(\"Spec.WarmStartConfig.ParentHyperParameterTuningJobs\", a.ko.Spec.WarmStartConfig.ParentHyperParameterTuningJobs, b.ko.Spec.WarmStartConfig.ParentHyperParameterTuningJobs)\n\t\t}\n\t\tif ackcompare.HasNilDifference(a.ko.Spec.WarmStartConfig.WarmStartType, b.ko.Spec.WarmStartConfig.WarmStartType) {\n\t\t\tdelta.Add(\"Spec.WarmStartConfig.WarmStartType\", a.ko.Spec.WarmStartConfig.WarmStartType, b.ko.Spec.WarmStartConfig.WarmStartType)\n\t\t} else if a.ko.Spec.WarmStartConfig.WarmStartType != nil && b.ko.Spec.WarmStartConfig.WarmStartType != nil {\n\t\t\tif *a.ko.Spec.WarmStartConfig.WarmStartType != *b.ko.Spec.WarmStartConfig.WarmStartType {\n\t\t\t\tdelta.Add(\"Spec.WarmStartConfig.WarmStartType\", a.ko.Spec.WarmStartConfig.WarmStartType, b.ko.Spec.WarmStartConfig.WarmStartType)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn delta\n}", "func ArePodSpecDifferent(lhs, rhs v1.PodSpec, strictTolerations bool) bool {\n\tchanged := false\n\n\tif len(lhs.Containers) != len(rhs.Containers) {\n\t\tchanged = true\n\t}\n\n\t// check nodeselectors\n\tif !areSelectorsSame(lhs.NodeSelector, rhs.NodeSelector) {\n\t\tchanged = true\n\t}\n\n\t// strictTolerations are for when we compare from the deployments or statefulsets\n\t// if we are seeing if rolled out pods contain changes we don't want strictTolerations\n\t// since k8s may add additional tolerations to pods\n\tif strictTolerations {\n\t\t// check tolerations\n\t\tif !areTolerationsSame(lhs.Tolerations, rhs.Tolerations) {\n\t\t\tchanged = true\n\t\t}\n\t} else {\n\t\t// check tolerations\n\t\tif !containsSameTolerations(lhs.Tolerations, rhs.Tolerations) {\n\t\t\tchanged = true\n\t\t}\n\t}\n\n\t// check container fields\n\tfor _, lContainer := range lhs.Containers {\n\t\tfound := false\n\n\t\tfor _, rContainer := range rhs.Containers {\n\t\t\t// Only compare the images of containers with the same name\n\t\t\tif lContainer.Name != rContainer.Name {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfound = true\n\n\t\t\t// can't use reflect.DeepEqual here, due to k8s adding token mounts\n\t\t\t// check that rContainer is all found within lContainer and that they match by name\n\t\t\tif !containsSameVolumeMounts(lContainer.VolumeMounts, rContainer.VolumeMounts) {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif lContainer.Image != rContainer.Image {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif !comparators.EnvValueEqual(lContainer.Env, rContainer.Env) {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif !reflect.DeepEqual(lContainer.Args, rContainer.Args) {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif !reflect.DeepEqual(lContainer.Ports, rContainer.Ports) {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif different, _ := utils.CompareResources(lContainer.Resources, rContainer.Resources); different {\n\t\t\t\tchanged = true\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\tchanged = true\n\t\t}\n\t}\n\treturn changed\n}", "func TestCompareStrings(t *testing.T) {\n\tlt := CompareStrings(\"a\", \"b\")\n\teq := CompareStrings(\"b\", \"b\")\n\tgt := CompareStrings(\"b\", \"a\")\n\n\tif err := checkResult(lt, eq, gt); err != nil {\n\t\tt.Fatalf(\"%s\", err)\n\t}\n}", "func ValidateResources(resources *corev1.ResourceRequirements, defaults corev1.ResourceRequirements) {\n\t// check for nil maps\n\tif resources.Requests == nil {\n\t\tresources.Requests = make(corev1.ResourceList)\n\t}\n\tif resources.Limits == nil {\n\t\tresources.Limits = make(corev1.ResourceList)\n\t}\n\n\t// if not given, use default cpu requests\n\t_, ok := resources.Requests[corev1.ResourceCPU]\n\tif !ok {\n\t\tresources.Requests[corev1.ResourceCPU] = defaults.Requests[corev1.ResourceCPU]\n\t}\n\n\t// if not given, use default memory requests\n\t_, ok = resources.Requests[corev1.ResourceMemory]\n\tif !ok {\n\t\tresources.Requests[corev1.ResourceMemory] = defaults.Requests[corev1.ResourceMemory]\n\t}\n\n\t// if not given, use default cpu limits\n\t_, ok = resources.Limits[corev1.ResourceCPU]\n\tif !ok {\n\t\tresources.Limits[corev1.ResourceCPU] = defaults.Limits[corev1.ResourceCPU]\n\t}\n\n\t// if not given, use default memory limits\n\t_, ok = resources.Limits[corev1.ResourceMemory]\n\tif !ok {\n\t\tresources.Limits[corev1.ResourceMemory] = defaults.Limits[corev1.ResourceMemory]\n\t}\n}", "func compareConfigs(config1 Configuration.Config, config2 Configuration.Config, t *testing.T) {\n\tfor _, t1 := range config2.Tool {\n\t\tfor _, t2 := range config2.Tool {\n\t\t\tif( (t1.Name != t2.Name) ||\n\t\t\t\t(t1.Enabled != t2.Enabled) ||\n\t\t\t\t(t1.Path != t2.Path) ||\n\t\t\t\t(t1.Args != t2.Args)){\n\t\t\t\t\tt.Fail()\n\t\t\t}\n\t\t}\n\t}\n\tif(config1.RelativePath != config2.RelativePath){\n\t\tt.Fail()\n\t}\n}", "func (c *Comparator) ComparesAsJSON(compares map[string][]FilePath) string {\n\tjsonString, _ := json.MarshalIndent(compares, \"\", \" \")\n\n\treturn string(jsonString)\n}", "func (s *FlowerSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\t// TODO\n\tswitch expected.Obj.(type) {\n\tcase *resources.Secret:\n\t\t// Dont update a secret\n\t\treturn false\n\t}\n\treturn true\n}", "func getRequestedResources(container corev1.Container) (map[string]int64, error) {\n\tfor _, v := range container.Env {\n\t\tif strings.HasPrefix(v.Name, \"FPGA_REGION\") || strings.HasPrefix(v.Name, \"FPGA_AFU\") {\n\t\t\treturn nil, errors.Errorf(\"environment variable '%s' is not allowed\", v.Name)\n\t\t}\n\t}\n\n\t// Container may happen to have Requests, but not Limits. Check Requests first,\n\t// then in the next loop iterate over Limits.\n\tfor resourceName, resourceQuantity := range container.Resources.Requests {\n\t\trname := strings.ToLower(string(resourceName))\n\t\tif !strings.HasPrefix(rname, namespace) {\n\t\t\t// Skip non-FPGA resources in Requests.\n\t\t\tcontinue\n\t\t}\n\n\t\tif container.Resources.Limits[resourceName] != resourceQuantity {\n\t\t\treturn nil, errors.Errorf(\n\t\t\t\t\"'limits' and 'requests' for %q must be equal as extended resources cannot be overcommitted\",\n\t\t\t\trname)\n\t\t}\n\t}\n\n\tresources := make(map[string]int64)\n\tfor resourceName, resourceQuantity := range container.Resources.Limits {\n\t\trname := strings.ToLower(string(resourceName))\n\t\tif !strings.HasPrefix(rname, namespace) {\n\t\t\t// Skip non-FPGA resources in Limits.\n\t\t\tcontinue\n\t\t}\n\n\t\tif container.Resources.Requests[resourceName] != resourceQuantity {\n\t\t\treturn nil, errors.Errorf(\n\t\t\t\t\"'limits' and 'requests' for %q must be equal as extended resources cannot be overcommitted\",\n\t\t\t\trname)\n\t\t}\n\n\t\tquantity, ok := resourceQuantity.AsInt64()\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"resource quantity isn't of integral type for %q\", rname)\n\t\t}\n\n\t\tresources[rname] = quantity\n\t}\n\n\treturn resources, nil\n}", "func TestDiff_srcDestContentsDiffer(t *testing.T) {\n\ts := t.TempDir()\n\td := t.TempDir()\n\n\terr := os.Mkdir(filepath.Join(s, \"a1\"), 0700)\n\tassert.NoError(t, err)\n\terr = os.WriteFile(\n\t\tfilepath.Join(s, \"a1\", \"f.yaml\"), []byte(`a`), 0600)\n\tassert.NoError(t, err)\n\n\terr = os.Mkdir(filepath.Join(d, \"a1\"), 0700)\n\tassert.NoError(t, err)\n\terr = os.WriteFile(\n\t\tfilepath.Join(d, \"a1\", \"f.yaml\"), []byte(`b`), 0600)\n\tassert.NoError(t, err)\n\n\tdiff, err := Diff(s, d)\n\tassert.NoError(t, err)\n\tassert.ElementsMatch(t, diff.List(), []string{\n\t\tfmt.Sprintf(\"a1%sf.yaml\", string(filepath.Separator)),\n\t})\n}", "func RunJSONSerializationTestForResourceReference_ARM(subject ResourceReference_ARM) 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 ResourceReference_ARM\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 AssertJSONEqualsBytes(expected []byte, given []byte, t *testing.T) {\n\teq, err := jsonBytesEqual(expected, given)\n\n\tif err != nil {\n\t\tt.Fatalf(\"Internal compare failure:%s\", err)\n\t}\n\tif !eq {\n\n\t\tt.Fatalf(\"JSON differs:\\nExpected:\\n-----\\n%s\\n-----\\nGot :\\n-----\\n%s\\n-----\\n\", string(expected), string(given))\n\t}\n}", "func AssertJSONEquals(expected string, given string, t *testing.T) {\n\ta := []byte(expected)\n\tb := []byte(given)\n\tAssertJSONEqualsBytes(a, b, t)\n}", "func (o ValidatingAdmissionPolicyBindingSpecPatchOutput) MatchResources() MatchResourcesPatchPtrOutput {\n\treturn o.ApplyT(func(v ValidatingAdmissionPolicyBindingSpecPatch) *MatchResourcesPatch { return v.MatchResources }).(MatchResourcesPatchPtrOutput)\n}", "func (resource *ResourceType) Equals(other Type, override EqualityOverrides) bool {\n\tif resource == other {\n\t\t// Same reference\n\t\treturn true\n\t}\n\n\totherResource, ok := other.(*ResourceType)\n\tif !ok {\n\t\treturn false\n\t}\n\n\t// Do cheap tests earlier\n\tif resource.isStorageVersion != otherResource.isStorageVersion ||\n\t\tlen(resource.testcases) != len(otherResource.testcases) ||\n\t\tlen(resource.functions) != len(otherResource.functions) ||\n\t\t!TypeEquals(resource.spec, otherResource.spec, override) ||\n\t\t!TypeEquals(resource.status, otherResource.status, override) ||\n\t\tlen(resource.annotations) != len(otherResource.annotations) ||\n\t\tresource.scope != otherResource.scope ||\n\t\tresource.armType != otherResource.armType ||\n\t\t!TypeEquals(resource.apiVersionTypeName, otherResource.apiVersionTypeName) ||\n\t\t!resource.apiVersionEnumValue.Equals(&otherResource.apiVersionEnumValue) ||\n\t\t!resource.InterfaceImplementer.Equals(otherResource.InterfaceImplementer, override) {\n\t\treturn false\n\t}\n\n\t// Check same functions present\n\tfor name, fn := range otherResource.functions {\n\t\tourFn, ok := resource.functions[name]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\n\t\tif !ourFn.Equals(fn, override) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Check same test cases present\n\tfor name, testcase := range otherResource.testcases {\n\t\tourCase, ok := resource.testcases[name]\n\t\tif !ok {\n\t\t\t// Didn't find the func, not equal\n\t\t\treturn false\n\t\t}\n\n\t\tif !ourCase.Equals(testcase, override) {\n\t\t\t// Different testcase, even though same name; not-equal\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Check same annotations present in the same order\n\tfor i, ourAnnotation := range resource.annotations {\n\t\totherAnnotation := otherResource.annotations[i]\n\t\tif ourAnnotation != otherAnnotation {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func CompareTokens(expected, actual []*Token) (bool, error) {\n\tif len(expected) != len(actual) {\n\t\treturn false, fmt.Errorf(\"Different lengths. Expected %d, Got %d\", len(expected), len(actual))\n\t}\n\tfor i := range expected {\n\t\tif expected[i].Type != actual[i].Type {\n\t\t\treturn false, fmt.Errorf(\"Different token types at index %d. Expected %v, Got %v. Value: %v\",\n\t\t\t\ti, expected[i].Type, actual[i].Type, expected[i].Value)\n\t\t}\n\t\tif expected[i].Value != actual[i].Value {\n\t\t\treturn false, fmt.Errorf(\"Different token values at index %d. Expected %v, Got %v\",\n\t\t\t\ti, expected[i].Value, actual[i].Value)\n\t\t}\n\t}\n\treturn true, nil\n}", "func TestCompareStrings(t *testing.T) {\n\tstrings1 := []string{\"one\", \"two\", \"three\"}\n\tstrings2 := []string{\"one\", \"two\"}\n\tstrings3 := []string{\"one\", \"two\", \"THREE\"}\n\n\tif !compareStrings(strings1, strings1) {\n\t\tt.Error(\"Equal slices fail check!\")\n\t}\n\n\tif compareStrings(strings1, strings2) {\n\t\tt.Error(\"Different size slices are OK!\")\n\t}\n\n\tif compareStrings(strings1, strings3) {\n\t\tt.Error(\"Slice with different strings are OK!\")\n\t}\n}", "func compareDefaultIDSetMaps(x, y *DefaultIDSetMap) bool {\n\tif x == nil && y == nil {\n\t\treturn true\n\t}\n\n\tif x == nil || y == nil {\n\t\treturn false\n\t}\n\n\tm1 := toMap(x)\n\tm2 := toMap(y)\n\n\tif len(m1) != len(m2) {\n\t\treturn false\n\t}\n\n\tfor k, v := range m1 {\n\t\tif !compareIDSets(v, m2[k]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func TablesAreEqual(t1, t2 Table) bool {\n\tif len(t1) != len(t2) {\n\t\treturn false\n\t}\n\n\tfor i, s := range t1 {\n\t\tif !StacksAreEqual(s, t2[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func CompareDatasetRef(a, b *DatasetRef) error {\n\tif a == nil && b != nil || a != nil && b == nil {\n\t\treturn fmt.Errorf(\"nil mismatch: %v != %v\", a, b)\n\t}\n\tif a == nil && b == nil {\n\t\treturn nil\n\t}\n\tif a.Peername != b.Peername {\n\t\treturn fmt.Errorf(\"peername mismatch. %s != %s\", a.Name, b.Name)\n\t}\n\tif a.Name != b.Name {\n\t\treturn fmt.Errorf(\"name mismatch. %s != %s\", a.Name, b.Name)\n\t}\n\tif a.Path != b.Path {\n\t\treturn fmt.Errorf(\"path mismatch. %s != %s\", a.Path, b.Path)\n\t}\n\treturn nil\n}", "func TestBucketPolicyResourceMatch(t *testing.T) {\n\n\t// generates statement with given resource..\n\tgenerateStatement := func(resource string) policy.Statement {\n\t\tstatement := policy.Statement{}\n\t\tstatement.Resources = set.CreateStringSet([]string{resource}...)\n\t\treturn statement\n\t}\n\n\t// generates resource prefix.\n\tgenerateResource := func(bucketName, objectName string) string {\n\t\treturn bucketARNPrefix + bucketName + \"/\" + objectName\n\t}\n\n\ttestCases := []struct {\n\t\tresourceToMatch string\n\t\tstatement policy.Statement\n\t\texpectedResourceMatch bool\n\t}{\n\t\t// Test case 1-4.\n\t\t// Policy with resource ending with bucket/* allows access to all objects inside the given bucket.\n\t\t{generateResource(\"minio-bucket\", \"\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix, \"minio-bucket\"+\"/*\")), true},\n\t\t{generateResource(\"minio-bucket\", \"\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix, \"minio-bucket\"+\"/*\")), true},\n\t\t{generateResource(\"minio-bucket\", \"\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix, \"minio-bucket\"+\"/*\")), true},\n\t\t{generateResource(\"minio-bucket\", \"\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix, \"minio-bucket\"+\"/*\")), true},\n\t\t// Test case - 5.\n\t\t// Policy with resource ending with bucket/oo* should not allow access to bucket/output.txt.\n\t\t{generateResource(\"minio-bucket\", \"output.txt\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix, \"minio-bucket\"+\"/oo*\")), false},\n\t\t// Test case - 6.\n\t\t// Policy with resource ending with bucket/oo* should allow access to bucket/ootput.txt.\n\t\t{generateResource(\"minio-bucket\", \"ootput.txt\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix, \"minio-bucket\"+\"/oo*\")), true},\n\t\t// Test case - 7.\n\t\t// Policy with resource ending with bucket/oo* allows access to all sub-dirs starting with \"oo\" inside given bucket.\n\t\t{generateResource(\"minio-bucket\", \"oop-bucket/my-file\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix, \"minio-bucket\"+\"/oo*\")), true},\n\t\t// Test case - 8.\n\t\t{generateResource(\"minio-bucket\", \"Asia/India/1.pjg\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix, \"minio-bucket\"+\"/Asia/Japan/*\")), false},\n\t\t// Test case - 9.\n\t\t{generateResource(\"minio-bucket\", \"Asia/India/1.pjg\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix, \"minio-bucket\"+\"/Asia/Japan/*\")), false},\n\t\t// Test case - 10.\n\t\t// Proves that the name space is flat.\n\t\t{generateResource(\"minio-bucket\", \"Africa/Bihar/India/design_info.doc/Bihar\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix,\n\t\t\t\"minio-bucket\"+\"/*/India/*/Bihar\")), true},\n\t\t// Test case - 11.\n\t\t// Proves that the name space is flat.\n\t\t{generateResource(\"minio-bucket\", \"Asia/China/India/States/Bihar/output.txt\"), generateStatement(fmt.Sprintf(\"%s%s\", bucketARNPrefix,\n\t\t\t\"minio-bucket\"+\"/*/India/*/Bihar/*\")), true},\n\t}\n\tfor i, testCase := range testCases {\n\t\tactualResourceMatch := bucketPolicyResourceMatch(testCase.resourceToMatch, testCase.statement)\n\t\tif testCase.expectedResourceMatch != actualResourceMatch {\n\t\t\tt.Errorf(\"Test %d: Expected Resource match to be `%v`, but instead found it to be `%v`\", i+1, testCase.expectedResourceMatch, actualResourceMatch)\n\t\t}\n\t}\n}", "func CompareRegexJSON(expected string, actual string, topDir string) (string, error) {\n\n\tvar fActual, fExpected *os.File\n\tvar err error\n\tif fActual, err = writeTempFile(\"tmp_actual\", actual); err != nil {\n\t\treturn \"\", err\n\t}\n\tif fExpected, err = writeTempFile(\"tmp_expected\", expected); err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer func() {\n\t\t_ = os.Remove(fActual.Name())\n\t\t_ = os.Remove(fExpected.Name())\n\t}()\n\n\tscript := path.Join(topDir, diffExecutable)\n\tcompareCmd := exec.Command(\n\t\t\"python\",\n\t\tscript,\n\t\t\"--use_model\",\n\t\tfActual.Name(),\n\t\tfExpected.Name())\n\tdiffCmd := exec.Command(\n\t\t\"python\",\n\t\tscript,\n\t\t\"--diff\",\n\t\t\"--use_model\",\n\t\tfActual.Name(),\n\t\tfExpected.Name())\n\treturn runJSONDiff(compareCmd, diffCmd)\n}", "func compare(a []string, b []string) bool {\n\tif len(a) != len(b) { // if their length is not equal\n\t\treturn false // then they are obviously not the same\n\t}\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] { // if there is one element unequal\n\t\t\treturn false // then it is false\n\t\t}\n\t}\n\treturn true // otherwise true\n}", "func RunJSONSerializationTestForRequestUriMatchConditionParameters_ARM(subject RequestUriMatchConditionParameters_ARM) 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 RequestUriMatchConditionParameters_ARM\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}" ]
[ "0.64290345", "0.5865311", "0.58325607", "0.5697454", "0.54446197", "0.5403544", "0.5374727", "0.53742474", "0.53078616", "0.52964586", "0.52862316", "0.51846445", "0.51759404", "0.5174776", "0.51174635", "0.5074527", "0.50719815", "0.50290644", "0.5021602", "0.5009109", "0.4984351", "0.49673533", "0.4951663", "0.49247012", "0.49116075", "0.48933783", "0.48583674", "0.48566896", "0.4851615", "0.48136693", "0.4798348", "0.47883686", "0.4770763", "0.47585484", "0.47533947", "0.47496495", "0.4724863", "0.47245175", "0.4718809", "0.4707709", "0.47015542", "0.46861923", "0.46825275", "0.4641478", "0.46294597", "0.46259698", "0.46214232", "0.4619345", "0.46152043", "0.4594025", "0.45823094", "0.45621532", "0.45569864", "0.45544282", "0.4550648", "0.4537797", "0.4525119", "0.4512455", "0.44956303", "0.44807518", "0.44755837", "0.44755837", "0.447459", "0.4469794", "0.44597653", "0.44446808", "0.44412678", "0.44397366", "0.44346705", "0.4429205", "0.44279018", "0.4423948", "0.44208175", "0.44196934", "0.4417696", "0.4405454", "0.44027242", "0.439934", "0.43981555", "0.43967795", "0.43849435", "0.43665984", "0.43613273", "0.43564573", "0.43533754", "0.43516463", "0.43324196", "0.43316162", "0.43283725", "0.43276703", "0.43261275", "0.4324415", "0.43228087", "0.43096384", "0.42994088", "0.4295694", "0.42904356", "0.42877686", "0.42832467", "0.42704114" ]
0.84132695
0
CompareResourceList compares `expected` and `got` ResourceList respectively, and informs the caller if the two ResourceList are equal. Here `equal` means the same resources with the same quantities. Returns the different resource, the comparison result (same semantic as strings.Compare) and a boolean that reports if the resourceLists are consistent. The ResourceLists are consistent only if the represent the same resource set (all the resources listed in one are also present in the another; no ResourceList is a superset nor a subset of the other)
CompareResourceList сравнивает `expected` и `got` ResourceList соответственно, и информирует вызывающего, равны ли два ResourceList. Здесь `равно` означает одинаковые ресурсы с одинаковыми количествами. Возвращает отличающийся ресурс, результат сравнения (имеет тот же семантический смысл, что и strings.Compare) и булево значение, которое сообщает, являются ли ResourceLists согласованными. ResourceLists согласованы только в том случае, если они представляют одинаковый набор ресурсов (все ресурсы, указанные в одном, также присутствуют в другом; ни один ResourceList не является собственным подмножеством или надмножеством другого).
func CompareResourceList(expected, got corev1.ResourceList) (string, int, bool) { if len(got) != len(expected) { framework.Logf("-> expected=%v (len=%d) got=%v (len=%d)", expected, len(expected), got, len(got)) return "", 0, false } for expResName, expResQty := range expected { gotResQty, ok := got[expResName] if !ok { return string(expResName), 0, false } if cmp := gotResQty.Cmp(expResQty); cmp != 0 { framework.Logf("-> resource=%q cmp=%d expected=%v got=%v", expResName, cmp, expResQty, gotResQty) return string(expResName), cmp, true } } return "", 0, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestResourceListSorting(t *testing.T) {\n\tsortedResourceList := make([]string, len(resourceList))\n\tcopy(sortedResourceList, resourceList)\n\tsort.Strings(sortedResourceList)\n\tfor i := 0; i < len(resourceList); i++ {\n\t\tif resourceList[i] != sortedResourceList[i] {\n\t\t\tt.Errorf(\"Expected resourceList[%d] = \\\"%s\\\", resourceList is not correctly sorted.\", i, sortedResourceList[i])\n\t\t\tbreak\n\t\t}\n\t}\n}", "func CmpResourceList(a, b *v1.ResourceList) bool {\n\treturn a.Cpu().Cmp(*b.Cpu()) == 0 &&\n\t\ta.Memory().Cmp(*b.Memory()) == 0 &&\n\t\tb.Pods().Cmp(*b.Pods()) == 0 &&\n\t\tb.StorageEphemeral().Cmp(*b.StorageEphemeral()) == 0\n}", "func CompareResources(resA, resB types.Resource) int {\n\tequal := cmp.Equal(resA, resB,\n\t\tignoreProtoXXXFields(),\n\t\tcmpopts.IgnoreFields(types.Metadata{}, \"ID\"),\n\t\tcmpopts.IgnoreFields(types.DatabaseV3{}, \"Status\"),\n\t\tcmpopts.EquateEmpty(),\n\t)\n\tif equal {\n\t\treturn Equal\n\t}\n\treturn Different\n}", "func CompareAllocatableResources(expected, got map[string]corev1.ResourceList) (string, string, int, bool) {\n\tif len(got) != len(expected) {\n\t\tframework.Logf(\"-> expected=%v (len=%d) got=%v (len=%d)\", expected, len(expected), got, len(got))\n\t\treturn \"\", \"\", 0, false\n\t}\n\tfor expZoneName, expResList := range expected {\n\t\tgotResList, ok := got[expZoneName]\n\t\tif !ok {\n\t\t\treturn expZoneName, \"\", 0, false\n\t\t}\n\t\tif resName, cmp, ok := CompareResourceList(expResList, gotResList); !ok || cmp != 0 {\n\t\t\treturn expZoneName, resName, cmp, ok\n\t\t}\n\t}\n\treturn \"\", \"\", 0, true\n}", "func ResourcesEqual(a, b map[string]envoy.Resource) bool {\n\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\n\tfor name, resource := range a {\n\t\tif !proto.Equal(resource, b[name]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (r Resources) Equal(o Resources) bool {\n\tLog.Vomit.Printf(\"Comparing resources: %+ v ?= %+ v\", r, o)\n\tif len(r) != len(o) {\n\t\tLog.Vomit.Println(\"Lengths differ\")\n\t\treturn false\n\t}\n\n\tif r.Ports() != o.Ports() {\n\t\tLog.Vomit.Println(\"Ports differ\")\n\t\treturn false\n\t}\n\n\tif math.Abs(r.Cpus()-o.Cpus()) > 0.001 {\n\t\tLog.Vomit.Println(\"Cpus differ\")\n\t\treturn false\n\t}\n\n\tif math.Abs(r.Memory()-o.Memory()) > 0.001 {\n\t\tLog.Vomit.Println(\"Memory differ\")\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (p *Plan) CompareResultSets(regressDir string, expectedDir string, t *tap.T) {\n\tfor i, rs := range p.ResultSets {\n\t\ttestName := strings.TrimPrefix(rs.Filename, regressDir+\"/out/\")\n\t\texpectedFilename := filepath.Join(expectedDir,\n\t\t\tfilepath.Base(rs.Filename))\n\t\tdiff, err := DiffFiles(expectedFilename, rs.Filename, 3)\n\n\t\tif err != nil {\n\t\t\tt.Diagnostic(\n\t\t\t\tfmt.Sprintf(`Query File: '%s'\nBindings File: '%s'\nBindings Name: '%s'\nQuery Parameters: '%v'\nExpected Result File: '%s'\nActual Result File: '%s'\n\nFailed to compare results: %s`,\n\t\t\t\t\tp.Query.Path,\n\t\t\t\t\tp.Path,\n\t\t\t\t\tp.Names[i],\n\t\t\t\t\tp.Bindings[i],\n\t\t\t\t\texpectedFilename,\n\t\t\t\t\trs.Filename,\n\t\t\t\t\terr.Error()))\n\t\t}\n\n\t\tif diff != \"\" {\n\t\t\tt.Diagnostic(\n\t\t\t\tfmt.Sprintf(`Query File: '%s'\nBindings File: '%s'\nBindings Name: '%s'\nQuery Parameters: '%v'\nExpected Result File: '%s'\nActual Result File: '%s'\n\n%s`,\n\t\t\t\t\tp.Query.Path,\n\t\t\t\t\tp.Path,\n\t\t\t\t\tp.Names[i],\n\t\t\t\t\tp.Bindings[i],\n\t\t\t\t\texpectedFilename,\n\t\t\t\t\trs.Filename,\n\t\t\t\t\tdiff))\n\t\t}\n\t\tt.Ok(diff == \"\", testName)\n\t}\n}", "func (r *Resources) Equal(other *Resources) bool {\n\treturn equal(r.CPU, other.CPU) &&\n\t\tequal(r.MEMORY, other.MEMORY) &&\n\t\tequal(r.DISK, other.DISK) &&\n\t\tequal(r.GPU, other.GPU)\n}", "func validateResourceList(resourceList core.ResourceList, upperBound core.ResourceList, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\tfor resourceName, quantity := range resourceList {\n\t\tresPath := fldPath.Key(string(resourceName))\n\t\t// Validate resource name.\n\t\tallErrs = append(allErrs, validateResourceName(&resourceName, resPath)...)\n\t\t// Validate resource quantity.\n\t\tallErrs = append(allErrs, corevalidation.ValidateResourceQuantityValue(string(resourceName), quantity, resPath)...)\n\t\tif upperBound != nil {\n\t\t\t// Check that request <= limit.\n\t\t\tupperBoundQuantity, exists := upperBound[resourceName]\n\t\t\tif exists && quantity.Cmp(upperBoundQuantity) > 0 {\n\t\t\t\tallErrs = append(allErrs, field.Invalid(fldPath, quantity.String(),\n\t\t\t\t\t\"must be less than or equal to the upper bound\"))\n\t\t\t}\n\t\t}\n\t}\n\treturn allErrs\n}", "func ExpectedResourceListFor(expectedISCount int64) kapi.ResourceList {\n\treturn kapi.ResourceList{\n\t\timageapi.ResourceImageStreams: *resource.NewQuantity(expectedISCount, resource.DecimalSI),\n\t}\n}", "func testCheckDDCloudAddressListMatches(name string, expected compute.IPAddressList) resource.TestCheckFunc {\n\tname = ensureResourceTypePrefix(name, \"ddcloud_address_list\")\n\n\treturn func(state *terraform.State) error {\n\t\tres, ok := state.RootModule().Resources[name]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Not found: %s\", name)\n\t\t}\n\n\t\taddressListID := res.Primary.ID\n\n\t\tclient := testAccProvider.Meta().(*providerState).Client()\n\t\taddressList, err := client.GetIPAddressList(addressListID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"bad: Get address list: %s\", err)\n\t\t}\n\t\tif addressList == nil {\n\t\t\treturn fmt.Errorf(\"bad: address list not found with Id '%s'\", addressListID)\n\t\t}\n\n\t\tif addressList.Name != expected.Name {\n\t\t\treturn fmt.Errorf(\"bad: address list '%s' has name '%s' (expected '%s')\", addressListID, addressList.Name, expected.Name)\n\t\t}\n\n\t\tif addressList.Description != expected.Description {\n\t\t\treturn fmt.Errorf(\"bad: address list '%s' has description '%s' (expected '%s')\", addressListID, addressList.Description, expected.Description)\n\t\t}\n\n\t\tif len(addressList.Addresses) != len(expected.Addresses) {\n\t\t\treturn fmt.Errorf(\"bad: address list '%s' has %d addresses or address-ranges (expected '%d')\", addressListID, len(addressList.Addresses), len(expected.Addresses))\n\t\t}\n\n\t\terr = compareAddressListEntries(expected, *addressList)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(addressList.ChildLists) != len(expected.ChildLists) {\n\t\t\treturn fmt.Errorf(\"bad: address list '%s' has %d child lists (expected '%d')\", addressListID, len(addressList.ChildLists), len(expected.ChildLists))\n\t\t}\n\n\t\tfor index := range addressList.ChildLists {\n\t\t\texpectedChildListID := expected.ChildLists[index].ID\n\t\t\tactualChildListID := addressList.ChildLists[index].ID\n\n\t\t\tif actualChildListID != expectedChildListID {\n\t\t\t\treturn fmt.Errorf(\"bad: address list '%s' has child list at index %d with Id %s (expected '%s')\",\n\t\t\t\t\taddressListID, index, actualChildListID, expectedChildListID,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func assertEqualEndpointLists(t *testing.T, expected, actual []*Endpoint) {\n\texpectedSet := map[string]*Endpoint{}\n\tfor _, ep := range expected {\n\t\tuid, found := ep.getSingleValuedAttrs()[DestinationUID.AttrName()]\n\t\tif !found {\n\t\t\tt.Fatalf(\"expected ep found with no UID is an indication of bad test data: '%v'\", ep)\n\t\t}\n\t\texpectedSet[uid] = ep\n\t}\n\tactualSet := map[string]*Endpoint{}\n\tfor _, ep := range actual {\n\t\tuid, found := ep.getSingleValuedAttrs()[DestinationUID.AttrName()]\n\t\tif !found {\n\t\t\tt.Errorf(\"actual ep found with no UID '%s'\", epDebugInfo(ep))\n\t\t\tcontinue\n\t\t}\n\t\tactualSet[uid] = ep\n\t}\n\tfor uid, expectedEp := range expectedSet {\n\t\tactualEp, found := actualSet[uid]\n\t\tif !found {\n\t\t\tt.Errorf(\"expecting endpoint\\nShortForm: %s\\nLongForm : %s\\nfound none\", epDebugInfo(expectedEp), *expectedEp)\n\t\t\tcontinue\n\t\t}\n\t\tassertEqualEndpoints(t, expectedEp, actualEp)\n\t\tdelete(actualSet, uid)\n\t}\n\tfor _, ep := range actualSet {\n\t\tt.Errorf(\"unexpected endpoint found: %s\", epDebugInfo(ep))\n\t}\n\tif len(expected) != len(actual) {\n\t\tt.Errorf(\"expected endpoint count: %d do not tally with actual count: %d\", len(expected), len(actual))\n\t}\n}", "func CompareIPLists(a []string, b []string) bool {\n\tif len(a) != len(b) {\n\t\treturn true\n\t}\n\n\tsort.Strings(a)\n\tsort.Strings(b)\n\n\tif !reflect.DeepEqual(a, b) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *Compare) Compare() (map[string][]schema.GroupVersionResource, error) {\n\tpreferredSrcResourceList, err := collectPreferredResources(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsrcCRDResource, err := collectPreferredCRDResource(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdstResourceList, err := collectNamespacedResources(r.DstDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpreferredSrcResourceList, err = r.excludeCRDs(preferredSrcResourceList, srcCRDResource, r.SrcClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresourcesDiff := r.compareResources(preferredSrcResourceList, dstResourceList)\n\tincompatibleGVKs, err := convertToGVRList(resourcesDiff)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't report an incompatibleGVK if user settings will skip resource anyways\n\texcludedResources := toStringSlice(settings.ExcludedInitialResources.Union(toSet(r.Plan.Status.ExcludedResources)))\n\tfilteredGVKs := []schema.GroupVersionResource{}\n\tfor _, gvr := range incompatibleGVKs {\n\t\tskip := false\n\t\tfor _, resource := range excludedResources {\n\t\t\tif strings.EqualFold(gvr.Resource, resource) {\n\t\t\t\tskip = true\n\t\t\t}\n\t\t}\n\t\tif !skip {\n\t\t\tfilteredGVKs = append(filteredGVKs, gvr)\n\t\t}\n\t}\n\n\treturn r.collectIncompatibleMapping(filteredGVKs)\n}", "func maxResourceList(list, new corev1.ResourceList) {\n\tfor name, quantity := range new {\n\t\tif value, ok := list[name]; !ok {\n\t\t\tlist[name] = quantity.DeepCopy()\n\t\t\tcontinue\n\t\t} else {\n\t\t\tif quantity.Cmp(value) > 0 {\n\t\t\t\tlist[name] = quantity.DeepCopy()\n\t\t\t}\n\t\t}\n\t}\n}", "func testCheckDDCloudPortListMatches(name string, expected compute.PortList) resource.TestCheckFunc {\n\tname = ensureResourceTypePrefix(name, \"ddcloud_port_list\")\n\n\treturn func(state *terraform.State) error {\n\t\tres, ok := state.RootModule().Resources[name]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"not found: %s\", name)\n\t\t}\n\n\t\tportListID := res.Primary.ID\n\n\t\tclient := testAccProvider.Meta().(*providerState).Client()\n\t\tportList, err := client.GetPortList(portListID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"bad: get port list: %s\", err)\n\t\t}\n\t\tif portList == nil {\n\t\t\treturn fmt.Errorf(\"bad: port list not found with Id '%s'\", portListID)\n\t\t}\n\n\t\tif portList.Name != expected.Name {\n\t\t\treturn fmt.Errorf(\"bad: port list '%s' has name '%s' (expected '%s')\", portListID, portList.Name, expected.Name)\n\t\t}\n\n\t\tif portList.Description != expected.Description {\n\t\t\treturn fmt.Errorf(\"bad: port list '%s' has description '%s' (expected '%s')\", portListID, portList.Description, expected.Description)\n\t\t}\n\n\t\tif len(portList.Ports) != len(expected.Ports) {\n\t\t\treturn fmt.Errorf(\"bad: port list '%s' has %d ports or port ranges (expected '%d')\", portListID, len(portList.Ports), len(expected.Ports))\n\t\t}\n\n\t\terr = comparePortListEntries(expected, *portList)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(portList.ChildLists) != len(expected.ChildLists) {\n\t\t\treturn fmt.Errorf(\"bad: port list '%s' has %d child lists (expected '%d')\", portListID, len(portList.ChildLists), len(expected.ChildLists))\n\t\t}\n\n\t\tfor index := range portList.ChildLists {\n\t\t\texpectedChildListID := expected.ChildLists[index].ID\n\t\t\tactualChildListID := portList.ChildLists[index].ID\n\n\t\t\tif actualChildListID != expectedChildListID {\n\t\t\t\treturn fmt.Errorf(\"bad: port list '%s' has child list at index %d with Id %s (expected '%s')\",\n\t\t\t\t\tportListID, index, actualChildListID, expectedChildListID,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func maxResourceList(list, new v1.ResourceList) {\n\tfor name, quantity := range new {\n\t\tif value, ok := list[name]; !ok {\n\t\t\tlist[name] = quantity.DeepCopy()\n\t\t\tcontinue\n\t\t} else {\n\t\t\tif quantity.Cmp(value) > 0 {\n\t\t\t\tlist[name] = quantity.DeepCopy()\n\t\t\t}\n\t\t}\n\t}\n}", "func parseResourceRequirementsList(rsr *v1alpha1.ResourceSpecRequirements) (corev1.ResourceList, error) {\n\trl := corev1.ResourceList{}\n\n\tif rsr.Cpu != \"\" {\n\t\tcpu := rsr.Cpu\n\t\tif !strings.HasSuffix(cpu, \"m\") {\n\t\t\tcpuFloat64, err := strconv.ParseFloat(cpu, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcpu = fmt.Sprintf(\"%.1f\", cpuFloat64)\n\t\t}\n\t\tcpuQuantity, err := resource.ParseQuantity(cpu)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trl[corev1.ResourceCPU] = cpuQuantity\n\t}\n\n\tif rsr.Memory != \"\" {\n\t\tmemoryQuantity, err := resource.ParseQuantity(rsr.Memory)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trl[corev1.ResourceMemory] = memoryQuantity\n\t}\n\n\tif rsr.Storage != \"\" {\n\t\tstorageQuantity, err := resource.ParseQuantity(rsr.Storage)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trl[corev1.ResourceStorage] = storageQuantity\n\t}\n\n\treturn rl, nil\n}", "func (in *ResourceList) DeepCopy() *ResourceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceList) DeepCopy() *ResourceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func List[T comparable](t *testing.T, actuals []T, expecteds []T) {\n\tt.Helper()\n\tEqual(t, len(actuals), len(expecteds))\n\n\tfor i, actual := range actuals {\n\t\tEqual(t, actual, expecteds[i])\n\t}\n}", "func CmpResources(a, b *v1.ResourceRequirements) bool {\n\treturn CmpResourceList(&a.Limits, &b.Limits) && CmpResourceList(&a.Requests, &b.Requests)\n}", "func (v NetworkListResponse) Equal(o NetworkListResponse) bool {\n\treturn len(v.NetworkIdentifiers) == len(o.NetworkIdentifiers) &&\n\t\tnetworkIdentifierSliceEqual(v.NetworkIdentifiers, o.NetworkIdentifiers)\n}", "func (m *MockMetaDataMgmtService) ListResource() ([]*entity.ResourceType, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListResource\")\n\tret0, _ := ret[0].([]*entity.ResourceType)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func SortResources(resources []*metav1.APIResourceList) {\n\tsort.SliceStable(resources, func(i, j int) bool {\n\t\tleft := resources[i]\n\t\tleftGV, _ := schema.ParseGroupVersion(left.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif leftGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"greater\"\n\t\t\treturn false\n\t\t}\n\n\t\tright := resources[j]\n\t\trightGV, _ := schema.ParseGroupVersion(right.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif rightGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"less\"\n\t\t\treturn true\n\t\t}\n\n\t\treturn i < j\n\t})\n}", "func TestCompareStrings(t *testing.T) {\n\tstrings1 := []string{\"one\", \"two\", \"three\"}\n\tstrings2 := []string{\"one\", \"two\"}\n\tstrings3 := []string{\"one\", \"two\", \"THREE\"}\n\n\tif !compareStrings(strings1, strings1) {\n\t\tt.Error(\"Equal slices fail check!\")\n\t}\n\n\tif compareStrings(strings1, strings2) {\n\t\tt.Error(\"Different size slices are OK!\")\n\t}\n\n\tif compareStrings(strings1, strings3) {\n\t\tt.Error(\"Slice with different strings are OK!\")\n\t}\n}", "func (r *Compare) CompareCRDs() (map[string][]schema.GroupVersionResource, error) {\n\tsrcCRDResource, err := collectPreferredCRDResource(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdstCRDResourceList, err := collectCRDResources(r.DstDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcrdGVDiff := r.compareResources(srcCRDResource, dstCRDResourceList)\n\t// if len(crdGVDiff)>0, then CRD APIVersion is incompatible between src and dest\n\tif len(crdGVDiff) > 0 {\n\t\tsrcCRDs, err := collectPreferredResources(r.SrcDiscovery)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsrcCRDs, err = r.includeCRDsOnly(srcCRDs, srcCRDResource, r.SrcClient)\n\n\t\tdstCRDs, err := collectNamespacedResources(r.DstDiscovery)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdstCRDs, err = r.includeCRDsOnly(dstCRDs, dstCRDResourceList, r.DstClient)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcrdsDiff := r.compareResources(srcCRDs, dstCRDs)\n\t\tincompatibleGVKs, err := convertToGVRList(crdsDiff)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Don't report an incompatibleGVK if user settings will skip resource anyways\n\t\texcludedResources := toStringSlice(settings.ExcludedInitialResources.Union(toSet(r.Plan.Status.ExcludedResources)))\n\t\tfilteredGVKs := []schema.GroupVersionResource{}\n\t\tfor _, gvr := range incompatibleGVKs {\n\t\t\tskip := false\n\t\t\tfor _, resource := range excludedResources {\n\t\t\t\tif strings.EqualFold(gvr.Resource, resource) {\n\t\t\t\t\tskip = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !skip {\n\t\t\t\tfilteredGVKs = append(filteredGVKs, gvr)\n\t\t\t}\n\t\t}\n\n\t\treturn r.collectIncompatibleMapping(filteredGVKs)\n\t}\n\treturn nil, nil\n}", "func (in ResourceList) DeepCopy() ResourceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceList)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "func TestCompareStrings(t *testing.T) {\n\tlt := CompareStrings(\"a\", \"b\")\n\teq := CompareStrings(\"b\", \"b\")\n\tgt := CompareStrings(\"b\", \"a\")\n\n\tif err := checkResult(lt, eq, gt); err != nil {\n\t\tt.Fatalf(\"%s\", err)\n\t}\n}", "func (m *MockList) Equal(other List) bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Equal\", other)\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "func AssertEqualStringArray(expected []string, result []string) {\n\tAssertType(expected, result)\n\tif expected == nil && result == nil {\n\t\treturn\n\t}\n\tif len(expected) != len(result) {\n\t\tpanic(fmt.Sprintf(\"Error: [] Different count of items\\nExpected Value: %v\\nResult: %v\", expected, result))\n\t}\n\tfor expectedIdx := range expected {\n\t\telementExists := false\n\t\tfor resultIdx := range result {\n\t\t\tif result[resultIdx] == expected[expectedIdx] {\n\t\t\t\telementExists = true\n\t\t\t}\n\t\t}\n\t\tif !elementExists {\n\t\t\tpanic(fmt.Sprintf(\"Error: [] Item missing: %v.\\nExpected Value: %v\\nResult: %v\", expected[expectedIdx], expected, result))\n\t\t}\n\t}\n}", "func compareRequests(want []interface{}, got []interface{}) error {\n\tif len(got) != len(want) {\n\t\tvar gotMsg string\n\t\tfor _, r := range got {\n\t\t\tgotMsg += fmt.Sprintf(\"%v: %+v]\\n\", reflect.TypeOf(r), r)\n\t\t}\n\n\t\tvar wantMsg string\n\t\tfor _, r := range want {\n\t\t\twantMsg += fmt.Sprintf(\"%v: %+v]\\n\", reflect.TypeOf(r), r)\n\t\t}\n\n\t\treturn fmt.Errorf(\"got %d requests, want %d requests:\\ngot:\\n%s\\nwant:\\n%s\", len(got), len(want), gotMsg, wantMsg)\n\t}\n\n\tfor i, want := range want {\n\t\tif reflect.TypeOf(got[i]) != reflect.TypeOf(want) {\n\t\t\treturn fmt.Errorf(\"request %d: got %+v, want %+v\", i, reflect.TypeOf(got[i]), reflect.TypeOf(want))\n\t\t}\n\t}\n\treturn nil\n}", "func compareRes(a, b []byte) error {\n\tvar am, bm interface{}\n\tif err := json.Unmarshal(a, &am); err != nil {\n\t\treturn fmt.Errorf(\"%s: %v\", a, err)\n\t}\n\tif err := json.Unmarshal(b, &bm); err != nil {\n\t\treturn fmt.Errorf(\"%s: %v\", b, err)\n\t}\n\n\treturn cmp(am, bm)\n}", "func (m *MockMutableList) Equal(other List) bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Equal\", other)\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "func TestListEqual(t *T) {\n\t// Degenerate case\n\tl1, l2 := NewList(), NewList()\n\tassert.Equal(t, true, l1.Equal(l2))\n\tassert.Equal(t, true, l2.Equal(l1))\n\n\t// False with different sizes\n\tl1 = l1.Prepend(1)\n\tassert.Equal(t, false, l1.Equal(l2))\n\tassert.Equal(t, false, l2.Equal(l1))\n\n\t// False with same sizes\n\tl2 = l2.Prepend(2)\n\tassert.Equal(t, false, l1.Equal(l2))\n\tassert.Equal(t, false, l2.Equal(l1))\n\n\t// Now true\n\tl1 = l1.Prepend(2)\n\tl2 = l2.Append(1)\n\tassert.Equal(t, true, l1.Equal(l2))\n\tassert.Equal(t, true, l2.Equal(l1))\n\n\t// False with embedded list\n\tl1 = l1.Prepend(NewList(3))\n\tassert.Equal(t, false, l1.Equal(l2))\n\tassert.Equal(t, false, l2.Equal(l1))\n\n\t// True with embedded set\n\tl2 = l2.Prepend(NewList(3))\n\tassert.Equal(t, true, l1.Equal(l2))\n\tassert.Equal(t, true, l2.Equal(l1))\n}", "func ListEquals(a, b []string) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\tfor i := range a {\n\t\tif a[i] != b[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func TestRedpandaResourceRequirements(t *testing.T) {\n\ttype test struct {\n\t\tname string\n\t\tsetRequestsCPU resource.Quantity\n\t\tsetRequestsMem resource.Quantity\n\t\tsetRedpandaCPU resource.Quantity\n\t\tsetRedpandaMem resource.Quantity\n\t\texpectedRedpandaCPU resource.Quantity\n\t\texpectedRedpandaMem resource.Quantity\n\t}\n\tmakeResources := func(t test) v1alpha1.RedpandaResourceRequirements {\n\t\treturn v1alpha1.RedpandaResourceRequirements{\n\t\t\tResourceRequirements: corev1.ResourceRequirements{\n\t\t\t\tRequests: corev1.ResourceList{\n\t\t\t\t\tcorev1.ResourceMemory: t.setRequestsMem,\n\t\t\t\t\tcorev1.ResourceCPU: t.setRequestsCPU,\n\t\t\t\t},\n\t\t\t},\n\t\t\tRedpanda: corev1.ResourceList{\n\t\t\t\tcorev1.ResourceMemory: t.setRedpandaMem,\n\t\t\t\tcorev1.ResourceCPU: t.setRedpandaCPU,\n\t\t\t},\n\t\t}\n\t}\n\n\tt.Run(\"Memory\", func(t *testing.T) {\n\t\ttests := []test{\n\t\t\t{\n\t\t\t\tname: \"RedpandaMemory is set from requests.memory\",\n\t\t\t\tsetRequestsMem: resource.MustParse(\"3000Mi\"),\n\t\t\t\texpectedRedpandaMem: resource.MustParse(\"2700Mi\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaMemory is set from lower redpanda.memory\",\n\t\t\t\tsetRequestsMem: resource.MustParse(\"4000Mi\"),\n\t\t\t\tsetRedpandaMem: resource.MustParse(\"3000Mi\"),\n\t\t\t\texpectedRedpandaMem: resource.MustParse(\"3000Mi\"),\n\t\t\t},\n\t\t}\n\t\tfor _, tt := range tests {\n\t\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\t\trrr := makeResources(tt)\n\t\t\t\tassert.Equal(t, tt.expectedRedpandaMem.Value(), rrr.RedpandaMemory().Value())\n\t\t\t})\n\t\t}\n\t})\n\n\tt.Run(\"CPU\", func(t *testing.T) {\n\t\ttests := []test{\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is set from integer requests.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is set from milli requests.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1000m\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is rounded up from milli requests.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1001m\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is set from lower redpanda.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"2\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\tsetRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is set from higher redpanda.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\tsetRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is rounded up from milli redpanda.cpu\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"1\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"20Gi\"),\n\t\t\t\tsetRedpandaCPU: resource.MustParse(\"1001m\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU is limited by 2GiB/core\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"10\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"4Gi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"2\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU has a minimum if requests >0\",\n\t\t\t\tsetRequestsCPU: resource.MustParse(\"100m\"),\n\t\t\t\tsetRequestsMem: resource.MustParse(\"100Mi\"),\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"1\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"RedpandaCPU not set if no request\",\n\t\t\t\texpectedRedpandaCPU: resource.MustParse(\"0\"),\n\t\t\t},\n\t\t}\n\t\tfor _, tt := range tests {\n\t\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\t\trrr := makeResources(tt)\n\t\t\t\tassert.Equal(t, tt.expectedRedpandaCPU.Value(), rrr.RedpandaCPU().Value())\n\t\t\t})\n\t\t}\n\t})\n}", "func CompareStorageRequests(initial corev1.ResourceRequirements, updated corev1.ResourceRequirements) StorageComparison {\n\tinitialSize := initial.Requests.Storage()\n\tupdatedSize := updated.Requests.Storage()\n\tif initialSize.IsZero() || updatedSize.IsZero() {\n\t\treturn StorageComparison{}\n\t}\n\tswitch updatedSize.Cmp(*initialSize) {\n\tcase -1: // decrease\n\t\treturn StorageComparison{Decrease: true}\n\tcase 1: // increase\n\t\treturn StorageComparison{Increase: true}\n\tdefault: // same size\n\t\treturn StorageComparison{}\n\t}\n}", "func (s *StorageSuite) TestServersEquality(c *check.C) {\n\tservers := Servers{{\n\t\tAdvertiseIP: \"192.168.1.1\",\n\t\tHostname: \"node-1\",\n\t\tRole: \"worker\",\n\t}}\n\ttestCases := []struct {\n\t\tservers Servers\n\t\tresult bool\n\t\tcomment string\n\t}{\n\t\t{\n\t\t\tservers: Servers{{\n\t\t\t\tAdvertiseIP: \"192.168.1.1\",\n\t\t\t\tHostname: \"node-1\",\n\t\t\t\tRole: \"worker\",\n\t\t\t}},\n\t\t\tresult: true,\n\t\t\tcomment: \"Servers should be equal\",\n\t\t},\n\t\t{\n\t\t\tservers: Servers{\n\t\t\t\t{\n\t\t\t\t\tAdvertiseIP: \"192.168.1.1\",\n\t\t\t\t\tHostname: \"node-1\",\n\t\t\t\t\tRole: \"worker\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tAdvertiseIP: \"192.168.1.2\",\n\t\t\t\t\tHostname: \"node-2\",\n\t\t\t\t\tRole: \"worker\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresult: false,\n\t\t\tcomment: \"Servers should not be equal: different number of servers\",\n\t\t},\n\t\t{\n\t\t\tservers: Servers{{\n\t\t\t\tAdvertiseIP: \"192.168.1.2\",\n\t\t\t\tHostname: \"node-1\",\n\t\t\t\tRole: \"worker\",\n\t\t\t}},\n\t\t\tresult: false,\n\t\t\tcomment: \"Servers should not be equal: different IPs\",\n\t\t},\n\t\t{\n\t\t\tservers: Servers{{\n\t\t\t\tAdvertiseIP: \"192.168.1.1\",\n\t\t\t\tHostname: \"node-2\",\n\t\t\t\tRole: \"worker\",\n\t\t\t}},\n\t\t\tresult: false,\n\t\t\tcomment: \"Servers should not be equal: different hostnames\",\n\t\t},\n\t\t{\n\t\t\tservers: Servers{{\n\t\t\t\tAdvertiseIP: \"192.168.1.1\",\n\t\t\t\tHostname: \"node-1\",\n\t\t\t\tRole: \"db\",\n\t\t\t}},\n\t\t\tresult: false,\n\t\t\tcomment: \"Servers should not be equal: different roles\",\n\t\t},\n\t}\n\tfor _, tc := range testCases {\n\t\tc.Assert(servers.IsEqualTo(tc.servers), check.Equals, tc.result,\n\t\t\tcheck.Commentf(tc.comment))\n\t}\n}", "func (l *List) Equal(m *List) bool {\n\treturn reflect.DeepEqual(l.entries, m.entries)\n}", "func (s *RedisSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\tswitch expected.Obj.(type) {\n\tcase *resources.Secret:\n\t\t// Dont update a secret\n\t\treturn false\n\tcase *resources.Service:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t\texpected.Obj.(*resources.Service).Spec.ClusterIP = observed.Obj.(*resources.Service).Spec.ClusterIP\n\tcase *resources.PodDisruptionBudget:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t}\n\treturn true\n}", "func ValidateResources(resources *corev1.ResourceRequirements, defaults corev1.ResourceRequirements) {\n\t// check for nil maps\n\tif resources.Requests == nil {\n\t\tresources.Requests = make(corev1.ResourceList)\n\t}\n\tif resources.Limits == nil {\n\t\tresources.Limits = make(corev1.ResourceList)\n\t}\n\n\t// if not given, use default cpu requests\n\t_, ok := resources.Requests[corev1.ResourceCPU]\n\tif !ok {\n\t\tresources.Requests[corev1.ResourceCPU] = defaults.Requests[corev1.ResourceCPU]\n\t}\n\n\t// if not given, use default memory requests\n\t_, ok = resources.Requests[corev1.ResourceMemory]\n\tif !ok {\n\t\tresources.Requests[corev1.ResourceMemory] = defaults.Requests[corev1.ResourceMemory]\n\t}\n\n\t// if not given, use default cpu limits\n\t_, ok = resources.Limits[corev1.ResourceCPU]\n\tif !ok {\n\t\tresources.Limits[corev1.ResourceCPU] = defaults.Limits[corev1.ResourceCPU]\n\t}\n\n\t// if not given, use default memory limits\n\t_, ok = resources.Limits[corev1.ResourceMemory]\n\tif !ok {\n\t\tresources.Limits[corev1.ResourceMemory] = defaults.Limits[corev1.ResourceMemory]\n\t}\n}", "func Compare(expected, actual io.Reader) error {\n\texpScan := bufio.NewScanner(expected)\n\tactScan := bufio.NewScanner(actual)\n\n\tfor line := 1; ; line++ {\n\t\texp, hasExp := scanTrimRight(expScan)\n\t\tact, hasAct := scanTrimRight(actScan)\n\n\t\t// EOF at the same time\n\t\tif !hasExp && !hasAct {\n\t\t\treturn nil\n\t\t}\n\t\t// they are not equal\n\t\tif exp != act {\n\t\t\treturn newErr(line, exp, act)\n\t\t}\n\t\t// they are all exists and equal\n\t\tif hasExp && hasAct {\n\t\t\tcontinue\n\t\t}\n\t\t// verify all empty line lefts\n\t\tif err := verifyEOFSpace(\"actual\", actScan); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := verifyEOFSpace(\"expected\", expScan); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// at this point, they should all be same\n\t\treturn nil\n\t}\n}", "func (resource *ResourceType) Equals(other Type, override EqualityOverrides) bool {\n\tif resource == other {\n\t\t// Same reference\n\t\treturn true\n\t}\n\n\totherResource, ok := other.(*ResourceType)\n\tif !ok {\n\t\treturn false\n\t}\n\n\t// Do cheap tests earlier\n\tif resource.isStorageVersion != otherResource.isStorageVersion ||\n\t\tlen(resource.testcases) != len(otherResource.testcases) ||\n\t\tlen(resource.functions) != len(otherResource.functions) ||\n\t\t!TypeEquals(resource.spec, otherResource.spec, override) ||\n\t\t!TypeEquals(resource.status, otherResource.status, override) ||\n\t\tlen(resource.annotations) != len(otherResource.annotations) ||\n\t\tresource.scope != otherResource.scope ||\n\t\tresource.armType != otherResource.armType ||\n\t\t!TypeEquals(resource.apiVersionTypeName, otherResource.apiVersionTypeName) ||\n\t\t!resource.apiVersionEnumValue.Equals(&otherResource.apiVersionEnumValue) ||\n\t\t!resource.InterfaceImplementer.Equals(otherResource.InterfaceImplementer, override) {\n\t\treturn false\n\t}\n\n\t// Check same functions present\n\tfor name, fn := range otherResource.functions {\n\t\tourFn, ok := resource.functions[name]\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\n\t\tif !ourFn.Equals(fn, override) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Check same test cases present\n\tfor name, testcase := range otherResource.testcases {\n\t\tourCase, ok := resource.testcases[name]\n\t\tif !ok {\n\t\t\t// Didn't find the func, not equal\n\t\t\treturn false\n\t\t}\n\n\t\tif !ourCase.Equals(testcase, override) {\n\t\t\t// Different testcase, even though same name; not-equal\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Check same annotations present in the same order\n\tfor i, ourAnnotation := range resource.annotations {\n\t\totherAnnotation := otherResource.annotations[i]\n\t\tif ourAnnotation != otherAnnotation {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func isInRes(expected string, res []string) bool {\n\tfor j := 0; j < len(res); j++ {\n\t\tif res[j] == expected {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func TestListResources_DuplicateResourceFilterByLabel(t *testing.T) {\n\tt.Parallel()\n\tctx := context.Background()\n\n\tbackend, err := lite.NewWithConfig(ctx, lite.Config{\n\t\tPath: t.TempDir(),\n\t\tClock: clockwork.NewFakeClock(),\n\t})\n\trequire.NoError(t, err)\n\n\tpresence := NewPresenceService(backend)\n\n\t// Same resource name, but have different labels.\n\tnames := []string{\"a\", \"a\", \"a\", \"a\"}\n\tlabels := []map[string]string{\n\t\t{\"env\": \"prod\"},\n\t\t{\"env\": \"dev\"},\n\t\t{\"env\": \"qa\"},\n\t\t{\"env\": \"dev\"},\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\tkind string\n\t\tinsertResources func()\n\t\twantNames []string\n\t}{\n\t\t{\n\t\t\tname: \"KindDatabaseServer\",\n\t\t\tkind: types.KindDatabaseServer,\n\t\t\tinsertResources: func() {\n\t\t\t\tfor i := 0; i < len(names); i++ {\n\t\t\t\t\tdb, err := types.NewDatabaseServerV3(types.Metadata{\n\t\t\t\t\t\tName: fmt.Sprintf(\"name-%v\", i),\n\t\t\t\t\t}, types.DatabaseServerSpecV3{\n\t\t\t\t\t\tHostID: \"_\",\n\t\t\t\t\t\tHostname: \"_\",\n\t\t\t\t\t\tDatabase: &types.DatabaseV3{\n\t\t\t\t\t\t\tMetadata: types.Metadata{\n\t\t\t\t\t\t\t\tName: names[i],\n\t\t\t\t\t\t\t\tLabels: labels[i],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tSpec: types.DatabaseSpecV3{\n\t\t\t\t\t\t\t\tProtocol: \"_\",\n\t\t\t\t\t\t\t\tURI: \"_\",\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\trequire.NoError(t, err)\n\t\t\t\t\t_, err = presence.UpsertDatabaseServer(ctx, db)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"KindAppServer\",\n\t\t\tkind: types.KindAppServer,\n\t\t\tinsertResources: func() {\n\t\t\t\tfor i := 0; i < len(names); i++ {\n\t\t\t\t\tserver, err := types.NewAppServerV3(types.Metadata{\n\t\t\t\t\t\tName: fmt.Sprintf(\"name-%v\", i),\n\t\t\t\t\t}, types.AppServerSpecV3{\n\t\t\t\t\t\tHostID: \"_\",\n\t\t\t\t\t\tApp: &types.AppV3{\n\t\t\t\t\t\t\tMetadata: types.Metadata{\n\t\t\t\t\t\t\t\tName: names[i],\n\t\t\t\t\t\t\t\tLabels: labels[i],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tSpec: types.AppSpecV3{URI: \"_\"},\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\t_, err = presence.UpsertApplicationServer(ctx, server)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"KindKubernetesCluster\",\n\t\t\tkind: types.KindKubernetesCluster,\n\t\t\tinsertResources: func() {\n\t\t\t\tfor i := 0; i < len(names); i++ {\n\n\t\t\t\t\tkube, err := types.NewKubernetesClusterV3(\n\t\t\t\t\t\ttypes.Metadata{\n\t\t\t\t\t\t\tName: names[i],\n\t\t\t\t\t\t\tLabels: labels[i],\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttypes.KubernetesClusterSpecV3{},\n\t\t\t\t\t)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\tkubeServer, err := types.NewKubernetesServerV3FromCluster(\n\t\t\t\t\t\tkube,\n\t\t\t\t\t\tfmt.Sprintf(\"host-%v\", i),\n\t\t\t\t\t\tfmt.Sprintf(\"hostID-%v\", i),\n\t\t\t\t\t)\n\t\t\t\t\trequire.NoError(t, err)\n\t\t\t\t\t// Upsert server.\n\t\t\t\t\t_, err = presence.UpsertKubernetesServer(ctx, kubeServer)\n\t\t\t\t\trequire.NoError(t, err)\n\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\ttc.insertResources()\n\n\t\t\t// Look among the duplicated resource by label\n\t\t\tresp, err := presence.ListResources(ctx, proto.ListResourcesRequest{\n\t\t\t\tResourceType: tc.kind,\n\t\t\t\tNeedTotalCount: true,\n\t\t\t\tLimit: 5,\n\t\t\t\tSearchKeywords: []string{\"dev\"},\n\t\t\t})\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Len(t, resp.Resources, 1)\n\t\t\trequire.Equal(t, 1, resp.TotalCount)\n\t\t\trequire.Equal(t, map[string]string{\"env\": \"dev\"}, resp.Resources[0].GetAllLabels())\n\t\t})\n\t}\n}", "func (p *serviceEvaluator) MatchingResources(input []api.ResourceName) []api.ResourceName {\n\treturn quota.Intersection(input, serviceResources)\n}", "func (list *BlackWhiteList) Equal(newList *BlackWhiteList) bool {\n\tlist.m.RLock()\n\tif len(list.whitelist) != len(newList.whitelist) || len(list.Blacklist) != len(newList.Blacklist) {\n\t\tlist.m.RUnlock()\n\t\treturn false\n\t}\n\tfor i, iprange := range list.whitelist {\n\t\tif !iprange.Equal(newList.whitelist[i]) {\n\t\t\tlist.m.RUnlock()\n\t\t\treturn false\n\t\t}\n\t}\n\tfor i, iprange := range list.Blacklist {\n\t\tif !iprange.Equal(newList.Blacklist[i]) {\n\t\t\tlist.m.RUnlock()\n\t\t\treturn false\n\t\t}\n\t}\n\tlist.m.RUnlock()\n\treturn true\n}", "func Merge(resources ...v1.ResourceList) v1.ResourceList {\n\tresult := v1.ResourceList{}\n\tfor _, resourceList := range resources {\n\t\tfor resourceName, quantity := range resourceList {\n\t\t\tcurrent := result[resourceName]\n\t\t\tcurrent.Add(quantity)\n\t\t\tresult[resourceName] = current\n\t\t}\n\t}\n\treturn result\n}", "func ArePodSpecDifferent(lhs, rhs v1.PodSpec, strictTolerations bool) bool {\n\tchanged := false\n\n\tif len(lhs.Containers) != len(rhs.Containers) {\n\t\tchanged = true\n\t}\n\n\t// check nodeselectors\n\tif !areSelectorsSame(lhs.NodeSelector, rhs.NodeSelector) {\n\t\tchanged = true\n\t}\n\n\t// strictTolerations are for when we compare from the deployments or statefulsets\n\t// if we are seeing if rolled out pods contain changes we don't want strictTolerations\n\t// since k8s may add additional tolerations to pods\n\tif strictTolerations {\n\t\t// check tolerations\n\t\tif !areTolerationsSame(lhs.Tolerations, rhs.Tolerations) {\n\t\t\tchanged = true\n\t\t}\n\t} else {\n\t\t// check tolerations\n\t\tif !containsSameTolerations(lhs.Tolerations, rhs.Tolerations) {\n\t\t\tchanged = true\n\t\t}\n\t}\n\n\t// check container fields\n\tfor _, lContainer := range lhs.Containers {\n\t\tfound := false\n\n\t\tfor _, rContainer := range rhs.Containers {\n\t\t\t// Only compare the images of containers with the same name\n\t\t\tif lContainer.Name != rContainer.Name {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfound = true\n\n\t\t\t// can't use reflect.DeepEqual here, due to k8s adding token mounts\n\t\t\t// check that rContainer is all found within lContainer and that they match by name\n\t\t\tif !containsSameVolumeMounts(lContainer.VolumeMounts, rContainer.VolumeMounts) {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif lContainer.Image != rContainer.Image {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif !comparators.EnvValueEqual(lContainer.Env, rContainer.Env) {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif !reflect.DeepEqual(lContainer.Args, rContainer.Args) {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif !reflect.DeepEqual(lContainer.Ports, rContainer.Ports) {\n\t\t\t\tchanged = true\n\t\t\t}\n\n\t\t\tif different, _ := utils.CompareResources(lContainer.Resources, rContainer.Resources); different {\n\t\t\t\tchanged = true\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\tchanged = true\n\t\t}\n\t}\n\treturn changed\n}", "func PrintResourceList(resources interface{}, output string, single bool) error {\n\tkt := reflect.ValueOf(resources)\n\t// Sometimes, we want to marshal the first resource of a slice or array as single item\n\tif kt.Kind() == reflect.Slice || kt.Kind() == reflect.Array {\n\t\tif single && kt.Len() == 1 {\n\t\t\treturn PrintResource(kt.Index(0).Interface(), output)\n\t\t}\n\n\t\t// If we have a zero len list, prevent printing \"null\"\n\t\tif kt.Len() == 0 {\n\t\t\treturn PrintResource([]string{}, output)\n\t\t}\n\t}\n\n\tswitch output {\n\tcase \"json\":\n\t\tjsonBytes, err := json.MarshalIndent(resources, \"\", \" \")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to marshal resources to json: %w\", err)\n\t\t}\n\t\tfmt.Println(string(jsonBytes))\n\tcase \"yaml\":\n\t\tyamlBytes, err := yaml.Marshal(resources)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to marshal resources to yaml: %w\", err)\n\t\t}\n\t\tfmt.Print(string(yamlBytes))\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown output format: %s\", output)\n\t}\n\treturn nil\n}", "func (a *Client) ListResources(ctx context.Context, params *ListResourcesParams) (*ListResourcesOK, error) {\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listResources\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/approval_system/resource\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &ListResourcesReader{formats: a.formats},\n\t\tAuthInfo: a.authInfo,\n\t\tContext: ctx,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ListResourcesOK), nil\n\n}", "func (r Resource) Equal(other Resource) bool {\n\tswitch {\n\tcase r.ID != other.ID,\n\t\tr.Status != other.Status,\n\t\t!r.Since.Equal(other.Since):\n\t\treturn false\n\tdefault:\n\t\treturn true\n\t}\n}", "func resourceVersionsMatch(o1 interface{}, o2 interface{}) bool {\n\tr1, ok1 := o1.(metav1.Object)\n\tr2, ok2 := o2.(metav1.Object)\n\tif !ok1 || !ok2 {\n\t\tmsg := fmt.Sprintf(\"error decoding kube objects during update, o1 type: %v, o2 type: %v\",\n\t\t\treflect.TypeOf(o1),\n\t\t\treflect.TypeOf(o2))\n\t\tlog.Scope.Error(msg)\n\t\tstats.RecordEventError(msg)\n\t\treturn false\n\t}\n\treturn r1.GetResourceVersion() == r2.GetResourceVersion()\n}", "func TestListArrayResHumanReadable(t *testing.T) {\n\tvar command = \"LISTARRAY\"\n\tvar resJSON = `{\"command\":\"LISTARRAY\",\"rid\":\"fromCLI\",\n\t\"result\":{\"status\":{\"code\":0,\"description\":\"DONE\"},\n\t\"data\":{\"arrayList\": [{\"createDatetime\": \"2021-04-16 15:52:14 +0900\",\n\t\"devicelist\": [{\"name\": \"uram0\",\"type\": \"BUFFER\"},\n\t{\"name\": \"S4H2NE0M600736 \",\"type\": \"DATA\"},\n\t{\"name\": \"S4H2NE0M600745\",\"type\": \"DATA\"},\n\t{\"name\": \"S4H2NE0M600763 \",\"type\": \"DATA\"}],\n\t\"name\": \"ARRAY0\",\"status\":\"Mounted\",\"updateDatetime\": \"2021-04-16 15:52:14 +0900\"},\n\t{\"createDatetime\": \"2021-04-16 15:52:14 +0900\",\"devicelist\": [{\"name\": \"uram1\",\"type\": \"BUFFER\"},\n\t{\"name\": \"S4H2NE0M600744\",\"type\": \"DATA\"},{\"name\": \"S4H2NE0M600743 \",\"type\": \"DATA\"},\n\t{\"name\": \"S4H2NE0M600746 \",\"type\": \"DATA\"}],\"name\": \"ARRAY1\",\"status\":\"Unmounted\",\n\t\"updateDatetime\": \"2021-04-16 15:52:14 +0900\"}]}}}`\n\n\texpected := `Name: ARRAY0\n---------------------------\nDatetime Created: 2021-04-16 15:52:14 +0900\nDatetime Updated: 2021-04-16 15:52:14 +0900\nStatus: Mounted\n\nDevices\n-------------\nName: uram0\nType: BUFFER\n\nName: S4H2NE0M600736 \nType: DATA\n\nName: S4H2NE0M600745\nType: DATA\n\nName: S4H2NE0M600763 \nType: DATA\n\n\nName: ARRAY1\n---------------------------\nDatetime Created: 2021-04-16 15:52:14 +0900\nDatetime Updated: 2021-04-16 15:52:14 +0900\nStatus: Unmounted\n\nDevices\n-------------\nName: uram1\nType: BUFFER\n\nName: S4H2NE0M600744\nType: DATA\n\nName: S4H2NE0M600743 \nType: DATA\n\nName: S4H2NE0M600746 \nType: DATA`\n\n\t// mj: For testing, I temporarily redirect log output to buffer.\n\tvar buff bytes.Buffer\n\tlog.SetOutput(&buff)\n\tlog.SetFlags(0)\n\n\tdisplaymgr.PrintResponse(command, resJSON, false, false)\n\n\toutput := buff.String()\n\toutput = output[:len(output)-1] // Remove the last \\n from output string\n\n\tdist := testmgr.Levenshtein([]rune(expected), []rune(output))\n\n\t// TODO(mj): Two long texts can be different slightly.\n\t// dist > thresholdDist should be reivsed once we find a better way to test long texts.\n\tthresholdDist := 5\n\tif dist > thresholdDist {\n\t\tt.Errorf(\"Expected: %q Output: %q\", expected, output)\n\t}\n}", "func (list List) Equal(other List) bool {\n\tif other.Length() != list.Length() {\n\t\treturn false\n\t}\n\tfor idx, val := range list {\n\t\tif other[idx] != val {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func compareAuthSet(expected *model.AuthSet, actual *model.AuthSet, t *testing.T) {\n\tassert.Equal(t, expected.IdData, actual.IdData)\n\tassert.Equal(t, expected.PubKey, actual.PubKey)\n\tassert.Equal(t, expected.DeviceId, actual.DeviceId)\n\tassert.Equal(t, expected.IdDataStruct, actual.IdDataStruct)\n\tassert.Equal(t, expected.IdDataSha256, actual.IdDataSha256)\n\tassert.Equal(t, expected.Status, actual.Status)\n\tcompareTime(uto.Time(expected.Timestamp), uto.Time(actual.Timestamp), t)\n}", "func AssertEqualStringMap(expected map[string]string, result map[string]string) {\n\tAssertType(expected, result)\n\tif expected == nil && result == nil {\n\t\treturn\n\t}\n\tif len(expected) != len(result) {\n\t\tpanic(fmt.Sprintf(\"Error: [] Different count of items\\nExpected Value: %v\\nResult: %v\", expected, result))\n\t}\n\tfor expectedKey := range expected {\n\t\tif result[expectedKey] != expected[expectedKey] {\n\t\t\tpanic(fmt.Sprintf(\"Error: [] Item missing: %v.\\nExpected Value: %v\\nResult: %v\", expected[expectedKey], expected, result))\n\t\t}\n\t}\n}", "func LinkedListsAreEqual(list1, list2 btll.NodeList) bool {\n\tif list1.Length != list2.Length || (list1.Head.Data != list2.Head.Data || list1.Tail.Data != list2.Tail.Data) {\n\t\treturn false\n\t}\n\tfor list2.Head != nil || list1.Head != nil {\n\t\tif list1.Head.Data != list2.Head.Data || list1.Head.Freq != list2.Head.Freq {\n\t\t\treturn false\n\t\t}\n\t\tlist2.Head = list2.Head.Next\n\t\tlist1.Head = list1.Head.Next\n\t}\n\tif list1.Head == nil && list2.Head == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func ListResource(baseURLs []string, URI string) ([]string, error) {\n\tif strings.HasPrefix(URI, \"@\") {\n\t\tURI = string(URI[1:])\n\t}\n\tfor _, baseURL := range baseURLs {\n\t\tparent, matchingExpr := path.Split(URI)\n\t\tif parent != \"\" {\n\t\t\tbaseURL = toolbox.URLPathJoin(baseURL, parent)\n\t\t} else {\n\t\t\tmatchingExpr = URI\n\t\t}\n\t\tvar exprSuffix = \"\"\n\t\tif path.Ext(matchingExpr) == \"\" {\n\t\t\texprSuffix = \".+\"\n\t\t}\n\t\tregExprText := strings.Replace(matchingExpr, \"*\", \".+\", strings.Count(matchingExpr, \"*\"))\n\t\tregExprText = regExprText + exprSuffix\n\t\tif !strings.HasPrefix(regExprText, \".+\") {\n\t\t\tregExprText = \".+\" + regExprText\n\t\t}\n\t\tregExpression := regexp.MustCompile(regExprText)\n\t\tresource := url.NewResource(baseURL)\n\t\tstorageService, err := storage.NewServiceForURL(resource.URL, \"\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tobjects, err := storageService.List(resource.URL)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar result = make([]string, 0)\n\t\tfor _, candidate := range objects {\n\t\t\tif !candidate.IsContent() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif regExpression.MatchString(candidate.URL()) {\n\t\t\t\tresult = append(result, candidate.URL())\n\t\t\t}\n\t\t}\n\t\tif len(result) > 0 {\n\t\t\tsort.Strings(result)\n\t\t\treturn result, nil\n\t\t}\n\t}\n\treturn nil, nil\n}", "func (o *ObjectCountEvaluator) MatchingResources(input []api.ResourceName) []api.ResourceName {\n\treturn quota.Intersection(input, []api.ResourceName{o.ResourceName})\n}", "func (m *MockClientInterface) ListCustomResource(apiGroup, version, namespace, resourceKind string) (*operatorclient.CustomResourceList, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListCustomResource\", apiGroup, version, namespace, resourceKind)\n\tret0, _ := ret[0].(*operatorclient.CustomResourceList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (a *MemberAwaitility) WaitForExpectedNumberOfResources(kind string, expected int, list func() (int, error)) error {\n\terr := wait.Poll(a.RetryInterval, a.Timeout, func() (done bool, err error) {\n\t\tactual, err := list()\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif actual == expected {\n\t\t\ta.T.Logf(\"The number of %s resources matches\", kind)\n\t\t\treturn true, nil\n\t\t}\n\t\ta.T.Logf(\"Waiting for the expected number of %s resources. Actual: %d, Expected: %d\", kind, actual, expected)\n\t\treturn false, nil\n\t})\n\treturn err\n}", "func (m *MockDestinationRuleSet) List(filterResource ...func(*v1alpha3.DestinationRule) bool) []*v1alpha3.DestinationRule {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{}\n\tfor _, a := range filterResource {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"List\", varargs...)\n\tret0, _ := ret[0].([]*v1alpha3.DestinationRule)\n\treturn ret0\n}", "func Compare(t *testing.T, expected string, out string) {\n\tif out != expected {\n\t\tt.Error(Warn(`FAIL!`), \"\\n\\n\"+\n\t\t\t`Got: `+quoted(out)+\"\\n\"+\n\t\t\t`Expected: `+quoted(expected)+\"\\n\",\n\t\t)\n\t} else {\n\t\tt.Log(Okay(`PASS:`), quoted(strings.TrimSuffix(out, \"\\n\")))\n\t}\n}", "func diffRemediations(old, new []*compv1alpha1.ComplianceRemediation) bool {\n\tif old == nil {\n\t\treturn new == nil\n\t}\n\n\tif len(old) != len(new) {\n\t\treturn false\n\t}\n\n\tfor idx := range old {\n\t\toldRem, newRem := old[idx], new[idx]\n\t\tif oldRem.Spec.Current.Object.GetKind() != newRem.Spec.Current.Object.GetKind() {\n\t\t\treturn false\n\t\t}\n\n\t\t// should we be more picky and just compare what can be set with the remediations? e.g. OSImageURL can't\n\t\t// be set with a remediation..\n\t\tif !cmp.Equal(oldRem.Spec.Current.Object, newRem.Spec.Current.Object) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (m *MockKubernetesService) ListAssociatedResourcesForDeletion(clusterID string) (*do.KubernetesAssociatedResources, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListAssociatedResourcesForDeletion\", clusterID)\n\tret0, _ := ret[0].(*do.KubernetesAssociatedResources)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func TestEqual(t *testing.T) {\n\ttables := []struct {\n\t\tx []string\n\t\ty []string\n\t\texpected bool\n\t}{\n\t\t{[]string{}, []string{}, true},\n\t\t{[]string{}, []string{\"\"}, false},\n\t\t{[]string{\"\"}, []string{\"\"}, true},\n\t\t{[]string{\"\"}, []string{\"a\"}, false},\n\t\t{[]string{\"a\"}, []string{\"a\", \"a\"}, false},\n\t\t{[]string{\"b\"}, []string{\"a\"}, false},\n\t\t{[]string{\"\", \"\", \"\"}, []string{\"\", \"\", \"\"}, true},\n\t\t{[]string{\"a\", \"b\", \"c\"}, []string{\"a\", \"b\", \"e\"}, false},\n\t}\n\n\tfor _, table := range tables {\n\t\tresult := Equal(table.x, table.y)\n\t\tif result != table.expected {\n\t\t\tt.Errorf(\"Match failed for (%s, %s). Expected %t, got %t\",\n\t\t\t\ttable.x, table.y, table.expected, result)\n\t\t}\n\t}\n}", "func (ro *ResourceOperations) List(parameters *ResourceListParameters) (*ResourceListResult, *AzureOperationResponse, error) {\n\tsubscriptionId := getSubscriptionId(ro.c, nil)\n\n\tpath := \"/subscriptions/\" + url.QueryEscape(subscriptionId)\n\n\tif parameters != nil {\n\t\tif parameters.ResourceGroupName != \"\" {\n\t\t\tpath += \"/resourcegroups/\" + url.QueryEscape(parameters.ResourceGroupName)\n\t\t}\n\t}\n\n\tpath += \"/resources?api-version=\" + url.QueryEscape(ro.c.apiVersion)\n\n\tif parameters != nil {\n\t\tif parameters.Top != 0 {\n\t\t\tpath += \"&$top=\" + strconv.Itoa(parameters.Top)\n\t\t}\n\n\t\tfilter := \"\"\n\n\t\tif parameters.ResourceType != \"\" {\n\t\t\tfilter += url.QueryEscape(\"resourceType eq '\" + parameters.ResourceType + \"'\")\n\t\t}\n\n\t\tif parameters.TagValue != \"\" {\n\t\t\tif filter != \"\" {\n\t\t\t\tfilter += url.QueryEscape(\" and \")\n\t\t\t}\n\t\t\tfilter += url.QueryEscape(\"tagValue eq '\" + parameters.ResourceType + \"'\")\n\t\t}\n\n\t\tif filter != \"\" {\n\t\t\tpath += \"&filter=\" + filter\n\t\t}\n\t}\n\n\tvar result ResourceListResult\n\tazureOperationResponse, err := ro.c.DoGet(path, &result)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &result, azureOperationResponse, nil\n}", "func Compare[T any](t testing.TB, x, y T) bool {\n\treturn objectsAreEqual(x, y)\n}", "func (m *MockWasmDeploymentSet) List(filterResource ...func(*v1beta1.WasmDeployment) bool) []*v1beta1.WasmDeployment {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{}\n\tfor _, a := range filterResource {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"List\", varargs...)\n\tret0, _ := ret[0].([]*v1beta1.WasmDeployment)\n\treturn ret0\n}", "func (rm fakeRESTMapper) Equal(other fakeRESTMapper) bool {\n\treturn cmp.Equal(rm.defaultGroupVersions, other.defaultGroupVersions)\n}", "func TestAddResource(t *testing.T) {\n\ttestName := \"TestAddResource\"\n\tbeforeTest()\n\t// kinds to check for status\n\tvar kindsToCheckStatus = map[string]bool{\n\t\tAPPLICATION: true,\n\t\t\"Ingress\": true,\n\t\t\"Service\": true,\n\t\t\"Deployment\": true,\n\t\t\"StatefulSet\": true,\n\t\t\"NetworkPolicy\": true,\n\t\t//\t\t\"Kappnav\": true,\n\t}\n\n\t// resources to pre-populate\n\tvar files = []string{\n\t\t/* 0 */ KappnavConfigFile,\n\t\t/* 1 */ CrdApplication,\n\t\t/* 2 */ appBookinfo,\n\t\t/* 3 */ appProductpage,\n\t\t/* 4 */ appDetails,\n\t\t/* 5 */ appReviews,\n\t\t/* 6 */ deploymentDetailsV1,\n\t\t/* 7 */ deploymentProcuctpageV1,\n\t\t/* 8 */ deploymentReviewsV1,\n\t\t/* 9 */ deploymentReviewsV2,\n\t\t/* 10 */ serviceDetails,\n\t\t/* 11 */ serviceProductpage,\n\t\t/* 12 */ serviceReview,\n\t\t/* 13 */ networkpolicyProductpage,\n\t\t/* 14 */ ingressBookinfo,\n\t\t/* 15 */ networkpolicyReviews,\n\t\t//\t\t/* 16 */ kappnavCRFile,\n\t}\n\n\titeration0IDs, err := readResourceIDs(files)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t/* Iteration 0: all normal */\n\ttestActions := newTestActions(testName, kindsToCheckStatus)\n\tvar emptyIDs = []resourceID{}\n\ttestActions.addIteration(iteration0IDs, emptyIDs)\n\n\t// iteration 1: Add deploymentReviewsV3\n\t// /* 16 */deploymentReviewsV3,\n\tres, err := readOneResourceID(deploymentReviewsV3)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tarrayLength := len(iteration0IDs)\n\tvar iteration1IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration1IDs, iteration0IDs)\n\titeration1IDs = append(iteration1IDs, res)\n\titeration1IDs[2].expectedStatus = warning // bookfino warning\n\titeration1IDs[5].expectedStatus = warning // review app warning\n\titeration1IDs[16].expectedStatus = warning // new deployment starts with warning status\n\ttestActions.addIteration(iteration1IDs, emptyIDs)\n\n\t// iteration 2: stabilize the new deployment to Normal\n\tarrayLength = len(iteration1IDs)\n\tvar iteration2IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration2IDs, iteration1IDs)\n\titeration2IDs[2].expectedStatus = Normal // bookfino Normal\n\titeration2IDs[5].expectedStatus = Normal // review app Normal\n\titeration2IDs[16].expectedStatus = Normal // new deployment Normal\n\ttestActions.addIteration(iteration2IDs, emptyIDs)\n\n\t/* iteration 3: add a new app */\n\tvar newFiles = []string{\n\t\t/* 17 */ appRatings,\n\t\t/* 18 */ deploymentRatingsV1,\n\t\t/* 19 */ serviceRatings,\n\t}\n\tnewResources, err := readResourceIDs(newFiles)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tarrayLength = len(iteration2IDs)\n\tvar iteration3IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration3IDs, iteration2IDs)\n\tfor _, newRes := range newResources {\n\t\titeration3IDs = append(iteration3IDs, newRes)\n\t}\n\titeration3IDs[2].expectedStatus = warning // bookfino now warning due to ratings app\n\titeration3IDs[17].expectedStatus = warning // ratings app warning\n\titeration3IDs[18].expectedStatus = warning // ratings deployment warning\n\ttestActions.addIteration(iteration3IDs, emptyIDs)\n\n\t/* iteration 4: everything back to normal */\n\tarrayLength = len(iteration3IDs)\n\tvar iteration4IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration4IDs, iteration3IDs)\n\titeration4IDs[2].expectedStatus = Normal // bookfino app Normal\n\titeration4IDs[17].expectedStatus = Normal // ratings app Normal\n\titeration4IDs[18].expectedStatus = Normal // ratings deployment Normal\n\ttestActions.addIteration(iteration4IDs, emptyIDs)\n\n\t/* iteration 7: clean up */\n\ttestActions.addIteration(emptyIDs, emptyIDs)\n\n\tclusterWatcher, err := createClusterWatcher(iteration0IDs, testActions, StatusFailureRate)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer clusterWatcher.shutDown()\n\n\t// make all trasition of testAction\n\terr = testActions.transitionAll()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func getResourceList(cpu, memory string) v1.ResourceList {\n\tres := v1.ResourceList{}\n\tif cpu != \"\" {\n\t\tres[v1.ResourceCPU] = resource.MustParse(cpu)\n\t}\n\tif memory != \"\" {\n\t\tres[v1.ResourceMemory] = resource.MustParse(memory)\n\t}\n\treturn res\n}", "func TestRunDiff(t *testing.T) {\n\tcases := map[string]struct {\n\t\tcomparers compare.ComparerSet\n\t\tresourceChange []plan.ResourcePlan\n\t\tpreHook func()\n\t\texpected int\n\t\texpectedOutput []string\n\t}{\n\t\t\"create returns false with create resource\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer fail\"},\n\t\t},\n\t\t\"create returns true with create resource\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer ok\"},\n\t\t},\n\t\t\"no matching comparer\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tAddressReturns: \"address\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"\"},\n\t\t},\n\t\t\"no matching comparer with strict enabled\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tAddressReturns: \"address\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tpreHook: func() {\n\t\t\t\tstrict = true\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"?\", \"address (no matching comparer)\"},\n\t\t},\n\t\t\"create returns true with multiple resources\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address1\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address2\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer ok\\ncomparer ok\"},\n\t\t},\n\t\t\"fails if there is at least 1 failure\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t\tDestroyComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address1\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tDeleteReturns: true,\n\t\t\t\t\tAddressReturns: \"address2\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer fail\", \"comparer ok\"},\n\t\t},\n\t\t\"returns 1 if there is at least 1 failure and errorOnFail is set\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t\tDestroyComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address1\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tDeleteReturns: true,\n\t\t\t\t\tAddressReturns: \"address2\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tpreHook: func() {\n\t\t\t\terrorOnFail = true\n\t\t\t},\n\t\t\texpected: 1,\n\t\t\texpectedOutput: []string{\"comparer fail\", \"comparer ok\"},\n\t\t},\n\t\t\"only outputs failed with failedOnly\": {\n\t\t\tcomparers: compare.ComparerSet{\n\t\t\t\tCreateComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: false,\n\t\t\t\t\tDiffOutput: \"comparer fail\",\n\t\t\t\t},\n\t\t\t\tDestroyComparer: &comparefakes.FakeComparer{\n\t\t\t\t\tDiffReturns: true,\n\t\t\t\t\tDiffOutput: \"comparer ok\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tresourceChange: []plan.ResourcePlan{\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tCreateReturns: true,\n\t\t\t\t\tAddressReturns: \"address1\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t\t&planfakes.FakeResourcePlan{\n\t\t\t\t\tDeleteReturns: true,\n\t\t\t\t\tAddressReturns: \"address2\",\n\t\t\t\t\tNameReturns: \"name\",\n\t\t\t\t\tTypeReturns: \"type\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tpreHook: func() {\n\t\t\t\tfailedOnly = true\n\t\t\t},\n\t\t\texpected: 0,\n\t\t\texpectedOutput: []string{\"comparer fail\"},\n\t\t},\n\t\t// TODO: test case to ensure comparers are called correctly(matching type and number of calls)\n\t}\n\n\tfor name, tc := range cases {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\t// set default vars\n\t\t\terrorOnFail = false\n\t\t\tstrict = false\n\t\t\tfailedOnly = false\n\n\t\t\tif tc.preHook != nil {\n\t\t\t\ttc.preHook()\n\t\t\t}\n\n\t\t\tvar output bytes.Buffer\n\t\t\tif got := runDiff(&output, tc.resourceChange, tc.comparers); got != tc.expected {\n\t\t\t\tt.Errorf(\"Expected: %v but got %v\", tc.expected, got)\n\t\t\t}\n\n\t\t\tfor _, s := range tc.expectedOutput {\n\t\t\t\tif !strings.Contains(output.String(), s) {\n\t\t\t\t\tt.Errorf(\"Result string did not contain %v\", s)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func compareFormulaArgList(lhs, rhs, matchMode formulaArg, caseSensitive bool) byte {\n\tif len(lhs.List) < len(rhs.List) {\n\t\treturn criteriaL\n\t}\n\tif len(lhs.List) > len(rhs.List) {\n\t\treturn criteriaG\n\t}\n\tfor arg := range lhs.List {\n\t\tcriteria := compareFormulaArg(lhs.List[arg], rhs.List[arg], matchMode, caseSensitive)\n\t\tif criteria != criteriaEq {\n\t\t\treturn criteria\n\t\t}\n\t}\n\treturn criteriaEq\n}", "func (rm *RsrcManager) SpecDiffers(expected, observed *reconciler.Object) bool {\n\te := expected.Obj.(*Object).Bucket\n\to := observed.Obj.(*Object).Bucket\n\treturn !reflect.DeepEqual(e.Acl, o.Acl) ||\n\t\t!reflect.DeepEqual(e.Billing, o.Billing) ||\n\t\t!reflect.DeepEqual(e.Cors, o.Cors) ||\n\t\t!reflect.DeepEqual(e.DefaultEventBasedHold, o.DefaultEventBasedHold) ||\n\t\t!reflect.DeepEqual(e.Encryption, o.Encryption) ||\n\t\t!reflect.DeepEqual(e.Labels, o.Labels) ||\n\t\t!reflect.DeepEqual(e.Lifecycle, o.Lifecycle) ||\n\t\t!strings.EqualFold(e.Location, o.Location) ||\n\t\t!reflect.DeepEqual(e.Logging, o.Logging) ||\n\t\t!reflect.DeepEqual(e.Name, o.Name) ||\n\t\t!reflect.DeepEqual(e.Owner, o.Owner) ||\n\t\t!reflect.DeepEqual(e.StorageClass, o.StorageClass) ||\n\t\t!reflect.DeepEqual(e.Versioning, o.Versioning) ||\n\t\t!reflect.DeepEqual(e.Website, o.Website)\n}", "func TestCompare(t *testing.T, first Block, second Block) {\n\tjs, err := json.Marshal(first)\n\tif err != nil {\n\t\tt.Errorf(\"the error was expected to be nil, error returned: %s\", err.Error())\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(js, second)\n\tif err != nil {\n\t\tt.Errorf(\"the error was expected to be nil, error returned: %s\", err.Error())\n\t\treturn\n\t}\n\n\treJS, err := json.Marshal(second)\n\tif err != nil {\n\t\tt.Errorf(\"the error was expected to be nil, error returned: %s\", err.Error())\n\t\treturn\n\t}\n\n\tif bytes.Compare(js, reJS) != 0 {\n\t\tt.Errorf(\"the transformed javascript is different.\\n%s\\n%s\", js, reJS)\n\t\treturn\n\t}\n\n\tif !first.Hash().Compare(second.Hash()) {\n\t\tt.Errorf(\"the instance conversion failed\")\n\t\treturn\n\t}\n}", "func CompareTokens(expected, actual []*Token) (bool, error) {\n\tif len(expected) != len(actual) {\n\t\treturn false, fmt.Errorf(\"Different lengths. Expected %d, Got %d\", len(expected), len(actual))\n\t}\n\tfor i := range expected {\n\t\tif expected[i].Type != actual[i].Type {\n\t\t\treturn false, fmt.Errorf(\"Different token types at index %d. Expected %v, Got %v. Value: %v\",\n\t\t\t\ti, expected[i].Type, actual[i].Type, expected[i].Value)\n\t\t}\n\t\tif expected[i].Value != actual[i].Value {\n\t\t\treturn false, fmt.Errorf(\"Different token values at index %d. Expected %v, Got %v\",\n\t\t\t\ti, expected[i].Value, actual[i].Value)\n\t\t}\n\t}\n\treturn true, nil\n}", "func listResources(clt resourcesAPIGetter, r *http.Request, resourceKind string) (*types.ListResourcesResponse, error) {\n\tvalues := r.URL.Query()\n\n\tlimit, err := queryLimitAsInt32(values, \"limit\", defaults.MaxIterationLimit)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// Sort is expected in format `<fieldName>:<asc|desc>` where\n\t// index 0 is fieldName and index 1 is direction.\n\t// If a direction is not set, or is not recognized, it defaults to ASC.\n\tvar sortBy types.SortBy\n\tsortParam := values.Get(\"sort\")\n\tif sortParam != \"\" {\n\t\tvals := strings.Split(sortParam, \":\")\n\t\tif vals[0] != \"\" {\n\t\t\tsortBy.Field = vals[0]\n\t\t\tif len(vals) > 1 && vals[1] == \"desc\" {\n\t\t\t\tsortBy.IsDesc = true\n\t\t\t}\n\t\t}\n\t}\n\n\tstartKey := values.Get(\"startKey\")\n\treq := proto.ListResourcesRequest{\n\t\tResourceType: resourceKind,\n\t\tLimit: limit,\n\t\tStartKey: startKey,\n\t\tSortBy: sortBy,\n\t\tPredicateExpression: values.Get(\"query\"),\n\t\tSearchKeywords: client.ParseSearchKeywords(values.Get(\"search\"), ' '),\n\t\tUseSearchAsRoles: values.Get(\"searchAsRoles\") == \"yes\",\n\t}\n\n\treturn clt.ListResources(r.Context(), req)\n}", "func (pList *LinkedListNumber) Compare(aList *LinkedListNumber) int {\n\ts1 := pList.String()\n\ts2 := aList.String()\n\n\tif len(s1) > len(s2) {\n\t\treturn 1\n\t}\n\tif len(s1) < len(s2) {\n\t\treturn -1\n\t}\n\n\treturn strings.Compare(s1, s2)\n}", "func (s *SQLProxySpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\tswitch expected.Obj.(type) {\n\tcase *resources.Service:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t\texpected.Obj.(*resources.Service).Spec.ClusterIP = observed.Obj.(*resources.Service).Spec.ClusterIP\n\t}\n\treturn true\n}", "func WhenSortedToEqual(actual, expected []string) (string, bool) {\n\tsort.Strings(actual)\n\tsort.Strings(expected)\n\n\tif reflect.DeepEqual(actual, expected) {\n\t\treturn \"\", true\n\t}\n\treturn fmt.Sprintf(\" expected: %#v\\nto deeply be: %#v\\n\", expected, actual), false\n}", "func (m *MockList) Difference(other List) (List, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Difference\", other)\n\tret0, _ := ret[0].(List)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func serverListEquals(a []dns.Server, b []dns.Server) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\tfor i := range a {\n\t\tif a[i] != b[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func TestResourceIDs(t *testing.T) {\n\ttestCases := []struct {\n\t\tdesc string\n\t\tin []ResourceID\n\t\texpected string\n\t\texpectParseError bool\n\t}{\n\t\t{\n\t\t\tdesc: \"single id\",\n\t\t\tin: []ResourceID{{\n\t\t\t\tClusterName: \"one\",\n\t\t\t\tKind: KindNode,\n\t\t\t\tName: \"uuid\",\n\t\t\t}},\n\t\t\texpected: `[\"/one/node/uuid\"]`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"multiple ids\",\n\t\t\tin: []ResourceID{{\n\t\t\t\tClusterName: \"one\",\n\t\t\t\tKind: KindNode,\n\t\t\t\tName: \"uuid-1\",\n\t\t\t}, {\n\t\t\t\tClusterName: \"two\",\n\t\t\t\tKind: KindDatabase,\n\t\t\t\tName: \"uuid-2\",\n\t\t\t}},\n\t\t\texpected: `[\"/one/node/uuid-1\",\"/two/db/uuid-2\"]`,\n\t\t},\n\t\t{\n\t\t\tdesc: \"no cluster name\",\n\t\t\tin: []ResourceID{{\n\t\t\t\tClusterName: \"\",\n\t\t\t\tKind: KindNode,\n\t\t\t\tName: \"uuid\",\n\t\t\t}},\n\t\t\texpected: `[\"//node/uuid\"]`,\n\t\t\texpectParseError: true,\n\t\t},\n\t\t{\n\t\t\tdesc: \"bad cluster name\",\n\t\t\tin: []ResourceID{{\n\t\t\t\tClusterName: \"/,\",\n\t\t\t\tKind: KindNode,\n\t\t\t\tName: \"uuid\",\n\t\t\t}},\n\t\t\texpected: `[\"//,/node/uuid\"]`,\n\t\t\texpectParseError: true,\n\t\t},\n\t\t{\n\t\t\tdesc: \"bad resource kind\",\n\t\t\tin: []ResourceID{{\n\t\t\t\tClusterName: \"one\",\n\t\t\t\tKind: \"not,/a,/kind\",\n\t\t\t\tName: \"uuid\",\n\t\t\t}},\n\t\t\texpected: `[\"/one/not,/a,/kind/uuid\"]`,\n\t\t\texpectParseError: true,\n\t\t},\n\t\t{\n\t\t\t// Any resource name is actually fine, test that the list parsing\n\t\t\t// doesn't break.\n\t\t\tdesc: \"bad resource name\",\n\t\t\tin: []ResourceID{{\n\t\t\t\tClusterName: \"one\",\n\t\t\t\tKind: KindNode,\n\t\t\t\tName: `really\"--,bad resource\\\"\\\\\"name`,\n\t\t\t}},\n\t\t\texpected: `[\"/one/node/really\\\"--,bad resource\\\\\\\"\\\\\\\\\\\"name\"]`,\n\t\t},\n\t}\n\tfor _, tc := range testCases {\n\t\tt.Run(tc.desc, func(t *testing.T) {\n\t\t\tout, err := ResourceIDsToString(tc.in)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, tc.expected, out)\n\n\t\t\t// Parse the ids from the string and make sure they match the\n\t\t\t// original.\n\t\t\tparsed, err := ResourceIDsFromString(out)\n\t\t\tif tc.expectParseError {\n\t\t\t\trequire.Error(t, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, tc.in, parsed)\n\t\t})\n\t}\n}", "func includesEqual(configured []string, desired []string) bool {\n\tif len(configured) != len(desired) {\n\t\treturn false\n\t}\n\tsort.Strings(configured)\n\tsort.Strings(desired)\n\tfor i := 0; i < len(configured); i++ {\n\t\tif configured[i] != desired[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (m *MockMutableList) Difference(other List) (List, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Difference\", other)\n\tret0, _ := ret[0].(List)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func AreSimilar(file1 string, file2 string) (bool, error) {\n\tf1, err := ioutil.ReadFile(file1)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tf2, err := ioutil.ReadFile(file2)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvar data1 []JSONObject\n\terr = json.Unmarshal(f1, &data1)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tvar data2 []JSONObject\n\terr = json.Unmarshal(f2, &data2)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tareSimilar := areUnorderedArraysSimilar(data1, data2)\n\treturn areSimilar, nil\n}", "func validateEntries(t *testing.T, entries, expected []endpoint.Endpoint) {\n\tif len(entries) != len(expected) {\n\t\tt.Fatalf(\"expected %q to match %q\", entries, expected)\n\t}\n\n\tfor i := range entries {\n\t\tif entries[i] != expected[i] {\n\t\t\tt.Fatalf(\"expected %q to match %q\", entries, expected)\n\t\t}\n\t}\n}", "func (m *MockClusterAdmin) ListPartitionReassignments(arg0 string, arg1 []int32) (map[string]map[int32]*sarama.PartitionReplicaReassignmentsStatus, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPartitionReassignments\", arg0, arg1)\n\tret0, _ := ret[0].(map[string]map[int32]*sarama.PartitionReplicaReassignmentsStatus)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (p *Peer) CompareContent(contentList []string) []interface{} {\n\t// Convert to an interface array\n\tcl := make([]interface{}, len(contentList))\n\tfor i, v := range contentList {\n\t\tcl[i] = v\n\t}\n\tcontentWeHaveSet := mapset.NewSetFromSlice(cl)\n\n\tcontentField := p.GetState().GetPoolField(\"RequiredContent\")\n\tif contentField == nil {\n\t\treturn make([]interface{}, 0)\n\t}\n\tcontentFromPool := contentField.(state.SignedList).Data\n\n\t// Convert to an interface array\n\ts := make([]interface{}, len(contentFromPool))\n\tfor i, v := range contentFromPool {\n\t\ts[i] = v\n\t}\n\n\t// Create a set\n\tcontentWeNeed := mapset.NewSetFromSlice(s)\n\n\t// Return the difference of the two\n\treturn contentWeNeed.Difference(contentWeHaveSet).ToSlice()\n}", "func (m *MockVirtualDestinationSet) List(filterResource ...func(*v1beta1.VirtualDestination) bool) []*v1beta1.VirtualDestination {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{}\n\tfor _, a := range filterResource {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"List\", varargs...)\n\tret0, _ := ret[0].([]*v1beta1.VirtualDestination)\n\treturn ret0\n}", "func (s *MySQLSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\tswitch expected.Obj.(type) {\n\tcase *resources.Secret:\n\t\t// Dont update a secret\n\t\treturn false\n\tcase *resources.Service:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t\texpected.Obj.(*resources.Service).Spec.ClusterIP = observed.Obj.(*resources.Service).Spec.ClusterIP\n\tcase *resources.PodDisruptionBudget:\n\t\texpected.Obj.SetResourceVersion(observed.Obj.GetResourceVersion())\n\t}\n\treturn true\n}", "func (s *WorkerSpec) Differs(expected ResourceInfo, observed ResourceInfo) bool {\n\t// TODO\n\treturn true\n}", "func (m *MockAuthorizationPolicySet) List(filterResource ...func(*v1beta1.AuthorizationPolicy) bool) []*v1beta1.AuthorizationPolicy {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{}\n\tfor _, a := range filterResource {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"List\", varargs...)\n\tret0, _ := ret[0].([]*v1beta1.AuthorizationPolicy)\n\treturn ret0\n}", "func PolicyRuleResourceMatches(rule *rbacv1.PolicyRule, requestedResource string) bool {\n\tfor _, ruleResource := range rule.Resources {\n\t\tif ruleResource == rbacv1.ResourceAll {\n\t\t\treturn true\n\t\t}\n\n\t\tif ruleResource == requestedResource {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (m *MockCustomResourceClient) ListCustomResource(apiGroup, version, namespace, resourceKind string) (*operatorclient.CustomResourceList, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListCustomResource\", apiGroup, version, namespace, resourceKind)\n\tret0, _ := ret[0].(*operatorclient.CustomResourceList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func EqualsListArg(a, b ListArg) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func Compare(oldMods, newMods []infrav1.ClusterModule) bool {\n\tif len(oldMods) != len(newMods) {\n\t\treturn false\n\t}\n\n\tsort.SliceStable(oldMods, func(i, j int) bool {\n\t\treturn oldMods[i].TargetObjectName < oldMods[j].TargetObjectName\n\t})\n\tsort.SliceStable(newMods, func(i, j int) bool {\n\t\treturn newMods[i].TargetObjectName < newMods[j].TargetObjectName\n\t})\n\n\tfor i := range oldMods {\n\t\tif oldMods[i].ControlPlane == newMods[i].ControlPlane &&\n\t\t\toldMods[i].TargetObjectName == newMods[i].TargetObjectName &&\n\t\t\toldMods[i].ModuleUUID == newMods[i].ModuleUUID {\n\t\t\tcontinue\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}" ]
[ "0.65800613", "0.6343115", "0.6236883", "0.59654737", "0.55586445", "0.5427846", "0.5257756", "0.5227804", "0.5226022", "0.51560676", "0.5124971", "0.5118968", "0.50719607", "0.5029155", "0.50274366", "0.50094444", "0.5001012", "0.49900916", "0.49872172", "0.49872172", "0.49754643", "0.49513274", "0.49506095", "0.49362636", "0.49262276", "0.49089256", "0.48589316", "0.48559687", "0.48246104", "0.48190248", "0.47746217", "0.47680724", "0.47256938", "0.47227013", "0.47133273", "0.46947894", "0.46928263", "0.4661206", "0.46507126", "0.4648887", "0.46438324", "0.46413442", "0.46391377", "0.4636019", "0.45992756", "0.45918798", "0.45772552", "0.45683217", "0.45570713", "0.45535433", "0.45403773", "0.45398378", "0.45308685", "0.45161417", "0.45139617", "0.45137954", "0.4510926", "0.45108625", "0.4501077", "0.4493612", "0.44919604", "0.44915006", "0.44811213", "0.4478043", "0.4477016", "0.44733208", "0.44630545", "0.44629794", "0.44609463", "0.44574437", "0.44492915", "0.44399437", "0.44376808", "0.44376287", "0.44361448", "0.44359022", "0.4435548", "0.4434005", "0.44323403", "0.44260305", "0.4420314", "0.44152015", "0.44110817", "0.44045657", "0.44024506", "0.43971506", "0.43946806", "0.43921405", "0.43913674", "0.43895894", "0.4389123", "0.43846107", "0.43834823", "0.4380988", "0.43806165", "0.4379894", "0.43797404", "0.43780166", "0.43721202", "0.43650937" ]
0.83638287
0
IsValidNodeTopology checks the provided NodeResourceTopology object if it is wellformad, internally consistent and consistent with the given kubelet config object. Returns true if the NodeResourceTopology object is consistent and well formet, false otherwise; if return false, logs the failure reason.
IsValidNodeTopology проверяет предоставленный объект NodeResourceTopology на соответствие формату, внутреннюю согласованность и согласованность с заданным объектом kubelet config. Возвращает true, если объект NodeResourceTopology согласован и правильно сформирован, и false в противном случае; если возвращается false, записывается причина неудачи.
func IsValidNodeTopology(nodeTopology *v1alpha2.NodeResourceTopology, kubeletConfig *kubeletconfig.KubeletConfiguration) bool { if nodeTopology == nil || len(nodeTopology.TopologyPolicies) == 0 { framework.Logf("failed to get topology policy from the node topology resource") return false } tmPolicy := string(topologypolicy.DetectTopologyPolicy(kubeletConfig.TopologyManagerPolicy, kubeletConfig.TopologyManagerScope)) if nodeTopology.TopologyPolicies[0] != tmPolicy { framework.Logf("topology policy mismatch got %q expected %q", nodeTopology.TopologyPolicies[0], tmPolicy) return false } expectedPolicyAttribute := v1alpha2.AttributeInfo{ Name: nfdtopologyupdater.TopologyManagerPolicyAttributeName, Value: kubeletConfig.TopologyManagerPolicy, } if !containsAttribute(nodeTopology.Attributes, expectedPolicyAttribute) { framework.Logf("topology policy attributes don't have correct topologyManagerPolicy attribute expected %v attributeList %v", expectedPolicyAttribute, nodeTopology.Attributes) return false } expectedScopeAttribute := v1alpha2.AttributeInfo{ Name: nfdtopologyupdater.TopologyManagerScopeAttributeName, Value: kubeletConfig.TopologyManagerScope, } if !containsAttribute(nodeTopology.Attributes, expectedScopeAttribute) { framework.Logf("topology policy attributes don't have correct topologyManagerScope attribute expected %v attributeList %v", expectedScopeAttribute, nodeTopology.Attributes) return false } if nodeTopology.Zones == nil || len(nodeTopology.Zones) == 0 { framework.Logf("failed to get topology zones from the node topology resource") return false } foundNodes := 0 for _, zone := range nodeTopology.Zones { // TODO constant not in the APIs if !strings.HasPrefix(strings.ToUpper(zone.Type), "NODE") { continue } foundNodes++ if !isValidCostList(zone.Name, zone.Costs) { framework.Logf("invalid cost list for zone %q", zone.Name) return false } if !isValidResourceList(zone.Name, zone.Resources) { framework.Logf("invalid resource list for zone %q", zone.Name) return false } } return foundNodes > 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func nodeIsValidForTopologyAwareHints(node *corev1.Node) bool {\n\treturn !node.Status.Allocatable.Cpu().IsZero() && node.Labels[corev1.LabelTopologyZone] != \"\"\n}", "func (t Topology) Validate() error {\n\terrs := []string{}\n\n\t// Check all node metadatas are valid, and the keys are parseable, i.e.\n\t// contain a scope.\n\tfor nodeID, nmd := range t.Nodes {\n\t\tif nmd.Metadata == nil {\n\t\t\terrs = append(errs, fmt.Sprintf(\"node ID %q has nil metadata\", nodeID))\n\t\t}\n\t\tif _, _, ok := ParseNodeID(nodeID); !ok {\n\t\t\terrs = append(errs, fmt.Sprintf(\"invalid node ID %q\", nodeID))\n\t\t}\n\n\t\t// Check all adjancency keys has entries in Node.\n\t\tfor _, dstNodeID := range nmd.Adjacency {\n\t\t\tif _, ok := t.Nodes[dstNodeID]; !ok {\n\t\t\t\terrs = append(errs, fmt.Sprintf(\"node metadata missing from adjacency %q -> %q\", nodeID, dstNodeID))\n\t\t\t}\n\t\t}\n\n\t\t// Check all the edge metadatas have entries in adjacencies\n\t\tfor dstNodeID := range nmd.Edges {\n\t\t\tif _, ok := t.Nodes[dstNodeID]; !ok {\n\t\t\t\terrs = append(errs, fmt.Sprintf(\"node %s metadatas missing for edge %q\", dstNodeID, nodeID))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn fmt.Errorf(\"%d error(s): %s\", len(errs), strings.Join(errs, \"; \"))\n\t}\n\n\treturn nil\n}", "func (d *portworx) ValidateVolumeTopology(vol *api.Volume, params map[string]string) error {\n\tvar topoMatches bool\n\tvar err error\n\tzone := params[torpedok8s.TopologyZoneK8sNodeLabel]\n\tnodes := node.GetNodesByTopologyZoneLabel(zone)\n\tfor _, node := range nodes {\n\t\tif topoMatches, err = d.isVolumeAttachedOnNode(vol, node); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif topoMatches {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn &ErrCsiTopologyMismatch{\n\t\tVolName: vol.Locator.Name,\n\t\tCause: fmt.Errorf(\"volume [%s] is not attched on nodes with topology label [%s]\", vol.Id, zone),\n\t}\n}", "func (m *NodeTopo) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateBrickTopo(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCluster(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateClusterTopo(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateHost(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLocalID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePosition(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 (ns NodeSolver) Validate() bool {\n\treturn config.ValidateNodeSolver(&ns)\n}", "func ValidateNodeSolver(ns RextNodeSolver) (hasError bool) {\n\tif len(ns.GetNodePath()) == 0 {\n\t\thasError = true\n\t\tlog.Errorln(\"node path is required in node solver config\")\n\t}\n\treturn hasError\n}", "func GetNodeTopology(ctx context.Context, topologyClient *topologyclientset.Clientset, nodeName string) *v1alpha2.NodeResourceTopology {\n\tvar nodeTopology *v1alpha2.NodeResourceTopology\n\tvar err error\n\tgomega.EventuallyWithOffset(1, func() bool {\n\t\tnodeTopology, err = topologyClient.TopologyV1alpha2().NodeResourceTopologies().Get(ctx, nodeName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tframework.Logf(\"failed to get the node topology resource: %v\", err)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}, time.Minute, 5*time.Second).Should(gomega.BeTrue())\n\treturn nodeTopology\n}", "func (r *reconciler) shouldEnableTopologyAwareHints(dns *operatorv1.DNS) (bool, error) {\n\tvar nodesList corev1.NodeList\n\tif err := r.cache.List(context.TODO(), &nodesList); err != nil {\n\t\treturn false, err\n\t}\n\tnodes := 0\n\tfor i := range nodesList.Items {\n\t\tif ignoreNodeForTopologyAwareHints(&nodesList.Items[i]) {\n\t\t\tcontinue\n\t\t}\n\t\tif !nodeIsValidForTopologyAwareHints(&nodesList.Items[i]) {\n\t\t\treturn false, nil\n\t\t}\n\t\tnodes++\n\t}\n\n\treturn nodes >= 2, nil\n}", "func (m *NodeTopoHost) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (element *ElasticsearchTopologyElement) Validate() error {\n\tvar merr = multierror.NewPrefixed(\"elasticsearch topology\")\n\tif element.NodeType == \"\" {\n\t\tmerr = merr.Append(errors.New(\"node_type cannot be empty\"))\n\t}\n\n\tif element.Size == 0 {\n\t\tmerr = merr.Append(errors.New(\"size cannot be empty\"))\n\t}\n\n\treturn merr.ErrorOrNil()\n}", "func (t *Tainter) IsNodeTainted(ctx context.Context) (bool, error) {\n\tnode, err := t.client.CoreV1().Nodes().Get(ctx, t.nodeName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfor i := range node.Spec.Taints {\n\t\tif node.Spec.Taints[i].Key == TaintKey {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "func ValidateHost(host string, config *Config) error {\n\t_, ok := config.Topology[host]\n\tif !ok {\n\t\treturn fmt.Errorf(\"unable to find info for host %q in config file\", host)\n\t}\n\treturn nil\n}", "func (g *GuidePost) validateNodeConfig(q *msg.Request) (bool, error) {\n\tif q.Node.Config == nil {\n\t\treturn false, fmt.Errorf(\"NodeConfig subobject missing\")\n\t}\n\treturn g.validateBucketInRepository(\n\t\tq.Node.Config.RepositoryID,\n\t\tq.Node.Config.BucketID,\n\t)\n}", "func (s *NodeSystem) IsValid() (bool, []error) {\n\terrors := make([]error, 0)\n\terrors = append(errors, checkForOrphanMultiBranchesNode(s)...)\n\terrors = append(errors, checkForCyclicRedundancyInNodeLinks(s)...)\n\terrors = append(errors, checkForUndeclaredNodeInNodeLink(s)...)\n\terrors = append(errors, checkForMultipleInstanceOfSameNode(s)...)\n\terrors = append(errors, checkForMultipleLinksToNodeWithoutJoinMode(s)...)\n\n\tif len(errors) == 0 {\n\t\treturn true, nil\n\t}\n\treturn false, errors\n}", "func CheckTopologyChanges(rcc *CassandraClusterReconciler, cc *api.CassandraCluster,\n\tstatus *api.CassandraClusterStatus, oldCRD *api.CassandraCluster) (bool, string) {\n\n\tchangelog, _ := diff.Diff(oldCRD.Spec.Topology, cc.Spec.Topology)\n\n\tif hasChange(changelog, diff.UPDATE) ||\n\t\thasChange(changelog, diff.DELETE, \"DC.Rack\", \"-DC\") ||\n\t\thasChange(changelog, diff.CREATE, \"DC.Rack\", \"-DC\") {\n\t\tlogrus.WithFields(logrus.Fields{\"cluster\": cc.Name}).Warningf(\n\t\t\ttopologyChangeRefused+\"No change other than adding/removing a DC can happen: %v restored to %v\",\n\t\t\tcc.Spec.Topology, oldCRD.Spec.Topology)\n\t\treturn true, api.ActionCorrectCRDConfig.Name\n\t}\n\n\tif cc.GetDCSize() < oldCRD.GetDCSize()-1 {\n\t\tlogrus.WithFields(logrus.Fields{\"cluster\": cc.Name}).Warningf(\n\t\t\ttopologyChangeRefused+\"You can only remove 1 DC at a time, \"+\n\t\t\t\t\"not only a Rack: %v restored to %v\", cc.Spec.Topology, oldCRD.Spec.Topology)\n\t\treturn true, api.ActionCorrectCRDConfig.Name\n\t}\n\n\tif cc.GetDCRackSize() < oldCRD.GetDCRackSize() {\n\n\t\tif cc.Status.LastClusterAction == api.ActionScaleDown.Name &&\n\t\t\tcc.Status.LastClusterActionStatus != api.StatusDone {\n\t\t\tlogrus.WithFields(logrus.Fields{\"cluster\": cc.Name}).\n\t\t\t\tWarningf(topologyChangeRefused +\n\t\t\t\t\t\"You must wait to the end of ScaleDown to 0 before deleting a DC\")\n\t\t\treturn true, api.ActionCorrectCRDConfig.Name\n\t\t}\n\n\t\tdcName := cc.GetRemovedDCName(oldCRD)\n\n\t\t//We need to check how many nodes were in the old CRD (before the user delete it)\n\t\tif found, nbNodes := oldCRD.GetDCNodesPerRacksFromName(dcName); found && nbNodes > 0 {\n\t\t\tlogrus.WithFields(logrus.Fields{\"cluster\": cc.Name}).\n\t\t\t\tWarningf(topologyChangeRefused+\n\t\t\t\t\t\"You must scale down the DC %s to 0 before deleting it\", dcName)\n\t\t\treturn true, api.ActionCorrectCRDConfig.Name\n\t\t}\n\n\t\tlogrus.WithFields(logrus.Fields{\"cluster\": cc.Name}).Warningf(\"Removing DC %s\", dcName)\n\n\t\t//We apply this change to the Cluster status\n\t\treturn rcc.deleteDCObjects(cc, status)\n\t}\n\n\treturn false, \"\"\n}", "func (m *NodeTopoBrickTopo) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func ExampleSurface_ValidateNode() {\n\tsurface := NewSurface(10)\n\tnode := NewNode(15, 5, true)\n\tif err := surface.ValidateNode(node); err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// Output: Invalid/unsupported x-axis value supplied!\n}", "func (s *Layer) IsFailedNode(nodeID byte) (failed bool, err error) {\n\n\tdone := make(chan *frame.Frame)\n\n\trequest := &session.Request{\n\t\tFunctionID: protocol.FnIsNodeFailed,\n\t\tPayload: []byte{nodeID},\n\t\tHasReturn: true,\n\t\tReturnCallback: func(err error, ret *frame.Frame) bool {\n\t\t\tdone <- ret\n\t\t\treturn false\n\t\t},\n\t}\n\n\ts.sessionLayer.MakeRequest(request)\n\tret := <-done\n\n\tif ret == nil {\n\t\terr = errors.New(\"Error checking failure status\")\n\t\treturn\n\t}\n\n\tfailed = ret.Payload[1] == 1\n\n\treturn\n}", "func ValidateTopologyKey(fldPath *field.Path, topologyKey string) *field.Error {\n\tif len(topologyKey) == 0 {\n\t\treturn field.Required(fldPath, \"can not be empty\")\n\t}\n\treturn nil\n}", "func (b *Block) ValidateMerkleRoot() bool {\n\tif b.TxHashes == nil {\n\t\treturn false\n\t}\n\tnumHashes := len(b.TxHashes)\n\thashes := make([][]byte, numHashes)\n\t// Reverse each item in b.TxHashses\n\tfor i, hash := range b.TxHashes {\n\t\thashes[i] = make([]byte, len(hash))\n\t\tcopy(hashes[i], hash)\n\t\tutil.ReverseByteArray(hashes[i])\n\t}\n\troot := util.MerkleRoot(hashes)\n\tutil.ReverseByteArray(root)\n\treturn bytes.Equal(root, b.MerkleRoot[:])\n}", "func (m *NodeTopoClusterTopo) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (m *NodeTopo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateBrickTopo(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateCluster(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateClusterTopo(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateHost(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidatePosition(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (m *TelemetryV2StackDriverConfig) GetTopology() *types.BoolValue {\n\tif m != nil {\n\t\treturn m.Topology\n\t}\n\treturn nil\n}", "func (m *NodeTopoPosition) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (r *Cluster) IsSchemaRegistryTLSEnabled() bool {\n\treturn r != nil &&\n\t\tr.Spec.Configuration.SchemaRegistry != nil &&\n\t\tr.Spec.Configuration.SchemaRegistry.TLS != nil &&\n\t\tr.Spec.Configuration.SchemaRegistry.TLS.Enabled\n}", "func (m *NodeStateNode) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateReadonly(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateServicelight(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSmartfail(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 *ClusterConfig) HasWindowsNodeGroup() bool {\n\tfor _, ng := range c.NodeGroups {\n\t\tif IsWindowsImage(ng.AMIFamily) {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor _, ng := range c.ManagedNodeGroups {\n\t\tif IsWindowsImage(ng.AMIFamily) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (m *ClusterNodeStateSmartfail) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (pt MDTurbo) Validate() bool {\n\tif pt.Magic != 52426 {\n\t\treturn false\n\t}\n\tif pt.Partitions1[0].Start != 256 {\n\t\treturn false\n\t}\n\treturn true\n}", "func ValidateTopologySpreadConstraints(constraints []core.TopologySpreadConstraint, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tfor i, constraint := range constraints {\n\t\tsubFldPath := fldPath.Index(i)\n\t\tif err := ValidateMaxSkew(subFldPath.Child(\"maxSkew\"), constraint.MaxSkew); err != nil {\n\t\t\tallErrs = append(allErrs, err)\n\t\t}\n\t\tif err := ValidateTopologyKey(subFldPath.Child(\"topologyKey\"), constraint.TopologyKey); err != nil {\n\t\t\tallErrs = append(allErrs, err)\n\t\t}\n\t\tif err := ValidateWhenUnsatisfiable(subFldPath.Child(\"whenUnsatisfiable\"), constraint.WhenUnsatisfiable); err != nil {\n\t\t\tallErrs = append(allErrs, err)\n\t\t}\n\t\t// tuple {topologyKey, whenUnsatisfiable} denotes one kind of spread constraint\n\t\tif err := ValidateSpreadConstraintNotRepeat(subFldPath.Child(\"{topologyKey, whenUnsatisfiable}\"), constraint, constraints[i+1:]); err != nil {\n\t\t\tallErrs = append(allErrs, err)\n\t\t}\n\t\tallErrs = append(allErrs, validateMinDomains(subFldPath.Child(\"minDomains\"), constraint.MinDomains, constraint.WhenUnsatisfiable)...)\n\t}\n\n\treturn allErrs\n}", "func (n *Node) IsControlPlane() bool {\n\treturn n.Role() == constants.ControlPlaneNodeRoleValue\n}", "func (n *Node) IsValid() bool {\n\n\t// obviously a port number of zero won't work\n\tif n.TcpAddr.Port == 0 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (ctl *Ctl) SpecIsValid() (bool, error) {\n\treturn true, nil\n}", "func (ctl *Ctl) SpecIsValid() (bool, error) {\n\treturn true, nil\n}", "func (m *NodeTopoCluster) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (n *Node) IsControlPlane() bool {\n\treturn n.Role == ControlPlaneRole\n}", "func (client Client) CheckRoute(domainGUID string, hostname string, path string, port int) (bool, Warnings, error) {\n\tvar query []Query\n\n\tif hostname != \"\" {\n\t\tquery = append(query, Query{Key: HostFilter, Values: []string{hostname}})\n\t}\n\n\tif path != \"\" {\n\t\tquery = append(query, Query{Key: PathFilter, Values: []string{path}})\n\t}\n\n\tif port != 0 {\n\t\tquery = append(query, Query{Key: PortFilter, Values: []string{fmt.Sprintf(\"%d\", port)}})\n\t}\n\n\tvar responseBody struct {\n\t\tMatchingRoute bool `json:\"matching_route\"`\n\t}\n\n\t_, warnings, err := client.MakeRequest(RequestParams{\n\t\tRequestName: internal.GetDomainRouteReservationsRequest,\n\t\tURIParams: internal.Params{\"domain_guid\": domainGUID},\n\t\tQuery: query,\n\t\tResponseBody: &responseBody,\n\t})\n\n\treturn responseBody.MatchingRoute, warnings, err\n}", "func (m *Mesh) CheckSanity() bool {\n\treturn m.faceStructure.checkSanity(uint32(len(m.Nodes))) && m.beamLattice.checkSanity(uint32(len(m.Nodes)))\n}", "func (c *LockReleaseController) verifyNodeExists(node *corev1.Node, expectedGCEInstanceID, expectedNodeInternalIP string) (bool, error) {\n\tif node == nil {\n\t\treturn false, nil\n\t}\n\tif node.Annotations == nil {\n\t\treturn false, fmt.Errorf(\"node %s annotations is nil\", node.Name)\n\t}\n\tinstanceID, ok := node.Annotations[gceInstanceIDKey]\n\tif !ok {\n\t\tklog.Warningf(\"Node %s missing key %s in node.annotations\", node.Name, gceInstanceIDKey)\n\t\treturn false, nil\n\t}\n\tif instanceID != expectedGCEInstanceID {\n\t\treturn false, nil\n\t}\n\tfor _, address := range node.Status.Addresses {\n\t\tif address.Type == corev1.NodeInternalIP && address.Address == expectedNodeInternalIP {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "func (c GlobalConfig) IsNode() bool {\n\treturn RunMode(c.OBSMode).IsNode()\n}", "func IsValidKernelParams(s string) bool {\n\treturn reValidKernelParams.MatchString(s)\n}", "func (r *Cluster) IsSchemaRegistryMutualTLSEnabled() bool {\n\treturn r != nil &&\n\t\tr.IsSchemaRegistryTLSEnabled() &&\n\t\tr.Spec.Configuration.SchemaRegistry.TLS.RequireClientAuth\n}", "func (t *OnfSwitch_Switch_Port) ΛValidate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"OnfSwitch_Switch_Port\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func getValidTopology(topologyMap map[string][]string) ([]string, []string) {\n\tvar regionValues []string\n\tvar zoneValues []string\n\tfor region, zones := range topologyMap {\n\t\tregionValues = append(regionValues, region)\n\t\tzoneValues = append(zoneValues, zones...)\n\t}\n\treturn regionValues, zoneValues\n}", "func (c Config) IsValid() bool {\n\treturn c.RandomTemperature > 0 && c.NumSimulation > 0\n}", "func (r *GlobalDNSZoneReconciler) IsValid(obj metav1.Object) (bool, error) {\n\tglobalDNSZone, ok := obj.(*redhatcopv1alpha1.GlobalDNSZone)\n\tif !ok {\n\t\treturn false, errs.New(\"unable to convert to GlobalDNSZone\")\n\t}\n\tfoundProviderDefinition := false\n\tif globalDNSZone.Spec.Provider.Route53 != nil {\n\t\tif foundProviderDefinition {\n\t\t\treturn false, errs.New(\"only one of the provider type field can be defined\")\n\t\t}\n\t\tfoundProviderDefinition = true\n\t\t// for route53 we just need to verify that the Zone is and that it controls the defined domain\n\t\troute53Client, err := tpdroute53.GetRoute53Client(context.TODO(), globalDNSZone, &r.ReconcilerBase)\n\t\tif err != nil {\n\t\t\tr.Log.Error(err, \"unable to retrieve route53 client for\", \"globalDNSZone\", globalDNSZone)\n\t\t\treturn false, err\n\t\t}\n\t\tinput := &route53.GetHostedZoneInput{\n\t\t\tId: aws.String(globalDNSZone.Spec.Provider.Route53.ZoneID),\n\t\t}\n\t\tresult, err := route53Client.GetHostedZone(input)\n\t\tif err != nil {\n\t\t\tr.Log.Error(err, \"unable to retrieve hosted zone with\", \"ZoneID\", globalDNSZone.Spec.Provider.Route53.ZoneID)\n\t\t\treturn false, err\n\t\t}\n\t\tif *result.HostedZone.Name != (globalDNSZone.Spec.Domain + \".\") {\n\t\t\terr := errs.New(\"route53 hosted zone name does not match global dns name\")\n\t\t\tr.Log.Error(err, \"aws route53 hosted zone\", \"name\", result.HostedZone.Name, \"does not match this global DNS zone name\", globalDNSZone.Spec.Domain+\".\")\n\t\t\treturn false, err\n\t\t}\n\t}\n\treturn true, nil\n}", "func (r *ResourceSpec) Valid() bool {\n\tif r.Name == \"\" {\n\t\tfmt.Println(\"no resource spec label\")\n\t\treturn false\n\t}\n\n\tfor _, c := range r.Credentials {\n\t\tif !c.Valid() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func (s *SyncerClient) SupportsNodeResourceUpdates(timeout time.Duration) (bool, error) {\n\t// If a previous call has already marked the handshake as complete, then just return the value.\n\tif s.handshakeStatus.complete {\n\t\treturn s.supportsNodeResourceUpdates, nil\n\t}\n\n\tselect {\n\tcase <-s.handshakeStatus.helloReceivedChan:\n\t\ts.logCxt.Debug(\"Received MsgServerHello from server\")\n\t\ts.handshakeStatus.complete = true\n\t\treturn s.supportsNodeResourceUpdates, nil\n\tcase <-time.After(timeout):\n\t\t// fallthrough\n\t}\n\n\treturn false, fmt.Errorf(\"Timed out waiting for handshake to complete\")\n}", "func (tee *Tee) ValidateShard(ctx context.Context, keyspace, shard string) error {\n\terr := tee.primary.ValidateShard(ctx, keyspace, shard)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := tee.secondary.ValidateShard(ctx, keyspace, shard); err != nil {\n\t\t// not critical enough to fail\n\t\tlog.Warningf(\"secondary.ValidateShard(%v,%v) failed: %v\", keyspace, shard, err)\n\t}\n\treturn nil\n}", "func (r *Resource) Valid() bool {\n\tif r.Spec == nil {\n\t\tfmt.Println(\"no resource spec\")\n\t\treturn false\n\t}\n\n\treturn r.Spec.Valid()\n}", "func (m *HyperflexNode) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with MoBaseMo\n\tif err := m.MoBaseMo.Validate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCluster(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateClusterMember(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIdentity(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIP(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePhysicalServer(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRole(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func IsValidPerformanceMode(performanceMode string, configType ConfigType) bool {\n\tif performanceMode == PerformanceModeEmpty {\n\t\treturn true\n\t}\n\n\tfor _, o := range ValidPerformanceModeOptions(configType) {\n\t\tif performanceMode == o {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func WithTopologyNodeZone(nodeZone string) Option {\n\treturn makeOption(func(p *proxy) error {\n\t\tp.nodeZone = nodeZone\n\t\treturn nil\n\t})\n}", "func (m *NodeTopoHost) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "func (m *NodeInfo) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateBootTime(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLastUpdatedDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePluginsInfo(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 (m *AzureManagedControlPlane) validateMaxNodeProvisionTime() field.ErrorList {\n\tvar allErrs field.ErrorList\n\tif ptr.Deref(m.Spec.AutoScalerProfile.MaxNodeProvisionTime, \"\") != \"\" {\n\t\tif !rMaxNodeProvisionTime.MatchString(ptr.Deref(m.Spec.AutoScalerProfile.MaxNodeProvisionTime, \"\")) {\n\t\t\tallErrs = append(allErrs, field.Invalid(field.NewPath(\"Spec\", \"AutoscalerProfile\", \"MaxNodeProvisionTime\"), m.Spec.AutoScalerProfile.MaxNodeProvisionTime, \"invalid value\"))\n\t\t}\n\t}\n\treturn allErrs\n}", "func (proc *Processor) ValidateTimestamp(hornetTx *hornet.Transaction) (valid, broadcast bool) {\n\tsnapshotTimestamp := tangle.GetSnapshotInfo().Timestamp\n\ttxTimestamp := hornetTx.GetTimestamp()\n\n\tpastTime := time.Now().Add(-10 * time.Minute).Unix()\n\tfutureTime := time.Now().Add(10 * time.Minute).Unix()\n\n\t// we need to accept all txs since the snapshot timestamp for synchronization\n\tif txTimestamp >= snapshotTimestamp && txTimestamp < futureTime {\n\t\treturn true, txTimestamp >= pastTime\n\t}\n\n\t// ignore invalid timestamps for solid entry points\n\treturn tangle.SolidEntryPointsContain(hornetTx.GetTxHash()), false\n}", "func TestValidateRoute(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\thost string\n\t\tallowNonCompliant string\n\t\texpectedErrors int\n\t}{\n\t\t{\n\t\t\tname: \"Non-DNS-compliant host with non-compliance allowed\",\n\t\t\thost: \"host\",\n\t\t\tallowNonCompliant: \"true\",\n\t\t\texpectedErrors: 0,\n\t\t},\n\t\t{\n\t\t\tname: \"Non-DNS-compliant host with non-compliance not allowed\",\n\t\t\thost: \"host\",\n\t\t\tallowNonCompliant: \"false\",\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Non-DNS-compliant host without non-compliance annotation\",\n\t\t\thost: \"host\",\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Specified label too long\",\n\t\t\thost: \"1234567890-1234567890-1234567890-1234567890-1234567890-123456789.host.com\",\n\t\t\tallowNonCompliant: \"\",\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Specified label too long, is not an error with non-compliance allowed\",\n\t\t\thost: \"1234567890-1234567890-1234567890-1234567890-1234567890-123456789.host.com\",\n\t\t\tallowNonCompliant: \"true\",\n\t\t\texpectedErrors: 0,\n\t\t},\n\t\t{\n\t\t\tname: \"Specified host name too long\",\n\t\t\thost: \"1234567890-1234567890-1234567890-1234567890-1234567890.\" +\n\t\t\t\t\"1234567890-1234567890-1234567890-1234567890-1234567890.\" +\n\t\t\t\t\"1234567890-1234567890-1234567890-1234567890-1234567890.\" +\n\t\t\t\t\"1234567890-1234567890-1234567890-1234567890-1234567890.\" +\n\t\t\t\t\"1234567890-1234567890-1234567890-1\",\n\t\t\tallowNonCompliant: \"\",\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Specified host name too long, is still an error even with non-compliance allowed\",\n\t\t\thost: \"1234567890-1234567890-1234567890-1234567890-1234567890.\" +\n\t\t\t\t\"1234567890-1234567890-1234567890-1234567890-1234567890.\" +\n\t\t\t\t\"1234567890-1234567890-1234567890-1234567890-1234567890.\" +\n\t\t\t\t\"1234567890-1234567890-1234567890-1234567890-1234567890.\" +\n\t\t\t\t\"1234567890-1234567890-1234567890-1\",\n\t\t\tallowNonCompliant: \"true\",\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"No host\",\n\t\t\thost: \"\",\n\t\t\tallowNonCompliant: \"\",\n\t\t\texpectedErrors: 1,\n\t\t},\n\t\t{\n\t\t\tname: \"Invalid DNS 952 host\",\n\t\t\thost: \"**\",\n\t\t\tallowNonCompliant: \"\",\n\t\t\texpectedErrors: 1,\n\t\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\terrs := ValidateHost(tc.host, tc.allowNonCompliant, field.NewPath(\"spec.host\"))\n\t\tif len(errs) != tc.expectedErrors {\n\t\t\tt.Errorf(\"Test case %q expected %d error(s), got %d: %v\", tc.name, tc.expectedErrors, len(errs), errs)\n\t\t}\n\t}\n}", "func validateNtpOnCluster(ntpObj ntpTest) {\n\tBy(fmt.Sprintf(\"ts:%s Validating Cluster\", time.Now().String()))\n\n\tBy(fmt.Sprintf(\"Validates NTP config file on Quorum Nodes\"))\n\tfor _, qnode := range ts.tu.QuorumNodes {\n\t\tip := ts.tu.NameToIPMap[qnode]\n\t\tif ip == ntpObj.oldLeaderIP {\n\t\t\tcontinue // skip validation as cmd is paused on that node\n\t\t}\n\t\tvar ntpServers []string\n\t\tif ip == ntpObj.ntpLeaderIP {\n\t\t\tntpServers = ntpObj.externalNtpServers\n\t\t} else {\n\t\t\tntpServers = []string{ntpObj.ntpLeaderIP}\n\t\t}\n\n\t\tEventually(func() bool {\n\t\t\tntpConf := ts.tu.CommandOutput(ip, \"bash -c 'if [ -f /etc/pensando/pen-ntp/chrony.conf ] ; then cat /etc/pensando/pen-ntp/chrony.conf; fi' \")\n\t\t\tif strings.Count(ntpConf, \"server \") == len(ntpServers) {\n\t\t\t\tfor _, ntpServer := range ntpServers {\n\t\t\t\t\tif strings.Index(ntpConf, \"server \"+ntpServer+\" iburst\") == -1 {\n\t\t\t\t\t\tBy(fmt.Sprintf(\"%v not present in config. found %v\", ntpServer, ntpConf))\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tBy(fmt.Sprintf(\"ntpserver: %v ntpconf: %v\", ntpServers, ntpConf))\n\t\t\treturn false\n\t\t}, 75, 5).Should(BeTrue(), \"NTP servers for %v quorum node should be %v\", qnode, ntpServers)\n\t}\n}", "func IsNodeCordoned(node *v1.Node) (bool, time.Time) {\n\tif node.Spec.Unschedulable {\n\t\tfor _, taint := range node.Spec.Taints {\n\t\t\tif taint.Key == v1.TaintNodeUnschedulable {\n\t\t\t\tif taint.TimeAdded != nil {\n\t\t\t\t\treturn true, taint.TimeAdded.Time\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn true, time.Time{}\n\t}\n\treturn false, time.Time{}\n}", "func ValidateClusterSpec(spec *kubermaticv1.ClusterSpec, dc *kubermaticv1.Datacenter, enabledFeatures features.FeatureGate, versionManager *version.Manager, currentVersion *semver.Semver, parentFieldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tif spec.HumanReadableName == \"\" {\n\t\tallErrs = append(allErrs, field.Required(parentFieldPath.Child(\"humanReadableName\"), \"no name specified\"))\n\t}\n\n\tif err := ValidateVersion(spec, versionManager, currentVersion, parentFieldPath.Child(\"version\")); err != nil {\n\t\tallErrs = append(allErrs, err)\n\t}\n\n\t// Validate if container runtime is valid for this cluster (in particular this checks for docker support).\n\tif err := ValidateContainerRuntime(spec); err != nil {\n\t\tallErrs = append(allErrs, field.Invalid(parentFieldPath.Child(\"containerRuntime\"), spec.ContainerRuntime, fmt.Sprintf(\"failed to validate container runtime: %s\", err)))\n\t}\n\n\tif !kubermaticv1.AllExposeStrategies.Has(spec.ExposeStrategy) {\n\t\tallErrs = append(allErrs, field.NotSupported(parentFieldPath.Child(\"exposeStrategy\"), spec.ExposeStrategy, kubermaticv1.AllExposeStrategies.Items()))\n\t}\n\n\t// Validate APIServerAllowedIPRanges for LoadBalancer expose strategy\n\tif spec.ExposeStrategy != kubermaticv1.ExposeStrategyLoadBalancer && spec.APIServerAllowedIPRanges != nil && len(spec.APIServerAllowedIPRanges.CIDRBlocks) > 0 {\n\t\tallErrs = append(allErrs, field.Forbidden(parentFieldPath.Child(\"APIServerAllowedIPRanges\"), \"Access control for API server is supported only for LoadBalancer expose strategy\"))\n\t}\n\n\t// Validate TunnelingAgentIP for Tunneling Expose strategy\n\tif spec.ExposeStrategy != kubermaticv1.ExposeStrategyTunneling && spec.ClusterNetwork.TunnelingAgentIP != \"\" {\n\t\tallErrs = append(allErrs, field.Forbidden(parentFieldPath.Child(\"TunnelingAgentIP\"), \"Tunneling agent IP can be configured only for Tunneling Expose strategy\"))\n\t}\n\n\t// External CCM is not supported for all providers and all Kubernetes versions.\n\tif spec.Features[kubermaticv1.ClusterFeatureExternalCloudProvider] {\n\t\tif !resources.ExternalCloudControllerFeatureSupported(dc, &spec.Cloud, spec.Version, versionManager.GetIncompatibilities()...) {\n\t\t\tallErrs = append(allErrs, field.Invalid(parentFieldPath.Child(\"features\").Key(kubermaticv1.ClusterFeatureExternalCloudProvider), true, \"external cloud-controller-manager is not supported for this cluster / provider combination\"))\n\t\t}\n\t}\n\n\tif spec.CNIPlugin != nil {\n\t\tif !cni.GetSupportedCNIPlugins().Has(spec.CNIPlugin.Type.String()) {\n\t\t\tallErrs = append(allErrs, field.NotSupported(parentFieldPath.Child(\"cniPlugin\", \"type\"), spec.CNIPlugin.Type.String(), sets.List(cni.GetSupportedCNIPlugins())))\n\t\t} else if versions, err := cni.GetAllowedCNIPluginVersions(spec.CNIPlugin.Type); err != nil || !versions.Has(spec.CNIPlugin.Version) {\n\t\t\tallErrs = append(allErrs, field.NotSupported(parentFieldPath.Child(\"cniPlugin\", \"version\"), spec.CNIPlugin.Version, sets.List(versions)))\n\t\t}\n\n\t\t// Dual-stack is not supported on Canal < v3.22\n\t\tif spec.ClusterNetwork.IPFamily == kubermaticv1.IPFamilyDualStack && spec.CNIPlugin.Type == kubermaticv1.CNIPluginTypeCanal {\n\t\t\tgte322Constraint, _ := semverlib.NewConstraint(\">= 3.22\")\n\t\t\tcniVer, _ := semverlib.NewVersion(spec.CNIPlugin.Version)\n\t\t\tif cniVer != nil && !gte322Constraint.Check(cniVer) {\n\t\t\t\tallErrs = append(allErrs, field.Forbidden(parentFieldPath.Child(\"cniPlugin\"), \"dual-stack not allowed on Canal CNI version lower than 3.22\"))\n\t\t\t}\n\t\t}\n\t}\n\n\tallErrs = append(allErrs, ValidateLeaderElectionSettings(&spec.ComponentsOverride.ControllerManager.LeaderElectionSettings, parentFieldPath.Child(\"componentsOverride\", \"controllerManager\", \"leaderElection\"))...)\n\tallErrs = append(allErrs, ValidateLeaderElectionSettings(&spec.ComponentsOverride.Scheduler.LeaderElectionSettings, parentFieldPath.Child(\"componentsOverride\", \"scheduler\", \"leaderElection\"))...)\n\n\texternalCCM := false\n\tif val, ok := spec.Features[kubermaticv1.ClusterFeatureExternalCloudProvider]; ok {\n\t\texternalCCM = val\n\t}\n\n\t// general cloud spec logic\n\tif errs := ValidateCloudSpec(spec.Cloud, dc, spec.ClusterNetwork.IPFamily, parentFieldPath.Child(\"cloud\"), externalCCM); len(errs) > 0 {\n\t\tallErrs = append(allErrs, errs...)\n\t}\n\n\tif errs := validateMachineNetworksFromClusterSpec(spec, parentFieldPath); len(errs) > 0 {\n\t\tallErrs = append(allErrs, errs...)\n\t}\n\n\tif errs := ValidateClusterNetworkConfig(&spec.ClusterNetwork, dc, spec.CNIPlugin, parentFieldPath.Child(\"networkConfig\")); len(errs) > 0 {\n\t\tallErrs = append(allErrs, errs...)\n\t}\n\n\tportRangeFld := field.NewPath(\"componentsOverride\", \"apiserver\", \"nodePortRange\")\n\tif err := ValidateNodePortRange(spec.ComponentsOverride.Apiserver.NodePortRange, portRangeFld); err != nil {\n\t\tallErrs = append(allErrs, err)\n\t}\n\n\tif errs := validateEncryptionConfiguration(spec, parentFieldPath.Child(\"encryptionConfiguration\")); len(errs) > 0 {\n\t\tallErrs = append(allErrs, errs...)\n\t}\n\n\treturn allErrs\n}", "func (manager *MetricsCacheManager) IsSystemInfoMetricsValid() bool {\n\tretention := manager.GetRetention()\n\n\tmanager.systemInfoMetricsMtx.RLock()\n\tdefer manager.systemInfoMetricsMtx.RUnlock()\n\n\treturn (!manager.systemInfoMetricsInvalid) &&\n\t\t(manager.systemInfoMetrics != nil) &&\n\t\t(time.Since(manager.systemInfoMetricsLastUpdatedTime) < retention)\n}", "func (r *Reservation) Validate() bool {\n\tr.Errors = make(map[string]string)\n\n\tif r.Start >= r.End {\n\t\tr.Errors[\"End\"] = \"End Time must be greater than Start Time\"\n\t}\n\n\tsession, err := mgo.Dial(os.Getenv(\"MONGODB_URI\"))\n\tutil.Check(err)\n\tdefer session.Close()\n\tc := session.DB(os.Getenv(\"MONGODB_DB\")).C(COLLECTION)\n\tvar results []Reservation\n\terr = c.Find(bson.M{\"month\": r.Month, \"day\": r.Day, \"year\": r.Year, \"location\": r.Location}).All(&results)\n\tutil.Check(err)\n\tfor _, reservation := range results {\n\t\tif r.End <= reservation.Start {\n\t\t\tcontinue\n\t\t}\n\t\tif r.Start >= reservation.End {\n\t\t\tcontinue\n\t\t}\n\t\ts := fmt.Sprintf(\"Reservation already booked for %s on %s from %s - %s\", reservation.Location.Name, reservation.Date(), reservation.StartTime(), reservation.EndTime())\n\t\tid := fmt.Sprintf(\"%d\", reservation.Id)\n\t\tr.Errors[id] = s\n\t}\n\n\treturn len(r.Errors) == 0\n}", "func IsNodeBeingDeleted(node *v1.Node, cl client.Client) (bool, error) {\n\t// check if node is managed by a cluster API machine and if the machine is marked for deletion\n\tif machineName, present := node.Annotations[constants.AnnotationClusterAPIMachine]; present && len(machineName) > 0 {\n\t\tmachine := &cluster_v1alpha1.Machine{}\n\t\terr := cl.Get(context.TODO(), client.ObjectKey{Name: machineName, Namespace: \"default\"}, machine)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"failed to get machine: default/%s due to: %v\", machineName, err)\n\t\t}\n\n\t\tif machine.GetDeletionTimestamp() != nil {\n\t\t\tlogrus.Debugf(\"machine: %s is being deleted. timestamp set: %v.\",\n\t\t\t\tmachineName, machine.GetDeletionTimestamp())\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "func CheckRouteRule(routeRule IstioObject, namespace string, serviceName string, version string) bool {\n\tif routeRule == nil || routeRule.GetSpec() == nil {\n\t\treturn false\n\t}\n\tif FilterByDestination(routeRule.GetSpec(), namespace, serviceName, version) {\n\t\t// RouteRule defines a version in the DestinationWeight\n\t\tif routes, ok := routeRule.GetSpec()[\"route\"]; ok {\n\t\t\tif dRoutes, ok := routes.([]interface{}); ok {\n\t\t\t\tfor _, route := range dRoutes {\n\t\t\t\t\tif dRoute, ok := route.(map[string]interface{}); ok {\n\t\t\t\t\t\tif labels, ok := dRoute[\"labels\"]; ok {\n\t\t\t\t\t\t\tif dLabels, ok := labels.(map[string]interface{}); ok {\n\t\t\t\t\t\t\t\tif versionValue, ok := dLabels[\"version\"]; ok && versionValue == version {\n\t\t\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func validateNodeAffinity(na *core.NodeAffinity, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\t// TODO: Uncomment the next three lines once RequiredDuringSchedulingRequiredDuringExecution is implemented.\n\t// if na.RequiredDuringSchedulingRequiredDuringExecution != nil {\n\t//\tallErrs = append(allErrs, ValidateNodeSelector(na.RequiredDuringSchedulingRequiredDuringExecution, fldPath.Child(\"requiredDuringSchedulingRequiredDuringExecution\"))...)\n\t// }\n\tif na.RequiredDuringSchedulingIgnoredDuringExecution != nil {\n\t\tallErrs = append(allErrs, ValidateNodeSelector(na.RequiredDuringSchedulingIgnoredDuringExecution, fldPath.Child(\"requiredDuringSchedulingIgnoredDuringExecution\"))...)\n\t}\n\tif len(na.PreferredDuringSchedulingIgnoredDuringExecution) > 0 {\n\t\tallErrs = append(allErrs, ValidatePreferredSchedulingTerms(na.PreferredDuringSchedulingIgnoredDuringExecution, fldPath.Child(\"preferredDuringSchedulingIgnoredDuringExecution\"))...)\n\t}\n\treturn allErrs\n}", "func (m *Node) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif !_Node_Host_Pattern.MatchString(m.GetHost()) {\n\t\treturn NodeValidationError{\n\t\t\tfield: \"Host\",\n\t\t\treason: \"value does not match regex pattern \\\"^\\\\\\\\*?[0-9a-zA-Z-._]+$\\\"\",\n\t\t}\n\t}\n\n\tif val := m.GetPort(); val < 1 || val > 65535 {\n\t\treturn NodeValidationError{\n\t\t\tfield: \"Port\",\n\t\t\treason: \"value must be inside range [1, 65535]\",\n\t\t}\n\t}\n\n\tif m.GetWeight() < 0 {\n\t\treturn NodeValidationError{\n\t\t\tfield: \"Weight\",\n\t\t\treason: \"value must be greater than or equal to 0\",\n\t\t}\n\t}\n\n\tfor key, val := range m.GetMetadata() {\n\t\t_ = val\n\n\t\t// no validation rules for Metadata[key]\n\n\t\tif v, ok := interface{}(val).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn NodeValidationError{\n\t\t\t\t\tfield: fmt.Sprintf(\"Metadata[%v]\", key),\n\t\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\t\tcause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func (f *FilterRouter) ValidRouter(router string) (bool, map[string]string) {\n\tisok, params := f.tree.Match(router)\n\tif isok == nil {\n\t\treturn false, nil\n\t}\n\tif isok, ok := isok.(bool); ok {\n\t\treturn isok, params\n\t} else {\n\t\treturn false, nil\n\t}\n}", "func IsReplicaRebuildingFailed(reusableFailedReplica *longhorn.Replica) bool {\n\treplicaRebuildFailedCondition := types.GetCondition(reusableFailedReplica.Status.Conditions, longhorn.ReplicaConditionTypeRebuildFailed)\n\n\tif replicaRebuildFailedCondition.Status != longhorn.ConditionStatusTrue {\n\t\treturn true\n\t}\n\n\tswitch replicaRebuildFailedCondition.Reason {\n\tcase longhorn.ReplicaConditionReasonRebuildFailedDisconnection, longhorn.NodeConditionReasonManagerPodDown, longhorn.NodeConditionReasonKubernetesNodeGone, longhorn.NodeConditionReasonKubernetesNodeNotReady:\n\t\treturn false\n\tdefault:\n\t\treturn true\n\t}\n}", "func (o *V0037JobProperties) HasSocketsPerNode() bool {\n\tif o != nil && o.SocketsPerNode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *socatManager) ValidHost(host string) bool {\n\t_, err := getSource(host)\n\treturn err == nil\n}", "func (m *DrivesDriveFirmwareNodeDrive) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (o *V0037JobProperties) GetSocketsPerNodeOk() (*int32, bool) {\n\tif o == nil || o.SocketsPerNode == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SocketsPerNode, true\n}", "func (tc *TestConfig) IsValid() bool {\n\treturn tc.APIConfig != nil && tc.err == nil\n}", "func (o *CreateTemplateRequestEntity) HasDisconnectedNodeAcknowledged() bool {\n\tif o != nil && o.DisconnectedNodeAcknowledged != nil {\n\t\treturn true\n\t}\n\n\treturn false\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 (t *OnfSwitchModel_SwitchModel_Port) ΛValidate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"OnfSwitchModel_SwitchModel_Port\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func isNodeValid(newNode, oldNode Node) bool {\n\t// if oldBlock.Index+1 != newBlock.Index {\n\t// \treturn false\n\t// }\n\n\t// Do a BFS and get the nodes attached to the newNode\n\tif oldNode.Hash != newNode.PrevLeftHash {\n\t\treturn false\n\t}\n\t// if PrevRightNode.Hash != newNode.PrevRightHash {\n\t// \treturn false\n\t// }\n\n\tif calculateHash(newNode) != newNode.Hash {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func ignoreNodeForTopologyAwareHints(node *corev1.Node) bool {\n\treturn nodeHasExcludedLabels(node.Labels) || !nodeIsReady(node.Status)\n}", "func (conf *Config) IsSwarmCompatible() error {\n\tif conf.LiveRestoreEnabled {\n\t\treturn fmt.Errorf(\"--live-restore daemon configuration is incompatible with swarm mode\")\n\t}\n\treturn nil\n}", "func ensureTopologyRequirements(ctx context.Context, nodeSelection *e2epod.NodeSelection, cs clientset.Interface, driverInfo *storageframework.DriverInfo, minCount int) error {\n\tnodes, err := e2enode.GetReadySchedulableNodes(ctx, cs)\n\tframework.ExpectNoError(err)\n\tif len(nodes.Items) < minCount {\n\t\te2eskipper.Skipf(fmt.Sprintf(\"Number of available nodes is less than %d - skipping\", minCount))\n\t}\n\n\ttopologyKeys := driverInfo.TopologyKeys\n\tif len(topologyKeys) == 0 {\n\t\t// The driver does not have any topology restrictions\n\t\treturn nil\n\t}\n\n\ttopologyList, topologyCount, err := getCurrentTopologiesNumber(cs, nodes, topologyKeys)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsuitableTopologies := []topology{}\n\tfor i, topo := range topologyList {\n\t\tif topologyCount[i] >= minCount {\n\t\t\tsuitableTopologies = append(suitableTopologies, topo)\n\t\t}\n\t}\n\tif len(suitableTopologies) == 0 {\n\t\te2eskipper.Skipf(\"No topology with at least %d nodes found - skipping\", minCount)\n\t}\n\t// Take the first suitable topology\n\te2epod.SetNodeAffinityTopologyRequirement(nodeSelection, suitableTopologies[0])\n\treturn nil\n}", "func CreateNodeResourceTopologies(ctx context.Context, extClient extclient.Interface) (*apiextensionsv1.CustomResourceDefinition, error) {\n\tcrd, err := NewNodeResourceTopologies()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Delete existing CRD (if any) with this we also get rid of stale objects\n\terr = extClient.ApiextensionsV1().CustomResourceDefinitions().Delete(ctx, crd.Name, metav1.DeleteOptions{})\n\tif err != nil && !errors.IsNotFound(err) {\n\t\treturn nil, fmt.Errorf(\"failed to delete NodeResourceTopology CRD: %w\", err)\n\t}\n\n\t// It takes time for the delete operation, wait until the CRD completely gone\n\tif err = wait.PollUntilContextTimeout(ctx, 5*time.Second, 1*time.Minute, true, func(ctx context.Context) (bool, error) {\n\t\t_, err = extClient.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, crd.Name, metav1.GetOptions{})\n\t\tif err == nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, err\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get NodeResourceTopology CRD: %w\", err)\n\t}\n\treturn extClient.ApiextensionsV1().CustomResourceDefinitions().Create(ctx, crd, metav1.CreateOptions{})\n}", "func (s *service) checkIfNodeIsConnected(ctx context.Context, arrayID string, nodeID string, rep *podmon.ValidateVolumeHostConnectivityResponse) error {\n\tctx, log, _ := GetRunidLog(ctx)\n\tlog.Infof(\"Checking if array %s is connected to node %s\", arrayID, nodeID)\n\tvar message string\n\trep.Connected = false\n\n\t// Initialize the Unity client to the 'arrayId' array\n\tctx, _ = setArrayIDContext(ctx, arrayID)\n\tunity, err := GetUnityClient(ctx, s, arrayID)\n\tif err != nil {\n\t\tmessage = fmt.Sprintf(\"Unable to get unity client for topology validation: %v\", err)\n\t\tlog.Info(message)\n\t\trep.Messages = append(rep.Messages, message)\n\t\treturn err\n\t}\n\n\t// Look up the 'nodeId' host on the array\n\thostnames := strings.Split(nodeID, \",\")\n\tshortName := hostnames[0]\n\tlongName := shortName\n\tif len(hostnames) > 1 {\n\t\tlongName = hostnames[1]\n\t}\n\thost, err := GetHostID(ctx, s, arrayID, shortName, longName)\n\tif err != nil {\n\t\tif status.Code(err) == codes.NotFound {\n\t\t\tmessage = fmt.Sprintf(\"Array %s does have any host with name '%s'\", arrayID, nodeID)\n\t\t} else {\n\t\t\tmessage = fmt.Sprintf(\"Host lookup failed. Error: %v\", err)\n\t\t}\n\t\tlog.Infof(message)\n\t\trep.Messages = append(rep.Messages, message)\n\t\trep.Connected = false\n\t\treturn nil\n\t}\n\n\t// Search in the list of FC initiators (if any)\n\tfcConnectivity := false\n\tif host != nil && len(host.HostContent.FcInitiators) != 0 {\n\t\tlog.Infof(\"Got FC Initiators, Checking health of initiators:%s\", host.HostContent.FcInitiators)\n\t\tfor _, initiator := range host.HostContent.FcInitiators {\n\t\t\tinitiatorID := initiator.ID\n\t\t\thostInitiator, err := FindHostInitiatorByID(ctx, unity, initiatorID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Infof(\"Unable to get initiators: %s\", err)\n\t\t\t}\n\t\t\tif hostInitiator != nil {\n\t\t\t\thealthContent := hostInitiator.HostInitiatorContent.Health\n\t\t\t\tif healthContent.DescriptionIDs[0] == componentOkMessage {\n\t\t\t\t\tmessage = fmt.Sprintf(\"FC Health is good for array:%s, Health:%s\", arrayID, healthContent.DescriptionIDs[0])\n\t\t\t\t\tlog.Infof(message)\n\t\t\t\t\trep.Messages = append(rep.Messages, message)\n\t\t\t\t\trep.Connected = true\n\t\t\t\t\tfcConnectivity = true\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tlog.Infof(\"FC Health is bad for array:%s, Health:%s\", arrayID, healthContent.DescriptionIDs[0])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Search in the list of iSCSI initiators (if any) and there is no connectivity seen through FC\n\tif host != nil && len(host.HostContent.IscsiInitiators) != 0 && !fcConnectivity {\n\t\tlog.Infof(\"Got iSCSI Initiators, Checking health of initiators:%s\", host.HostContent.IscsiInitiators)\n\t\tfor _, initiator := range host.HostContent.IscsiInitiators {\n\t\t\tinitiatorID := initiator.ID\n\t\t\thostInitiator, err := FindHostInitiatorByID(ctx, unity, initiatorID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Infof(\"Unable to get initiators: %s\", err)\n\t\t\t}\n\t\t\tif hostInitiator != nil {\n\t\t\t\thealthContent := hostInitiator.HostInitiatorContent.Health\n\t\t\t\tif healthContent.DescriptionIDs[0] == componentOkMessage {\n\t\t\t\t\tmessage = fmt.Sprintf(\"iSCSI Health is good for array:%s, Health:%s\", arrayID, healthContent.DescriptionIDs[0])\n\t\t\t\t\tlog.Infof(message)\n\t\t\t\t\trep.Messages = append(rep.Messages, message)\n\t\t\t\t\trep.Connected = true\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tlog.Infof(\"iSCSI Health is bad for array:%s, Health:%s\", arrayID, healthContent.DescriptionIDs[0])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\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 (s *OpenconfigOfficeAp_System_TelnetServer) Validate() error {\n\tif err := ytypes.Validate(SchemaTree[\"OpenconfigOfficeAp_System_TelnetServer\"], s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func IsComponentEnabledInSpec(componentName ComponentName, controlPlaneSpec *v1alpha1.IstioOperatorSpec) (bool, error) {\n\tif componentName == IngressComponentName {\n\t\treturn len(controlPlaneSpec.Components.IngressGateways) != 0, nil\n\t}\n\tif componentName == EgressComponentName {\n\t\treturn len(controlPlaneSpec.Components.EgressGateways) != 0, nil\n\t}\n\n\tcomponentNodeI, found, err := tpath.GetFromStructPath(controlPlaneSpec, \"Components.\"+string(componentName)+\".Enabled\")\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"error in IsComponentEnabledInSpec GetFromStructPath componentEnabled for component=%s: %s\",\n\t\t\tcomponentName, err)\n\t}\n\tif !found || componentNodeI == nil {\n\t\treturn false, nil\n\t}\n\tcomponentNode, ok := componentNodeI.(*v1alpha1.BoolValueForPB)\n\tif !ok {\n\t\treturn false, fmt.Errorf(\"component %s enabled has bad type %T, expect *v1alpha2.BoolValueForPB\", componentName, componentNodeI)\n\t}\n\tif componentNode == nil {\n\t\treturn false, nil\n\t}\n\treturn componentNode.Value, nil\n}", "func (t *OnfSwitch_Switch_State) ΛValidate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"OnfSwitch_Switch_State\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (m *Maps) ValidCoordinate(c types.Coordinate) bool {\n\treturn c.X < width && c.X >= 0 && c.Y < height && c.Y >= 0\n}", "func IsNodeSchedulable(node *v1.Node) bool {\n\tif node == nil {\n\t\treturn false\n\t}\n\treturn !node.Spec.Unschedulable && IsNodeReady(node)\n}", "func (b *PodAffinityTermApplyConfiguration) WithTopologyKey(value string) *PodAffinityTermApplyConfiguration {\n\tb.TopologyKey = &value\n\treturn b\n}", "func (h *FriendlyHost) Valid() bool {\n\treturn svchost.IsValid(h.Raw)\n}", "func (conf *Config) IsSwarmCompatible() error {\n\tif conf.ClusterStore != \"\" || conf.ClusterAdvertise != \"\" {\n\t\treturn fmt.Errorf(\"--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode\")\n\t}\n\tif conf.LiveRestoreEnabled {\n\t\treturn fmt.Errorf(\"--live-restore daemon configuration is incompatible with swarm mode\")\n\t}\n\treturn nil\n}", "func (o DrillSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DrillSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (l *LoginReqModel) IsOTTValid() error {\n\t// 1. Checking if it is even a number\n\t_, toIntErr := strconv.Atoi(l.OTT)\n\tif toIntErr != nil {\n\t\treturn errors.New(\"Cannot convert OTT to number\")\n\t}\n\t// 2. Cheking hour range\n\thourStr := l.OTT[0:2]\n\thourNum, _ := strconv.Atoi(hourStr)\n\tif hourNum < 0 || hourNum > 23 {\n\t\treturn errors.New(\"OTT hour not in range\")\n\t}\n\t// 3. Cheking minute range\n\tminuteStr := l.OTT[2:4]\n\tminuteNum, _ := strconv.Atoi(minuteStr)\n\tif hourNum < 0 || hourNum > 59 {\n\t\treturn errors.New(\"OTT minute not in range\")\n\t}\n\tl.Hour = uint8(hourNum)\n\tl.Minute = uint8(minuteNum)\n\treturn nil\n}", "func isNodeCapable(pod *v1.Pod, node v1.Node) (bool, []string, error) {\n\tfits := true\n\tfailReasons := []string{}\n\tfor _, predicateKey := range predicatesEvalOrderStore {\n\t\tfit, failures, err := predicatesFuncMap[predicateKey](pod, node)\n\t\tif err != nil {\n\t\t\treturn false, nil, err\n\t\t}\n\t\tfits = fits && fit\n\t\tfailReasons = append(failReasons, failures...)\n\t}\n\treturn fits, failReasons, nil\n}", "func (n *Node) Ready() bool {\n\t// Nodes that are not leaders will not have WireGuardIPs, so it is not required.\n\treturn n != nil && n.Endpoint != nil && !(n.Endpoint.IP == nil && n.Endpoint.DNS == \"\") && n.Endpoint.Port != 0 && n.Key != nil && n.InternalIP != nil && n.Subnet != nil && time.Now().Unix()-n.LastSeen < int64(resyncPeriod)*2/int64(time.Second)\n}", "func (d *portworx) IsNodeOutOfMaintenance(n node.Node) (bool, error) {\n\tstNode, err := d.GetDriverNode(&n)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif stNode.Status == api.Status_STATUS_OK {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (o DrillSpecPodConfigPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecutionOutput) TopologyKey() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DrillSpecPodConfigPodSchedulingAffinityPodAffinityRequiredDuringSchedulingIgnoredDuringExecution) string {\n\t\treturn v.TopologyKey\n\t}).(pulumi.StringOutput)\n}", "func (t *Tensor) IsValid() bool {\n\tif DimProduct(t.Dims) != int64(len(t.Buffer)/int(DtypeSize[t.Dtype])) {\n\t\treturn false\n\t}\n\treturn true\n}", "func (t *OpenconfigSystem_System_TelnetServer) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"OpenconfigSystem_System_TelnetServer\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}" ]
[ "0.61786824", "0.5564089", "0.5552909", "0.5381619", "0.50309676", "0.50297743", "0.5022979", "0.49563727", "0.49521244", "0.48063827", "0.47571453", "0.47314247", "0.4716992", "0.47108042", "0.4706679", "0.4685612", "0.4675897", "0.4675828", "0.46655697", "0.46429", "0.46191123", "0.4601381", "0.45890528", "0.45577574", "0.45546725", "0.44967118", "0.44962296", "0.44797787", "0.44695377", "0.44286942", "0.44273803", "0.442079", "0.44164336", "0.44164336", "0.43845984", "0.43741018", "0.43331048", "0.43275872", "0.43178424", "0.4317397", "0.4299714", "0.42965138", "0.4289519", "0.42862502", "0.42796874", "0.42642862", "0.42612374", "0.42604747", "0.42562532", "0.42334598", "0.42268735", "0.42250773", "0.4221504", "0.42167228", "0.42129126", "0.42072064", "0.4204843", "0.4198752", "0.41889718", "0.41889256", "0.4186641", "0.4181476", "0.4178169", "0.41747123", "0.41737473", "0.41733915", "0.41703606", "0.41622043", "0.41614306", "0.41595975", "0.41555503", "0.41547754", "0.4152608", "0.4146865", "0.4145915", "0.41440204", "0.41424534", "0.414032", "0.41228187", "0.4119236", "0.41184258", "0.41172996", "0.41127288", "0.41125068", "0.4112484", "0.4111", "0.41096413", "0.41057065", "0.41055194", "0.41045254", "0.4103285", "0.40980384", "0.40961263", "0.409173", "0.40894514", "0.40838", "0.40832978", "0.40806642", "0.4072926", "0.40712407" ]
0.8106002
0
ParseSoftwareAttribute parses the bytes into a SoftwareAttribute instance.
ParseSoftwareAttribute парсит байты в экземпляр SoftwareAttribute.
func ParseSoftwareAttribute(r *read.BigEndian, l uint16) (SoftwareAttribute, error) { sw, err := Read127CharString(r, l) return SoftwareAttribute{sw}, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ParseAttribute(b []byte) (Attribute, error) {\n\tif len(b) < 22 {\n\t\treturn Attribute{}, fmt.Errorf(\"attribute data should be at least 22 bytes but is %d\", len(b))\n\t}\n\n\tr := binutil.NewLittleEndianReader(b)\n\n\tnameLength := r.Byte(0x09)\n\tnameOffset := r.Uint16(0x0A)\n\n\tname := \"\"\n\tif nameLength != 0 {\n\t\tnameBytes := r.Read(int(nameOffset), int(nameLength)*2)\n\t\tname = utf16.DecodeString(nameBytes, binary.LittleEndian)\n\t}\n\n\tresident := r.Byte(0x08) == 0x00\n\tvar attributeData []byte\n\tactualSize := uint64(0)\n\tallocatedSize := uint64(0)\n\tif resident {\n\t\tdataOffset := int(r.Uint16(0x14))\n\t\tuDataLength := r.Uint32(0x10)\n\t\tif int64(uDataLength) > maxInt {\n\t\t\treturn Attribute{}, fmt.Errorf(\"attribute data length %d overflows maximum int value %d\", uDataLength, maxInt)\n\t\t}\n\t\tdataLength := int(uDataLength)\n\t\texpectedDataLength := dataOffset + dataLength\n\n\t\tif len(b) < expectedDataLength {\n\t\t\treturn Attribute{}, fmt.Errorf(\"expected attribute data length to be at least %d but is %d\", expectedDataLength, len(b))\n\t\t}\n\n\t\tattributeData = r.Read(dataOffset, dataLength)\n\t} else {\n\t\tdataOffset := int(r.Uint16(0x20))\n\t\tif len(b) < dataOffset {\n\t\t\treturn Attribute{}, fmt.Errorf(\"expected attribute data length to be at least %d but is %d\", dataOffset, len(b))\n\t\t}\n\t\tallocatedSize = r.Uint64(0x28)\n\t\tactualSize = r.Uint64(0x30)\n\t\tattributeData = r.ReadFrom(int(dataOffset))\n\t}\n\n\treturn Attribute{\n\t\tType: AttributeType(r.Uint32(0)),\n\t\tResident: resident,\n\t\tName: name,\n\t\tFlags: AttributeFlags(r.Uint16(0x0C)),\n\t\tAttributeId: int(r.Uint16(0x0E)),\n\t\tAllocatedSize: allocatedSize,\n\t\tActualSize: actualSize,\n\t\tData: binutil.Duplicate(attributeData),\n\t}, nil\n}", "func parseAttribute(line string) Attribute {\n\tif !strings.HasPrefix(line, AttributeCommentPrefix) {\n\t\treturn nil\n\t}\n\tline = strings.TrimSpace(line[len(AttributeCommentPrefix):])\n\tcolon := strings.IndexRune(line, ':')\n\tvar key, value string\n\tif colon == -1 {\n\t\tkey = line\n\t} else {\n\t\tkey, value = line[:colon], line[colon+1:]\n\t}\n\tswitch key {\n\tcase \"linkage\":\n\t\treturn parseLinkageAttribute(value)\n\tcase \"name\":\n\t\treturn nameAttribute(strings.TrimSpace(value))\n\tcase \"thread_local\":\n\t\treturn tlsAttribute{}\n\tdefault:\n\t\t// FIXME decide what to do here. return error? log warning?\n\t\tpanic(\"unknown attribute key: \" + key)\n\t}\n\treturn nil\n}", "func (c *StickersCreateStickerSetRequest) SetSoftware(value string) {\n\tc.Flags.Set(3)\n\tc.Software = value\n}", "func ParseAttributes(b []byte) ([]Attribute, error) {\n\tif len(b) == 0 {\n\t\treturn []Attribute{}, nil\n\t}\n\tattributes := make([]Attribute, 0)\n\tfor len(b) > 0 {\n\t\tif len(b) < 4 {\n\t\t\treturn nil, fmt.Errorf(\"attribute header data should be at least 4 bytes but is %d\", len(b))\n\t\t}\n\n\t\tr := binutil.NewLittleEndianReader(b)\n\t\tattrType := r.Uint32(0)\n\t\tif attrType == uint32(AttributeTypeTerminator) {\n\t\t\tbreak\n\t\t}\n\n\t\tif len(b) < 8 {\n\t\t\treturn nil, fmt.Errorf(\"cannot read attribute header record length, data should be at least 8 bytes but is %d\", len(b))\n\t\t}\n\n\t\tuRecordLength := r.Uint32(0x04)\n\t\tif int64(uRecordLength) > maxInt {\n\t\t\treturn nil, fmt.Errorf(\"record length %d overflows maximum int value %d\", uRecordLength, maxInt)\n\t\t}\n\t\trecordLength := int(uRecordLength)\n\t\tif recordLength <= 0 {\n\t\t\treturn nil, fmt.Errorf(\"cannot handle attribute with zero or negative record length %d\", recordLength)\n\t\t}\n\n\t\tif recordLength > len(b) {\n\t\t\treturn nil, fmt.Errorf(\"attribute record length %d exceeds data length %d\", recordLength, len(b))\n\t\t}\n\n\t\trecordData := r.Read(0, recordLength)\n\t\tattribute, err := ParseAttribute(recordData)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattributes = append(attributes, attribute)\n\t\tb = r.ReadFrom(recordLength)\n\t}\n\treturn attributes, nil\n}", "func parseFamily(b []byte) (Family, error) {\n\tad, err := netlink.NewAttributeDecoder(b)\n\tif err != nil {\n\t\treturn Family{}, err\n\t}\n\n\tvar f Family\n\tfor ad.Next() {\n\t\tswitch ad.Type() {\n\t\tcase unix.CTRL_ATTR_FAMILY_ID:\n\t\t\tf.ID = ad.Uint16()\n\t\tcase unix.CTRL_ATTR_FAMILY_NAME:\n\t\t\tf.Name = ad.String()\n\t\tcase unix.CTRL_ATTR_VERSION:\n\t\t\tv := ad.Uint32()\n\t\t\tif v > math.MaxUint8 {\n\t\t\t\treturn Family{}, errInvalidFamilyVersion\n\t\t\t}\n\n\t\t\tf.Version = uint8(v)\n\t\tcase unix.CTRL_ATTR_MCAST_GROUPS:\n\t\t\tad.Nested(parseMulticastGroups(&f.Groups))\n\t\t}\n\t}\n\n\tif err := ad.Err(); err != nil {\n\t\treturn Family{}, err\n\t}\n\n\treturn f, nil\n}", "func (setattr *FuseSetattrIn) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, setattr)\n\n\treturn err\n}", "func parseStationInfo(b []byte) (*StationInfo, error) {\n\tattrs, err := netlink.UnmarshalAttributes(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar info StationInfo\n\tfor _, a := range attrs {\n\t\tswitch a.Type {\n\t\tcase unix.NL80211_ATTR_MAC:\n\t\t\tinfo.HardwareAddr = net.HardwareAddr(a.Data)\n\t\tcase unix.NL80211_ATTR_STA_INFO:\n\t\t\tnattrs, err := netlink.UnmarshalAttributes(a.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif err := (&info).parseAttributes(nattrs); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// Parsed the necessary data.\n\t\t\treturn &info, nil\n\t\t}\n\t}\n\n\t// No station info found\n\treturn nil, os.ErrNotExist\n}", "func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) {\n\tsoftIRQStat := SoftIRQStat{}\n\tvar total uint64\n\tvar prefix string\n\n\t_, err := fmt.Sscanf(line, \"%s %d %d %d %d %d %d %d %d %d %d %d\",\n\t\t&prefix, &total,\n\t\t&softIRQStat.Hi, &softIRQStat.Timer, &softIRQStat.NetTx, &softIRQStat.NetRx,\n\t\t&softIRQStat.Block, &softIRQStat.BlockIoPoll,\n\t\t&softIRQStat.Tasklet, &softIRQStat.Sched,\n\t\t&softIRQStat.Hrtimer, &softIRQStat.Rcu)\n\n\tif err != nil {\n\t\treturn SoftIRQStat{}, 0, fmt.Errorf(\"couldn't parse %q (softirq): %w\", line, err)\n\t}\n\n\treturn softIRQStat, total, nil\n}", "func NewSoftware(software string) Software {\n\treturn Software(software)\n}", "func (removexattr *FuseRemovexattrIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\tif length > 0 {\n\t\tremovexattr.Name = string(bcontent[:length-1])\n\t}\n\n\treturn nil\n}", "func (i SNSPlatformApplicationAttribute) ParseByName(s string) (SNSPlatformApplicationAttribute, error) {\n\tif val, ok := _SNSPlatformApplicationAttributeNameToValueMap[s]; ok {\n\t\t// parse ok\n\t\treturn val, nil\n\t}\n\n\t// error\n\treturn -1, fmt.Errorf(\"Enum Name of %s Not Expected In SNSPlatformApplicationAttribute Values List\", s)\n}", "func DecodeAttribute(b []byte) (*Attribute, []byte, error) {\n\tif len(b) < SizeofRtAttr {\n\t\treturn nil, nil, netlink.ErrNoData\n\t}\n\n\tlength := *(*uint16)(unsafe.Pointer(&b[0:2][0]))\n\tif uint16(len(b)) < length ||\n\t\tlength < SizeofRtAttr {\n\t\treturn nil, b, netlink.ErrNoData\n\t}\n\n\ta := &Attribute{}\n\ta.Type = *(*uint16)(unsafe.Pointer(&b[2:4][0]))\n\tdata_len := int(length) - RTA_STRUCT_ALEN\n\ta.data = make([]byte, data_len)\n\tcopy(a.data, b[RTA_STRUCT_ALEN:length])\n\n\tr := netlink.Align(int(length), RTA_ALIGNTO)\n\treturn a, b[r:], nil\n}", "func ParseAttribute(v []byte, c *Candidate) error {\n\tp := candidateParser{\n\t\tbuf: v,\n\t\tc: c,\n\t}\n\terr := p.parse()\n\treturn err\n}", "func (attr *Attribute) UnmarshalBinary(data []byte) error {\n\t// Read the common portion of the attribute record header\n\tif err := attr.Header.UnmarshalBinary(data); err != nil {\n\t\treturn err\n\t}\n\n\t// Sanity check the record length\n\tif int(attr.Header.RecordLength) > len(data) {\n\t\treturn ErrTruncatedData\n\t}\n\n\t// For the sake of simple bounds checking below, restrict our working\n\t// data set to this record\n\tif len(data) > int(attr.Header.RecordLength) {\n\t\tdata = data[:attr.Header.RecordLength]\n\t}\n\n\t// Read the form-specific portion of the attribute record header\n\tformHeader := data[AttributeRecordHeaderLength:]\n\tif attr.Header.Resident() {\n\t\tif err := attr.Resident.UnmarshalBinary(formHeader); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif err := attr.Nonresident.UnmarshalBinary(formHeader); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Read the attribute name if it has one\n\tif attr.Header.NameLength > 0 {\n\t\tstart := int(attr.Header.NameOffset)\n\t\tlength := int(attr.Header.NameLength) * 2 // NameLength is in characters, assuming 16-bit unicode\n\t\tend := start + length\n\t\tif end > len(data) {\n\t\t\treturn ErrAttributeNameOutOfBounds\n\t\t}\n\t\tvar err error\n\t\tattr.Name, err = utf16ToString(data[start:end])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Read the attribute value if it's resident and nonzero\n\tif attr.Header.Resident() && attr.Resident.ValueLength > 0 {\n\t\tstart := int(attr.Resident.ValueOffset)\n\t\tlength := int(attr.Resident.ValueLength)\n\t\tend := start + length\n\t\tif end > len(data) {\n\t\t\treturn ErrAttributeValueOutOfBounds\n\t\t}\n\t\tattr.ResidentValue = make([]byte, length)\n\t\tcopy(attr.ResidentValue, data[start:end])\n\t}\n\n\treturn nil\n}", "func (getattr *FuseGetattrIn) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, getattr)\n\n\treturn err\n}", "func (setxattr *FuseSetxattrIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 8 {\n\t\treturn ErrDataLen\n\t}\n\n\tcommon.ParseBinary(bcontent[:4], &setxattr.Size)\n\tcommon.ParseBinary(bcontent[4:8], &setxattr.Flags)\n\n\tarray := bytes.Split(bcontent[8:], []byte{0})\n\n\tif len(array) < 2 {\n\t\treturn ErrDataLen\n\t}\n\n\tsetxattr.Name = string(array[0])\n\tsetxattr.Value = string(array[1])\n\n\treturn nil\n}", "func (parser *Parser) parseAttribute() *Attribute {\n\tattrNSIdx := parser.getLEWord(parser.ParserOffset)\n\tattrNameIdx := parser.getLEWord(parser.ParserOffset + (1 * WORD_SIZE))\n\tattrValueIdx := parser.getLEWord(parser.ParserOffset + (2 * WORD_SIZE))\n\tattrType := parser.getLEWord(parser.ParserOffset + (3 * WORD_SIZE))\n\tattrData := parser.getLEWord(parser.ParserOffset + (4 * WORD_SIZE))\n\n\tattr := new(Attribute)\n\tattr.Name = parser.getString(attrNameIdx)\n\n\tif uint32(attrNSIdx) == 0xFFFFFFFF {\n\t\tattr.Namespace = \"\"\n\t\tattr.Prefix = \"\"\n\t} else {\n\t\turi := parser.getString(attrNSIdx)\n\t\tif v, ok := parser.Namespaces[uri]; ok {\n\t\t\tattr.Namespace = uri\n\t\t\tattr.Prefix = v\n\t\t}\n\t}\n\n\tif uint32(attrValueIdx) == 0xFFFFFFFF {\n\t\tattr.Value = parser.getAttributeValue(attrType, attrData)\n\t} else {\n\t\tattr.Value = parser.getString(attrValueIdx)\n\t}\n\n\treturn attr\n}", "func ManifestUnpack([]byte) Manifest { panic(\"\") }", "func ParseGetaspecificPbxDeviceFirmwareResponse(rsp *http.Response) (*GetaspecificPbxDeviceFirmwareResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetaspecificPbxDeviceFirmwareResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest PbxDeviceFirmwares\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func (p *Attribute) UnmarshalBinary(data []byte) error {\n\t// good old [length|field] encoding. length is an uint64\n\tif data[0] != MagicByte {\n\t\treturn errors.New(\"missing magic byte\")\n\t}\n\tif 8 >= (uint64)(len(data)) {\n\t\treturn errors.New(\"invalid length data\")\n\t}\n\tvar index uint64 = 1\n\tlengthName := binary.BigEndian.Uint64(data[index : index+8])\n\tindex += 8\n\tif index+lengthName >= (uint64)(len(data)) {\n\t\treturn errors.New(\"invalid name data\")\n\t}\n\tp.Name = string(data[index : index+lengthName])\n\tindex += lengthName\n\n\tlengthTypename := binary.BigEndian.Uint64(data[index : index+8])\n\tindex += 8\n\tif index+lengthTypename >= (uint64)(len(data)) {\n\t\treturn errors.New(\"invalid typename data\")\n\t}\n\tp.Typename = string(data[index : index+lengthTypename])\n\tindex += lengthTypename\n\n\tlengthValue := binary.BigEndian.Uint64(data[index : index+8])\n\tindex += 8\n\tif index+lengthValue > (uint64)(len(data)) {\n\t\treturn errors.New(\"invalid value data\")\n\t}\n\tp.Value = data[index : index+lengthValue]\n\treturn nil\n}", "func (release *FuseReleaseIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 24 {\n\t\treturn ErrDataLen\n\t}\n\n\terr := common.ParseBinary(bcontent, release)\n\n\treturn err\n}", "func (_Distributor *DistributorFilterer) ParseBountyWasPaid(log types.Log) (*DistributorBountyWasPaid, error) {\n\tevent := new(DistributorBountyWasPaid)\n\tif err := _Distributor.contract.UnpackLog(event, \"BountyWasPaid\", log); err != nil {\n\t\treturn nil, err\n\t}\n\treturn event, nil\n}", "func parseMAC(s string) net.HardwareAddr {\n\tha, err := net.ParseMAC(s)\n\tpanicIfError(err)\n\treturn ha\n}", "func (s *Software) GetFrom(m *Message) error {\n\treturn (*TextAttribute)(s).GetFromAs(m, AttrSoftware)\n}", "func ParseMAC(s string) (m MAC, err error) {\n\tif len(s) == 12 {\n\t\ts = fmt.Sprintf(\"%s.%s.%s\", s[0:4], s[4:8], s[8:12])\n\t}\n\thw, err := net.ParseMAC(s)\n\tif len(hw) == 8 {\n\t\treturn nil, &net.AddrError{Err: \"EUI-64 not suported\", Addr: s}\n\t}\n\treturn MAC(hw), err\n}", "func (create *FuseCreateIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 16 {\n\t\treturn ErrDataLen\n\t}\n\n\tcommon.ParseBinary(bcontent[:4], &create.Flags)\n\tcommon.ParseBinary(bcontent[4:8], &create.Mode)\n\tcommon.ParseBinary(bcontent[8:12], &create.Umask)\n\tcommon.ParseBinary(bcontent[12:16], &create.Padding)\n\n\t// length-1 是为了避开最后一个'\\0'字符\n\tcreate.Name = string(bcontent[16 : length-1])\n\n\treturn nil\n}", "func (i SNSSubscribeAttribute) ParseByName(s string) (SNSSubscribeAttribute, error) {\n\tif val, ok := _SNSSubscribeAttributeNameToValueMap[s]; ok {\n\t\t// parse ok\n\t\treturn val, nil\n\t}\n\n\t// error\n\treturn -1, fmt.Errorf(\"Enum Name of %s Not Expected In SNSSubscribeAttribute Values List\", s)\n}", "func ParseLine(line string) (Version, error) {\n\t// The line returned by go version for stable releases is:\n\t// \"go version go<version> <os>/<arch>\"\n\t// For unstable releases it is:\n\t// \"go version devel go<version> <timestamp> <os>/<arch>\"\n\tfields := strings.Fields(line)\n\tversion := fields[2] // field after \"go version\"\n\tif version == \"devel\" {\n\t\tversion = fields[3] // field after \"go version devel\"\n\t}\n\n\treturn Parse(version)\n}", "func ParseModemFirmwareManifest(ctx context.Context) (*mfwd.FirmwareManifestV2, error) {\n\tctx, st := timing.Start(ctx, \"ParseModemFirmwareManifest\")\n\tdefer st.End()\n\n\tmodemFirmwareProtoPath := GetModemFirmwareManifestPath()\n\toutput, err := testexec.CommandContext(ctx, \"cat\", modemFirmwareProtoPath).Output()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to access the firmware manifest: %s\", modemFirmwareProtoPath)\n\t}\n\n\ttesting.ContextLog(ctx, \"Parsing modem firmware proto\")\n\tmanifest := &mfwd.FirmwareManifestV2{}\n\tif err := proto.UnmarshalText(string(output), manifest); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to parse firmware manifest: %s\", modemFirmwareProtoPath)\n\t}\n\ttesting.ContextLog(ctx, \"Parsed successfully\")\n\n\treturn manifest, nil\n}", "func readAttributeSelection(bytes *Bytes) (attributeSelection AttributeSelection, err error) {\n\terr = bytes.ReadSubBytes(classUniversal, tagSequence, attributeSelection.readComponents)\n\tif err != nil {\n\t\terr = LdapError{fmt.Sprintf(\"readAttributeSelection:\\n%s\", err.Error())}\n\t\treturn\n\t}\n\treturn\n}", "func (i SNSPlatformApplicationAttribute) ParseByKey(s string) (SNSPlatformApplicationAttribute, error) {\n\tfor k, v := range _SNSPlatformApplicationAttributeValueToKeyMap {\n\t\tif v == s {\n\t\t\t// parse ok\n\t\t\treturn k, nil\n\t\t}\n\t}\n\n\t// error\n\treturn -1, fmt.Errorf(\"Enum Key of %s Not Expected In SNSPlatformApplicationAttribute Keys List\", s)\n}", "func (getxattr *FuseGetxattrIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 8 {\n\t\treturn ErrDataLen\n\t}\n\n\tcommon.ParseBinary(bcontent[:4], &getxattr.Size)\n\tcommon.ParseBinary(bcontent[4:8], &getxattr.Padding)\n\n\tif length > 8 {\n\t\tgetxattr.Name = string(bcontent[8 : length-1])\n\t}\n\n\treturn nil\n}", "func (os *OS) UnmarshalText(b []byte) error {\n\tsplit := bytes.Split(b, []byte(\":\"))\n\tif len(split) != 2 {\n\t\treturn trace.BadParameter(\"OS should be in format vendor:version, got %q\", b)\n\t}\n\tos.Vendor = string(split[0])\n\tos.Version = string(split[1])\n\treturn nil\n}", "func (o *ConvergedinfraServerComplianceDetailsAllOf) SetFirmware(v string) {\n\to.Firmware = &v\n}", "func StructureDetailsFromBytes(markersBytes []byte) (markersPair *StructureDetails, consumedBytes int, err error) {\n\tmarshalUtil := marshalutil.New(markersBytes)\n\tif markersPair, err = StructureDetailsFromMarshalUtil(marshalUtil); err != nil {\n\t\terr = errors.Errorf(\"failed to parse StructureDetails from MarshalUtil: %w\", err)\n\t\treturn\n\t}\n\tconsumedBytes = marshalUtil.ReadOffset()\n\n\treturn\n}", "func meminfoFromBytes(buf []byte) (meminfomap, error) {\n\tret := make(meminfomap)\n\tfor _, line := range bytes.Split(buf, []byte{'\\n'}) {\n\t\tkv := bytes.SplitN(line, []byte{':'}, 2)\n\t\tif len(kv) != 2 {\n\t\t\t// invalid line?\n\t\t\tcontinue\n\t\t}\n\t\tkey := string(kv[0])\n\t\ttokens := bytes.SplitN(bytes.TrimSpace(kv[1]), []byte{' '}, 2)\n\t\tif len(tokens) > 0 {\n\t\t\tvalue, err := strconv.ParseUint(string(tokens[0]), 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tret[key] = value\n\t\t}\n\t}\n\treturn ret, nil\n}", "func HexParse(signature string) (string, error) {\n\tsignature = preprocessHex(signature)\n\t// Validate the hexadecimal\n\t_, err := hex.DecodeString(signature)\n\treturn signature, err\n}", "func (o *PostPartsParams) SetFirmware(firmware *string) {\n\to.Firmware = firmware\n}", "func Parse(arg string) (Attr, error) {\n\targ = strings.TrimSpace(arg)\n\tattr := Attr{\n\t\tOriginal: arg,\n\t\tinputType: \"string\",\n\t}\n\tif len(arg) == 0 {\n\t\treturn attr, errors.New(\"argument can not be blank\")\n\t}\n\n\tparts := strings.Split(arg, \":\")\n\tattr.Name = name.New(parts[0])\n\tif len(parts) > 1 {\n\t\tattr.inputType = parts[1]\n\t}\n\n\tif len(parts) > 2 {\n\t\tattr.goType = parts[2]\n\t}\n\n\treturn attr, nil\n}", "func ParseGetaspecificPbxDeviceFirmwareBinaryResponse(rsp *http.Response) (*GetaspecificPbxDeviceFirmwareBinaryResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetaspecificPbxDeviceFirmwareBinaryResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest PbxDeviceFirmwareBinaries\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func Parse(arg string) (Attr, error) {\n\targ = strings.TrimSpace(arg)\n\tattr := Attr{\n\t\tOriginal: arg,\n\t\tcommonType: \"string\",\n\t}\n\tif len(arg) == 0 {\n\t\treturn attr, errors.New(\"argument can not be blank\")\n\t}\n\n\tparts := strings.Split(arg, \":\")\n\tattr.Name = name.New(parts[0])\n\tif len(parts) > 1 {\n\t\tattr.commonType = parts[1]\n\t}\n\n\tif len(parts) > 2 {\n\t\tattr.goType = parts[2]\n\t}\n\n\treturn attr, nil\n}", "func DDBAttributeFromKey(input string) (DDBAttribute, error) {\n\tattrs := regexpMatchAttribute.FindStringSubmatch(input)\n\tif len(attrs) == 0 {\n\t\treturn DDBAttribute{}, fmt.Errorf(\"parse attribute from key: %s\", input)\n\t}\n\tupperString := strings.ToUpper(attrs[2])\n\treturn DDBAttribute{\n\t\tName: &attrs[1],\n\t\tDataType: &upperString,\n\t}, nil\n}", "func (c *Capabilities) FromBytes(buf *bytes.Buffer) error {\n\tdec := gob.NewDecoder(buf)\n\tif err := dec.Decode(&c.Node); err != nil {\n\t\treturn err\n\t}\n\tif err := dec.Decode(&c.Ver); err != nil {\n\t\treturn err\n\t}\n\treturn dec.Decode(&c.Features)\n}", "func FromBytes(bs []byte) (*Event, error) {\n\t// TODO:\n\t// - consider 64 bit operating systems with 24 byte slices.\n\t// - is this the most efficient way to do this? Maybe just decode directly into a struct\n\t// - maybe check for input system requirements (ie, check that it is running on linux)\n\tif len(bs) != 16 {\n\t\treturn nil, ErrDecode{fmt.Sprintf(\"invalid event: should be %d bytes is %d bytes\", 16, len(bs))}\n\t}\n\n\tev := EVCode(binary.LittleEndian.Uint16(bs[8:10]))\n\tif ev >= EV_CNT {\n\t\treturn nil, ErrDecode{fmt.Sprintf(\"invalid event: %v\", ev)}\n\t}\n\n\tsec := binary.LittleEndian.Uint32(bs[0:4])\n\tusec := binary.LittleEndian.Uint32(bs[4:8])\n\n\tc := binary.LittleEndian.Uint16(bs[10:12])\n\n\treturn &Event{\n\t\tTime: time.Unix(int64(sec), int64(usec)),\n\t\tType: ev,\n\t\tCode: evCode(ev, c),\n\t\tValue: int32(binary.LittleEndian.Uint32(bs[12:16])),\n\t}, nil\n}", "func ParseUint16(strval string) (uint16, error) {\n\tval, err := parseUint(strval, 16)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn uint16(val), nil\n}", "func UnSerialiseFromString( packet []byte, parseAll bool ) (*BaseEvent,error) {\n var packetLen uint\n headerTemplate := fmt.Sprintf( \"%s%s:%%d\", FRAME_HEADER, PROTOCOL_VERSION_NUMBER )\n if numParsed,err:=fmt.Sscanf(string(packet), headerTemplate, &packetLen); numParsed != 1 {\n newErr := errors.New( \"UnSerialiseFromString error failed to parse header:\" + err.Error() + \" packet:\"+string(packet) )\n return nil,newErr\n } // if\n\n body := packet[FRAME_HEADER_LEN:]\n event := new( BaseEvent )\n err := event.ParseBody( body, parseAll )\n return event,err\n}", "func ParseProduct(name string) (Product, error) {\n\tif x, ok := _ProductValue[name]; ok {\n\t\treturn x, nil\n\t}\n\treturn Product(0), fmt.Errorf(\"%s is not a valid Product\", name)\n}", "func NewByteAttribute(attrName string) *SDK.AttributeDefinition {\n\treturn NewAttributeDefinition(attrName, \"B\")\n}", "func (fifi *FIAdditionalFIToFI) Parse(record string) error {\n\tif utf8.RuneCountInString(record) != 216 {\n\t\treturn NewTagWrongLengthErr(216, len(record))\n\t}\n\tfifi.tag = record[:6]\n\tfifi.AdditionalFIToFI.LineOne = fifi.parseStringField(record[6:41])\n\tfifi.AdditionalFIToFI.LineTwo = fifi.parseStringField(record[41:76])\n\tfifi.AdditionalFIToFI.LineThree = fifi.parseStringField(record[76:111])\n\tfifi.AdditionalFIToFI.LineFour = fifi.parseStringField(record[111:146])\n\tfifi.AdditionalFIToFI.LineFive = fifi.parseStringField(record[146:181])\n\tfifi.AdditionalFIToFI.LineSix = fifi.parseStringField(record[181:216])\n\treturn nil\n}", "func parseCPUStat(line string) (CPUStat, int64, error) {\n\tcpuStat := CPUStat{}\n\tvar cpu string\n\n\tcount, err := fmt.Sscanf(line, \"%s %f %f %f %f %f %f %f %f %f %f\",\n\t\t&cpu,\n\t\t&cpuStat.User, &cpuStat.Nice, &cpuStat.System, &cpuStat.Idle,\n\t\t&cpuStat.Iowait, &cpuStat.IRQ, &cpuStat.SoftIRQ, &cpuStat.Steal,\n\t\t&cpuStat.Guest, &cpuStat.GuestNice)\n\n\tif err != nil && err != io.EOF {\n\t\treturn CPUStat{}, -1, fmt.Errorf(\"couldn't parse %q (cpu): %w\", line, err)\n\t}\n\tif count == 0 {\n\t\treturn CPUStat{}, -1, fmt.Errorf(\"couldn't parse %q (cpu): 0 elements parsed\", line)\n\t}\n\n\tcpuStat.User /= userHZ\n\tcpuStat.Nice /= userHZ\n\tcpuStat.System /= userHZ\n\tcpuStat.Idle /= userHZ\n\tcpuStat.Iowait /= userHZ\n\tcpuStat.IRQ /= userHZ\n\tcpuStat.SoftIRQ /= userHZ\n\tcpuStat.Steal /= userHZ\n\tcpuStat.Guest /= userHZ\n\tcpuStat.GuestNice /= userHZ\n\n\tif cpu == \"cpu\" {\n\t\treturn cpuStat, -1, nil\n\t}\n\n\tcpuID, err := strconv.ParseInt(cpu[3:], 10, 64)\n\tif err != nil {\n\t\treturn CPUStat{}, -1, fmt.Errorf(\"couldn't parse %q (cpu/cpuid): %w\", line, err)\n\t}\n\n\treturn cpuStat, cpuID, nil\n}", "func (o *NetworkElementSummaryAllOf) SetFirmware(v string) {\n\to.Firmware = &v\n}", "func (b *BSS) parseAttributes(attrs []netlink.Attribute) error {\n\tfor _, a := range attrs {\n\t\tswitch a.Type {\n\t\tcase unix.NL80211_BSS_BSSID:\n\t\t\tb.BSSID = net.HardwareAddr(a.Data)\n\t\tcase unix.NL80211_BSS_FREQUENCY:\n\t\t\tb.Frequency = int(nlenc.Uint32(a.Data))\n\t\tcase unix.NL80211_BSS_BEACON_INTERVAL:\n\t\t\t// Raw value is in \"Time Units (TU)\". See:\n\t\t\t// https://en.wikipedia.org/wiki/Beacon_frame\n\t\t\tb.BeaconInterval = time.Duration(nlenc.Uint16(a.Data)) * 1024 * time.Microsecond\n\t\tcase unix.NL80211_BSS_SEEN_MS_AGO:\n\t\t\t// * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms\n\t\t\tb.LastSeen = time.Duration(nlenc.Uint32(a.Data)) * time.Millisecond\n\t\tcase unix.NL80211_BSS_STATUS:\n\t\t\t// NOTE: BSSStatus copies the ordering of nl80211's BSS status\n\t\t\t// constants. This may not be the case on other operating systems.\n\t\t\tb.Status = BSSStatus(nlenc.Uint32(a.Data))\n\t\tcase unix.NL80211_BSS_INFORMATION_ELEMENTS:\n\t\t\ties, err := parseIEs(a.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// TODO(mdlayher): return more IEs if they end up being generally useful\n\t\t\tfor _, ie := range ies {\n\t\t\t\tswitch ie.ID {\n\t\t\t\tcase ieSSID:\n\t\t\t\t\tb.SSID = decodeSSID(ie.Data)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func ParseMachineSpec(file string) (*MachineSpec, error) {\n\tvar p []byte\n\tvar err error\n\tif file == \"-\" {\n\t\tp, err = ioutil.ReadAll(os.Stdin)\n\t} else {\n\t\tp, err = ioutil.ReadFile(file)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar spec MachineSpec\n\tdec := json.NewDecoder(bytes.NewReader(p))\n\tdec.UseNumber()\n\tif err := dec.Decode(&spec); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &spec, nil\n}", "func (f *FSEIDFields) UnmarshalBinary(b []byte) error {\n\tl := len(b)\n\tif l < 2 {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\n\tf.Flags = b[0]\n\toffset := 1\n\n\tif f.HasChID() || f.HasCh() {\n\t\tif f.HasIPv4() {\n\t\t\tif l < offset+4 {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tf.IPv4Address = net.IP(b[offset : offset+4])\n\t\t\toffset += 4\n\t\t}\n\t\tif f.HasIPv6() {\n\t\t\tif l < offset+16 {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tf.IPv6Address = net.IP(b[offset : offset+16])\n\t\t\toffset += 16\n\t\t}\n\n\t\tif l <= offset {\n\t\t\treturn nil\n\t\t}\n\n\t\tf.ChooseID = b[offset:]\n\t\treturn nil\n\t}\n\n\tif l < offset+4 {\n\t\treturn nil\n\t}\n\tf.SEID = binary.BigEndian.Uint64(b[offset : offset+8])\n\toffset += 8\n\n\tif f.HasIPv4() {\n\t\tif l < offset+4 {\n\t\t\treturn io.ErrUnexpectedEOF\n\t\t}\n\t\tf.IPv4Address = net.IP(b[offset : offset+4])\n\t\toffset += 4\n\t}\n\tif f.HasIPv6() {\n\t\tif l < offset+16 {\n\t\t\treturn io.ErrUnexpectedEOF\n\t\t}\n\t\tf.IPv6Address = net.IP(b[offset : offset+16])\n\t}\n\n\treturn nil\n}", "func (r *Runtime) ParseModule(wasmBytes []byte) (*Module, error) {\n\treturn r.cfg.Environment.ParseModule(wasmBytes)\n}", "func (r *CAA) Parse(i string) error {\n\ts := strings.SplitN(i, \" \", 3)\n\tif len(s) != 3 {\n\t\treturn errors.New(\"CAA records need to have the format \\\"Flags Tag Value\\\"\")\n\t}\n\tf, err := strconv.ParseUint(s[0], 10, 8)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif f != 128 {\n\t\treturn errors.New(\"only first bit of flag may be set\")\n\t}\n\tr.Flags = uint8(f)\n\tif len(s[1]) > 255 {\n\t\treturn errors.New(\"tag length may not exceed 255 characters\")\n\t}\n\tr.Tag = s[1]\n\tr.Value = s[2]\n\treturn nil\n}", "func (d *Decoder) parseLine(line []byte) ([]pair, error) {\n\tvar add pair\n\tvar beg, offset int64\n\tvar esc bool\n\n\tstate := make(scanState, 0, 3)\n\tbuf := bytes.NewReader(line)\n\n\tfor r, sz, err := buf.ReadRune(); err == nil; r, sz, err = buf.ReadRune() {\n\t\tif r == 0xFFFD && sz == 1 {\n\t\t\treturn nil, errBadUnicode(line, offset)\n\t\t}\n\t\tswitch state.top() {\n\t\tcase scanNone:\n\t\t\tif unicode.IsSpace(r) {\n\t\t\t\t// skip\n\t\t\t} else if unicode.IsLetter(r) || unicode.IsNumber(r) {\n\t\t\t\tstate.push(scanAttr)\n\t\t\t\tbeg = offset\n\t\t\t} else {\n\t\t\t\treturn nil, errBadAttr(line, offset)\n\t\t\t}\n\t\tcase scanAttr:\n\t\t\tif unicode.IsSpace(r) {\n\t\t\t\tadd.attr = line[beg:offset]\n\t\t\t\td.pairbuf = append(d.pairbuf, add)\n\t\t\t\tif _, ok := d.attrs[string(add.attr)]; ok {\n\t\t\t\t\td.havemulti = true\n\t\t\t\t\td.multi[string(add.attr)] = struct{}{}\n\t\t\t\t} else {\n\t\t\t\t\td.attrs[string(add.attr)] = struct{}{}\n\t\t\t\t}\n\t\t\t\tadd.attr, add.val, esc = nil, nil, false\n\t\t\t\tstate.pop()\n\t\t\t} else if r == '=' {\n\t\t\t\tadd.attr = line[beg:offset]\n\t\t\t\tif _, ok := d.attrs[string(add.attr)]; ok {\n\t\t\t\t\td.havemulti = true\n\t\t\t\t\td.multi[string(add.attr)] = struct{}{}\n\t\t\t\t} else {\n\t\t\t\t\td.attrs[string(add.attr)] = struct{}{}\n\t\t\t\t}\n\t\t\t\tstate.pop()\n\t\t\t\tstate.push(scanValueStart)\n\t\t\t} else if !(r == '-' || unicode.IsLetter(r) || unicode.IsNumber(r)) {\n\t\t\t\treturn nil, errBadAttr(line, offset)\n\t\t\t}\n\t\tcase scanValueStart:\n\t\t\tbeg = offset\n\t\t\tstate.pop()\n\t\t\tstate.push(scanValue)\n\n\t\t\tif r == '\\'' {\n\t\t\t\tstate.push(scanQuoteStart)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfallthrough\n\t\tcase scanValue:\n\t\t\tif unicode.IsSpace(r) {\n\t\t\t\tstate.pop()\n\t\t\t\tadd.val = line[beg:offset]\n\t\t\t\tif esc {\n\t\t\t\t\tadd.val = bytes.Replace(add.val, []byte(\"''\"), []byte(\"'\"), -1)\n\t\t\t\t}\n\t\t\t\td.pairbuf = append(d.pairbuf, add)\n\t\t\t\tadd.attr, add.val = nil, nil\n\t\t\t}\n\t\tcase scanQuoteClose:\n\t\t\tstate.pop()\n\t\t\tif r == '\\'' {\n\t\t\t\tesc = true\n\t\t\t\tstate.push(scanQuoteValue)\n\t\t\t} else if unicode.IsSpace(r) {\n\t\t\t\tstate.pop()\n\t\t\t\tadd.val = line[beg : offset-1]\n\t\t\t\tif esc {\n\t\t\t\t\tadd.val = bytes.Replace(add.val, []byte(\"''\"), []byte(\"'\"), -1)\n\t\t\t\t}\n\t\t\t\td.pairbuf = append(d.pairbuf, add)\n\t\t\t\tadd.attr, add.val, esc = nil, nil, false\n\t\t\t} else {\n\t\t\t\treturn nil, errMissingSpace(line, offset)\n\t\t\t}\n\t\tcase scanQuoteStart:\n\t\t\tstate.pop()\n\t\t\tif r != '\\'' {\n\t\t\t\tbeg++\n\t\t\t\tstate.pop()\n\t\t\t\tstate.push(scanQuoteValue)\n\t\t\t} else {\n\t\t\t\tesc = true\n\t\t\t}\n\t\tcase scanQuoteValue:\n\t\t\tif r == '\\'' {\n\t\t\t\tstate.pop()\n\t\t\t\tstate.push(scanQuoteClose)\n\t\t\t} else if r == '\\n' {\n\t\t\t\treturn nil, errUnterminated(line, offset)\n\t\t\t}\n\t\t}\n\t\toffset += int64(sz)\n\t}\n\tswitch state.top() {\n\tcase scanQuoteValue, scanQuoteStart:\n\t\treturn nil, errUnterminated(line, offset)\n\tcase scanAttr:\n\t\tadd.attr = line[beg:offset]\n\t\tif _, ok := d.attrs[string(add.attr)]; ok {\n\t\t\td.havemulti = true\n\t\t\td.multi[string(add.attr)] = struct{}{}\n\t\t} else {\n\t\t\td.attrs[string(add.attr)] = struct{}{}\n\t\t}\n\t\td.pairbuf = append(d.pairbuf, add)\n\tcase scanValueStart:\n\t\tbeg = offset\n\t\tfallthrough\n\tcase scanQuoteClose:\n\t\toffset--\n\t\tfallthrough\n\tcase scanValue:\n\t\tadd.val = line[beg:offset]\n\t\tif esc {\n\t\t\tadd.val = bytes.Replace(add.val, []byte(\"''\"), []byte(\"'\"), -1)\n\t\t}\n\t\td.pairbuf = append(d.pairbuf, add)\n\t}\n\treturn d.pairbuf, nil\n}", "func Parse(b []byte) (UUID, error) {\n\tswitch len(b) {\n\tcase 16:\n\t\tvar u UUID\n\t\tcopy(u[:], b)\n\t\treturn u, nil\n\tcase 32:\n\t\tvar u UUID\n\t\t_, err := hex.Decode(u[:], b)\n\t\tif err != nil {\n\t\t\treturn u, ErrInvalidUUID\n\t\t}\n\t\treturn u, nil\n\tcase 36:\n\t\treturn parseFormatted(b)\n\tdefault:\n\t\treturn UUID{}, ErrInvalidUUID\n\t}\n}", "func (op *OptVendorOpts) FromBytes(data []byte) error {\n\tbuf := uio.NewBigEndianBuffer(data)\n\top.EnterpriseNumber = buf.Read32()\n\tif err := op.VendorOpts.FromBytesWithParser(buf.ReadAll(), vendParseOption); err != nil {\n\t\treturn err\n\t}\n\treturn buf.FinError()\n}", "func (ioctl *FuseIoctlIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 32 {\n\t\treturn ErrDataLen\n\t}\n\n\tcommon.ParseBinary(bcontent[:8], &ioctl.Fh)\n\tcommon.ParseBinary(bcontent[8:12], &ioctl.Flags)\n\tcommon.ParseBinary(bcontent[12:16], &ioctl.Cmd)\n\tcommon.ParseBinary(bcontent[16:24], &ioctl.Arg)\n\tcommon.ParseBinary(bcontent[24:28], &ioctl.InSize)\n\tcommon.ParseBinary(bcontent[28:32], &ioctl.OutSize)\n\n\tioctl.InBuf = bcontent[32:]\n\n\treturn nil\n}", "func Parse(str string) (hash Hash, err error) {\n\terr = errHashFormat\n\tif len(str) != 2*Size {\n\t\treturn\n\t}\n\tfor i := range hash {\n\t\ta := unhex(str[2*i])\n\t\tb := unhex(str[2*i+1])\n\t\tif a == 255 || b == 255 {\n\t\t\treturn\n\t\t}\n\t\thash[i] = a<<4 | b\n\t}\n\terr = nil\n\treturn\n}", "func (a *Parser) parseBytes(b []byte) error {\n\tnvp := newNameValParser(a, b)\n\tvar name, value *symval\n\tvar err error\n\tfor {\n\t\tname, value, err = nvp.next()\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif name == nil && value == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tif name == nil {\n\t\t\t// standalone name or value\n\t\t\tif a.isStandaloneBoolParameter(value) {\n\t\t\t\t// standalone name\n\t\t\t\tname, value = value, &symval{resolved: true, s: \"true\"}\n\t\t\t} else {\n\t\t\t\t// standalone value\n\t\t\t\tif _, ok := a.params[\"\"]; !ok {\n\t\t\t\t\treturn fmt.Errorf(`unexpected standalone value: \"%s\"`, value.s)\n\t\t\t\t}\n\t\t\t\t// the famous empty name\n\t\t\t\tname = &symval{resolved: true, s: \"\"}\n\t\t\t}\n\t\t}\n\n\t\t// assert name != nil && value != nil\n\n\t\toperator := a.operator(name.s)\n\t\tif operator != nil {\n\t\t\terr := operator.handle(value.s)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\terr := a.setValue(name, value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (s Software) AddTo(m *Message) error {\n\treturn TextAttribute(s).AddToAs(m, AttrSoftware, softwareRawMaxB)\n}", "func (header *FuseInHeader) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, header)\n\n\treturn err\n}", "func (c *Client) parseStationInfo(b []byte) (*StationInfo, error) {\n\tattrs, err := netlink.UnmarshalAttributes(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar info StationInfo\n\tfor _, a := range attrs {\n\t\tswitch a.Type {\n\t\tcase nl80211.AttrMac:\n\t\t\tcopy(info.HardwareAddr[:], a.Data)\n\n\t\tcase nl80211.AttrStaInfo:\n\t\t\tnattrs, err := netlink.UnmarshalAttributes(a.Data)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif err := (&info).parseAttributes(nattrs); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t// nl80211.AttrStaInfo is last attribute we are interested in\n\t\t\treturn &info, nil\n\n\t\tcase nl80211.AttrIfindex:\n\t\t\tifaceIndex := int(nlenc.Uint32(a.Data))\n\t\t\tiface, ok := c.interfaces[ifaceIndex]\n\t\t\tif !ok {\n\t\t\t\tiface.Index = ifaceIndex\n\t\t\t}\n\t\t\tinfo.Iface = *iface\n\n\t\tdefault:\n\t\t\t// The other attributes that are returned here: nl80211.AttrGeneration\n\t\t\t// No need to parse them for now.\n\t\t\tcontinue\n\t\t}\n\t}\n\n\t// No station info found\n\treturn nil, os.ErrNotExist\n}", "func (tag *CustomSegmentTag) Decode(line string) (m3u8.CustomTag, error) {\n\tvar err error\n\n\t// Since this is a Segment tag, we want to create a new tag every time it is decoded\n\t// as there can be one for each segment with\n\tnewTag := new(CustomSegmentTag)\n\n\tfor k, v := range m3u8.DecodeAttributeList(line[20:]) {\n\t\tswitch k {\n\t\tcase \"NAME\":\n\t\t\tnewTag.Name = v\n\t\tcase \"JEDI\":\n\t\t\tif v == \"YES\" {\n\t\t\t\tnewTag.Jedi = true\n\t\t\t} else if v == \"NO\" {\n\t\t\t\tnewTag.Jedi = false\n\t\t\t} else {\n\t\t\t\terr = errors.New(\"Valid strings for JEDI attribute are YES and NO.\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn newTag, err\n}", "func(r *Runtime) ParseModule(wasmBytes []byte) (*Module, error) {\n\treturn r.cfg.Environment.ParseModule(wasmBytes)\n}", "func (rename *FuseRename2In) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 16 {\n\t\treturn ErrDataLen\n\t}\n\n\tcommon.ParseBinary(bcontent[:8], &rename.NewDir)\n\tcommon.ParseBinary(bcontent[8:12], &rename.Flags)\n\tcommon.ParseBinary(bcontent[12:16], &rename.Padding)\n\n\tarray := bytes.Split(bcontent[16:], []byte{0})\n\n\tif len(array) < 2 {\n\t\treturn ErrDataLen\n\t}\n\n\trename.OldName = string(array[0])\n\trename.NewName = string(array[1])\n\n\treturn nil\n}", "func ManufacturerData(id uint16, b []byte) Field {\n\treturn func(p *Packet) error {\n\t\td := append([]byte{uint8(id), uint8(id >> 8)}, b...)\n\t\treturn p.append(manufacturerData, d)\n\t}\n}", "func (e *Extras) FromString(str string) (err error) {\n\tattrs := strings.Split(str, \":\")\n\n\tss, err := strconv.Atoi(attrs[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\te.SampleSet = SampleSet(ss)\n\n\tss, err = strconv.Atoi(attrs[1])\n\tif err != nil {\n\t\treturn err\n\t}\n\te.AdditionalSet = SampleSet(ss)\n\n\te.CustomIndex, err = strconv.Atoi(attrs[2])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.SampleVolume, err = strconv.Atoi(attrs[3])\n\te.Filename = attrs[4]\n\treturn err\n}", "func parseDevstat(buf []byte) (Devstat, error) {\n\tvar ds Devstat\n\tbr := bytes.NewReader(buf)\n\t//\terr := binary.Read(br, binary.LittleEndian, &ds)\n\terr := common.Read(br, binary.LittleEndian, &ds)\n\tif err != nil {\n\t\treturn ds, err\n\t}\n\n\treturn ds, nil\n}", "func (c *StickersCreateStickerSetRequest) GetSoftware() (value string, ok bool) {\n\tif c == nil {\n\t\treturn\n\t}\n\tif !c.Flags.Has(3) {\n\t\treturn value, false\n\t}\n\treturn c.Software, true\n}", "func ParseBinary(binary string) (int, error) {\n\tvar value int\n\tfor p, bit := range reverse(binary) {\n\t\tsgn := 0\n\t\tif bit != '0' && bit != '1' {\n\t\t\treturn 0, ErrInvalidCharacter\n\t\t} else if bit == '1' {\n\t\t\tsgn = 1\n\t\t}\n\n\t\tvalue += sgn * (1 << uint(p))\n\t}\n\treturn value, nil\n}", "func ExampleAttributeDecoder_decode() {\n\t// Create a netlink.AttributeDecoder using some example attribute bytes\n\t// that are prepared for this example.\n\tad, err := netlink.NewAttributeDecoder(exampleAttributes())\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create attribute decoder: %v\", err)\n\t}\n\n\t// Iterate attributes until completion, checking the type of each and\n\t// decoding them as appropriate.\n\tvar out decodeOut\n\tfor ad.Next() {\n\t\t// Check the type of the current attribute with ad.Type. Typically you\n\t\t// will find netlink attribute types and data values in C headers as\n\t\t// constants.\n\t\tswitch ad.Type() {\n\t\tcase 1:\n\t\t\t// Number is a uint16.\n\t\t\tout.Number = ad.Uint16()\n\t\tcase 2:\n\t\t\t// String is a string.\n\t\t\tout.String = ad.String()\n\t\tcase 3:\n\t\t\t// Nested is a nested structure, so we will use a method on the\n\t\t\t// nested type along with ad.Do to decode it in a concise way.\n\t\t\tad.Nested(out.Nested.decode)\n\t\t}\n\t}\n\n\t// Any errors encountered during decoding (including any errors from\n\t// decoding the nested attributes) will be returned here.\n\tif err := ad.Err(); err != nil {\n\t\tlog.Fatalf(\"failed to decode attributes: %v\", err)\n\t}\n\n\tfmt.Printf(`Number: %d\nString: %q\nNested:\n - A: %d\n - B: %d`,\n\t\tout.Number, out.String, out.Nested.A, out.Nested.B,\n\t)\n\t// Output:\n\t// Number: 1\n\t// String: \"hello world\"\n\t// Nested:\n\t// - A: 2\n\t// - B: 3\n}", "func extractMTI(str string) (spec Spec, mti, rest string, err error) {\n\tmti, rest = str[0:4], str[4:len(str)]\n\n\tspecName := \"\"\n\tswitch string(mti[0]) {\n\tcase \"0\":\n\t\tspecName = \"1987\"\n\tcase \"1\":\n\t\tspecName = \"1993\"\n\tcase \"2\":\n\t\tspecName = \"2003\"\n\tdefault:\n\t\treturn Spec{}, \"\", \"\", fmt.Errorf(\"Invalid mti version %v\", string(mti[0]))\n\t}\n\n\tspec, ok := specs[specName]\n\tif !ok {\n\t\treturn Spec{}, \"\", \"\", fmt.Errorf(\"iso8583:%s is not supported\", specName)\n\t}\n\n\treturn\n}", "func (ut *AddFirmwarePayload) Validate() (err error) {\n\tif ut.Etag == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"etag\"))\n\t}\n\tif ut.Module == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"module\"))\n\t}\n\tif ut.Profile == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"profile\"))\n\t}\n\tif ut.URL == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"url\"))\n\t}\n\tif ut.Meta == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`type`, \"meta\"))\n\t}\n\treturn\n}", "func ParseRemoteSecretBytes(secretBytes []byte) (*RemoteSecret, error) {\n\tsecret := &RemoteSecret{}\n\terr := yaml.Unmarshal(secretBytes, &secret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn secret, nil\n}", "func NewAttributePair(attributeVals []string, attrOwner *AttributeOwner) (*AttributePair, error) {\n\tif len(attributeVals) < 6 {\n\t\treturn nil, errors.New(\"Invalid attribute entry\")\n\t}\n\tvar attrPair = *new(AttributePair)\n\tif attrOwner != nil {\n\t\tattrPair.SetOwner(attrOwner)\n\t} else {\n\t\tattrPair.SetOwner(&AttributeOwner{strings.TrimSpace(attributeVals[0]), strings.TrimSpace(attributeVals[1])})\n\t}\n\tattrPair.SetAttributeName(strings.TrimSpace(attributeVals[2]))\n\tattrPair.SetAttributeValue([]byte(strings.TrimSpace(attributeVals[3])))\n\t//Reading validFrom date\n\tdateStr := strings.TrimSpace(attributeVals[4])\n\tif dateStr != \"\" {\n\t\tvar t time.Time\n\t\tvar err error\n\t\tif t, err = time.Parse(time.RFC3339, dateStr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattrPair.SetValidFrom(t)\n\t}\n\t//Reading validTo date\n\tdateStr = strings.TrimSpace(attributeVals[5])\n\tif dateStr != \"\" {\n\t\tvar t time.Time\n\t\tvar err error\n\t\tif t, err = time.Parse(time.RFC3339, dateStr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattrPair.SetValidTo(t)\n\t}\n\treturn &attrPair, nil\n}", "func (p *parser) parseAttributeSelector() (Selector, error) {\n\tif p.i >= len(p.s) {\n\t\treturn nil, fmt.Errorf(\"expected attribute selector ([attribute]), found EOF instead\")\n\t}\n\tif p.s[p.i] != '[' {\n\t\treturn nil, fmt.Errorf(\"expected attribute selector ([attribute]), found '%c' instead\", p.s[p.i])\n\t}\n\n\tp.i++\n\tp.skipWhitespace()\n\tkey, err := p.parseIdentifier()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.skipWhitespace()\n\tif p.i >= len(p.s) {\n\t\treturn nil, errors.New(\"unexpected EOF in attribute selector\")\n\t}\n\n\tif p.s[p.i] == ']' {\n\t\tp.i++\n\t\treturn attributeExistsSelector(key), nil\n\t}\n\n\tif p.i+2 >= len(p.s) {\n\t\treturn nil, errors.New(\"unexpected EOF in attribute selector\")\n\t}\n\n\top := p.s[p.i : p.i+2]\n\tif op[0] == '=' {\n\t\top = \"=\"\n\t} else if op[1] != '=' {\n\t\treturn nil, fmt.Errorf(`expected equality operator, found \"%s\" instead`, op)\n\t}\n\tp.i += len(op)\n\n\tp.skipWhitespace()\n\tif p.i >= len(p.s) {\n\t\treturn nil, errors.New(\"unexpected EOF in attribute selector\")\n\t}\n\tvar val string\n\tvar rx *regexp.Regexp\n\tif op == \"#=\" {\n\t\trx, err = p.parseRegex()\n\t} else {\n\t\tswitch p.s[p.i] {\n\t\tcase '\\'', '\"':\n\t\t\tval, err = p.parseString()\n\t\tdefault:\n\t\t\tval, err = p.parseIdentifier()\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.skipWhitespace()\n\tif p.i >= len(p.s) {\n\t\treturn nil, errors.New(\"unexpected EOF in attribute selector\")\n\t}\n\tif p.s[p.i] != ']' {\n\t\treturn nil, fmt.Errorf(\"expected ']', found '%c' instead\", p.s[p.i])\n\t}\n\tp.i++\n\n\tswitch op {\n\tcase \"=\":\n\t\treturn attributeEqualsSelector(key, val), nil\n\tcase \"!=\":\n\t\treturn attributeNotEqualSelector(key, val), nil\n\tcase \"~=\":\n\t\treturn attributeIncludesSelector(key, val), nil\n\tcase \"|=\":\n\t\treturn attributeDashmatchSelector(key, val), nil\n\tcase \"^=\":\n\t\treturn attributePrefixSelector(key, val), nil\n\tcase \"$=\":\n\t\treturn attributeSuffixSelector(key, val), nil\n\tcase \"*=\":\n\t\treturn attributeSubstringSelector(key, val), nil\n\tcase \"#=\":\n\t\treturn attributeRegexSelector(key, rx), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"attribute operator %q is not supported\", op)\n}", "func (p *parser) parseAttributeSelector() (Selector, error) {\n\tif p.i >= len(p.s) {\n\t\treturn nil, fmt.Errorf(\"expected attribute selector ([attribute]), found EOF instead\")\n\t}\n\tif p.s[p.i] != '[' {\n\t\treturn nil, fmt.Errorf(\"expected attribute selector ([attribute]), found '%c' instead\", p.s[p.i])\n\t}\n\n\tp.i++\n\tp.skipWhitespace()\n\tkey, err := p.parseIdentifier()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.skipWhitespace()\n\tif p.i >= len(p.s) {\n\t\treturn nil, errors.New(\"unexpected EOF in attribute selector\")\n\t}\n\n\tif p.s[p.i] == ']' {\n\t\tp.i++\n\t\treturn attributeExistsSelector(key), nil\n\t}\n\n\tif p.i+2 >= len(p.s) {\n\t\treturn nil, errors.New(\"unexpected EOF in attribute selector\")\n\t}\n\n\top := p.s[p.i : p.i+2]\n\tif op[0] == '=' {\n\t\top = \"=\"\n\t} else if op[1] != '=' {\n\t\treturn nil, fmt.Errorf(`expected equality operator, found \"%s\" instead`, op)\n\t}\n\tp.i += len(op)\n\n\tp.skipWhitespace()\n\tif p.i >= len(p.s) {\n\t\treturn nil, errors.New(\"unexpected EOF in attribute selector\")\n\t}\n\tvar val string\n\tvar rx *regexp.Regexp\n\tif op == \"#=\" {\n\t\trx, err = p.parseRegex()\n\t} else {\n\t\tswitch p.s[p.i] {\n\t\tcase '\\'', '\"':\n\t\t\tval, err = p.parseString()\n\t\tdefault:\n\t\t\tval, err = p.parseIdentifier()\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.skipWhitespace()\n\tif p.i >= len(p.s) {\n\t\treturn nil, errors.New(\"unexpected EOF in attribute selector\")\n\t}\n\tif p.s[p.i] != ']' {\n\t\treturn nil, fmt.Errorf(\"expected ']', found '%c' instead\", p.s[p.i])\n\t}\n\tp.i++\n\n\tswitch op {\n\tcase \"=\":\n\t\treturn attributeEqualsSelector(key, val), nil\n\tcase \"!=\":\n\t\treturn attributeNotEqualSelector(key, val), nil\n\tcase \"~=\":\n\t\treturn attributeIncludesSelector(key, val), nil\n\tcase \"|=\":\n\t\treturn attributeDashmatchSelector(key, val), nil\n\tcase \"^=\":\n\t\treturn attributePrefixSelector(key, val), nil\n\tcase \"$=\":\n\t\treturn attributeSuffixSelector(key, val), nil\n\tcase \"*=\":\n\t\treturn attributeSubstringSelector(key, val), nil\n\tcase \"#=\":\n\t\treturn attributeRegexSelector(key, rx), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"attribute operator %q is not supported\", op)\n}", "func (interrupt *FuseInterruptIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 8 {\n\t\treturn ErrDataLen\n\t}\n\n\terr := common.ParseBinary(bcontent, interrupt)\n\n\treturn err\n}", "func (platform *Platform) ParseOSXVersion(versionData string) {\n\tlines := strings.Split(versionData, \"\\n\")\n\tfor _, l := range lines {\n\t\ts := strings.Split(l, \":\\t\")\n\t\tif len(s) == 2 {\n\t\t\tswitch s[0] {\n\t\t\tcase \"ProductName\":\n\t\t\t\tplatform.Name = s[1]\n\t\t\tcase \"ProductVersion\":\n\t\t\t\tplatform.Version = s[1]\n\t\t\tcase \"BuildVersion\":\n\t\t\t\tplatform.Build = s[1]\n\t\t\t}\n\t\t}\n\t}\n}", "func (i SNSSubscribeAttribute) ParseByKey(s string) (SNSSubscribeAttribute, error) {\n\tfor k, v := range _SNSSubscribeAttributeValueToKeyMap {\n\t\tif v == s {\n\t\t\t// parse ok\n\t\t\treturn k, nil\n\t\t}\n\t}\n\n\t// error\n\treturn -1, fmt.Errorf(\"Enum Key of %s Not Expected In SNSSubscribeAttribute Keys List\", s)\n}", "func (f *STAGFields) UnmarshalBinary(b []byte) error {\n\tl := len(b)\n\tif l < 3 {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\n\tf.Flags = b[0]\n\toffset := 1\n\n\tif f.HasPCP() {\n\t\tf.PCP = b[offset] & 0x07\n\t}\n\n\tif f.HasDEI() {\n\t\tf.DEIFlag = (b[offset] >> 3) & 0x01\n\t}\n\n\tif f.HasVID() {\n\t\tf.CVID = binary.BigEndian.Uint16(b[offset:offset+2]) & 0xf0ff\n\t}\n\n\treturn nil\n}", "func ParseBytes(data []byte) (Config, error) {\n\tc, err := parseConfig(data)\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\treturn c, nil\n}", "func ParseSchemaLine(line string) (key string, t *SchemaType) {\n\tkeyValArr := strings.SplitN(line, \"=\", 2) // Split between key and value\n\n\tif len(keyValArr) != 2 { // Not a key=val\n\t\treturn\n\t}\n\n\tkey = keyValArr[0] // Set key to first position in array\n\trawVal := keyValArr[1] // Set our raw value\n\n\tparsedSt, parseErr := NewSchemaType(rawVal) // Attempt to parse our \"raw\" value to a SchemaType\n\n\tif parseErr == nil {\n\t\tt = parsedSt\n\t}\n\n\treturn\n}", "func DecodeAttributeList(b []byte) (AttributeList, []byte, error) {\n\tam := make(map[int]*Attribute)\n\n\tfor {\n\t\tatt, br, err := DecodeAttribute(b)\n\t\tif err == netlink.ErrNoData {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, b, err\n\t\t}\n\t\tam[int(att.Type)] = att\n\t\tb = br\n\t}\n\n\treturn AttributeList(am), b, nil\n}", "func ParseBytes(b []byte) ([]byte, error) {\n\treturn ParseString(string(b))\n}", "func Parse(val string) (info Info, err error) {\n\tvar ival int64\n\n\tswitch val {\n\tcase \"b\", \"bool\":\n\t\tinfo = Bool\n\t\treturn\n\n\tcase \"byte\":\n\t\tinfo = Byte\n\t\treturn\n\n\tcase \"rune\":\n\t\tinfo = Rune\n\t\treturn\n\t}\n\n\tm := reSized.FindStringSubmatch(val)\n\tif m != nil {\n\t\tswitch m[1] {\n\t\tcase \"i\", \"int\":\n\t\t\tinfo.Type = TInt\n\n\t\tcase \"u\", \"uint\":\n\t\t\tinfo.Type = TUint\n\n\t\tcase \"s\", \"string\":\n\t\t\tinfo.Type = TString\n\n\t\tdefault:\n\t\t\treturn info, fmt.Errorf(\"unknown type: %s\", val)\n\t\t}\n\t\tvar bits int64\n\t\tif len(m[2]) > 0 {\n\t\t\tbits, err = strconv.ParseInt(m[2], 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tinfo.Bits = Size(bits)\n\t\tinfo.MinBits = info.Bits\n\t\treturn\n\t}\n\n\tm = reArr.FindStringSubmatch(val)\n\tif m == nil {\n\t\treturn info, fmt.Errorf(\"unknown type: %s\", val)\n\t}\n\tvar elType Info\n\telType, err = Parse(m[2])\n\tif err != nil {\n\t\treturn\n\t}\n\tival, err = strconv.ParseInt(m[1], 10, 32)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tinfo.Type = TArray\n\tinfo.Bits = Size(ival) * elType.Bits\n\tinfo.MinBits = info.Bits\n\tinfo.ElementType = &elType\n\tinfo.ArraySize = Size(ival)\n\n\treturn\n}", "func ParseBytes(content []byte) (Metalink, error) {\n\tmetafile := Metalink{}\n\n\terr := xml.Unmarshal(content, &metafile)\n\tif err != nil {\n\t\treturn metafile, err\n\t}\n\treturn metafile, nil\n}", "func ParseGetPbxDeviceFirmwareitemsResponse(rsp *http.Response) (*GetPbxDeviceFirmwareitemsResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetPbxDeviceFirmwareitemsResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest []PbxDeviceFirmwares2\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func (pd *ProductData) UnmarshalBinary(buf []byte) error {\n\tif len(buf) < 14 {\n\t\treturn newBufError(ErrBufferTooShort, 14, len(buf))\n\t}\n\n\tcopy(pd.Key[:], buf[1:4])\n\tcopy(pd.DevCat[:], buf[4:6])\n\treturn nil\n}", "func (forget *FuseForgetIn) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, forget)\n\n\treturn err\n}", "func FromBytes(bytes []byte) (Manifest, error) {\n\tmanifest := &manifest{}\n\n\t// Preserve the raw manifest so that manifest.Bytes() returns bytes in\n\t// the same order that they were passed to this function\n\tmanifest.raw = make([]byte, len(bytes))\n\tcopy(manifest.raw, bytes)\n\n\tsigned, _ := clearsign.Decode(bytes)\n\tif signed != nil {\n\t\tsignature, err := ioutil.ReadAll(signed.ArmoredSignature.Body)\n\t\tif err != nil {\n\t\t\treturn nil, util.Errorf(\"Could not read signature from pod manifest: %s\", err)\n\t\t}\n\t\tmanifest.signature = signature\n\n\t\t// the original plaintext is in signed.Plaintext, but the signature\n\t\t// corresponds to signed.Bytes, so that's what we need to save\n\t\tmanifest.plaintext = signed.Bytes\n\n\t\t// parse YAML from the message's plaintext instead\n\t\tbytes = signed.Plaintext\n\t}\n\n\tif err := yaml.Unmarshal(bytes, manifest); err != nil {\n\t\treturn nil, util.Errorf(\"Could not read pod manifest: %s\", err)\n\t}\n\tif err := ValidManifest(manifest); err != nil {\n\t\treturn nil, util.Errorf(\"invalid manifest: %s\", err)\n\t}\n\treturn manifest, nil\n}", "func ParseRemoveAddressFrame(r *bytes.Reader, version protocol.VersionNumber) (*RemoveAddressFrame, error) {\n\tframe := &RemoveAddressFrame{}\n\n\t// read the TypeByte\n\tif _, err := r.ReadByte(); err != nil {\n\t\treturn nil, err\n\t}\n\taid, err := r.ReadByte()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tframe.AddrID = protocol.AddressID(aid)\n\treturn frame, nil\n}", "func (cuseInit *CuseInitIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 16 {\n\t\treturn ErrDataLen\n\t}\n\n\terr := common.ParseBinary(bcontent, cuseInit)\n\n\treturn err\n}", "func (p *MaxiiotPayload) Unmarshal(b []byte) (err error) {\n\tdefer func() {\n\t\tif res := recover(); res != nil {\n\t\t\terr = fmt.Errorf(\"panic: %v\", res)\n\t\t}\n\t}()\n\n\tlength := len(b)\n\tif length < 9 {\n\t\treturn errors.New(\"unspoorts maxiiot device protocol\")\n\t}\n\tflag := 0\n\tp.Header = b[flag]\n\tflag++\n\ttc := &TransCode{}\n\ttc.Unmarshal(b[flag])\n\tp.TransCode = tc\n\tflag++\n\tcopy(p.DeviceID[:], b[flag:flag+2])\n\tflag += 2\n\tswitch p.DeviceID {\n\tcase [2]byte{0x00, 0x06}:\n\t\tsmoke := &Smoke{}\n\t\tif err := smoke.Unmarshal(b[flag : length-2]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tp.SensorData = smoke\n\tdefault:\n\t\treturn errors.New(\"unspoorts maxiiot device protocol\")\n\t}\n\n\treturn nil\n}", "func DescriptorFromBytes(data []byte) (*Descriptor, error) {\n\tvar d Descriptor\n\tif err := json.Unmarshal(data, &d); err != nil {\n\t\treturn nil, fmt.Errorf(\"descriptor: parsing failed: %v\", err)\n\t}\n\treturn &d, nil\n}", "func ParseReplacechangeaspecificPbxDeviceFirmwareResponse(rsp *http.Response) (*ReplacechangeaspecificPbxDeviceFirmwareResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &ReplacechangeaspecificPbxDeviceFirmwareResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest PbxDeviceFirmwares\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func parseLine(lineStr string) (Check, error) {\n\tcolumns := strings.Split(lineStr, \"|\")\n\tts, _ := strconv.ParseInt(columns[0], 10, 32)\n\n\treturn Check{ts, parseMeasurements(columns[1])}, nil\n}" ]
[ "0.6094672", "0.49585745", "0.49561727", "0.47174284", "0.4682577", "0.4675515", "0.4654408", "0.46499464", "0.45818946", "0.4525342", "0.45146385", "0.44944", "0.44848514", "0.44841257", "0.44420215", "0.44036722", "0.4384886", "0.43354794", "0.42904556", "0.42374355", "0.42350456", "0.4214246", "0.4190772", "0.41788664", "0.41753167", "0.4086966", "0.4084982", "0.4077412", "0.40750042", "0.40656254", "0.40528527", "0.4050024", "0.40395787", "0.4031215", "0.40243012", "0.40047845", "0.40037388", "0.40010795", "0.3997427", "0.3989618", "0.39889324", "0.398796", "0.39780492", "0.39762127", "0.39610803", "0.39489335", "0.39471012", "0.39451477", "0.3943798", "0.39232725", "0.3923177", "0.39174002", "0.39102903", "0.39004886", "0.38908502", "0.3887958", "0.38854954", "0.38836464", "0.38829175", "0.3880359", "0.38734293", "0.38718042", "0.38571918", "0.3854778", "0.38524354", "0.3850718", "0.38441285", "0.38416713", "0.38329434", "0.38159278", "0.38040376", "0.38013247", "0.3799827", "0.37985405", "0.37918264", "0.37884173", "0.37851453", "0.3784139", "0.37730485", "0.37730485", "0.37702316", "0.37689126", "0.37609148", "0.37605262", "0.37482718", "0.3743022", "0.3742555", "0.37422183", "0.37360024", "0.37341127", "0.37321505", "0.37319857", "0.37258038", "0.3716615", "0.37157127", "0.3711359", "0.37103945", "0.37047586", "0.37016013", "0.3699217" ]
0.82919925
0
SetGlobalBalancer set grpc balancer with scheme.
SetGlobalBalancer устанавливает gRPC балансер с схемой.
func SetGlobalBalancer(scheme string, builder selector.Builder) { mu.Lock() defer mu.Unlock() b := base.NewBalancerBuilder( scheme, &Builder{builder: builder}, base.Config{HealthCheck: true}, ) gBalancer.Register(b) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *ioThrottlerPool) SetGlobalLimit(r rate.Limit, b int) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tp.globalLimiter.SetBurst(b)\n\tp.globalLimiter.SetLimit(r)\n\tp.updateBufferSize()\n}", "func startGrpcBalancer(host string, addresses []string) (error) {\n\t// Start tcp listening port\n\tlis, err := net.Listen(\"tcp\", host)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Create server service\n\tgrpcServer := grpc.NewServer()\n\ts := &server.LoadBalancer{}\n\t// Init servers for routing\n\ts.InitServers(context.Background(), addresses)\n\tcalculate.RegisterCalculateMatrixServer(grpcServer, s)\n\t// Attach listener to server\n\tgrpcServer.Serve(lis)\n\treturn nil\n}", "func NewGRPCLBBalancer(r naming.Resolver) Balancer {\n\treturn &balancer{\n\t\tr: r,\n\t}\n}", "func (d *discovery) SetLoadBalancer(b LoadBalancer) {\n\td.loadBalancerLock.Lock()\n\tdefer d.loadBalancerLock.Unlock()\n\td.loadBalancer = b\n}", "func (ctl *Controller) SetGlobalBrightness(brightness uint8) {\n\tctl.brightness = brightness\n\n\t// Update the buffer to reflect this.\n\tfor i, clr := range ctl.ledColours {\n\t\tctl.updateBuffer(i, clr)\n\t}\n}", "func NewSetBalancer(ctx context.Context, enabled bool) (*SetBalancer, error) {\n\treturn &SetBalancer{\n\t\tbase: base{\n\t\t\tctx: ctx,\n\t\t\tresultch: make(chan RPCResult, 1),\n\t\t},\n\t\treq: &pb.SetBalancerRunningRequest{On: &enabled},\n\t}, nil\n}", "func initGRPCGateway(db *gorm.DB, roomUC usecase.RoomUseCase, addressMux string, addressRPCServer string) error {\n\n\tctx := context.Background()\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tmux := runtime.NewServeMux()\n\tdialOptions := []grpc.DialOption{grpc.WithInsecure()}\n\n\terr := roompb.RegisterRoomServiceHandlerFromEndpoint(ctx, mux, addressRPCServer, dialOptions)\n\tif err != nil {\n\t\tfmt.Println(\"Error when register Room GRPC Gateway, cause: \", err)\n\t\treturn err\n\t}\n\n\t//Starting GRPC Gateway\n\tfmt.Println(\"Room GRPC Server started, using GRPC Gateway mode, on :\", addressMux)\n\tlis, err := net.Listen(\"tcp\", addressMux)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to listen %v \", err)\n\t}\n\n\treturn http.Serve(lis, mux)\n\n}", "func InitRoundRobin(name string, endpoints []string) {\n\tif len(lb) == 0 {\n\t\tlb = make(map[string]*roundrobin.Balancer)\n\t}\n\n\tlb[name] = roundrobin.New(endpoints)\n}", "func SetBusiness(biz *types.Business) {\n\tif biz == nil {\n\t\tbiz = types.DefaultBusiness()\n\t} else {\n\t\tbiz.Init()\n\t}\n\tglobalBusiness = biz\n}", "func NewBalancer(opts []Options) (*Balancer, error) {\n\tif len(opts) == 0 {\n\t\treturn nil, errors.New(\"invalid options\")\n\t}\n\n\t// create balancer base on given options.\n\tbalancer := &Balancer{pool: make(pool, len(opts))}\n\n\tfor i := 0; i < len(opts); i++ {\n\t\tbalancer.pool[i] = newBackend(&opts[i])\n\t}\n\n\treturn balancer, nil\n}", "func BindGlobalFlags(v *viper.Viper, flags *pflag.FlagSet) {\n}", "func init() {\n\tbalancer.Register(orcaLBBuilder{})\n}", "func (reb *Manager) RunGlobalReb(smap *cluster.Smap, globRebID int64, buckets ...string) {\n\tmd := &globArgs{\n\t\tsmap: smap,\n\t\tconfig: cmn.GCO.Get(),\n\t}\n\tif len(buckets) == 0 || buckets[0] == \"\" {\n\t\tmd.ecUsed = reb.t.GetBowner().Get().IsECUsed()\n\t} else {\n\t\t// single bucket rebalance is AIS case only\n\t\tbck := cluster.Bck{Name: buckets[0], Provider: cmn.AIS}\n\t\tprops, ok := reb.t.GetBowner().Get().Get(&bck)\n\t\tif !ok {\n\t\t\tglog.Errorf(\"Bucket %q not found\", bck.Name)\n\t\t\treturn\n\t\t}\n\t\tmd.ecUsed = props.EC.Enabled\n\t}\n\n\tif !reb.globalRebPrecheck(md, globRebID) {\n\t\treturn\n\t}\n\tif !reb.globalRebInit(md, globRebID, buckets...) {\n\t\treturn\n\t}\n\n\t// At this point only one rebalance is running so we can safely enable regular GFN.\n\tgfn := reb.t.GetGFN(cluster.GFNGlobal)\n\tgfn.Activate()\n\tdefer gfn.Deactivate()\n\n\terrCnt := 0\n\tif err := reb.globalRebSyncAndRun(md); err == nil {\n\t\terrCnt = reb.globalRebWaitAck(md)\n\t} else {\n\t\tglog.Warning(err)\n\t}\n\treb.stage.Store(rebStageFin)\n\tfor errCnt != 0 && !reb.xreb.Aborted() {\n\t\terrCnt = reb.bcast(md, reb.waitFinExtended)\n\t}\n\treb.globalRebFini(md)\n\t// clean up all collected data\n\tif md.ecUsed {\n\t\treb.ecReb.cleanup()\n\t}\n\n\treb.nodeStages = make(map[string]uint32) // cleanup after run\n}", "func setSBRBackendGVK(\n\tsbr *v1alpha1.ServiceBindingRequest,\n\tresourceRef string,\n\tbackendGVK schema.GroupVersionKind,\n\tenvVarPrefix string,\n) {\n\tsbr.Spec.BackingServiceSelector = &v1alpha1.BackingServiceSelector{\n\t\tGroupVersionKind: metav1.GroupVersionKind{Group: backendGVK.Group, Version: backendGVK.Version, Kind: backendGVK.Kind},\n\t\tResourceRef: resourceRef,\n\t\tEnvVarPrefix: &envVarPrefix,\n\t}\n}", "func (c *ConfigRequest) SetGlobalConfig(g *ac.GlobalConfig) {\n\tc.V1.Sys.Mlsa = g.V1.Mlsa\n\n\tif logLevel := g.GetV1().GetLog().GetLevel().GetValue(); logLevel != \"\" {\n\t\tc.V1.Sys.Log.Level.Value = logLevel\n\t}\n\n\tif logFormat := g.GetV1().GetLog().GetFormat().GetValue(); logFormat != \"\" {\n\t\tc.V1.Sys.Log.Format.Value = logFormat\n\t}\n}", "func (_obj *Apilangpack) TarsSetProtocol(p m.Protocol) {\n\t_obj.s.TarsSetProtocol(p)\n}", "func NewMultiAddrBalancer(addrs []string) grpc.Balancer {\n\tr := NewHelpResolver(addrs)\n\treturn grpc.RoundRobin(r)\n}", "func NewGlobalLoadBalancerMonitorV1(options *GlobalLoadBalancerMonitorV1Options) (service *GlobalLoadBalancerMonitorV1, err error) {\n\tserviceOptions := &core.ServiceOptions{\n\t\tURL: DefaultServiceURL,\n\t\tAuthenticator: options.Authenticator,\n\t}\n\n\terr = core.ValidateStruct(options, \"options\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbaseService, err := core.NewBaseService(serviceOptions)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif options.URL != \"\" {\n\t\terr = baseService.SetServiceURL(options.URL)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tservice = &GlobalLoadBalancerMonitorV1{\n\t\tService: baseService,\n\t\tCrn: options.Crn,\n\t}\n\n\treturn\n}", "func initGlobalConfig(secCfg tikvconfig.Security) {\n\tif secCfg.ClusterSSLCA != \"\" || secCfg.ClusterSSLCert != \"\" {\n\t\tconf := tidbconfig.GetGlobalConfig()\n\t\tconf.Security.ClusterSSLCA = secCfg.ClusterSSLCA\n\t\tconf.Security.ClusterSSLCert = secCfg.ClusterSSLCert\n\t\tconf.Security.ClusterSSLKey = secCfg.ClusterSSLKey\n\t\ttidbconfig.StoreGlobalConfig(conf)\n\t}\n}", "func (g *GRPC) SetHTTPServer(serv *http.Server) {\n\tg.httpServer = serv\n}", "func (m *MockLoadBalancerServiceIface) AssignToGlobalLoadBalancerRule(p *AssignToGlobalLoadBalancerRuleParams) (*AssignToGlobalLoadBalancerRuleResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AssignToGlobalLoadBalancerRule\", p)\n\tret0, _ := ret[0].(*AssignToGlobalLoadBalancerRuleResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func SetGlobalSelector(builder Builder) {\n\tglobalSelector = builder\n}", "func LoadBalancer_Classic(loadBalancer awselasticloadbalancing.LoadBalancer) LoadBalancer {\n\t_init_.Initialize()\n\n\tvar returns LoadBalancer\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_codedeploy.LoadBalancer\",\n\t\t\"classic\",\n\t\t[]interface{}{loadBalancer},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func SetGlobalLogger(cores ...zapcore.Core) {\n\tcore := zapcore.NewTee(cores...)\n\tzap.ReplaceGlobals(zap.New(core))\n\n\tlogger = zap.L()\n}", "func (globalLoadBalancerMonitor *GlobalLoadBalancerMonitorV1) SetServiceURL(url string) error {\n\treturn globalLoadBalancerMonitor.Service.SetServiceURL(url)\n}", "func ConfigureLoadBalancer(clusterName string) error {\n\tallNodes, err := nodes.List(fmt.Sprintf(\"label=%s=%s\", constants.ClusterLabelKey, clusterName))\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// identify external load balancer node\n\tloadBalancerNode, err := nodes.ExternalLoadBalancerNode(allNodes)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// collect info about the existing controlplane nodes\n\tvar backendServers = map[string]string{}\n\tcontrolPlaneNodes, err := nodes.SelectNodesByRole(\n\t\tallNodes,\n\t\tconstants.ControlPlaneNodeRoleValue,\n\t)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tfor _, n := range controlPlaneNodes {\n\t\tcontrolPlaneIP, err := n.IP()\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to get IP for node %s\", n.Name())\n\t\t}\n\t\tbackendServers[n.Name()] = fmt.Sprintf(\"%s:%d\", controlPlaneIP, 6443)\n\t}\n\n\t// create loadbalancer config data\n\tloadbalancerConfig, err := loadbalancer.Config(&loadbalancer.ConfigData{\n\t\tControlPlanePort: loadbalancer.ControlPlanePort,\n\t\tBackendServers: backendServers,\n\t})\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif err := loadBalancerNode.WriteFile(loadbalancer.ConfigPath, loadbalancerConfig); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\treturn errors.WithStack(docker.Kill(\"SIGHUP\", loadBalancerNode.Name()))\n}", "func InitGlobalFlags(flags *pflag.FlagSet) {\n\tcliconfig.InitLoggingLevel(flags)\n\tcliconfig.InitClientConfigFile(flags)\n\tcliconfig.InitChannelID(flags)\n\tcliconfig.InitUserName(flags)\n\tcliconfig.InitUserPassword(flags)\n\tcliconfig.InitOrgID(flags)\n\tcliconfig.InitMspID(flags)\n\tcliconfig.InitKeyType(flags)\n\tcliconfig.InitEphemeralFlag(flags)\n\tcliconfig.InitSigAlg(flags)\n\tcliconfig.InitTimeout(flags)\n\n}", "func InitGrpcResolver(namespace string, mgr ctrl.Manager) (*KubeResolver, error) {\n\tkr := &KubeResolver{\n\t\tnamespace: namespace, Client: mgr.GetClient(),\n\t\tresolvers: make(map[string][]*serviceResolver, 2),\n\t\tlogger: ctrl.Log.WithName(\"KubeResolver\"),\n\t}\n\terr := ctrl.NewControllerManagedBy(mgr).For(&corev1.Endpoints{}).Complete(kr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresolver.Register(kr)\n\tkr.logger.Info(\"Registered KubeResolver with kubebuilder and gRPC\")\n\treturn kr, nil\n}", "func ConfigureGlobalBBSCache(ctx context.Context, bbsURL, cafile, certfile, keyfile string, pollInterval time.Duration, testing bbs.Client) (*BBSCache, error) {\n\tglobalBBSCacheLock.Lock()\n\tdefer globalBBSCacheLock.Unlock()\n\n\tif globalBBSCache.configured {\n\t\treturn globalBBSCache, nil\n\t}\n\n\tglobalBBSCache.configured = true\n\tif testing != nil {\n\t\tglobalBBSCache.bbsAPIClient = testing\n\t} else {\n\t\tclientConfig := bbs.ClientConfig{\n\t\t\tURL: bbsURL,\n\t\t\tIsTLS: true,\n\t\t\tCAFile: cafile,\n\t\t\tCertFile: certfile,\n\t\t\tKeyFile: keyfile,\n\t\t\tClientSessionCacheSize: 0,\n\t\t\tMaxIdleConnsPerHost: 0,\n\t\t\tInsecureSkipVerify: false,\n\t\t\tRetries: 10,\n\t\t\tRequestTimeout: 5 * time.Second,\n\t\t}\n\t\tvar err error\n\t\tglobalBBSCache.bbsAPIClient, err = bbs.NewClientWithConfig(clientConfig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tglobalBBSCache.bbsAPIClientLogger = lager.NewLogger(\"bbs\")\n\tglobalBBSCache.pollInterval = pollInterval\n\tglobalBBSCache.lastUpdated = time.Time{} // zero time\n\tglobalBBSCache.cancelContext = ctx\n\n\tgo globalBBSCache.start()\n\n\treturn globalBBSCache, nil\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func configureServer(s *graceful.Server, scheme, addr string) {\n}", "func SetGlobalBus(bus EventBus) {\n\tglobalBus = bus\n}", "func (_obj *Apichannels) TarsSetProtocol(p m.Protocol) {\n\t_obj.s.TarsSetProtocol(p)\n}", "func SetGlobalGroup(iq IQ, roleName, group string) error {\n\treturn globalAuth(iq, http.MethodPut, roleName, MemberTypeGroup, group)\n}", "func SetGlobal(filename string) error {\n\turls, err := LoadURLs(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tEnv = *urls\n\treturn nil\n}", "func configureServer(s *http.Server, scheme, addr string) {\n\n}", "func SetGlobalConfigMap(key string, value interface{}) {\n\tglobalConfig.Lock()\n\tglobalConfig.gMap[key] = value\n\tglobalConfig.Unlock()\n}", "func NewRandomLoadBalancer(ctx context.Context, frontend NetAddr, backends ...NetAddr) (*LoadBalancer, error) {\n\treturn newLoadBalancer(ctx, frontend, randomPolicy(), backends...)\n}", "func configureServer(s *http.Server, scheme, addr string) {\n}", "func configureServer(s *http.Server, scheme, addr string) {\n}", "func configureServer(s *http.Server, scheme, addr string) {\n}", "func configureServer(s *http.Server, scheme, addr string) {\n}", "func configureServer(s *http.Server, scheme, addr string) {\n}", "func configureServer(s *http.Server, scheme, addr string) {\n}", "func NewBalancer(name string, handler EventHandler, configure *conf.BalancersConfiguration) (balancer *Balancer) {\n\n\tbalancer = new(Balancer)\n\tbalancer.name = name\n\tbalancer.handler = handler\n\tconfiguration := configure.GetBalancerConfiguration(name)\n\tbalancer.balancerType = configuration.BalancerType\n\tbalancer.initQueue(configuration)\n\tbalancer.aggregatorManager = initAggregatorManager(configuration.AggreagatorName, balancer, configuration.WorkAggregatorConfiguration)\n\tbalancer.poolManager = initRoutinePoolManager(name, balancer.balancerType, balancer, handler, configuration)\n\treturn balancer\n}", "func (_obj *DataService) TarsSetProtocol(p m.Protocol) {\n\t_obj.s.TarsSetProtocol(p)\n}", "func (w *World) SetEnumGlobal() {\n\tif w.Desc == nil {\n\t\treturn\n\t}\n\trfl := w.Reflector(rtypes.T_Enums)\n\tif rfl.Name == \"\" {\n\t\treturn\n\t}\n\tw.Desc.GenerateEnumTypes()\n\tstate := w.State()\n\tenums, err := rfl.PushTo(state.Context(), w.Desc.EnumTypes)\n\tif err != nil {\n\t\treturn\n\t}\n\tstate.L.SetGlobal(\"Enum\", enums)\n}", "func (s) TestBalancer_AddressesChanging(t *testing.T) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\tdefer cancel()\n\n\tsrv1 := startServer(t, reportBoth)\n\tsrv2 := startServer(t, reportBoth)\n\tsrv3 := startServer(t, reportBoth)\n\tsrv4 := startServer(t, reportBoth)\n\n\t// srv1: weight 10\n\tsrv1.oobMetrics.SetQPS(10.0)\n\tsrv1.oobMetrics.SetApplicationUtilization(1.0)\n\t// srv2: weight 100\n\tsrv2.oobMetrics.SetQPS(10.0)\n\tsrv2.oobMetrics.SetApplicationUtilization(.1)\n\t// srv3: weight 20\n\tsrv3.oobMetrics.SetQPS(20.0)\n\tsrv3.oobMetrics.SetApplicationUtilization(1.0)\n\t// srv4: weight 200\n\tsrv4.oobMetrics.SetQPS(20.0)\n\tsrv4.oobMetrics.SetApplicationUtilization(.1)\n\n\tsc := svcConfig(t, oobConfig)\n\tif err := srv1.StartClient(grpc.WithDefaultServiceConfig(sc)); err != nil {\n\t\tt.Fatalf(\"Error starting client: %v\", err)\n\t}\n\tsrv2.Client = srv1.Client\n\taddrs := []resolver.Address{{Addr: srv1.Address}, {Addr: srv2.Address}, {Addr: srv3.Address}}\n\tsrv1.R.UpdateState(resolver.State{Addresses: addrs})\n\n\t// Call each backend once to ensure the weights have been received.\n\tensureReached(ctx, t, srv1.Client, 3)\n\ttime.Sleep(weightUpdatePeriod)\n\tcheckWeights(ctx, t, srvWeight{srv1, 1}, srvWeight{srv2, 10}, srvWeight{srv3, 2})\n\n\t// Add backend 4\n\taddrs = append(addrs, resolver.Address{Addr: srv4.Address})\n\tsrv1.R.UpdateState(resolver.State{Addresses: addrs})\n\ttime.Sleep(weightUpdatePeriod)\n\tcheckWeights(ctx, t, srvWeight{srv1, 1}, srvWeight{srv2, 10}, srvWeight{srv3, 2}, srvWeight{srv4, 20})\n\n\t// Shutdown backend 3. RPCs will no longer be routed to it.\n\tsrv3.Stop()\n\ttime.Sleep(weightUpdatePeriod)\n\tcheckWeights(ctx, t, srvWeight{srv1, 1}, srvWeight{srv2, 10}, srvWeight{srv4, 20})\n\n\t// Remove addresses 2 and 3. RPCs will no longer be routed to 2 either.\n\taddrs = []resolver.Address{{Addr: srv1.Address}, {Addr: srv4.Address}}\n\tsrv1.R.UpdateState(resolver.State{Addresses: addrs})\n\ttime.Sleep(weightUpdatePeriod)\n\tcheckWeights(ctx, t, srvWeight{srv1, 1}, srvWeight{srv4, 20})\n\n\t// Re-add 2 and remove the rest.\n\taddrs = []resolver.Address{{Addr: srv2.Address}}\n\tsrv1.R.UpdateState(resolver.State{Addresses: addrs})\n\ttime.Sleep(weightUpdatePeriod)\n\tcheckWeights(ctx, t, srvWeight{srv2, 10})\n\n\t// Re-add 4.\n\taddrs = append(addrs, resolver.Address{Addr: srv4.Address})\n\tsrv1.R.UpdateState(resolver.State{Addresses: addrs})\n\ttime.Sleep(weightUpdatePeriod)\n\tcheckWeights(ctx, t, srvWeight{srv2, 10}, srvWeight{srv4, 20})\n}", "func (_obj *WebApiAuth) TarsSetProtocol(p m.Protocol) {\n\t_obj.s.TarsSetProtocol(p)\n}", "func (r *GslbReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\t// Figure out Gslb resource name to Reconcile when non controlled Endpoint is updated\n\n\tendpointMapFn := handler.ToRequestsFunc(\n\t\tfunc(a handler.MapObject) []reconcile.Request {\n\t\t\tgslbList := &k8gbv1beta1.GslbList{}\n\t\t\topts := []client.ListOption{\n\t\t\t\tclient.InNamespace(a.Meta.GetNamespace()),\n\t\t\t}\n\t\t\tc := mgr.GetClient()\n\t\t\terr := c.List(context.TODO(), gslbList, opts...)\n\t\t\tif err != nil {\n\t\t\t\tlog.Info().Msg(\"Can't fetch gslb objects\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tgslbName := \"\"\n\t\t\tfor _, gslb := range gslbList.Items {\n\t\t\t\tfor _, rule := range gslb.Spec.Ingress.Rules {\n\t\t\t\t\tfor _, path := range rule.HTTP.Paths {\n\t\t\t\t\t\tif path.Backend.ServiceName == a.Meta.GetName() {\n\t\t\t\t\t\t\tgslbName = gslb.Name\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 len(gslbName) > 0 {\n\t\t\t\treturn []reconcile.Request{\n\t\t\t\t\t{NamespacedName: types.NamespacedName{\n\t\t\t\t\t\tName: gslbName,\n\t\t\t\t\t\tNamespace: a.Meta.GetNamespace(),\n\t\t\t\t\t}},\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\tcreateGslbFromIngress := func(annotationKey string, annotationValue string, a handler.MapObject, strategy string) {\n\t\tlog.Info().Msgf(\"Detected strategy annotation(%s:%s) on Ingress(%s)\",\n\t\t\tannotationKey, annotationValue, a.Meta.GetName())\n\t\tc := mgr.GetClient()\n\t\tingressToReuse := &v1beta1.Ingress{}\n\t\terr := c.Get(context.Background(), client.ObjectKey{\n\t\t\tNamespace: a.Meta.GetNamespace(),\n\t\t\tName: a.Meta.GetName(),\n\t\t}, ingressToReuse)\n\t\tif err != nil {\n\t\t\tlog.Info().Msgf(\"Ingress(%s) does not exist anymore. Skipping Glsb creation...\", a.Meta.GetName())\n\t\t\treturn\n\t\t}\n\t\tgslbExist := &k8gbv1beta1.Gslb{}\n\t\terr = c.Get(context.Background(), client.ObjectKey{\n\t\t\tNamespace: a.Meta.GetNamespace(),\n\t\t\tName: a.Meta.GetName(),\n\t\t}, gslbExist)\n\t\tif err == nil {\n\t\t\tlog.Info().Msgf(\"Gslb(%s) already exists. Skipping Gslb creation...\", gslbExist.Name)\n\t\t\treturn\n\t\t}\n\t\tgslb := &k8gbv1beta1.Gslb{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tNamespace: a.Meta.GetNamespace(),\n\t\t\t\tName: a.Meta.GetName(),\n\t\t\t\tAnnotations: a.Meta.GetAnnotations(),\n\t\t\t},\n\t\t\tSpec: k8gbv1beta1.GslbSpec{\n\t\t\t\tIngress: k8gbv1beta1.FromV1Beta1IngressSpec(ingressToReuse.Spec),\n\t\t\t\tStrategy: k8gbv1beta1.Strategy{\n\t\t\t\t\tType: strategy,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tif strategy == failoverStrategy {\n\t\t\tfor annotationKey, annotationValue := range a.Meta.GetAnnotations() {\n\t\t\t\tif annotationKey == primaryGeoTagAnnotation {\n\t\t\t\t\tgslb.Spec.Strategy.PrimaryGeoTag = annotationValue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif gslb.Spec.Strategy.PrimaryGeoTag == \"\" {\n\t\t\t\tlog.Info().Msgf(\"%s annotation is missing, skipping Gslb creation...\", primaryGeoTagAnnotation)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tlog.Info().Msgf(\"Creating new Gslb(%s) out of Ingress annotation\", gslb.Name)\n\t\terr = c.Create(context.Background(), gslb)\n\t\tif err != nil {\n\t\t\tlog.Err(err).Msg(\"Glsb creation failed\")\n\t\t}\n\t}\n\tingressMapFn := handler.ToRequestsFunc(\n\t\tfunc(a handler.MapObject) []reconcile.Request {\n\t\t\tfor annotationKey, annotationValue := range a.Meta.GetAnnotations() {\n\t\t\t\tif annotationKey == strategyAnnotation {\n\t\t\t\t\tswitch annotationValue {\n\t\t\t\t\tcase roundRobinStrategy:\n\t\t\t\t\t\tcreateGslbFromIngress(annotationKey, annotationKey, a, roundRobinStrategy)\n\t\t\t\t\tcase failoverStrategy:\n\t\t\t\t\t\tcreateGslbFromIngress(annotationKey, annotationKey, a, failoverStrategy)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tFor(&k8gbv1beta1.Gslb{}).\n\t\tOwns(&v1beta1.Ingress{}).\n\t\tOwns(&externaldns.DNSEndpoint{}).\n\t\tWatches(&source.Kind{Type: &corev1.Endpoints{}},\n\t\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\t\tToRequests: endpointMapFn}).\n\t\tWatches(&source.Kind{Type: &v1beta1.Ingress{}},\n\t\t\t&handler.EnqueueRequestsFromMapFunc{\n\t\t\t\tToRequests: ingressMapFn}).\n\t\tComplete(r)\n}", "func Init(c *conf.Config) {\n\t// service\n\tinitService(c)\n\t// init grpc\n\tgrpcSvr = grpc.New(nil, arcSvc, newcomerSvc)\n\tengineOuter := bm.DefaultServer(c.BM.Outer)\n\t// init outer router\n\touterRouter(engineOuter)\n\tif err := engineOuter.Start(); err != nil {\n\t\tlog.Error(\"engineOuter.Start() error(%v) | config(%v)\", err, c)\n\t\tpanic(err)\n\t}\n}", "func (m *MockLoadBalancerServiceIface) UpdateGlobalLoadBalancerRule(p *UpdateGlobalLoadBalancerRuleParams) (*UpdateGlobalLoadBalancerRuleResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateGlobalLoadBalancerRule\", p)\n\tret0, _ := ret[0].(*UpdateGlobalLoadBalancerRuleResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func CreateBalancer(numWorker int) *LoadBalancer {\n\tdone := make(chan *Worker, numWorker)\n\tb := &LoadBalancer{make(Pool, 0, numWorker), done}\n\tfor i := 0; i < numWorker; i++ {\n\t\tw := &Worker{make(chan Job, JOB_BUFFER_LENGTH), 0, i}\n\t\theap.Push(&b.workerPool, w)\n\t\tgo w.work(done)\n\t}\n\treturn b\n}", "func (c Config) SetGlobal(option, value string) {\n\tif globals, ok := c[Globals]; ok {\n\t\tif settings, ok := globals.(map[string]string); ok {\n\t\t\tsettings[option] = value\n\t\t}\n\t}\n}", "func (gm GlobalManager) InitGlobalManager(ctx sdk.Context, totalLino types.Coin) sdk.Error {\n\treturn gm.storage.InitGlobalState(ctx, totalLino)\n}", "func NewRandom(res sd.Resolver) Balancer {\n\treturn &randomLB{\n\t\tres: res,\n\t}\n}", "func (broadcast *Broadcast) ChangeGlobalAllocationParam(ctx context.Context, creator string,\n\tparameter model.GlobalAllocationParam, reason string, privKeyHex string, seq int64) (*model.BroadcastResponse, error) {\n\tmsg := model.ChangeGlobalAllocationParamMsg{\n\t\tCreator: creator,\n\t\tParameter: parameter,\n\t\tReason: reason,\n\t}\n\treturn broadcast.broadcastTransaction(ctx, msg, privKeyHex, seq, \"\", false)\n}", "func NewGlobalLoadBalancerMonitorV1UsingExternalConfig(options *GlobalLoadBalancerMonitorV1Options) (globalLoadBalancerMonitor *GlobalLoadBalancerMonitorV1, err error) {\n\tif options.ServiceName == \"\" {\n\t\toptions.ServiceName = DefaultServiceName\n\t}\n\n\tif options.Authenticator == nil {\n\t\toptions.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tglobalLoadBalancerMonitor, err = NewGlobalLoadBalancerMonitorV1(options)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = globalLoadBalancerMonitor.Service.ConfigureService(options.ServiceName)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif options.URL != \"\" {\n\t\terr = globalLoadBalancerMonitor.Service.SetServiceURL(options.URL)\n\t}\n\treturn\n}", "func NewGRPCServer(logger log.Logger, protoAddr string, app types.Application) service.Service {\n\tproto, addr := tmnet.ProtocolAndAddress(protoAddr)\n\ts := &GRPCServer{\n\t\tlogger: logger,\n\t\tproto: proto,\n\t\taddr: addr,\n\t\tapp: app,\n\t}\n\ts.BaseService = *service.NewBaseService(logger, \"ABCIServer\", s)\n\treturn s\n}", "func (sv *globalSystemVariables) SetGlobal(name string, val interface{}) error {\n\tsv.mutex.Lock()\n\tdefer sv.mutex.Unlock()\n\tname = strings.ToLower(name)\n\tsysVar, ok := systemVars[name]\n\tif !ok {\n\t\treturn sql.ErrUnknownSystemVariable.New(name)\n\t}\n\tif sysVar.Scope == sql.SystemVariableScope_Session {\n\t\treturn sql.ErrSystemVariableSessionOnly.New(name)\n\t}\n\tif !sysVar.Dynamic || sysVar.ValueFunction != nil {\n\t\treturn sql.ErrSystemVariableReadOnly.New(name)\n\t}\n\tconvertedVal, _, err := sysVar.Type.Convert(val)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsvv := sql.SystemVarValue{Var: sysVar, Val: convertedVal}\n\tsv.sysVarVals[name] = svv\n\tif sysVar.NotifyChanged != nil {\n\t\tsysVar.NotifyChanged(sql.SystemVariableScope_Global, svv)\n\t}\n\treturn nil\n}", "func Global(v *viper.Viper) {\n\tAppConf = v\n}", "func SetGlobalHttpClient(client *http.Client) {\n\tdefaultHttpClient = client\n}", "func (service *Service) initGRPC(ctx context.Context) error {\n\t// ============================= Initialize runtime mux =============================\n\tif service.runtimeMuxEndpoint == \"\" {\n\t\tservice.runtimeMuxEndpoint = \"/\"\n\t}\n\n\t// Apply servemux options to runtime muxer\n\tservice.runtimeMux = runtime.NewServeMux(service.serveMuxOptions...)\n\n\t// ============================= Initialize grpc proxy client =============================\n\tvar (\n\t\tgPort int\n\t\terr error\n\t)\n\n\tif service.cfg.ServiceTLSEnabled() {\n\t\tcreds, err := credentials.NewClientTLSFromFile(\n\t\t\tservice.cfg.ServiceTLSCertFile(), service.cfg.ServiceTLSServerName())\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err,\n\t\t\t\t\"failed to create tls config for %s service\", service.cfg.ServiceTLSServerName())\n\t\t}\n\t\tservice.dialOptions = append(service.dialOptions, grpc.WithTransportCredentials(creds))\n\t\tgPort = service.cfg.HTTPort()\n\t} else {\n\t\tservice.dialOptions = append(service.dialOptions, grpc.WithInsecure())\n\t\tgPort = service.cfg.GRPCPort()\n\t}\n\n\t// Enable wait for ready RPCs\n\twaitForReadyUnaryInterceptor := func(\n\t\tctx context.Context,\n\t\tmethod string,\n\t\treq, reply interface{},\n\t\tcc *grpc.ClientConn,\n\t\tinvoker grpc.UnaryInvoker,\n\t\topts ...grpc.CallOption,\n\t) error {\n\t\treturn invoker(ctx, method, req, reply, cc, append(opts, grpc.WaitForReady(true))...)\n\t}\n\n\t// Add client unary interceptos\n\tunaryClientInterceptors := []grpc.UnaryClientInterceptor{waitForReadyUnaryInterceptor}\n\tfor _, unaryInterceptor := range service.unaryClientInterceptors {\n\t\tunaryClientInterceptors = append(unaryClientInterceptors, unaryInterceptor)\n\t}\n\n\t// Add client streaming interceptos\n\tstreamClientInterceptors := make([]grpc.StreamClientInterceptor, 0)\n\tfor _, streamInterceptor := range service.streamClientInterceptors {\n\t\tstreamClientInterceptors = append(streamClientInterceptors, streamInterceptor)\n\t}\n\n\t// Add inteceptors as dial option\n\tservice.dialOptions = append(service.dialOptions, []grpc.DialOption{\n\t\tgrpc.WithUnaryInterceptor(\n\t\t\tgrpc_middleware.ChainUnaryClient(unaryClientInterceptors...),\n\t\t),\n\t\tgrpc.WithStreamInterceptor(\n\t\t\tgrpc_middleware.ChainStreamClient(streamClientInterceptors...),\n\t\t),\n\t}...)\n\n\t// client connection to the reverse gateway\n\tservice.clientConn, err = conn.DialService(context.Background(), &conn.GRPCDialOptions{\n\t\tServiceName: \"self\",\n\t\tAddress: fmt.Sprintf(\"localhost:%d\", gPort),\n\t\tDialOptions: service.dialOptions,\n\t\tK8Service: false,\n\t})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"client failed to dial to gRPC server\")\n\t}\n\n\t// ============================= Initialize grpc server =============================\n\t// Add transport credentials if secure option is passed\n\tif service.cfg.ServiceTLSEnabled() {\n\t\tcreds, err := credentials.NewServerTLSFromFile(\n\t\t\tservice.cfg.ServiceTLSCertFile(), service.cfg.ServiceTLSKeyFile())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create grpc server tls credentials: %v\", err)\n\t\t}\n\t\tservice.serverOptions = append(\n\t\t\tservice.serverOptions, grpc.Creds(creds),\n\t\t)\n\t}\n\n\t// Append interceptors as server options\n\tservice.serverOptions = append(\n\t\tservice.serverOptions, grpc_middleware.WithUnaryServerChain(service.unaryInterceptors...))\n\tservice.serverOptions = append(\n\t\tservice.serverOptions, grpc_middleware.WithStreamServerChain(service.streamInterceptors...))\n\n\tservice.gRPCServer = grpc.NewServer(service.serverOptions...)\n\n\t// register reflection on the gRPC server\n\treflection.Register(service.gRPCServer)\n\n\treturn nil\n}", "func (m *Modules) SetIngressGlobalRouteConfig(ctx context.Context, projectID string, c *config.GlobalRoutesConfig) error {\n\tmodule, err := m.loadModule(projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn module.SetIngressGlobalRouteConfig(ctx, projectID, c)\n}", "func TestServiceRegistryExternalTrafficGlobalBeta(t *testing.T) {\n\tctx := genericapirequest.NewDefaultContext()\n\tstorage, _, server := NewTestREST(t, nil)\n\tdefer server.Terminate(t)\n\tsvc := &api.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"external-lb-esipp\",\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tapi.BetaAnnotationExternalTraffic: api.AnnotationValueExternalTrafficGlobal,\n\t\t\t},\n\t\t},\n\t\tSpec: api.ServiceSpec{\n\t\t\tSelector: map[string]string{\"bar\": \"baz\"},\n\t\t\tSessionAffinity: api.ServiceAffinityNone,\n\t\t\tType: api.ServiceTypeLoadBalancer,\n\t\t\tPorts: []api.ServicePort{{\n\t\t\t\tPort: 6502,\n\t\t\t\tProtocol: api.ProtocolTCP,\n\t\t\t\tTargetPort: intstr.FromInt(6502),\n\t\t\t}},\n\t\t},\n\t}\n\tcreated_svc, err := storage.Create(ctx, svc, false)\n\tif created_svc == nil || err != nil {\n\t\tt.Errorf(\"Unexpected failure creating service %v\", err)\n\t}\n\tcreated_service := created_svc.(*api.Service)\n\tif service.NeedsHealthCheck(created_service) {\n\t\tt.Errorf(\"Expecting health check not needed, returned health check needed instead\")\n\t}\n\t// Make sure the service does not have the health check node port allocated\n\tport := service.GetServiceHealthCheckNodePort(created_service)\n\tif port != 0 {\n\t\tt.Errorf(\"Unexpected allocation of health check node port: %v\", port)\n\t}\n}", "func rcSetGlobal(p *TCompiler, code *TCode) (*value.Value, error) {\n\tg := p.sys.Scopes.GetGlobal()\n\tvarV := g.GetByIndex(code.A)\n\tvarV.SetValue(p.regGet(code.B))\n\tp.moveNext()\n\treturn varV, nil\n}", "func (m *ApiMeta) GlobalFlagSet(cmd string) *flag.FlagSet {\n\tf := flag.NewFlagSet(cmd, flag.ContinueOnError)\n\n\tf.StringVar(&m.gateEndpoint, \"gate-endpoint\", \"http://localhost:8084\",\n\t\t\"Gate (API server) endpoint\")\n\n\tf.Usage = func() {}\n\n\treturn f\n}", "func SetWithBackends(cf kubernetes.ClientFactory, prom prometheus.ClientInterface) {\n\tclientFactory = cf\n\tprometheusClient = prom\n}", "func Init(c *conf.Config, s *service.Service) {\n\tsrv = s\n\t// init inner router\n\teng := bm.DefaultServer(c.BM)\n\tinitRouter(eng)\n\t// init inner server\n\tif err := eng.Start(); err != nil {\n\t\tlog.Error(\"bm.DefaultServer error(%v)\", err)\n\t\tpanic(err)\n\t}\n}", "func (s) TestBalancer_TwoAddresses_OOBThenPerCall(t *testing.T) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\tdefer cancel()\n\n\tsrv1 := startServer(t, reportBoth)\n\tsrv2 := startServer(t, reportBoth)\n\n\t// srv1 starts loaded and srv2 starts without load; ensure RPCs are routed\n\t// disproportionately to srv2 (10:1).\n\tsrv1.oobMetrics.SetQPS(10.0)\n\tsrv1.oobMetrics.SetApplicationUtilization(1.0)\n\n\tsrv2.oobMetrics.SetQPS(10.0)\n\tsrv2.oobMetrics.SetApplicationUtilization(.1)\n\n\t// For per-call metrics (not used initially), srv2 reports that it is\n\t// loaded and srv1 reports low load. After confirming OOB works, switch to\n\t// per-call and confirm the new routing weights are applied.\n\tsrv1.callMetrics.SetQPS(10.0)\n\tsrv1.callMetrics.SetApplicationUtilization(.1)\n\n\tsrv2.callMetrics.SetQPS(10.0)\n\tsrv2.callMetrics.SetApplicationUtilization(1.0)\n\n\tsc := svcConfig(t, oobConfig)\n\tif err := srv1.StartClient(grpc.WithDefaultServiceConfig(sc)); err != nil {\n\t\tt.Fatalf(\"Error starting client: %v\", err)\n\t}\n\taddrs := []resolver.Address{{Addr: srv1.Address}, {Addr: srv2.Address}}\n\tsrv1.R.UpdateState(resolver.State{Addresses: addrs})\n\n\t// Call each backend once to ensure the weights have been received.\n\tensureReached(ctx, t, srv1.Client, 2)\n\n\t// Wait for the weight update period to allow the new weights to be processed.\n\ttime.Sleep(weightUpdatePeriod)\n\tcheckWeights(ctx, t, srvWeight{srv1, 1}, srvWeight{srv2, 10})\n\n\t// Update to per-call weights.\n\tc := svcConfig(t, perCallConfig)\n\tparsedCfg := srv1.R.CC.ParseServiceConfig(c)\n\tif parsedCfg.Err != nil {\n\t\tpanic(fmt.Sprintf(\"Error parsing config %q: %v\", c, parsedCfg.Err))\n\t}\n\tsrv1.R.UpdateState(resolver.State{Addresses: addrs, ServiceConfig: parsedCfg})\n\n\t// Wait for the weight update period to allow the new weights to be processed.\n\ttime.Sleep(weightUpdatePeriod)\n\tcheckWeights(ctx, t, srvWeight{srv1, 10}, srvWeight{srv2, 1})\n}", "func (_obj *Apipayments) TarsSetProtocol(p m.Protocol) {\n\t_obj.s.TarsSetProtocol(p)\n}", "func (bs *BusinessServer) initBCSControllerClient() {\n\tctx := &grpclb.Context{\n\t\tTarget: bs.viper.GetString(\"bcscontroller.servicename\"),\n\t\tEtcdConfig: bs.etcdCfg,\n\t}\n\n\t// gRPC dial options, with insecure and timeout.\n\topts := []grpc.DialOption{\n\t\tgrpc.WithInsecure(),\n\t\tgrpc.WithTimeout(bs.viper.GetDuration(\"bcscontroller.calltimeout\")),\n\t}\n\n\t// build gRPC client of bcscontroller.\n\tconn, err := grpclb.NewGRPCConn(ctx, opts...)\n\tif err != nil {\n\t\tlogger.Fatal(\"can't create bcscontroller gRPC client, %+v\", err)\n\t}\n\tbs.bcsControllerConn = conn\n\tbs.bcsControllerCli = pbbcscontroller.NewBCSControllerClient(conn.Conn())\n\tlogger.Info(\"create bcs-controller gRPC client success.\")\n}", "func (s *Serverus) InitGRPC() {\n\tlog.Println(\"Initializing gRPC\")\n\ts.server = grpc.NewServer(\n\t\tgrpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(s.interceptors...)), // register the interceptors injected and the base\n\t)\n}", "func checkGlobalSet(t *testing.T, expError bool, fabMode, vlans, vxlans string) {\n\tgl := client.Global{\n\t\tName: \"global\",\n\t\tNetworkInfraType: fabMode,\n\t\tVlans: vlans,\n\t\tVxlans: vxlans,\n\t}\n\terr := contivClient.GlobalPost(&gl)\n\tif err != nil && !expError {\n\t\tt.Fatalf(\"Error setting global {%+v}. Err: %v\", gl, err)\n\t} else if err == nil && expError {\n\t\tt.Fatalf(\"Set global {%+v} succeded while expecing error\", gl)\n\t} else if err == nil {\n\t\t// verify global state\n\t\tgotGl, err := contivClient.GlobalGet(\"global\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error getting global object. Err: %v\", err)\n\t\t}\n\n\t\t// verify expected values\n\t\tif gotGl.NetworkInfraType != fabMode || gotGl.Vlans != vlans || gotGl.Vxlans != vxlans {\n\t\t\tt.Fatalf(\"Error Got global state {%+v} does not match expected %s, %s, %s\", gotGl, fabMode, vlans, vxlans)\n\t\t}\n\n\t\t// verify the state created\n\t\tgCfg := &gstate.Cfg{}\n\t\tgCfg.StateDriver = stateStore\n\t\terr = gCfg.Read(\"\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error reading global cfg state. Err: %v\", err)\n\t\t}\n\n\t\tif gCfg.Auto.VLANs != vlans || gCfg.Auto.VXLANs != vxlans {\n\t\t\tt.Fatalf(\"global config Vlan/Vxlan ranges %s/%s are not same as %s/%s\",\n\t\t\t\tgCfg.Auto.VLANs, gCfg.Auto.VXLANs, vlans, vxlans)\n\t\t}\n\n\t\t// verify global oper state\n\t\tgOper := &gstate.Oper{}\n\t\tgOper.StateDriver = stateStore\n\t\terr = gOper.Read(\"\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Error reading global oper state. Err: %v\", err)\n\t\t}\n\n\t\t// verify vxlan resources\n\t\tvxlanRsrc := &resources.AutoVXLANCfgResource{}\n\t\tvxlanRsrc.StateDriver = stateStore\n\t\tif err := vxlanRsrc.Read(\"global\"); err != nil {\n\t\t\tt.Fatalf(\"Error reading vxlan resource. Err: %v\", err)\n\t\t}\n\n\t\t// verify vlan resource\n\t\tvlanRsrc := &resources.AutoVLANCfgResource{}\n\t\tvlanRsrc.StateDriver = stateStore\n\t\tif err := vlanRsrc.Read(\"global\"); err != nil {\n\t\t\tt.Fatalf(\"Error reading vlan resource. Err: %v\", err)\n\t\t}\n\t}\n}", "func (h *Host) initBackends() {\n\n\t//check if we have any backends to proxy requests to\n\tif h.backends != nil {\n\n\t\t//loop over configs\n\t\tfor _, v := range h.backends.Map {\n\t\t\t//grab the server url and parse it\n\t\t\tserverUrl, err := url.Parse(v.(string))\n\n\t\t\t//if its not a valid url log the error\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t} else {\n\t\t\t\t//create a new proxy for our backend and add it to our proxy slice\n\t\t\t\th.proxies = append(h.proxies, httputil.NewSingleHostReverseProxy(serverUrl))\n\t\t\t}\n\t\t}\n\n\t\t//loop over proxies and block till one is needed\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\tfor _, p := range h.proxies {\n\t\t\t\t\th.proxyChannel <- p\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n}", "func SetBackend(backend SupportedBackend, b Backend) {\n\tswitch backend {\n\tcase YFinBackend:\n\t\tbackends.YFin = b\n\tcase BATSBackend:\n\t\tbackends.Bats = b\n\t}\n}", "func (gb *gcpBalancer) newSubConn() {\n\tgb.mu.Lock()\n\tdefer gb.mu.Unlock()\n\n\t// there are chances the newly created subconns are still connecting,\n\t// we can wait on those new subconns.\n\tfor _, scState := range gb.scStates {\n\t\tif scState == connectivity.Connecting {\n\t\t\treturn\n\t\t}\n\t}\n\n\tsc, err := gb.cc.NewSubConn(\n\t\tgb.addrs,\n\t\tbalancer.NewSubConnOptions{HealthCheckEnabled: healthCheckEnabled},\n\t)\n\tif err != nil {\n\t\tgrpclog.Errorf(\"grpcgcp.gcpBalancer: failed to NewSubConn: %v\", err)\n\t\treturn\n\t}\n\tgb.scRefs[sc] = &subConnRef{\n\t\tsubConn: sc,\n\t}\n\tgb.scStates[sc] = connectivity.Idle\n\tsc.Connect()\n}", "func (h *HTTPTransport) SetScheme(req *http.Request) {\n\tif req.URL.Scheme != \"\" {\n\t\treturn\n\t}\n\tif h.shouldUseTLS(req) {\n\t\treq.URL.Scheme = \"https\"\n\t} else {\n\t\treq.URL.Scheme = \"http\"\n\t}\n}", "func (f5 *BigIP) handleGlobalPolicyUpdate(msg comm.Message) comm.Message {\n\n\tif err := f5.upsertPool(msg); err != nil {\n\t\tmsg.Error = err.Error()\n\t\treturn msg\n\t}\n\n\t//create a draftPath policy\n\tglobalPolicy, draftName, draftPath := f5.getGlobalPolicyInfo(msg.Service.TLS)\n\n\tpolicyNeedsUpdate, policyRuleExist, err := f5.policyNeedsUpdate(f5.addPartitionToName(globalPolicy), msg)\n\tif err != nil {\n\t\tmsg.Error = err.Error()\n\t\treturn msg\n\t}\n\n\tif policyRuleExist && !policyNeedsUpdate {\n\t\tlog.Debugf(\"no policy update for %v\", msg.Service.Name)\n\t\treturn msg\n\t}\n\n\tif err := f5.cli.CreateDraftFromPolicy(f5.addPartitionToName(globalPolicy)); err != nil {\n\t\tmsg.Error = fmt.Sprintf(\"error creating %v policy %v\", draftPath, err.Error())\n\t\treturn msg\n\t}\n\tdefer func() {\n\t\tif err := f5.cli.DeletePolicy(draftName); err != nil {\n\t\t\tlog.Warnf(\"Error deleting draftPath policy %v %v\", globalPolicy, err)\n\t\t}\n\t}()\n\n\tif policyNeedsUpdate {\n\n\t\tlog.Debugf(\"updating policy %v\", globalPolicy)\n\n\t\tif err := f5.cli.ModifyPolicyRule(draftName, msg.Service.Name, f5.buildPolicyRuleFromMsg(msg)); err != nil {\n\t\t\tmsg.Error = fmt.Sprintf(\"could not modify policy rule %v %v\", msg.Service.Name, err.Error())\n\t\t\treturn msg\n\t\t}\n\n\t\tif err := f5.cli.PublishDraftPolicy(draftPath); err != nil {\n\t\t\tmsg.Error = fmt.Sprintf(\"could not publish draft %v %v\", globalPolicy, err.Error())\n\t\t\treturn msg\n\t\t}\n\n\t\treturn msg\n\t}\n\n\tif !policyRuleExist {\n\n\t\tlog.Debugf(\"updating policy %v with new rule for %v\", globalPolicy, msg.Service.Name)\n\n\t\tif err := f5.cli.AddRuleToPolicy(draftName, f5.buildPolicyRuleFromMsg(msg)); err != nil {\n\t\t\tmsg.Error = fmt.Sprintf(\"error adding rule %v to draftPath policy %v\", msg.Service.Name, err.Error())\n\t\t\treturn msg\n\t\t}\n\n\t\tif err := f5.cli.PublishDraftPolicy(draftPath); err != nil {\n\t\t\tmsg.Error = fmt.Sprintf(\"could not publish draft %v %v\", draftPath, err.Error())\n\t\t\treturn msg\n\t\t}\n\n\t\treturn msg\n\t}\n\n\treturn msg\n}", "func main() {\n\tvar (\n\t\t//port = flag.Int(\"port\", 7472, \"HTTP listening port for Prometheus metrics\")\n\t\t//name = flag.String(\"name\", \"lb-ippool\", \"configmap name in default namespace\")\n\t\tpath = flag.String(\"config\", \"\", \"config file\")\n\t\tkubeconfig = flag.String(\"kubeconfig\", \"\", \"absolute path to the kubeconfig file (only needed when running outside of k8s)\")\n\t)\n\n\tflag.Parse()\n\tif len(*path) == 0 {\n\t\tklog.Fatalf(fmt.Sprintf(\"config file is required\"))\n\t}\n\n\trestConfig, err := clientcmd.BuildConfigFromFlags(\"\", *kubeconfig)\n\tif err != nil {\n\t\tklog.Fatal(err)\n\t}\n\tclientset, err := kubernetes.NewForConfig(restConfig)\n\tif err != nil {\n\t\tklog.Fatal(err)\n\t}\n\tbroadcaster := record.NewBroadcaster()\n\tbroadcaster.StartRecordingToSink(&corev1.EventSinkImpl{Interface: corev1.New(clientset.CoreV1().RESTClient()).Events(\"\")})\n\trecorder := broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: \"lb-controller\"})\n\tqueue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter())\n\n\t// INFO: (1) 与 router server 建立 bgp session\n\ts := getSpeaker(*path)\n\n\tsvcWatcher := cache.NewListWatchFromClient(clientset.CoreV1().RESTClient(), \"services\",\n\t\tmetav1.NamespaceAll, fields.Everything())\n\tsvcIndexer, svcInformer := cache.NewIndexerInformer(svcWatcher, &v1.Service{}, 0, cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tkey, err := cache.MetaNamespaceKeyFunc(obj)\n\t\t\tif err == nil {\n\t\t\t\tqueue.Add(svcKey(key))\n\t\t\t}\n\t\t},\n\t\tUpdateFunc: func(old interface{}, new interface{}) {\n\t\t\t//key, err := cache.MetaNamespaceKeyFunc(new)\n\t\t\t//if err == nil {\n\t\t\t//\t//queue.Add(svcKey(key))\n\t\t\t//\tklog.Infof(fmt.Sprintf(\"update %s\", key))\n\t\t\t//}\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\t//key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n\t\t\t//if err == nil {\n\t\t\t//\t//queue.Add(svcKey(key))\n\t\t\t//\tklog.Infof(fmt.Sprintf(\"delete %s\", key))\n\t\t\t//}\n\t\t},\n\t}, cache.Indexers{})\n\n\tepWatcher := cache.NewListWatchFromClient(clientset.CoreV1().RESTClient(), \"endpoints\",\n\t\tmetav1.NamespaceAll, fields.Everything())\n\tepIndexer, epInformer := cache.NewIndexerInformer(epWatcher, &v1.Endpoints{}, 0, cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\t//key, err := cache.MetaNamespaceKeyFunc(obj)\n\t\t\t//if err == nil {\n\t\t\t//\t//queue.Add(svcKey(key))\n\t\t\t//\tklog.Info(key)\n\t\t\t//}\n\t\t},\n\t\tUpdateFunc: func(old interface{}, new interface{}) {\n\t\t\t//key, err := cache.MetaNamespaceKeyFunc(new)\n\t\t\t//if err == nil {\n\t\t\t//\tklog.Info(key)\n\t\t\t//\t//queue.Add(svcKey(key))\n\t\t\t//}\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\t//key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n\t\t\t//if err == nil {\n\t\t\t//\t//queue.Add(svcKey(key))\n\t\t\t//\tklog.Info(key)\n\t\t\t//}\n\t\t},\n\t}, cache.Indexers{})\n\n\tstopCh := make(chan struct{})\n\tgo svcInformer.Run(stopCh)\n\tgo epInformer.Run(stopCh)\n\tif !cache.WaitForCacheSync(stopCh, svcInformer.HasSynced, epInformer.HasSynced) {\n\t\tklog.Fatalf(fmt.Sprintf(\"time out waiting for cache sync\"))\n\t}\n\n\tsync := func(key interface{}, queue workqueue.RateLimitingInterface) error {\n\t\tdefer queue.Done(key)\n\n\t\tswitch k := key.(type) {\n\t\tcase svcKey:\n\t\t\tsvc, exists, err := svcIndexer.GetByKey(string(k))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !exists {\n\t\t\t\treturn fmt.Errorf(\"not exist\")\n\t\t\t}\n\t\t\tendpoints, exists, err := epIndexer.GetByKey(string(k))\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"failed to get endpoints\")\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !exists {\n\t\t\t\treturn fmt.Errorf(\"not exist\")\n\t\t\t}\n\n\t\t\tif svc.(*v1.Service).Spec.Type != v1.ServiceTypeLoadBalancer {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\trecorder.Eventf(svc.(*v1.Service), v1.EventTypeNormal, \"SetBalancer\", \"advertise svc ip\")\n\t\t\ts.SetBalancer(string(k), svc.(*v1.Service), endpoints.(*v1.Endpoints))\n\t\t\treturn nil\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unknown key type for %s %T\", key, key))\n\t\t}\n\t}\n\n\tfor {\n\t\tkey, quit := queue.Get()\n\t\tif quit {\n\t\t\treturn\n\t\t}\n\n\t\terr := sync(key, queue)\n\t\tif err != nil {\n\t\t\tklog.Error(err)\n\t\t} else {\n\t\t\tqueue.Forget(key)\n\t\t}\n\t}\n}", "func SetGlobalOptions(opts ...Option) {\n\tglobalOptions = opts\n}", "func (c *Client) SetBackoff(backoff retryablehttp.Backoff) {\n\tc.modifyLock.RLock()\n\tdefer c.modifyLock.RUnlock()\n\tc.config.modifyLock.Lock()\n\tdefer c.config.modifyLock.Unlock()\n\n\tc.config.Backoff = backoff\n}", "func (s) TestBalancer_OneAddress(t *testing.T) {\n\ttestCases := []struct {\n\t\trt reportType\n\t\tcfg iwrr.LBConfig\n\t}{\n\t\t{rt: reportNone, cfg: perCallConfig},\n\t\t{rt: reportCall, cfg: perCallConfig},\n\t\t{rt: reportOOB, cfg: oobConfig},\n\t}\n\n\tfor _, tc := range testCases {\n\t\tt.Run(fmt.Sprintf(\"reportType:%v\", tc.rt), func(t *testing.T) {\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)\n\t\t\tdefer cancel()\n\n\t\t\tsrv := startServer(t, tc.rt)\n\n\t\t\tsc := svcConfig(t, tc.cfg)\n\t\t\tif err := srv.StartClient(grpc.WithDefaultServiceConfig(sc)); err != nil {\n\t\t\t\tt.Fatalf(\"Error starting client: %v\", err)\n\t\t\t}\n\n\t\t\t// Perform many RPCs to ensure the LB policy works with 1 address.\n\t\t\tfor i := 0; i < 100; i++ {\n\t\t\t\tsrv.callMetrics.SetQPS(float64(i))\n\t\t\t\tsrv.oobMetrics.SetQPS(float64(i))\n\t\t\t\tif _, err := srv.Client.EmptyCall(ctx, &testpb.Empty{}); err != nil {\n\t\t\t\t\tt.Fatalf(\"Error from EmptyCall: %v\", err)\n\t\t\t\t}\n\t\t\t\ttime.Sleep(time.Millisecond) // Delay; test will run 100ms and should perform ~10 weight updates\n\t\t\t}\n\t\t})\n\t}\n}", "func (puo *PendingloanbindingUpdateOne) SetPointLB(i int) *PendingloanbindingUpdateOne {\n\tpuo.mutation.ResetPointLB()\n\tpuo.mutation.SetPointLB(i)\n\treturn puo\n}", "func NewSimpleBalancer(addr string) (sb *SimpleBalancer, err error) {\n\tsb = &SimpleBalancer{}\n\tsb.url, err = url.Parse(addr)\n\n\treturn\n}", "func desiredLoadBalancerService(ci *operatorv1.IngressController, deploymentRef metav1.OwnerReference, platform *configv1.PlatformStatus) (bool, *corev1.Service, error) {\n\tif ci.Status.EndpointPublishingStrategy.Type != operatorv1.LoadBalancerServiceStrategyType {\n\t\treturn false, nil, nil\n\t}\n\tservice := manifests.LoadBalancerService()\n\n\tname := controller.LoadBalancerServiceName(ci)\n\n\tservice.Namespace = name.Namespace\n\tservice.Name = name.Name\n\n\tif service.Labels == nil {\n\t\tservice.Labels = map[string]string{}\n\t}\n\tservice.Labels[\"router\"] = name.Name\n\tservice.Labels[manifests.OwningIngressControllerLabel] = ci.Name\n\n\tservice.Spec.Selector = controller.IngressControllerDeploymentPodSelector(ci).MatchLabels\n\n\tlb := ci.Status.EndpointPublishingStrategy.LoadBalancer\n\tisInternal := lb != nil && lb.Scope == operatorv1.InternalLoadBalancer\n\n\tif service.Annotations == nil {\n\t\tservice.Annotations = map[string]string{}\n\t}\n\n\tproxyNeeded, err := IsProxyProtocolNeeded(ci, platform)\n\tif err != nil {\n\t\treturn false, nil, fmt.Errorf(\"failed to determine if proxy protocol is proxyNeeded for ingresscontroller %q: %v\", ci.Name, err)\n\t}\n\n\tif platform != nil {\n\t\tif isInternal {\n\t\t\tannotation := InternalLBAnnotations[platform.Type]\n\t\t\tfor name, value := range annotation {\n\t\t\t\tservice.Annotations[name] = value\n\t\t\t}\n\n\t\t\t// Set the GCP Global Access annotation for internal load balancers on GCP only\n\t\t\tif platform.Type == configv1.GCPPlatformType {\n\t\t\t\tif lb != nil && lb.ProviderParameters != nil &&\n\t\t\t\t\tlb.ProviderParameters.Type == operatorv1.GCPLoadBalancerProvider &&\n\t\t\t\t\tlb.ProviderParameters.GCP != nil {\n\t\t\t\t\tglobalAccessEnabled := lb.ProviderParameters.GCP.ClientAccess == operatorv1.GCPGlobalAccess\n\t\t\t\t\tservice.Annotations[GCPGlobalAccessAnnotation] = strconv.FormatBool(globalAccessEnabled)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tannotation := externalLBAnnotations[platform.Type]\n\t\t\tfor name, value := range annotation {\n\t\t\t\tservice.Annotations[name] = value\n\t\t\t}\n\t\t}\n\t\tswitch platform.Type {\n\t\tcase configv1.AWSPlatformType:\n\t\t\tservice.Annotations[awsLBHealthCheckIntervalAnnotation] = awsLBHealthCheckIntervalDefault\n\t\t\tif proxyNeeded {\n\t\t\t\tservice.Annotations[awsLBProxyProtocolAnnotation] = \"*\"\n\t\t\t}\n\t\t\tif lb != nil && lb.ProviderParameters != nil {\n\t\t\t\tif aws := lb.ProviderParameters.AWS; aws != nil && lb.ProviderParameters.Type == operatorv1.AWSLoadBalancerProvider {\n\t\t\t\t\tswitch aws.Type {\n\t\t\t\t\tcase operatorv1.AWSNetworkLoadBalancer:\n\t\t\t\t\t\tservice.Annotations[AWSLBTypeAnnotation] = AWSNLBAnnotation\n\t\t\t\t\t\t// NLBs require a different health check interval than CLBs.\n\t\t\t\t\t\t// See <https://bugzilla.redhat.com/show_bug.cgi?id=1908758>.\n\t\t\t\t\t\tservice.Annotations[awsLBHealthCheckIntervalAnnotation] = awsLBHealthCheckIntervalNLB\n\t\t\t\t\tcase operatorv1.AWSClassicLoadBalancer:\n\t\t\t\t\t\tif aws.ClassicLoadBalancerParameters != nil {\n\t\t\t\t\t\t\tif v := aws.ClassicLoadBalancerParameters.ConnectionIdleTimeout; v.Duration > 0 {\n\t\t\t\t\t\t\t\tservice.Annotations[awsELBConnectionIdleTimeoutAnnotation] = strconv.FormatUint(uint64(v.Round(time.Second).Seconds()), 10)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif platform.AWS != nil && len(platform.AWS.ResourceTags) > 0 {\n\t\t\t\tvar additionalTags []string\n\t\t\t\tfor _, userTag := range platform.AWS.ResourceTags {\n\t\t\t\t\tif len(userTag.Key) > 0 {\n\t\t\t\t\t\tadditionalTags = append(additionalTags, userTag.Key+\"=\"+userTag.Value)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(additionalTags) > 0 {\n\t\t\t\t\tservice.Annotations[awsLBAdditionalResourceTags] = strings.Join(additionalTags, \",\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set the load balancer for AWS to be as aggressive as Azure (2 fail @ 5s interval, 2 healthy)\n\t\t\tservice.Annotations[awsLBHealthCheckTimeoutAnnotation] = awsLBHealthCheckTimeoutDefault\n\t\t\tservice.Annotations[awsLBHealthCheckUnhealthyThresholdAnnotation] = awsLBHealthCheckUnhealthyThresholdDefault\n\t\t\tservice.Annotations[awsLBHealthCheckHealthyThresholdAnnotation] = awsLBHealthCheckHealthyThresholdDefault\n\t\tcase configv1.IBMCloudPlatformType, configv1.PowerVSPlatformType:\n\t\t\t// Set ExternalTrafficPolicy to type Cluster - IBM's LoadBalancer impl is created within the cluster.\n\t\t\t// LB places VIP on one of the worker nodes, using keepalived to maintain the VIP and ensuring redundancy\n\t\t\t// LB relies on iptable rules kube-proxy puts in to send traffic from the VIP node to the cluster\n\t\t\t// If policy is local, traffic is only sent to pods on the local node, as such Cluster enables traffic to flow to all the pods in the cluster\n\t\t\tservice.Spec.ExternalTrafficPolicy = corev1.ServiceExternalTrafficPolicyTypeCluster\n\t\t\tif proxyNeeded {\n\t\t\t\tservice.Annotations[iksLBEnableFeaturesAnnotation] = iksLBEnableFeaturesProxyProtocol\n\t\t\t}\n\n\t\tcase configv1.AlibabaCloudPlatformType:\n\t\t\tif !isInternal {\n\t\t\t\tservice.Annotations[alibabaCloudLBAddressTypeAnnotation] = alibabaCloudLBAddressTypeInternet\n\t\t\t}\n\t\t}\n\t\t// Azure load balancers are not customizable and are set to (2 fail @ 5s interval, 2 healthy)\n\t\t// GCP load balancers are not customizable and are set to (3 fail @ 8s interval, 1 healthy)\n\n\t\tif v, err := shouldUseLocalWithFallback(ci, service); err != nil {\n\t\t\treturn true, service, err\n\t\t} else if v {\n\t\t\tservice.Annotations[localWithFallbackAnnotation] = \"\"\n\t\t}\n\t}\n\n\tif ci.Spec.EndpointPublishingStrategy != nil {\n\t\tlb := ci.Spec.EndpointPublishingStrategy.LoadBalancer\n\t\tif lb != nil && len(lb.AllowedSourceRanges) > 0 {\n\t\t\tcidrs := make([]string, len(lb.AllowedSourceRanges))\n\t\t\tfor i, cidr := range lb.AllowedSourceRanges {\n\t\t\t\tcidrs[i] = string(cidr)\n\t\t\t}\n\t\t\tservice.Spec.LoadBalancerSourceRanges = cidrs\n\t\t}\n\t}\n\n\tservice.SetOwnerReferences([]metav1.OwnerReference{deploymentRef})\n\treturn true, service, nil\n}", "func (s *Servers) initiateGRPCServer(endpoint string, config RuntimeConfig) error {\n\taddr := fmt.Sprintf(\"%s:%d\", endpoint, config.port)\n\tln, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\tlog.Fatalf(\"gRPC server: failed to listen: %v\", err)\n\t\tos.Exit(2)\n\t}\n\ts.gRPCListener = ln\n\n\topts := []grpc.ServerOption{\n\t\ts.getUnaryInterceptors(),\n\t\t// grpc.ChainUnaryInterceptor(\n\t\t// \ts.Backend.AuthInterceptor.Unary(),\n\t\t// \ts.Backend.ObserverRegistry.UnaryInterceptor,\n\t\t// ),\n\t\t// MaxConnectionAge is just to avoid long connection, to facilitate load balancing\n\t\t// MaxConnectionAgeGrace will torn them, default to infinity\n\t\tgrpc.KeepaliveParams(keepalive.ServerParameters{MaxConnectionAge: 2 * time.Minute}),\n\t}\n\n\t// load mutual TLS cert/key and root CA cert\n\tif config.tlsCaCert != \"\" && config.tlsCert != \"\" && config.tlsKey != \"\" {\n\t\tkeyPair, err := tls.LoadX509KeyPair(config.tlsCert, config.tlsKey)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to load server TLS cert/key with error:%v\", err)\n\t\t}\n\n\t\tcert, err := ioutil.ReadFile(config.tlsCaCert)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to load root CA cert file with error:%v\", err)\n\t\t}\n\n\t\tpool := x509.NewCertPool()\n\t\tpool.AppendCertsFromPEM(cert)\n\n\t\tta := credentials.NewTLS(&tls.Config{\n\t\t\tCertificates: []tls.Certificate{keyPair},\n\t\t\tClientCAs: pool,\n\t\t\tClientAuth: tls.RequireAndVerifyClientCert,\n\t\t})\n\n\t\topts = append(opts, grpc.Creds(ta))\n\t}\n\n\ts.gRPCServer = grpc.NewServer(opts...)\n\n\ts.registerGRPCService()\n\tlog.Printf(\"gRPC server serving at %s\", addr)\n\n\tfb := fallback.NewServer(fmt.Sprintf(\"%s:%d\", endpoint, config.fallbackPort), fmt.Sprintf(\"%s:%d\", endpoint, config.port))\n\ts.fallbackServer = fb\n\n\t// Register reflection service on gRPC server.\n\treflection.Register(s.gRPCServer)\n\n\treturn s.gRPCServer.Serve(ln)\n}", "func (gb *gcpBalancer) bindSubConn(bindKey string, sc balancer.SubConn) {\n\tgb.mu.Lock()\n\tdefer gb.mu.Unlock()\n\t_, ok := gb.affinityMap[bindKey]\n\tif !ok {\n\t\tgb.affinityMap[bindKey] = sc\n\t}\n\tgb.scRefs[sc].affinityIncr()\n}", "func (obj *ShopSys) TarsSetProtocol(p model.Protocol) {\n\tobj.s.TarsSetProtocol(p)\n}", "func (obj *ShopSys) TarsSetProtocol(p model.Protocol) {\n\tobj.s.TarsSetProtocol(p)\n}", "func (c *ClusterManager) GC(lbNames []string, nodePorts []backends.ServicePort) error {\n\t// On GC:\n\t// * Loadbalancers need to get deleted before backends.\n\t// * Backends are refcounted in a shared pool.\n\t// * We always want to GC backends even if there was an error in GCing\n\t// loadbalancers, because the next Sync could rely on the GC for quota.\n\t// * There are at least 2 cases for backend GC:\n\t// 1. The loadbalancer has been deleted.\n\t// 2. An update to the url map drops the refcount of a backend. This can\n\t// happen when an Ingress is updated, if we don't GC after the update\n\t// we'll leak the backend.\n\tlbErr := c.l7Pool.GC(lbNames)\n\tbeErr := c.backendPool.GC(nodePorts)\n\tif lbErr != nil {\n\t\treturn lbErr\n\t}\n\tif beErr != nil {\n\t\treturn beErr\n\t}\n\n\t// TODO(ingress#120): Move this to the backend pool so it mirrors creation\n\tif len(lbNames) == 0 {\n\t\tigName := c.ClusterNamer.InstanceGroup()\n\t\tglog.Infof(\"Deleting instance group %v\", igName)\n\t\tif err := c.instancePool.DeleteInstanceGroup(igName); err != err {\n\t\t\treturn err\n\t\t}\n\t\tglog.V(2).Infof(\"Shutting down firewall as there are no loadbalancers\")\n\t\tc.firewallPool.Shutdown()\n\t}\n\n\treturn nil\n}", "func (pu *PendingloanbindingUpdate) SetPointLB(i int) *PendingloanbindingUpdate {\n\tpu.mutation.ResetPointLB()\n\tpu.mutation.SetPointLB(i)\n\treturn pu\n}" ]
[ "0.5183199", "0.5077026", "0.49607387", "0.4854912", "0.47470388", "0.47414953", "0.4728902", "0.47090948", "0.46896395", "0.46880862", "0.46415812", "0.4627773", "0.46094668", "0.4597579", "0.45945796", "0.45730206", "0.45671153", "0.45562032", "0.4491078", "0.44766483", "0.44675103", "0.44379058", "0.44354638", "0.4430052", "0.44250864", "0.4391749", "0.43600962", "0.43537486", "0.4351377", "0.43476364", "0.43476364", "0.43476364", "0.43476364", "0.43476364", "0.43476364", "0.43476364", "0.43476364", "0.43476364", "0.43476364", "0.43302608", "0.43301943", "0.43276632", "0.43117958", "0.42937022", "0.42924556", "0.42709368", "0.42598256", "0.42598256", "0.42598256", "0.42598256", "0.42598256", "0.42598256", "0.42597863", "0.4244447", "0.42418763", "0.4218989", "0.42121693", "0.42104122", "0.42090714", "0.41916865", "0.41907904", "0.41881534", "0.4165824", "0.41566923", "0.41457132", "0.41419724", "0.41411185", "0.41395548", "0.41377342", "0.41221341", "0.4110992", "0.41102713", "0.41094357", "0.41088367", "0.41013786", "0.40728894", "0.40590194", "0.40504748", "0.404797", "0.404669", "0.40284777", "0.40105048", "0.39962938", "0.39939883", "0.39863002", "0.39760065", "0.3971908", "0.39705622", "0.3967872", "0.39446658", "0.39444727", "0.39419335", "0.3940914", "0.39405763", "0.3920878", "0.39152166", "0.3913234", "0.3913234", "0.39130405", "0.39129585" ]
0.8345059
0
Build creates a grpc Picker.
Build creates a grpc Picker.
func (b *Builder) Build(info base.PickerBuildInfo) gBalancer.Picker { if len(info.ReadySCs) == 0 { // Block the RPC until a new picker is available via UpdateState(). return base.NewErrPicker(gBalancer.ErrNoSubConnAvailable) } nodes := make([]selector.Node, 0) for conn, info := range info.ReadySCs { ins, _ := info.Address.Attributes.Value("rawServiceInstance").(*registry.ServiceInstance) nodes = append(nodes, &grpcNode{ Node: selector.NewNode(info.Address.Addr, ins), subConn: conn, }) } p := &Picker{ selector: b.builder.Build(), } p.selector.Apply(nodes) return p }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*nodePickerBuilder) Build(info base.PickerBuildInfo) balancer.V2Picker {\n\tif len(info.ReadySCs) == 0 {\n\t\treturn base.NewErrPickerV2(balancer.ErrNoSubConnAvailable)\n\t}\n\n\tvar scs []balancer.SubConn\n\tfor sc := range info.ReadySCs {\n\t\tscs = append(scs, sc)\n\t}\n\n\treturn &nodePicker{\n\t\tsubConns: scs,\n\t}\n}", "func (gp Provider) Build(config config.Credentials) provider.Provider {\n\tclient := NewClient()\n\n\treturn &Provider{\n\t\tVerifier: provider.NewVerifierBasket(\n\t\t\tNewTeamVerifier(teamConfigsToTeam(config.Github.Teams), client),\n\t\t\tNewOrganizationVerifier(config.Github.Organizations, client),\n\t\t),\n\t}\n}", "func (cupBuilder *CupBuilder) Build() *Cup {\n return cupBuilder.cup\n}", "func (gb *gcpBalancer) regeneratePicker() {\n\tgb.mu.RLock()\n\tdefer gb.mu.RUnlock()\n\n\tif gb.state == connectivity.TransientFailure {\n\t\tgb.picker = newErrPicker(balancer.ErrTransientFailure)\n\t\treturn\n\t}\n\treadyRefs := []*subConnRef{}\n\n\t// Select ready subConns from subConn map.\n\tfor sc, scState := range gb.scStates {\n\t\tif scState == connectivity.Ready {\n\t\t\treadyRefs = append(readyRefs, gb.scRefs[sc])\n\t\t}\n\t}\n\tgb.picker = newGCPPicker(readyRefs, gb)\n}", "func NewPicker(store MediumSourceStorer) *Picker {\n\treturn &Picker{\n\t\tstore: store,\n\t}\n}", "func NewPickUp() Pickup {\n p := Pickup{name: \"Pickup\", vehicle: \"Pickup\", speed: 60, capacity: 2, isPrivate: true}\n return p\n}", "func (bb *gcpBalancerBuilder) Build(\n\tcc balancer.ClientConn,\n\topt balancer.BuildOptions,\n) balancer.Balancer {\n\treturn &gcpBalancer{\n\t\tcc: cc,\n\t\taffinityMap: make(map[string]balancer.SubConn),\n\t\tscRefs: make(map[balancer.SubConn]*subConnRef),\n\t\tscStates: make(map[balancer.SubConn]connectivity.State),\n\t\tcsEvltr: &connectivityStateEvaluator{},\n\t\t// Initialize picker to a picker that always return\n\t\t// ErrNoSubConnAvailable, because when state of a SubConn changes, we\n\t\t// may call UpdateState with this picker.\n\t\tpicker: newErrPicker(balancer.ErrNoSubConnAvailable),\n\t}\n}", "func (p *PopupWidget) Build() {\n\tif imgui.BeginPopup(p.name, int(p.flags)) {\n\t\tp.layout.Build()\n\t\timgui.EndPopup()\n\t}\n}", "func NewPeerPicker(tracker *Tracker, list *memberlist.Memberlist) PeerPicker {\n\treturn PeerPicker{\n\t\ttracker: tracker,\n\t\tourName: list.LocalNode().Name,\n\t}\n}", "func (opts BuilderOptions) Build(b Builder) (desc.Descriptor, error) {\n\treturn doBuild(b, opts)\n}", "func (rb *DataframeAnalyticsFieldSelectionBuilder) Build() DataframeAnalyticsFieldSelection {\n\treturn *rb.v\n}", "func (p *PopupModalWidget) Build() {\n\tif imgui.BeginPopupModalV(p.name, p.open, int(p.flags)) {\n\t\tp.layout.Build()\n\t\timgui.EndPopup()\n\t}\n}", "func (b *Builder) Build() (*corev1.PersistentVolumeClaim, error) {\n\tif len(b.errs) > 0 {\n\t\treturn nil, errors.Errorf(\"%+v\", b.errs)\n\t}\n\treturn b.pvc.object, nil\n}", "func (b *ChaincodeDataBuilder) Build() *ccprovider.ChaincodeData {\n\tcd := &ccprovider.ChaincodeData{\n\t\tName: b.name,\n\t\tVersion: b.version,\n\t\tVscc: b.vscc,\n\t}\n\n\tif b.policy != \"\" {\n\t\tpolicyEnv, err := policydsl.FromString(b.policy)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tpolicyBytes, err := proto.Marshal(policyEnv)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tcd.Policy = policyBytes\n\t}\n\treturn cd\n}", "func (qb QueryBuilder) Build() (*stackdriver.ProjectsTimeSeriesListCall, error) {\n\tif err := qb.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfilter := qb.composeFilter()\n\n\tif qb.metricSelector.Empty() {\n\t\treturn qb.translator.createListTimeseriesRequest(filter, qb.metricKind, qb.metricValueType, \"\"), nil\n\t}\n\n\tfilterForSelector, reducer, err := qb.translator.filterForSelector(qb.metricSelector, allowedCustomMetricsLabelPrefixes, allowedCustomMetricsFullLabelNames)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn qb.translator.createListTimeseriesRequest(joinFilters(filterForSelector, filter), qb.metricKind, qb.metricValueType, reducer), nil\n}", "func BuildFrom(pvc *corev1.PersistentVolumeClaim) *Builder {\n\tif pvc == nil {\n\t\tb := NewBuilder()\n\t\tb.errs = append(\n\t\t\tb.errs,\n\t\t\terrors.New(\"failed to build pvc object: nil pvc\"),\n\t\t)\n\t\treturn b\n\t}\n\treturn &Builder{\n\t\tpvc: &PVC{\n\t\t\tobject: pvc,\n\t\t},\n\t}\n}", "func (b *CapabilityBuilder) Build() (object *Capability, err error) {\n\tobject = new(Capability)\n\tobject.bitmap_ = b.bitmap_\n\tobject.inherited = b.inherited\n\tobject.name = b.name\n\tobject.value = b.value\n\treturn\n}", "func (Codegen) Buildbox() error {\n\tfmt.Println(\"\\n=====> Building GRPC Buildbox...\\n\")\n\treturn trace.Wrap(sh.RunV(\n\t\t\"docker\", \"build\",\n\t\t\"--tag\", fmt.Sprint(\"satellite-grpc-buildbox:\", version()),\n\t\t\"--build-arg\", fmt.Sprint(\"GRPC_PROTOC_VER=\", grpcProtocVersion),\n\t\t\"--build-arg\", fmt.Sprint(\"GRPC_GOGO_PROTO_TAG=\", grpcGogoProtoTag),\n\t\t\"-f\", \"build.assets/grpc/Dockerfile\",\n\t\t\".\",\n\t))\n}", "func (b *corelibBalancer) rebuildpicker(OnOff bool) {\n\ttmp := make([]picker.ServerForPick, 0, len(b.servers))\n\tfor _, server := range b.servers {\n\t\tif server.Pickable() {\n\t\t\ttmp = append(tmp, server)\n\t\t}\n\t}\n\tb.picker.UpdateServers(tmp)\n\tif OnOff {\n\t\tb.c.resolver.Wake(resolver.CALL)\n\t}\n\treturn\n}", "func (b *PeerDependencyListBuilder) Build() (list *PeerDependencyList, err error) {\n\titems := make([]*PeerDependency, len(b.items))\n\tfor i, item := range b.items {\n\t\titems[i], err = item.Build()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\tlist = new(PeerDependencyList)\n\tlist.items = items\n\treturn\n}", "func (c *Client) Build(params map[string]interface{}) (api.ClientAPI, error) {\n\tUsername, _ := params[\"Username\"].(string)\n\tPassword, _ := params[\"Password\"].(string)\n\tTenantName, _ := params[\"TenantName\"].(string)\n\tRegion, _ := params[\"Region\"].(string)\n\treturn AuthenticatedClient(AuthOptions{\n\t\tUsername: Username,\n\t\tPassword: Password,\n\t\tTenantName: TenantName,\n\t\tRegion: Region,\n\t})\n}", "func (b *balancerDiscovery) regeneratePicker() {\n\tif b.state == connectivity.TransientFailure {\n\t\tb.picker = b.newPicker(nil, balancer.ErrTransientFailure)\n\t\treturn\n\t}\n\tb.picker = b.newPicker(b.subConns, nil)\n}", "func (c *Client) Build(params map[string]interface{}) (api.ClientAPI, error) {\n\t// tenantName, _ := params[\"name\"].(string)\n\n\tidentity, _ := params[\"identity\"].(map[string]interface{})\n\tcompute, _ := params[\"compute\"].(map[string]interface{})\n\t// network, _ := params[\"network\"].(map[string]interface{})\n\n\tusername, _ := identity[\"Username\"].(string)\n\tpassword, _ := identity[\"Password\"].(string)\n\tdomainName, _ := identity[\"UserDomainName\"].(string)\n\n\tregion, _ := compute[\"Region\"].(string)\n\tprojectName, _ := compute[\"ProjectName\"].(string)\n\tprojectID, _ := compute[\"ProjectID\"].(string)\n\tdefaultImage, _ := compute[\"DefaultImage\"].(string)\n\n\treturn AuthenticatedClient(\n\t\tAuthOptions{\n\t\t\tUsername: username,\n\t\t\tPassword: password,\n\t\t\tRegion: region,\n\t\t\tDomainName: domainName,\n\t\t\tProjectName: projectName,\n\t\t\tProjectID: projectID,\n\t\t},\n\t\topenstack.CfgOptions{\n\t\t\tDefaultImage: defaultImage,\n\t\t},\n\t)\n}", "func New() *Bricker {\n\treturn &Bricker{\n\t\tconnection: make(map[string]connector.Connector),\n\t\tfirst: \"\",\n\t\tuids: make(map[uint32]string),\n\t\tsubscriber: make(map[hash.Hash]map[string]Subscriber),\n\t\tchoosers: make([]uint8, 0)}\n}", "func (b *CCSBuilder) Build() (object *CCS, err error) {\n\tobject = new(CCS)\n\tobject.id = b.id\n\tobject.href = b.href\n\tobject.bitmap_ = b.bitmap_\n\tobject.disableSCPChecks = b.disableSCPChecks\n\tobject.enabled = b.enabled\n\treturn\n}", "func (p *googleCloudProvider) Construct(_ context.Context, _ *rpc.ConstructRequest) (*rpc.ConstructResponse, error) {\n\treturn nil, status.Error(codes.Unimplemented, \"Construct is not yet implemented\")\n}", "func (builder *TsQueryCommandBuilder) Build() (Command, error) {\n\tif builder.protobuf == nil {\n\t\tpanic(\"builder.protobuf must not be nil\")\n\t}\n\n\tif len(builder.protobuf.GetQuery().GetBase()) == 0 {\n\t\treturn nil, ErrQueryRequired\n\t}\n\n\tif builder.protobuf.GetStream() && builder.callback == nil {\n\t\treturn nil, newClientError(\"TsQueryCommand requires a callback when streaming.\", nil)\n\t}\n\n\treturn &TsQueryCommand{\n\t\tprotobuf: builder.protobuf,\n\t\tcallback: builder.callback,\n\t}, nil\n}", "func (p *googleCloudProvider) Construct(_ context.Context, _ *rpc.ConstructRequest) (*rpc.ConstructResponse, error) {\n\n\treturn nil, status.Error(codes.Unimplemented, \"Construct is not yet implemented\")\n}", "func (c *configuration) BuildGrpcClients(cc ClientConnector) {\n\tclientProps := c.Properties.Client\n\tfor _, cli := range grpcClients {\n\t\tprop := new(ClientProperties)\n\t\tif err := mapstruct.Decode(prop, clientProps[cli.name]); err != nil {\n\t\t\tlog.Error(err)\n\t\t\tbreak\n\t\t}\n\t\tcc.Connect(cli.name, cli.cb, prop)\n\t}\n}", "func newChoiceBuilder(choiceDef *ChoiceDef) ChoiceBuilder {\n\treturn &chosenBuilder{\n\t\tchoiceDef: choiceDef,\n\t}\n}", "func (b *Builder) Build() (corev1.Container, error) {\n\terr := b.validate()\n\tif err != nil {\n\t\treturn corev1.Container{}, err\n\t}\n\treturn b.con.asContainer(), nil\n}", "func (b Builder) Build(name string) *CommandProcessor {\n\tcp := new(CommandProcessor)\n\tcp.TickingComponent = sim.NewTickingComponent(name, b.engine, b.freq, cp)\n\n\tunlimited := math.MaxInt32\n\tcp.ToDriver = sim.NewLimitNumMsgPort(cp, 1, name+\".ToDriver\")\n\tcp.toDriverSender = akitaext.NewBufferedSender(\n\t\tcp.ToDriver, buffering.NewBuffer(unlimited))\n\tcp.ToDMA = sim.NewLimitNumMsgPort(cp, 1, name+\".ToDispatcher\")\n\tcp.toDMASender = akitaext.NewBufferedSender(\n\t\tcp.ToDMA, buffering.NewBuffer(unlimited))\n\tcp.ToCUs = sim.NewLimitNumMsgPort(cp, 1, name+\".ToCUs\")\n\tcp.toCUsSender = akitaext.NewBufferedSender(\n\t\tcp.ToDMA, buffering.NewBuffer(unlimited))\n\tcp.ToTLBs = sim.NewLimitNumMsgPort(cp, 1, name+\".ToTLBs\")\n\tcp.toTLBsSender = akitaext.NewBufferedSender(\n\t\tcp.ToDMA, buffering.NewBuffer(unlimited))\n\tcp.ToRDMA = sim.NewLimitNumMsgPort(cp, 1, name+\".ToRDMA\")\n\tcp.toRDMASender = akitaext.NewBufferedSender(\n\t\tcp.ToDMA, buffering.NewBuffer(unlimited))\n\tcp.ToPMC = sim.NewLimitNumMsgPort(cp, 1, name+\".ToPMC\")\n\tcp.toPMCSender = akitaext.NewBufferedSender(\n\t\tcp.ToDMA, buffering.NewBuffer(unlimited))\n\tcp.ToAddressTranslators = sim.NewLimitNumMsgPort(cp, 1,\n\t\tname+\".ToAddressTranslators\")\n\tcp.toAddressTranslatorsSender = akitaext.NewBufferedSender(\n\t\tcp.ToDMA, buffering.NewBuffer(unlimited))\n\tcp.ToCaches = sim.NewLimitNumMsgPort(cp, 1, name+\".ToCaches\")\n\tcp.toCachesSender = akitaext.NewBufferedSender(\n\t\tcp.ToDMA, buffering.NewBuffer(unlimited))\n\n\tcp.bottomKernelLaunchReqIDToTopReqMap =\n\t\tmake(map[string]*protocol.LaunchKernelReq)\n\tcp.bottomMemCopyH2DReqIDToTopReqMap =\n\t\tmake(map[string]*protocol.MemCopyH2DReq)\n\tcp.bottomMemCopyD2HReqIDToTopReqMap =\n\t\tmake(map[string]*protocol.MemCopyD2HReq)\n\n\tb.buildDispatchers(cp)\n\n\tif b.visTracer != nil {\n\t\ttracing.CollectTrace(cp, b.visTracer)\n\t}\n\n\treturn cp\n}", "func NewClient(uri string, opts ...grpc.DialOption) (services.Project, error) {\n\t// Initialize connection pool\n\tpool, err := grpcpool.New(func() (*grpc.ClientConn, error) {\n\t\treturn grpc.Dial(uri, opts...)\n\t}, PoolInitial, PoolMax, PoolTimeout)\n\n\t// Close on destruction\n\truntime.SetFinalizer(pool, func(p *grpcpool.Pool) {\n\t\tif !p.IsClosed() {\n\t\t\tp.Close()\n\t\t}\n\t})\n\n\t// Return wrapper\n\treturn &client{\n\t\tpool: pool,\n\t}, err\n}", "func New(b builder.Builder, tracker, hosted string) *Builder {\n\t//create our new builder\n\tn := &Builder{\n\t\tb: b,\n\t\tbase: hosted,\n\t\trpc: gorpc.NewServer(),\n\t\ttcl: client.New(tracker, http.DefaultClient, client.JsonCodec),\n\t\tbq: rpc.NewBuilderQueue(),\n\t\tmux: http.NewServeMux(),\n\t\tdler: newDownloader(),\n\t}\n\n\t//register the build service in the rpc\n\tif err := n.rpc.RegisterService(n.bq, \"\"); err != nil {\n\t\tpanic(err)\n\t}\n\n\t//make sure we respond to pings\n\tif err := n.rpc.RegisterService(pinger.Pinger{}, \"\"); err != nil {\n\t\tpanic(err)\n\t}\n\n\t//register the codec\n\tn.rpc.RegisterCodec(json.NewCodec(), \"application/json\")\n\n\t//add the handlers to our mux\n\tn.mux.Handle(\"/\", n.rpc)\n\tn.mux.Handle(\"/download/\", http.StripPrefix(\"/download/\", n.dler))\n\n\t//start processing tasks\n\tgo n.run()\n\n\treturn n\n}", "func (b fileInputBuilder) Build(ctx context.Context, cfg task.ExecutorInputBuilderConfig, deps task.ExecutorInputBuilderDependencies, target *task.ExecutorInputBuilderTarget) error {\n\turi := cfg.AnnotatedValue.GetData()\n\tdeps.Log.Debug().\n\t\tInt(\"sequence-index\", cfg.AnnotatedValueIndex).\n\t\tStr(\"uri\", uri).\n\t\tStr(\"input\", cfg.InputSpec.Name).\n\t\tStr(\"task\", cfg.TaskSpec.Name).\n\t\tMsg(\"Preparing file input value\")\n\n\t// Prepare readonly volume for URI\n\tresp, err := deps.FileSystem.CreateVolumeForRead(ctx, &fs.CreateVolumeForReadRequest{\n\t\tURI: uri,\n\t\tOwner: &cfg.OwnerRef,\n\t\tNamespace: cfg.Pipeline.GetNamespace(),\n\t})\n\tif err != nil {\n\t\treturn maskAny(err)\n\t}\n\t// TODO handle case where node is different\n\tif nodeName := resp.GetNodeName(); nodeName != \"\" {\n\t\ttarget.NodeName = &nodeName\n\t}\n\n\t// Mount PVC or HostPath, depending on result\n\tvolName := util.FixupKubernetesName(fmt.Sprintf(\"input-%s-%d\", cfg.InputSpec.Name, cfg.AnnotatedValueIndex))\n\tif resp.GetVolumeName() != \"\" {\n\t\t// Get created PersistentVolume\n\t\tvar pv corev1.PersistentVolume\n\t\tpvKey := client.ObjectKey{\n\t\t\tName: resp.GetVolumeName(),\n\t\t}\n\t\tif err := deps.Client.Get(ctx, pvKey, &pv); err != nil {\n\t\t\tdeps.Log.Warn().Err(err).Msg(\"Failed to get PersistentVolume\")\n\t\t\treturn maskAny(err)\n\t\t}\n\n\t\t// Add PV to resources for deletion list (if needed)\n\t\tif resp.DeleteAfterUse {\n\t\t\ttarget.Resources = append(target.Resources, &pv)\n\t\t}\n\n\t\t// Create PVC\n\t\tpvcName := util.FixupKubernetesName(fmt.Sprintf(\"%s-%s-%s-%d-%s\", cfg.Pipeline.GetName(), cfg.TaskSpec.Name, cfg.InputSpec.Name, cfg.AnnotatedValueIndex, uniuri.NewLen(6)))\n\t\tstorageClassName := pv.Spec.StorageClassName\n\t\tpvc := corev1.PersistentVolumeClaim{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: pvcName,\n\t\t\t\tNamespace: cfg.Pipeline.GetNamespace(),\n\t\t\t\tOwnerReferences: []metav1.OwnerReference{cfg.OwnerRef},\n\t\t\t},\n\t\t\tSpec: corev1.PersistentVolumeClaimSpec{\n\t\t\t\tAccessModes: pv.Spec.AccessModes,\n\t\t\t\tVolumeName: resp.GetVolumeName(),\n\t\t\t\tResources: corev1.ResourceRequirements{\n\t\t\t\t\tRequests: pv.Spec.Capacity,\n\t\t\t\t},\n\t\t\t\tStorageClassName: &storageClassName,\n\t\t\t},\n\t\t}\n\t\tif err := deps.Client.Create(ctx, &pvc); err != nil {\n\t\t\treturn maskAny(err)\n\t\t}\n\t\ttarget.Resources = append(target.Resources, &pvc)\n\n\t\t// Add volume for the pod\n\t\tvol := corev1.Volume{\n\t\t\tName: volName,\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tPersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{\n\t\t\t\t\tClaimName: pvcName,\n\t\t\t\t\tReadOnly: true,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\ttarget.Pod.Spec.Volumes = append(target.Pod.Spec.Volumes, vol)\n\t} else if resp.GetVolumeClaimName() != \"\" {\n\t\t// Add PVC to resources for deletion list (if needed)\n\t\tif resp.DeleteAfterUse {\n\t\t\t// Get created PersistentVolume\n\t\t\tvar pvc corev1.PersistentVolumeClaim\n\t\t\tpvcKey := client.ObjectKey{\n\t\t\t\tName: resp.GetVolumeClaimName(),\n\t\t\t\tNamespace: cfg.Pipeline.GetNamespace(),\n\t\t\t}\n\t\t\tif err := deps.Client.Get(ctx, pvcKey, &pvc); err != nil {\n\t\t\t\tdeps.Log.Warn().Err(err).Msg(\"Failed to get PersistentVolumeClaim\")\n\t\t\t\treturn maskAny(err)\n\t\t\t}\n\t\t\ttarget.Resources = append(target.Resources, &pvc)\n\t\t}\n\n\t\t// Add volume for the pod, unless such a volume already exists\n\t\tif vol, found := util.GetVolumeWithForPVC(&target.Pod.Spec, resp.GetVolumeClaimName()); !found {\n\t\t\tvol := corev1.Volume{\n\t\t\t\tName: volName,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tPersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{\n\t\t\t\t\t\tClaimName: resp.GetVolumeClaimName(),\n\t\t\t\t\t\tReadOnly: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\ttarget.Pod.Spec.Volumes = append(target.Pod.Spec.Volumes, vol)\n\t\t} else {\n\t\t\tvolName = vol.Name\n\t\t}\n\t} else if resp.GetVolumePath() != \"\" {\n\t\t// Mount VolumePath as HostPath volume\n\t\tdirType := corev1.HostPathDirectoryOrCreate\n\t\t// Add volume for the pod\n\t\tvol := corev1.Volume{\n\t\t\tName: volName,\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\tPath: resp.GetVolumePath(),\n\t\t\t\t\tType: &dirType,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\ttarget.Pod.Spec.Volumes = append(target.Pod.Spec.Volumes, vol)\n\t\t// Ensure pod is schedule on node\n\t\tif nodeName := resp.GetNodeName(); nodeName != \"\" {\n\t\t\tif target.Pod.Spec.NodeName == \"\" {\n\t\t\t\ttarget.Pod.Spec.NodeName = nodeName\n\t\t\t} else if target.Pod.Spec.NodeName != nodeName {\n\t\t\t\t// Found conflict\n\t\t\t\tdeps.Log.Error().\n\t\t\t\t\tStr(\"pod-nodeName\", target.Pod.Spec.NodeName).\n\t\t\t\t\tStr(\"pod-nodeNameRequest\", nodeName).\n\t\t\t\t\tMsg(\"Conflicting pod node spec\")\n\t\t\t\treturn maskAny(fmt.Errorf(\"Conflicting Node assignment\"))\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// No valid respond\n\t\treturn maskAny(fmt.Errorf(\"FileSystem service return invalid response\"))\n\t}\n\n\t// Map volume in container fs namespace\n\tmountPath := filepath.Join(\"/koalja\", \"inputs\", cfg.InputSpec.Name, strconv.Itoa(cfg.AnnotatedValueIndex))\n\ttarget.Container.VolumeMounts = append(target.Container.VolumeMounts, corev1.VolumeMount{\n\t\tName: volName,\n\t\tReadOnly: true,\n\t\tMountPath: mountPath,\n\t\tSubPath: resp.GetSubPath(),\n\t})\n\n\t// Create template data\n\ttarget.TemplateData = append(target.TemplateData, map[string]interface{}{\n\t\t\"volumeName\": resp.GetVolumeName(),\n\t\t\"volumeClaimName\": resp.GetVolumeClaimName(),\n\t\t\"volumePath\": resp.GetVolumePath(),\n\t\t\"mountPath\": mountPath,\n\t\t\"subPath\": resp.GetSubPath(),\n\t\t\"nodeName\": resp.GetNodeName(),\n\t\t\"path\": filepath.Join(mountPath, resp.GetLocalPath()),\n\t\t\"base\": filepath.Base(resp.GetLocalPath()),\n\t\t\"dir\": filepath.Dir(resp.GetLocalPath()),\n\t})\n\n\treturn nil\n}", "func New() (grpc_fpl.FPLClient, func(), error) {\n\tport := viper.GetString(\"port\")\n\tconn, err := grpc.Dial(fmt.Sprintf(\"localhost:%v\", port), grpc.WithInsecure())\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error while connecting to gRPC server at port %v: %v\", port, err)\n\t}\n\n\tclient := grpc_fpl.NewFPLClient(conn)\n\n\tcleanup := func() {\n\t\tif conn != nil {\n\t\t\tconn.Close()\n\t\t}\n\t}\n\treturn client, cleanup, nil\n}", "func (c Config) Build() (*Gaffer, error) {\n\n\t// Initialise Gaffer object\n\tg := &Gaffer{\n\t\tConfig: c,\n\t\tedge_buffer: map[EdgeKey]*Edge{},\n\t\tentity_buffer: map[EntityKey]*Entity{},\n\t\tbufferq: make(chan *Update, 5000),\n\t\tloadq: make(chan *map[string]interface{}, 50),\n\t}\n\n\t// Start loader and buffer manager goroutines\n\tgo g.Loader()\n\tgo g.BufferManager()\n\n\treturn g, nil\n}", "func newBuilder() balancer.Builder {\n\treturn base.NewBalancerBuilder(Name, &rrPickerBuilder{})\n}", "func (c *lscChoco) Build(thing sdk.Thing, sensors []Sensor, chanIDs []string) {\n\tc.thing = thing\n\tc.thingToken = c.thing.Key\n\tc.status = Status{State: state.CREATED}\n\tc.sensors = sensors\n\tc.channelIDs = chanIDs\n\tfor i := range c.sensors {\n\t\tc.sensors[i].SetState(state.CREATED)\n\t}\n\n}", "func (rb *CompositeAggregationBuilder) Build() CompositeAggregation {\n\treturn *rb.v\n}", "func BuildRPCToken(client, service, method string) ([]byte, error) {\n\ttok := RPCToken{\n\t\tClient: client,\n\t\tKind: TokenKindRPC,\n\t\tService: service,\n\t\tMethod: method,\n\t}\n\n\treturn json.Marshal(tok)\n}", "func createObjectPicker(n int64, distrib string) (ObjectSelector, error) {\n\n\tswitch distrib {\n\tcase ZIPFIAN_OBJECT_PICK:\n\t\tvar x = new(Zipf)\n\t\tx.SetParams(n, 0.8, 99)\n\t\treturn x, nil\n\tcase UNIFORM_OBJECT_PICK:\n\t\tvar y = new(Uniform)\n\t\ty.SetParams(n, 99)\n\t\treturn y, nil\n\t}\n\treturn nil, errors.New(\"Not a valid distribution for object selection\")\n}", "func BuildFactory(appearance int) GUIFactory {\n\tswitch appearance {\n\tcase React:\n\t\treturn new(ReactFactory)\n\tcase Vue:\n\t\treturn new(VueFactory)\n\tcase Angular:\n\t\treturn new(AngularFactory)\n\t}\n\treturn nil\n}", "func (pb PlannerBuilder) Build() Planner {\n\treturn &planner{\n\t\tlp: NewLogicalPlanner(pb.lopts...),\n\t\tpp: NewPhysicalPlanner(pb.popts...),\n\t}\n}", "func (x *fastReflection_RpcCommandOptions) New() protoreflect.Message {\n\treturn new(fastReflection_RpcCommandOptions)\n}", "func newBuilder() balancer.Builder {\n\treturn &gcpBalancerBuilder{\n\t\tname: Name,\n\t}\n}", "func (tmpl *APIClientTemplate) Build() APIClient {\n\treturn tmpl.BuildWithAuthorization(tmpl.Authorization)\n}", "func (b *Builder) Build(ctx context.Context, app *AppContext) error {\n\tif err := buildComponents(ctx, app); err != nil {\n\t\treturn fmt.Errorf(\"error building components: %v\", err)\n\t}\n\treturn nil\n}", "func (p PhoneCallAccepted) construct() PhoneCallClass { return &p }", "func (*SpecFactory) Build(resource string) runtime.Object {\n\n\tswitch resource {\n\tcase \"services\":\n\t\treturn &v1.Service{}\n\tcase \"configmaps\":\n\t\treturn &v1.ConfigMap{}\n\t}\n\n\tpanic(fmt.Errorf(\"no resource mapped for %s\", resource))\n}", "func BuildPbsbService(serviceEmail string, key []byte) (*pbsb.Service, error) {\n\tconf := &jwt.Config{\n\t\tEmail: serviceEmail,\n\t\tPrivateKey: key,\n\t\tScopes: []string{\n\t\t\tpbsb.CloudPlatformScope,\n\t\t\tpbsb.PubsubScope,\n\t\t},\n\t\tTokenURL: google.JWTTokenURL,\n\t}\n\n\tif service, err := pbsb.New(conf.Client(oauth2.NoContext)); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn service, nil\n\t}\n}", "func NewRPC(ctx context.Context, lgr log.Logger, addr string, opts ...RPCOption) (RPC, error) {\n\tvar cfg rpcConfig\n\tfor i, opt := range opts {\n\t\tif err := opt(&cfg); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"rpc option %d failed to apply to RPC config: %w\", i, err)\n\t\t}\n\t}\n\tif cfg.backoffAttempts < 1 { // default to at least 1 attempt, or it always fails to dial.\n\t\tcfg.backoffAttempts = 1\n\t}\n\tunderlying, err := dialRPCClientWithBackoff(ctx, lgr, addr, cfg.backoffAttempts, cfg.gethRPCOptions...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar wrapped RPC = &BaseRPCClient{c: underlying}\n\n\tif cfg.limit != 0 {\n\t\twrapped = NewRateLimitingClient(wrapped, rate.Limit(cfg.limit), cfg.burst)\n\t}\n\n\tif httpRegex.MatchString(addr) {\n\t\twrapped = NewPollingClient(ctx, lgr, wrapped, WithPollRate(cfg.httpPollInterval))\n\t}\n\n\treturn wrapped, nil\n}", "func (c *Config) Build() weather.Provider {\n\t// Build the OWM URL.\n\twURL := url.URL{\n\t\tScheme: \"http\",\n\t\tHost: \"api.wunderground.com\",\n\t\tPath: fmt.Sprintf(\"/api/%s/conditions/q/%s.json\", c.apiKey, c.query),\n\t}\n\treturn Provider(wURL.String())\n}", "func (b *builder) Build(url resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) {\n\ttgt, err := parseURL(url.URL.String())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid consul URL: %w\", err)\n\t}\n\n\tcli, err := api.NewClient(tgt.consulConfig())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to connect to the ConsulAPI: %w\", err)\n\t}\n\n\tplan, err := b.targetToPlan(tgt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := NewResolver(cc, plan, WithLogger(b.logger.WithName(tgt.Service)), WithStrategies(b.strategies))\n\n\tgo func() {\n\t\t_ = plan.RunWithClientAndHclog(cli, nil)\n\t}()\n\tgo func() {\n\t\tr.resolveWithPeriod(cli, tgt)\n\t}()\n\n\treturn r, nil\n}", "func (rb *TotalFeatureImportanceClassBuilder) Build() TotalFeatureImportanceClass {\n\treturn *rb.v\n}", "func Create(ctx context.Context, client *selvpcclient.ServiceClient, createOpts CreateOpts) (*Project, *selvpcclient.ResponseResult, error) {\n\t// Nest create options into the parent \"project\" JSON structure.\n\ttype createProject struct {\n\t\tOptions CreateOpts `json:\"project\"`\n\t}\n\tcreateProjectOpts := &createProject{Options: createOpts}\n\trequestBody, err := json.Marshal(createProjectOpts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\turl := strings.Join([]string{client.Endpoint, resourceURL}, \"/\")\n\tresponseResult, err := client.DoRequest(ctx, http.MethodPost, url, bytes.NewReader(requestBody))\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif responseResult.Err != nil {\n\t\treturn nil, responseResult, responseResult.Err\n\t}\n\n\t// Extract a project from the response body.\n\tvar result struct {\n\t\tProject *Project `json:\"project\"`\n\t}\n\terr = responseResult.ExtractResult(&result)\n\tif err != nil {\n\t\treturn nil, responseResult, err\n\t}\n\n\treturn result.Project, responseResult, nil\n}", "func createObjectPicker(n int64, distrib string) (ObjectSelector, error) {\n\n\tswitch distrib {\n\tcase ZIPFIAN_OBJECT_PICK:\n\t\tvar x = new(Zipf)\n\t\tx.SetParams(n, 0.8, 99)\n\t\treturn x, nil\n\tcase UNIFORM_OBJECT_PICK:\n\t\tvar y = new(Uniform)\n\t\ty.SetParams(n, 99)\n\t\treturn y, nil\n\t}\n\n\tfmt.Println(\"what is the distribution :\", distrib)\n\treturn new(Uniform), errors.New(\"Not a valid distribution for object selection\")\n}", "func (rb *PercolateQueryBuilder) Build() PercolateQuery {\n\treturn *rb.v\n}", "func NewFromGRPC(conn *grpc.ClientConn, log *zap.Logger, timeout time.Duration) (api.Peer, error) {\n\tl := log.Named(`NewFromGRPC`)\n\tp := &peer{conn: conn, log: log.Named(`peer`), timeout: timeout}\n\tif err := p.initEndorserClient(); err != nil {\n\t\tl.Error(`Failed to initialize endorser client`, zap.Error(err))\n\t\treturn nil, errors.Wrap(err, `failed to initialize EndorserClient`)\n\t}\n\treturn p, nil\n}", "func NewGRPC(port string, options ...grpc.ServerOption) *GRPC {\n\tsrv := grpc.NewServer(options...)\n\treturn &GRPC{\n\t\tServer: srv,\n\t\tport: port,\n\t}\n}", "func (rb *PhraseSuggestOptionBuilder) Build() PhraseSuggestOption {\n\treturn *rb.v\n}", "func (rb *PluginStatsBuilder) Build() PluginStats {\n\treturn *rb.v\n}", "func newRPCClientService() (*rpcClientService, error) {\n return &rpcClientService{rpcCh: make(chan *sendRPCState)}, nil\n}", "func (p *googleCloudProvider) Create(ctx context.Context, req *rpc.CreateRequest) (*rpc.CreateResponse, error) {\n\turn := resource.URN(req.GetUrn())\n\tlabel := fmt.Sprintf(\"%s.Create(%s)\", p.name, urn)\n\tlogging.V(9).Infof(\"%s executing\", label)\n\n\t// Deserialize RPC inputs\n\tinputs, err := plugin.UnmarshalProperties(req.GetProperties(), plugin.MarshalOptions{\n\t\tLabel: fmt.Sprintf(\"%s.properties\", label), SkipNulls: true,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinputsMap := inputs.Mappable()\n\n\tresourceKey := string(urn.Type())\n\tres, ok := p.resourceMap.Resources[resourceKey]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"resource %q not found\", resourceKey)\n\t}\n\n\turi, err := buildCreateUrl(res, inputs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbody := p.prepareAPIInputs(inputs, nil, res.CreateProperties)\n\n\tvar op map[string]interface{}\n\tif res.AssetUpload {\n\t\tvar content []byte\n\t\tsource := inputs[\"source\"]\n\t\tif source.IsAsset() {\n\t\t\tcontent, err = source.AssetValue().Bytes()\n\t\t} else if source.IsArchive() {\n\t\t\tcontent, err = source.ArchiveValue().Bytes(resource.ZIPArchive)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\top, err = p.client.UploadWithTimeout(res.CreateVerb, uri, body, content, 0)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error sending upload request: %s: %q %+v %d\", err, uri, inputs.Mappable(), len(content))\n\t\t}\n\t} else {\n\t\top, err = p.client.RequestWithTimeout(res.CreateVerb, uri, body, 0)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error sending request: %s: %q %+v\", err, uri, inputs.Mappable())\n\t\t}\n\t}\n\n\tresp, err := p.waitForResourceOpCompletion(res.BaseUrl, op)\n\tif err != nil {\n\t\tif resp == nil {\n\t\t\treturn nil, errors.Wrapf(err, \"waiting for completion\")\n\t\t}\n\t\t// A partial failure may have occurred because we got an error and a response.\n\t\t// Try reading the resource state and return a partial error if there is some.\n\t\tid, idErr := calculateResourceId(res, inputsMap, resp)\n\t\tif idErr != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"waiting for completion / calculate ID %s\", idErr)\n\t\t}\n\t\treadResp, getErr := p.client.RequestWithTimeout(\"GET\", id, nil, 0)\n\t\tif getErr != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"waiting for completion / read state %s\", getErr)\n\t\t}\n\t\tcheckpoint, cpErr := plugin.MarshalProperties(\n\t\t\tcheckpointObject(inputs, readResp),\n\t\t\tplugin.MarshalOptions{Label: fmt.Sprintf(\"%s.partialCheckpoint\", label), KeepSecrets: true, SkipNulls: true},\n\t\t)\n\t\tif cpErr != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"waiting for completion / checkpoint %s\", cpErr)\n\t\t}\n\t\treturn nil, partialError(id, err, checkpoint, req.GetProperties())\n\t}\n\n\t// Store both outputs and inputs into the state.\n\tcheckpoint, err := plugin.MarshalProperties(\n\t\tcheckpointObject(inputs, resp),\n\t\tplugin.MarshalOptions{Label: fmt.Sprintf(\"%s.checkpoint\", label), KeepSecrets: true, SkipNulls: true},\n\t)\n\n\tid, err := calculateResourceId(res, inputsMap, resp)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"calculating resource ID\")\n\t}\n\n\treturn &rpc.CreateResponse{\n\t\tId: id,\n\t\tProperties: checkpoint,\n\t}, nil\n}", "func (c ChannelsChannelParticipants) construct() ChannelsChannelParticipantsClass { return &c }", "func newBuilder() balancer.Builder {\n\treturn base.NewBalancerBuilderV2(Name, &rrPickerBuilder{}, base.Config{HealthCheck: true})\n}", "func (m builder) build() (oci.SpecModifier, error) {\n\tif len(m.devices) == 0 && m.cdiSpec == nil {\n\t\treturn nil, nil\n\t}\n\n\tif m.cdiSpec != nil {\n\t\tmodifier := fromCDISpec{\n\t\t\tcdiSpec: &cdi.Spec{Spec: m.cdiSpec},\n\t\t}\n\t\treturn modifier, nil\n\t}\n\n\tregistry, err := cdi.NewCache(\n\t\tcdi.WithAutoRefresh(false),\n\t\tcdi.WithSpecDirs(m.specDirs...),\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create CDI registry: %v\", err)\n\t}\n\n\tmodifier := fromRegistry{\n\t\tlogger: m.logger,\n\t\tregistry: registry,\n\t\tdevices: m.devices,\n\t}\n\n\treturn modifier, nil\n}", "func Build(ns string, app *parser.Appfile) (*v1alpha2.ApplicationConfiguration, []*v1alpha2.Component, error) {\n\tb := &builder{app}\n\treturn b.CompleteWithContext(ns)\n}", "func (rb *PagerDutyEventProxyBuilder) Build() PagerDutyEventProxy {\n\treturn *rb.v\n}", "func newComposeBuilder(appMan Manifest) Builder {\n return &ComposeBuilder{manifest: appMan}\n}", "func (p PhoneCallWaiting) construct() PhoneCallClass { return &p }", "func newBuilder() balancer.Builder {\n\treturn base.NewBalancerBuilderWithConfig(Name, &rrPickerBuilder{}, base.Config{HealthCheck: true})\n}", "func (s *Service) Build(ctx context.Context, buildOptions options.Build) error {\n\treturn s.build(ctx, buildOptions)\n}", "func (b *Builder) Build() (*RollDPoS, error) {\n\tif b.chain == nil {\n\t\treturn nil, errors.Wrap(ErrNewRollDPoS, \"blockchain APIs is nil\")\n\t}\n\tif b.broadcastHandler == nil {\n\t\treturn nil, errors.Wrap(ErrNewRollDPoS, \"broadcast callback is nil\")\n\t}\n\tif b.clock == nil {\n\t\tb.clock = clock.New()\n\t}\n\tb.cfg.DB.DbPath = b.cfg.Consensus.ConsensusDBPath\n\tctx, err := NewRollDPoSCtx(\n\t\tconsensusfsm.NewConsensusConfig(b.cfg.Consensus.FSM, b.cfg.DardanellesUpgrade, b.cfg.Genesis, b.cfg.Consensus.Delay),\n\t\tb.cfg.DB,\n\t\tb.cfg.SystemActive,\n\t\tb.cfg.Consensus.ToleratedOvertime,\n\t\tb.cfg.Genesis.TimeBasedRotation,\n\t\tb.chain,\n\t\tb.blockDeserializer,\n\t\tb.rp,\n\t\tb.broadcastHandler,\n\t\tb.delegatesByEpochFunc,\n\t\tb.proposersByEpochFunc,\n\t\tb.encodedAddr,\n\t\tb.priKey,\n\t\tb.clock,\n\t\tb.cfg.Genesis.BeringBlockHeight,\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error when constructing consensus context\")\n\t}\n\tcfsm, err := consensusfsm.NewConsensusFSM(ctx, b.clock)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error when constructing the consensus FSM\")\n\t}\n\treturn &RollDPoS{\n\t\tcfsm: cfsm,\n\t\tctx: ctx,\n\t\tstartDelay: b.cfg.Consensus.Delay,\n\t\tready: make(chan interface{}),\n\t}, nil\n}", "func New(target string, opts ...grpc.DialOption) (*Client, error) {\n\tconn, err := grpc.Dial(target, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{conn, quotaservice.NewQuotaServiceClient(conn)}, nil\n}", "func (cb *ClientBuilder) Build() *Client {\n\treturn cb.client\n}", "func (cb *ClientBuilder) Build() *Client {\n\treturn cb.client\n}", "func NewColorPicker() ColorPicker {\n\timageColors := make(map[string]Color)\n\n\treturn &colorPicker{\n\t\timageColors: imageColors,\n\t}\n}", "func Build(namespace, name, strategyType, fromKind, fromNamespace, fromName string) buildapi.Build {\n\treturn buildapi.Build{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t\tSelfLink: \"/build/\" + name,\n\t\t},\n\t\tSpec: buildapi.BuildSpec{\n\t\t\tCommonSpec: CommonSpec(strategyType, fromKind, fromNamespace, fromName),\n\t\t},\n\t}\n}", "func (Codegen) Grpc() error {\n\tmg.Deps(Codegen.Buildbox)\n\tfmt.Println(\"\\n=====> Running GRPC Codegen inside docker...\\n\")\n\treturn trace.Wrap(sh.RunV(\n\t\t\"docker\", \"run\",\n\t\thostVolume(\"delegated\"),\n\t\tfmt.Sprint(\"satellite-grpc-buildbox:\", version()),\n\t\t\"sh\", \"-c\",\n\t\t\"cd /go/src/github.com/gravitational/satellite/ && go run mage.go internal:grpcAgent internal:grpcDebug\",\n\t))\n}", "func NewBuilder() *Builder {\n\treturn &Builder{pvc: &PVC{object: &corev1.PersistentVolumeClaim{}}}\n}", "func (b *Buddy) Build() Builder {\n\treturn Builder{b}\n}", "func (p PhoneCallRequested) construct() PhoneCallClass { return &p }", "func (builder *BitVectorBuilderData) Build(enableFasterSelect1 bool, enableFasterSelect0 bool) (SuccinctBitVector, error) {\n\tbuilder.vec.build(enableFasterSelect1, enableFasterSelect0)\n\tvec := builder.vec\n\tbuilder.vec = new(BitVectorData)\n\treturn vec, nil\n}", "func New(file string) ComposeFile {\n\tresult := ComposeFile{\n\t\tFile: []string{file},\n\t\tData: DockerCompose{\n\t\t\tVersion: \"3.7\",\n\t\t\tServices: make(map[string]*Service),\n\t\t},\n\t}\n\treturn result\n}", "func (x *fastReflection_ModuleOptions) New() protoreflect.Message {\n\treturn new(fastReflection_ModuleOptions)\n}", "func (a *ArgoCDRepoServer) CreateGRPC(gitClient git.Client) *grpc.Server {\n\tserver := grpc.NewServer(\n\t\tgrpc.StreamInterceptor(grpc_middleware.ChainStreamServer(\n\t\t\tgrpc_logrus.StreamServerInterceptor(a.log),\n\t\t\tgrpc_util.PanicLoggerStreamServerInterceptor(a.log),\n\t\t)),\n\t\tgrpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(\n\t\t\tgrpc_logrus.UnaryServerInterceptor(a.log),\n\t\t\tgrpc_util.PanicLoggerUnaryServerInterceptor(a.log),\n\t\t)),\n\t)\n\tversion.RegisterVersionServiceServer(server, &version.Server{})\n\tmanifestService := repository.NewService(a.ns, a.kubeclientset, gitClient)\n\trepository.RegisterRepositoryServiceServer(server, manifestService)\n\n\t// Register reflection service on gRPC server.\n\treflection.Register(server)\n\n\treturn server\n}", "func (p PhoneCall) construct() PhoneCallClass { return &p }", "func (b Builder) Build() (*VerifiableCredential, error) {\n\tif err := validator.New().Struct(b); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif b.ProofVersion == 0 {\n\t\tb.ProofVersion = proof.V2\n\t}\n\n\tsuite, err := proof.SignatureSuites().GetSuiteForCredentials(b.SignatureType, b.ProofVersion)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The \"id\" attribute is added if missing from the claim data.\n\tvar credSubjects = map[string]interface{}{SubjectIDAttribute: b.SubjectDID.String()}\n\tfor k, v := range b.Data {\n\t\tcredSubjects[k] = v\n\t}\n\n\toptions := &proof.ProofOptions{ProofPurpose: proof.AssertionMethodPurpose}\n\t// Compute the claim proofs for selective disclosure.\n\tvar claimProofs = make(map[string]proof.Proof, len(credSubjects))\n\tfor k, v := range credSubjects {\n\t\tcredential := &VerifiableCredential{\n\t\t\tMetadata: *b.Metadata,\n\t\t\tCredentialSubject: map[string]interface{}{k: v},\n\t\t}\n\t\tif err := suite.Sign(credential, b.Signer, options); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclaimProofs[k] = *credential.Proof\n\t}\n\n\tcred := &VerifiableCredential{\n\t\tMetadata: *b.Metadata,\n\t\tCredentialSubject: credSubjects,\n\t\tClaimProofs: claimProofs,\n\t}\n\treturn cred, suite.Sign(cred, b.Signer, options)\n}", "func (tmpb *PoolBuilder) Build() pool.TaskPool {\n\n\tvar aTaskPool pool.TaskPool\n\n\tif tmpb.poolType == FIXED {\n\n\t\taTaskPool = pool.NewFixedTaskPool()\n\n\t} else if tmpb.poolType == CACHED {\n\n\t\taTaskPool = pool.NewCachedTaskPool(tmpb.maxCachePeriodInMillis)\n\n\t} else {\n\n\t\taTaskPool = pool.NewElasticTaskPool(tmpb.maxCachePeriodInMillis, tmpb.minWorkerCount)\n\n\t}\n\n\taTaskPool.SetMaxQueueCount(tmpb.maxQueueCount)\n\taTaskPool.SetMaxWorkerCount(tmpb.maxWorkerCount)\n\taTaskPool.SetCustomErrorFunction(tmpb.customErrorFunction)\n\n\treturn aTaskPool\n}", "func (r *Rest) Build(name string) *Rest {\n\tr.endpoints[name] = r.tmp\n\tr.tmp = RestEndPoint{}\n\treturn r\n}", "func CredentialCreationFromProto(cc *wantypes.CredentialCreation) *CredentialCreation {\n\tif cc == nil {\n\t\treturn nil\n\t}\n\treturn &CredentialCreation{\n\t\tResponse: publicKeyCredentialCreationOptionsFromProto(cc.PublicKey),\n\t}\n}", "func (client *BuildServiceClient) getSupportedBuildpackCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildpackName string, options *BuildServiceClientGetSupportedBuildpackOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif buildServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter buildServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{buildServiceName}\", url.PathEscape(buildServiceName))\n\tif buildpackName == \"\" {\n\t\treturn nil, errors.New(\"parameter buildpackName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{buildpackName}\", url.PathEscape(buildpackName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func newBuilder() balancer.Builder {\n\treturn base.NewBalancerBuilder(Name, &rrPickerBuilder{}, base.Config{HealthCheck: true})\n}", "func (d DialogPeer) construct() DialogPeerClass { return &d }", "func (client *BuildServiceClient) listSupportedBuildpacksCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, options *BuildServiceClientListSupportedBuildpacksOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif buildServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter buildServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{buildServiceName}\", url.PathEscape(buildServiceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func Build(q interface{}, opts ...Option) ([]byte, error) {\n\tb := &builder{\n\t\tquery: q,\n\t\toperationType: \"query\",\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(b)\n\t}\n\n\treturn b.build()\n}", "func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {\n\tr.cc = cc\n\n\t// Update conn states if proactively updates already work\n\tinstances, err := r.discoverer.Instances()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr.updateAddresses(instances)\n\tr.closing.Add(1)\n\tgo r.watcher()\n\treturn r, nil\n}", "func (p *googleCloudProvider) Create(ctx context.Context, req *rpc.CreateRequest) (*rpc.CreateResponse, error) {\n\turn := resource.URN(req.GetUrn())\n\tlabel := fmt.Sprintf(\"%s.Create(%s)\", p.name, urn)\n\tlogging.V(9).Infof(\"%s executing\", label)\n\n\t// Deserialize RPC inputs\n\tinputs, err := plugin.UnmarshalProperties(req.GetProperties(), plugin.MarshalOptions{\n\t\tLabel: fmt.Sprintf(\"%s.properties\", label), SkipNulls: true,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tunmodifiedInputs := deepcopy.Copy(inputs).(resource.PropertyMap)\n\tresourceKey := string(urn.Type())\n\n\tres, ok := p.resourceMap.Resources[resourceKey]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"resource %q not found\", resourceKey)\n\t}\n\tlogging.V(9).Infof(\"Looked up metadata for %q: %+v\", resourceKey, res)\n\n\t// Handle IamMember, IamBinding resources.\n\tif isIAMOverlay(urn) {\n\t\tinputs, err = inputsForIAMOverlayCreate(res, urn, inputs, p.client)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\turi, err := buildCreateURL(res, inputs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinputsMap := inputs.Mappable()\n\n\tbody := p.prepareAPIInputs(inputs, nil, res.Create.SDKProperties)\n\n\tvar op map[string]interface{}\n\tvar contentType string\n\tif val, hasContentType := inputs[\"contentType\"]; hasContentType {\n\t\tcontentType = val.StringValue()\n\t}\n\n\tif res.AssetUpload {\n\t\top, err = p.handleAssetUpload(uri, &res, inputs, body)\n\t} else if needsMultiPartFormdataContentType(contentType, res) {\n\t\top, err = p.handleFormDataUpload(uri, &res, inputs)\n\t} else {\n\t\top, err = retryRequest(p.client, res.Create.Verb, uri, contentType, body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error sending request: %s: %q %+v\", err, uri, inputs.Mappable())\n\t\t}\n\t}\n\n\tresp, err := p.waitForResourceOpCompletion(urn, res.Create.CloudAPIOperation, op, nil)\n\tif err != nil {\n\t\tif resp == nil {\n\t\t\treturn nil, errors.Wrapf(err, \"waiting for completion\")\n\t\t}\n\t\t// A partial failure may have occurred because we got an error and a response.\n\t\t// Try reading the resource state and return a partial error if there is some.\n\t\tid, idErr := calculateResourceID(res, inputsMap, resp)\n\t\tif idErr != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"waiting for completion / calculate ID %s\", idErr)\n\t\t}\n\t\treadResp, getErr := p.client.RequestWithTimeout(res.Read.Verb, resources.AssembleURL(res.RootURL, id), \"\", nil, 0)\n\t\tif getErr != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"waiting for completion / read state %s\", getErr)\n\t\t}\n\t\tdefaults, defErr := extractDefaultsFromResponse(res, inputs, readResp)\n\t\tif defErr != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to extract defaults from response: %s\", defErr)\n\t\t}\n\t\tcheckpoint, cpErr := plugin.MarshalProperties(\n\t\t\tcheckpointObject(inputs, defaults, resp),\n\t\t\tplugin.MarshalOptions{Label: fmt.Sprintf(\"%s.partialCheckpoint\", label), KeepSecrets: true, SkipNulls: true},\n\t\t)\n\t\tif cpErr != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"waiting for completion / checkpoint %s\", cpErr)\n\t\t}\n\t\treturn nil, partialError(id, err, checkpoint, req.GetProperties())\n\t}\n\n\t// There are several APIs where the response from the create/operation is non-standard or contains\n\t// stale data. When it comes to checkpointing, we want to store information that strictly matches what we\n\t// get from a subsequent read. As a result, we do an additional read call here and use that to checkpoint state.\n\t// This is likely superfluous/duplicative in many cases but erring on the side of correctness here instead.\n\tid, err := calculateResourceID(res, inputsMap, resp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"object retrieval failure after successful create / calculate ID %w\", err)\n\t}\n\turl := id\n\tif !strings.HasPrefix(url, \"http\") {\n\t\turl = resources.AssembleURL(res.RootURL, url)\n\t}\n\tresp, err = p.client.RequestWithTimeout(res.Read.Verb, url, \"\", nil, 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"object retrieval failure after successful create / read state: %w\", err)\n\t}\n\tdefaults, err := extractDefaultsFromResponse(res, inputs, resp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to extract defaults from response: %w\", err)\n\t}\n\t// Checkpoint defaults, outputs and inputs into the state.\n\tif isIAMOverlay(urn) {\n\t\tresp = unmodifiedInputs.Mappable()\n\t}\n\tcheckpoint, err := plugin.MarshalProperties(\n\t\tcheckpointObject(unmodifiedInputs, defaults, resp),\n\t\tplugin.MarshalOptions{Label: fmt.Sprintf(\"%s.checkpoint\", label), KeepSecrets: true, SkipNulls: true},\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal checkpoint: %w\", err)\n\t}\n\n\treturn &rpc.CreateResponse{\n\t\tId: id,\n\t\tProperties: checkpoint,\n\t}, nil\n}", "func NewProviderGRPC(cfg ProviderGRPCConfig) (*ProviderGRPC, error) {\n\tvar (\n\t\tport = cfg.Port\n\t)\n\tif port == 0 {\n\t\treturn nil, errors.New(\"Port must be specified\")\n\t}\n\n\tclient, err := gstorage.NewClient(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserver := grpc.NewServer()\n\ts := &ProviderGRPC{client, server, port}\n\tpb.RegisterStorageServer(server, s)\n\n\treturn s, nil\n}" ]
[ "0.64123386", "0.54491264", "0.5207384", "0.519233", "0.51873875", "0.5060041", "0.500911", "0.49661744", "0.49641725", "0.49387065", "0.4873675", "0.48730406", "0.48674744", "0.48580194", "0.48238623", "0.48182973", "0.4813414", "0.48090446", "0.47689024", "0.47326857", "0.472298", "0.47173777", "0.4714252", "0.47028232", "0.4657974", "0.4646954", "0.464248", "0.4640698", "0.4627448", "0.46177128", "0.46067518", "0.46032315", "0.45969844", "0.4575776", "0.45622355", "0.45620275", "0.45553702", "0.45458055", "0.454211", "0.4523647", "0.45215964", "0.4520909", "0.45207787", "0.45046082", "0.4486489", "0.44824702", "0.44690093", "0.4456611", "0.4425975", "0.4425165", "0.44249907", "0.44241765", "0.44193524", "0.4408623", "0.44069913", "0.44063196", "0.43991753", "0.43969265", "0.4394562", "0.4389627", "0.4378603", "0.43784538", "0.43737596", "0.43610385", "0.43590707", "0.43556008", "0.43553787", "0.43514198", "0.434673", "0.43427888", "0.4337698", "0.43356222", "0.4335578", "0.4329329", "0.43278053", "0.43198928", "0.43198928", "0.43146753", "0.43107393", "0.4309643", "0.43050283", "0.43048543", "0.42909476", "0.42800912", "0.4276427", "0.42745587", "0.42705044", "0.42670897", "0.42619225", "0.4257408", "0.42559502", "0.42554557", "0.42500275", "0.42477682", "0.4246343", "0.42430097", "0.42423904", "0.42402583", "0.423995", "0.42380658" ]
0.75783914
0
Deprecated: Use MetricSpecWithThreshold.ProtoReflect.Descriptor instead.
Устарело: используйте MetricSpecWithThreshold.ProtoReflect.Descriptor вместо этого.
func (*MetricSpecWithThreshold) Descriptor() ([]byte, []int) { return file_api_adaptive_load_metric_spec_proto_rawDescGZIP(), []int{2} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ThresholdSpec) Descriptor() ([]byte, []int) {\n\treturn file_api_adaptive_load_metric_spec_proto_rawDescGZIP(), []int{1}\n}", "func (*TelemetryThreshold) Descriptor() ([]byte, []int) {\n\treturn file_huawei_telemetry_proto_rawDescGZIP(), []int{5}\n}", "func (*AlertingCondition_Spec_TimeSeries_Threshold) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_alerting_condition_proto_rawDescGZIP(), []int{0, 0, 0, 1}\n}", "func (*TargetMetrics_Metric) Descriptor() ([]byte, []int) {\n\treturn file_asgt_type_target_metrics_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*TargetMetrics) Descriptor() ([]byte, []int) {\n\treturn file_asgt_type_target_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*KafkaMeter) Descriptor() ([]byte, []int) {\n\treturn file_pkg_sinks_plugin_proto_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*MetricSpec) Descriptor() ([]byte, []int) {\n\treturn file_api_adaptive_load_metric_spec_proto_rawDescGZIP(), []int{0}\n}", "func (*CircuitBreakers_Thresholds) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_cluster_circuit_breaker_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*FeaturestoreMonitoringConfig_ThresholdConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_featurestore_monitoring_proto_rawDescGZIP(), []int{0, 2}\n}", "func (*NodeThreshold) Descriptor() ([]byte, []int) {\n\treturn file_models_model_node_threshold_proto_rawDescGZIP(), []int{0}\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 (*OnTargetAudienceMetrics) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{19}\n}", "func (*WriteKafkaMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_sinks_plugin_proto_metrics_proto_rawDescGZIP(), []int{2}\n}", "func (*CLRMetric) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{1}\n}", "func (TelemetryThreshold_ThresholdOpType) EnumDescriptor() ([]byte, []int) {\n\treturn file_huawei_telemetry_proto_rawDescGZIP(), []int{5, 0}\n}", "func (*Metric) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{2}\n}", "func (*LivenessProbeCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{13}\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*MonitoredResourceDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_monitored_resource_descriptor_proto_rawDescGZIP(), []int{0}\n}", "func (*Metric) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{0}\n}", "func (*ClrThread) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{3}\n}", "func (*Metric) Descriptor() ([]byte, []int) {\n\treturn file_tlogpb_tlog_proto_rawDescGZIP(), []int{4}\n}", "func (*OperationTypeThreshold) Descriptor() ([]byte, []int) {\n\treturn file_chain_proto_rawDescGZIP(), []int{7}\n}", "func (*Metrics) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{0}\n}", "func (*MetricInfo) Descriptor() ([]byte, []int) {\n\treturn file_msgType_proto_rawDescGZIP(), []int{15}\n}", "func (*TrialProfilerMetricLabels) Descriptor() ([]byte, []int) {\n\treturn file_determined_trial_v1_trial_proto_rawDescGZIP(), []int{3}\n}", "func (*RateLimitingSampler) Descriptor() ([]byte, []int) {\n\treturn file_opencensus_proto_trace_v1_trace_config_proto_rawDescGZIP(), []int{3}\n}", "func (*MetricImplementation) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{6}\n}", "func (AlertingCondition_Spec_TimeSeries_Threshold_Compare) EnumDescriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_alerting_condition_proto_rawDescGZIP(), []int{0, 0, 0, 1, 0}\n}", "func (*MetricsReport) Descriptor() ([]byte, []int) {\n\treturn file_determined_trial_v1_trial_proto_rawDescGZIP(), []int{9}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\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 (*Range) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{1}\n}", "func (*KafkaGauge) Descriptor() ([]byte, []int) {\n\treturn file_pkg_sinks_plugin_proto_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (*FaultRateLimit) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_filter_fault_v2_fault_proto_rawDescGZIP(), []int{1}\n}", "func (TelemetrySelfDefinedEvent_ThresholdRelation) EnumDescriptor() ([]byte, []int) {\n\treturn file_huawei_telemetry_proto_rawDescGZIP(), []int{3, 0}\n}", "func (*DurationLT) Descriptor() ([]byte, []int) {\n\treturn file_buf_validate_conformance_cases_wkt_duration_proto_rawDescGZIP(), []int{5}\n}", "func (*MetricsRange) Descriptor() ([]byte, []int) {\n\treturn file_determined_project_v1_project_proto_rawDescGZIP(), []int{5}\n}", "func (*WatchLimitsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{7}\n}", "func (*CLRMetricCollection) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{0}\n}", "func (*OperationSetThreshold) Descriptor() ([]byte, []int) {\n\treturn file_chain_proto_rawDescGZIP(), []int{16}\n}", "func (*ClrGC) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{2}\n}", "func (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\n}", "func (*WatchLimitRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{5}\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "func (Metric_Scale) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*MetricsServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{18}\n}", "func (*MetricData) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_common_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (*AccountThreshold) Descriptor() ([]byte, []int) {\n\treturn file_chain_proto_rawDescGZIP(), []int{9}\n}", "func (*TimerFamilySpec) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{17}\n}", "func (*GetModelVersionMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{94}\n}", "func (*PlanChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_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 (*BaseMetrics) Descriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{0}\n}", "func (*Sample) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_common_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*MetricConfiguration) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{5}\n}", "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "func (*MetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{11}\n}", "func (*DurationLTE) Descriptor() ([]byte, []int) {\n\treturn file_buf_validate_conformance_cases_wkt_duration_proto_rawDescGZIP(), []int{6}\n}", "func (*LoadBalancerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_test_proto_rawDescGZIP(), []int{9}\n}", "func (*TrialSourceInfoMetric) Descriptor() ([]byte, []int) {\n\treturn file_determined_trial_v1_trial_proto_rawDescGZIP(), []int{11}\n}", "func (*MetricLimit) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_quota_quota_proto_rawDescGZIP(), []int{1}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (ms Metric) MetricDescriptor() MetricDescriptor {\n\treturn newMetricDescriptor(&(*ms.orig).MetricDescriptor)\n}", "func (*CMatchTeamTimedStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{10}\n}", "func (*AllowedValues) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_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 (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 (*TelemetryExpectation) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{8}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*Performance) Descriptor() ([]byte, []int) {\n\treturn file_commissionService_proto_rawDescGZIP(), []int{2}\n}", "func (*MinMax) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{2}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_automate_gateway_api_telemetry_telemetry_proto_rawDescGZIP(), []int{0}\n}", "func (*DurationExLTGT) Descriptor() ([]byte, []int) {\n\treturn file_buf_validate_conformance_cases_wkt_duration_proto_rawDescGZIP(), []int{10}\n}", "func (*MetricsWorkload) Descriptor() ([]byte, []int) {\n\treturn file_determined_trial_v1_trial_proto_rawDescGZIP(), []int{1}\n}", "func (*XqosTmPerformanceAlarm) Descriptor() ([]byte, []int) {\n\treturn file_huaweiV8R12_qos_notification_proto_rawDescGZIP(), []int{30}\n}", "func (*LabelDescriptor) Descriptor() ([]byte, []int) {\n\treturn edgelq_logging_proto_v1alpha2_common_proto_rawDescGZIP(), []int{0}\n}", "func (*Telemetry) Descriptor() ([]byte, []int) {\n\treturn file_huawei_telemetry_proto_rawDescGZIP(), []int{0}\n}", "func (*ConstantSampler) Descriptor() ([]byte, []int) {\n\treturn file_opencensus_proto_trace_v1_trace_config_proto_rawDescGZIP(), []int{2}\n}", "func (*PlanChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Thread) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_JVMMetric_proto_rawDescGZIP(), []int{5}\n}", "func (*DatasetRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_metric_proto_rawDescGZIP(), []int{0}\n}", "func (*PlanChange_Modified) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_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 (*DurationGT) Descriptor() ([]byte, []int) {\n\treturn file_buf_validate_conformance_cases_wkt_duration_proto_rawDescGZIP(), []int{7}\n}", "func (*DurationGTELTE) Descriptor() ([]byte, []int) {\n\treturn file_buf_validate_conformance_cases_wkt_duration_proto_rawDescGZIP(), []int{11}\n}", "func (*ThresholdReportingPluginConfig) Descriptor() ([]byte, []int) {\n\treturn file_core_services_ocr2_plugins_functions_config_config_types_proto_rawDescGZIP(), []int{0}\n}", "func (ResourceName) EnumDescriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_common_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (*ClusterMonitorData) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{10}\n}", "func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {\n\treturn legacyLoadMessageDesc(t, \"\")\n}", "func (*FaultRateLimit_HeaderLimit) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_filter_fault_v2_fault_proto_rawDescGZIP(), []int{1, 1}\n}", "func (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_pkg_sinks_plugin_proto_metrics_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 (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (*PerformanceWhere) Descriptor() ([]byte, []int) {\n\treturn file_commissionService_proto_rawDescGZIP(), []int{3}\n}", "func (*CircuitBreakers_Thresholds_RetryBudget) Descriptor() ([]byte, []int) {\n\treturn file_envoy_api_v2_cluster_circuit_breaker_proto_rawDescGZIP(), []int{0, 0, 0}\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 (*ListMetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (ConstantSampler_ConstantDecision) EnumDescriptor() ([]byte, []int) {\n\treturn file_opencensus_proto_trace_v1_trace_config_proto_rawDescGZIP(), []int{2, 0}\n}" ]
[ "0.6960433", "0.65074533", "0.60811925", "0.6029226", "0.60165745", "0.6012746", "0.59527254", "0.5918514", "0.58969796", "0.5872111", "0.5858821", "0.5857826", "0.58539706", "0.58046436", "0.5786188", "0.5784575", "0.5756746", "0.572665", "0.56305903", "0.56272644", "0.5596084", "0.5594624", "0.5593038", "0.5589756", "0.55790037", "0.5573242", "0.5541749", "0.5540635", "0.55343306", "0.5524222", "0.5520098", "0.5517843", "0.55131066", "0.5477834", "0.5469404", "0.5464909", "0.5462445", "0.54600143", "0.54580456", "0.54419637", "0.5441328", "0.54411584", "0.5439449", "0.5432137", "0.542997", "0.54265684", "0.54093665", "0.5406215", "0.53925073", "0.53781223", "0.5373668", "0.5371227", "0.5369532", "0.5356953", "0.53562534", "0.5350958", "0.53457993", "0.5344443", "0.5341049", "0.5338952", "0.5320434", "0.53158295", "0.5310572", "0.53096735", "0.53084904", "0.53084666", "0.5302823", "0.5302126", "0.53013", "0.52908474", "0.52901345", "0.52897924", "0.5283903", "0.5279966", "0.5266287", "0.5249581", "0.5249454", "0.52469647", "0.5242142", "0.52403945", "0.5239539", "0.52353716", "0.52333915", "0.5229634", "0.52252746", "0.52202976", "0.52186376", "0.5214565", "0.5211602", "0.52113813", "0.52077305", "0.52017254", "0.5201628", "0.5200531", "0.5198861", "0.51978934", "0.5193695", "0.5192123", "0.51910126", "0.5185399" ]
0.7160946
0
Deprecated: Use Scorecard.ProtoReflect.Descriptor instead.
Устарело: используйте Scorecard.ProtoReflect.Descriptor вместо этого.
func (*Scorecard) Descriptor() ([]byte, []int) { return file_google_monitoring_dashboard_v1_scorecard_proto_rawDescGZIP(), []int{0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Score) Descriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{2}\n}", "func (*BaseScore) Descriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{3}\n}", "func (*CMsgPlayerCard) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{38}\n}", "func (*CMsgPlayerConductScorecard) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{168}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_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 (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\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 (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*Modifier) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{6}\n}", "func (*CMsgPlayerConductScorecardRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{167}\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 (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*CMsgPlayerCard_StatModifier) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{38, 0}\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\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 (*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 (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (x *fastReflection_Supply) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Supply\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_Metadata) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Metadata\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*CMsgCustomGameWhitelistForEdit) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{50}\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 (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "func (*OnTargetAudienceMetrics) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{19}\n}", "func (AttackComplexity) EnumDescriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{1}\n}", "func (*CMsgCustomGameWhitelist) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{49}\n}", "func (*CMsgClientToGCRecyclePlayerCard) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{214}\n}", "func (*Game) Descriptor() ([]byte, []int) {\n\treturn file_public_rules_rules_proto_rawDescGZIP(), []int{5}\n}", "func (*Instant) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{7}\n}", "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "func (*LeaderInfoProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{39}\n}", "func (*Leaderboard) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{49}\n}", "func (*CSVCMsg_HltvReplay) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{51}\n}", "func (*ValidatorUpdates) Descriptor() ([]byte, []int) {\n\treturn file_core_abci_v1alpha1_abci_proto_rawDescGZIP(), []int{6}\n}", "func (*CodeLens) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{164}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*CMsgClientToGCGetProfileCardStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{139}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*PrivateApiCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{24}\n}", "func (*Description) Descriptor() ([]byte, []int) {\n\treturn file_Harmony_proto_rawDescGZIP(), []int{4}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*Decl_FunctionDecl_Overload) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2, 1, 0}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*CMsgClientToGCGetProfileCard) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{137}\n}", "func (*EACLRecord) Descriptor() ([]byte, []int) {\n\treturn file_v2_acl_grpc_types_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgFlipLobbyTeams) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{90}\n}", "func (*CSVCMsg_GameEventListDescriptorT) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{44, 1}\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 (*CMsgInspectElement) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{145}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Draw) Descriptor() ([]byte, []int) {\n\treturn file_public_rules_rules_proto_rawDescGZIP(), []int{2}\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*Card) Descriptor() ([]byte, []int) {\n\treturn file_proto_stripe_proto_rawDescGZIP(), []int{4}\n}", "func (*CMsgDOTAProfileCard) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{22}\n}", "func (*CMsgDOTARealtimeGameStats_PlayerDetails) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{27, 5}\n}", "func (*CCLCMsg_HltvReplay) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{52}\n}", "func (*CSVCMsg_HltvReplay) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{51}\n}", "func (*CSVCMsg_GameEventListDescriptorT) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{44, 1}\n}", "func (*CMatchTeamTimedStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{10}\n}", "func (*LeaderboardRecord) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{51}\n}", "func (*Team) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{12}\n}", "func (*MyProto) Descriptor() ([]byte, []int) {\n\treturn file_my_proto_proto_rawDescGZIP(), []int{0}\n}", "func (*CMatchClip) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{14}\n}", "func (x *fastReflection_ModuleOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ModuleOptions\n}", "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Correctness) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{13}\n}", "func (*Message5908) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{13}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*PlayerPoint) Descriptor() ([]byte, []int) {\n\treturn file_msgdata_proto_rawDescGZIP(), []int{18}\n}", "func (*CMatchPlayerTimedStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{9}\n}", "func (*ListCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{164}\n}", "func (*CandidateInfoProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{41}\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*RoleInfoProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{42}\n}", "func (*PrivateVisibility) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_dns_v1_dns_zone_proto_rawDescGZIP(), []int{2}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (x *fastReflection_RpcCommandOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RpcCommandOptions\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 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 (*Player) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{6}\n}", "func (*Reference) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{3}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (*Validator) Descriptor() ([]byte, []int) {\n\treturn file_tm_replay_proto_rawDescGZIP(), []int{13}\n}", "func (x *fastReflection_Input) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Input\n}", "func (*UpdateTeam) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{6}\n}", "func (CVSSv3_Impact) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_containeranalysis_v1beta1_cvss_cvss_proto_rawDescGZIP(), []int{0, 5}\n}", "func (*CMsgClientToGCVoteForLeagueGameMVP) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{181}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (*PolicyRule) Descriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_skv2_api_multicluster_v1alpha1_cluster_proto_rawDescGZIP(), []int{2}\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}" ]
[ "0.700281", "0.6879392", "0.68285745", "0.6728023", "0.66748387", "0.6673123", "0.6658392", "0.6644106", "0.66355675", "0.66153055", "0.66022944", "0.66015166", "0.65768534", "0.6576063", "0.65572953", "0.6551013", "0.65416706", "0.6523413", "0.6518851", "0.651338", "0.6506201", "0.6505877", "0.6505526", "0.6494367", "0.6485224", "0.64839387", "0.6471758", "0.6467003", "0.64669275", "0.6465438", "0.6459129", "0.6453696", "0.64466804", "0.64353865", "0.6432846", "0.6432553", "0.64294493", "0.64293236", "0.6428831", "0.6424936", "0.64244473", "0.6423159", "0.64169365", "0.6413482", "0.6412987", "0.6410625", "0.64102036", "0.640894", "0.6406266", "0.64036953", "0.64028776", "0.640216", "0.6399701", "0.6396498", "0.639573", "0.6395544", "0.6394525", "0.63883597", "0.6385302", "0.6384902", "0.63845325", "0.63831234", "0.6381341", "0.63783234", "0.63782936", "0.63754934", "0.63738054", "0.63684064", "0.6367496", "0.6364238", "0.6363453", "0.6361802", "0.6357843", "0.63552064", "0.6355072", "0.6355033", "0.63545233", "0.63534653", "0.6350837", "0.6350258", "0.6349757", "0.6347458", "0.6347246", "0.6346134", "0.63445216", "0.63385284", "0.63375926", "0.63373774", "0.6334668", "0.6331724", "0.6329643", "0.6328221", "0.6326576", "0.63246226", "0.63223726", "0.63197297", "0.6318145", "0.63177913", "0.63177454", "0.63160974" ]
0.72033995
0
Deprecated: Use Scorecard_GaugeView.ProtoReflect.Descriptor instead.
Устарело: используйте Scorecard_GaugeView.ProtoReflect.Descriptor вместо этого.
func (*Scorecard_GaugeView) Descriptor() ([]byte, []int) { return file_google_monitoring_dashboard_v1_scorecard_proto_rawDescGZIP(), []int{0, 0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ClrGC) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{2}\n}", "func (*KafkaGauge) Descriptor() ([]byte, []int) {\n\treturn file_pkg_sinks_plugin_proto_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (*CLRMetric) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{1}\n}", "func (*CLRMetricCollection) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{0}\n}", "func (*Metrics) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*Metric) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{2}\n}", "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*TargetMetrics_Metric) Descriptor() ([]byte, []int) {\n\treturn file_asgt_type_target_metrics_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*OnTargetAudienceMetrics) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{19}\n}", "func (*CMsgClientToGCGiveTip) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{239}\n}", "func (*BaseMetrics) Descriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgClientToGCVoteForLeagueGameMVP) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{181}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (*GC) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_JVMMetric_proto_rawDescGZIP(), []int{4}\n}", "func (*KafkaMeter) Descriptor() ([]byte, []int) {\n\treturn file_pkg_sinks_plugin_proto_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgDOTARealtimeGameStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{27}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*TargetMetrics) Descriptor() ([]byte, []int) {\n\treturn file_asgt_type_target_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgMapStatsSnapshot) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{90}\n}", "func (*MetricInfo) Descriptor() ([]byte, []int) {\n\treturn file_msgType_proto_rawDescGZIP(), []int{15}\n}", "func (*NumericValue) Descriptor() ([]byte, []int) {\n\treturn file_google_analytics_admin_v1alpha_access_report_proto_rawDescGZIP(), []int{10}\n}", "func (*PostTrendingMetricsViewRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{171}\n}", "func (*Metric) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{0}\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 (*ClrThread) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{3}\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*CMsgGlobalMapStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{91}\n}", "func (*CMsgClientToGCVoteForMVP) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{182}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*NetRateTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{2}\n}", "func (*GPULabelRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{10}\n}", "func (*CMatchTeamTimedStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{10}\n}", "func (*MetricImplementation) Descriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{6}\n}", "func (*CMsgClientToGCTeammateStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{187}\n}", "func (*PlanChange_Added) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*ListTrendingMetricsViewsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{172}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (Metric_Scale) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_assessment_metric_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*MetricData) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_common_metrics_proto_rawDescGZIP(), []int{1}\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 (*GoogleProfilerCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{12}\n}", "func (*CMsgDOTALiveLeagueGameUpdate) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{104}\n}", "func (*Metric) Descriptor() ([]byte, []int) {\n\treturn file_tlogpb_tlog_proto_rawDescGZIP(), []int{4}\n}", "func (*TrialProfilerMetricLabels) Descriptor() ([]byte, []int) {\n\treturn file_determined_trial_v1_trial_proto_rawDescGZIP(), []int{3}\n}", "func (*MetricsServing) Descriptor() ([]byte, []int) {\n\treturn file_pkg_webview_view_proto_rawDescGZIP(), []int{9}\n}", "func (*Message3920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{17}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (VersionView) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{0}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "func (*CMsgClientToGCGiveTipResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{240}\n}", "func (*Message5908) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{13}\n}", "func (*ClientStatsPayload) Descriptor() ([]byte, []int) {\n\treturn file_datadog_trace_stats_proto_rawDescGZIP(), []int{1}\n}", "func (*PostModelVersionMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{93}\n}", "func (*GetModelVersionMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{94}\n}", "func (*Preferences) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{8}\n}", "func (*BackfilledMetrics) Descriptor() ([]byte, []int) {\n\treturn file_BackfillMetrics_proto_rawDescGZIP(), []int{0}\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 (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*CMsgProfileUpdate) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{277}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgClientToGCGetProfileCardStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{139}\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*CMsgGCNotificationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{113}\n}", "func (*MaximizeConversions) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_bidding_proto_rawDescGZIP(), []int{6}\n}", "func (*Message6054) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{23}\n}", "func (*CMsgDOTABotDebugInfo) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{41}\n}", "func (*CMsgGameDataSpecialValueBonus) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{68}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*MetricsServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{18}\n}", "func (*BackfilledMetrics_Data) Descriptor() ([]byte, []int) {\n\treturn file_BackfillMetrics_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*CMsgCustomGameWhitelistForEdit) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{50}\n}", "func (*CSOEconItemDropRateBonus) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{78}\n}", "func (*CMatchPlayerTimedStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{9}\n}", "func (*ClientGroupedStats) Descriptor() ([]byte, []int) {\n\treturn file_datadog_trace_stats_proto_rawDescGZIP(), []int{3}\n}", "func (*JVMMetricCollection) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_JVMMetric_proto_rawDescGZIP(), []int{0}\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (*MetricsReport) Descriptor() ([]byte, []int) {\n\treturn file_determined_trial_v1_trial_proto_rawDescGZIP(), []int{9}\n}", "func (*Telemetry) Descriptor() ([]byte, []int) {\n\treturn file_huawei_telemetry_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgDOTARealtimeGameStats_GraphData) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{27, 11}\n}", "func (*NetProtoTalker) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*DiagOperation) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{10}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*CMsgDOTABotDebugInfo_Bot) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{41, 0}\n}", "func (*CMsgDOTARealtimeGameStatsTerse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{28}\n}", "func (*MultiTrendingMetricsViewResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{173}\n}", "func (*MaximizeConversionValue) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v14_common_bidding_proto_rawDescGZIP(), []int{7}\n}", "func (*CMsgConsumableUsage) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{46}\n}", "func (*CMsgDOTAClientToGCQuickStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{251}\n}", "func (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (*MetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{11}\n}", "func (*CSVCMsg_GameEventListDescriptorT) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{44, 1}\n}", "func (*Degree) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_talent_v4beta1_profile_proto_rawDescGZIP(), []int{11}\n}", "func (*RefreshResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{17}\n}" ]
[ "0.6824529", "0.68163484", "0.67460763", "0.66216606", "0.65765965", "0.65765387", "0.6563826", "0.65418273", "0.6529831", "0.65259284", "0.65070504", "0.6475942", "0.6463522", "0.6460196", "0.6457537", "0.6445932", "0.6419697", "0.6413116", "0.6407112", "0.63850945", "0.63491607", "0.63464916", "0.6337833", "0.63311464", "0.63238573", "0.6320074", "0.6318079", "0.6315722", "0.63131756", "0.63122004", "0.6310013", "0.6302924", "0.629308", "0.62917036", "0.6284138", "0.6281044", "0.6279408", "0.62707406", "0.6269557", "0.6266669", "0.62636006", "0.62608784", "0.6255406", "0.6251367", "0.6251156", "0.62481964", "0.62480706", "0.6243464", "0.624083", "0.6234853", "0.6218241", "0.62159765", "0.6214936", "0.62145895", "0.6213625", "0.6209406", "0.619898", "0.6198606", "0.6195309", "0.61946297", "0.6193919", "0.61934304", "0.618907", "0.6187731", "0.6186804", "0.6185477", "0.6185024", "0.6183286", "0.61825806", "0.6174484", "0.6168433", "0.61678296", "0.61656106", "0.61643136", "0.61632603", "0.61610913", "0.61609954", "0.6160161", "0.6159802", "0.61588025", "0.6158729", "0.6157504", "0.6154262", "0.6153343", "0.615176", "0.61477655", "0.61467457", "0.6146026", "0.614566", "0.6144133", "0.61411685", "0.6140872", "0.6138836", "0.6135872", "0.6135528", "0.6131107", "0.6128428", "0.6126325", "0.61255145", "0.61235535" ]
0.77736974
0
Deprecated: Use Scorecard_SparkChartView.ProtoReflect.Descriptor instead.
Устарело: используйте Scorecard_SparkChartView.ProtoReflect.Descriptor вместо этого.
func (*Scorecard_SparkChartView) Descriptor() ([]byte, []int) { return file_google_monitoring_dashboard_v1_scorecard_proto_rawDescGZIP(), []int{0, 1} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "func (*Scorecard_GaugeView) Descriptor() ([]byte, []int) {\n\treturn file_google_monitoring_dashboard_v1_scorecard_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Chart) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{20}\n}", "func (*ChartInfo) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{24}\n}", "func (*ChartOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_monitoring_dashboard_v1_xychart_proto_rawDescGZIP(), []int{1}\n}", "func (*PostModelVersionMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{93}\n}", "func (*ListTrendingMetricsViewsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{172}\n}", "func (*GetModelVersionMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{94}\n}", "func (*XyChart) Descriptor() ([]byte, []int) {\n\treturn file_google_monitoring_dashboard_v1_xychart_proto_rawDescGZIP(), []int{0}\n}", "func (*Chart) Descriptor() ([]byte, []int) {\n\treturn file_svr_chart_v1_chart_db_proto_rawDescGZIP(), []int{0}\n}", "func (*OnTargetAudienceMetrics) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{19}\n}", "func (*ReadTensorboardUsageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{7}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*ReadTensorboardTimeSeriesDataResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{37}\n}", "func (*Scorecard) Descriptor() ([]byte, []int) {\n\treturn file_google_monitoring_dashboard_v1_scorecard_proto_rawDescGZIP(), []int{0}\n}", "func (*PostTrendingMetricsViewRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{171}\n}", "func (*Score) Descriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{2}\n}", "func (*SafetyFeedback) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_safety_proto_rawDescGZIP(), []int{1}\n}", "func (*ReadTensorboardUsageRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{6}\n}", "func (x *fastReflection_LightClientAttackEvidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_LightClientAttackEvidence\n}", "func (*ReadTensorboardTimeSeriesDataRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{36}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*FabricView) Descriptor() ([]byte, []int) {\n\treturn file_fabric_view_data_proto_rawDescGZIP(), []int{0}\n}", "func (*Message5908) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{13}\n}", "func (*MetricsServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{18}\n}", "func (*CheckerChartV1) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{20}\n}", "func (*UpdateTensorboardTimeSeriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{32}\n}", "func (*BaseMetrics) Descriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{0}\n}", "func (*BatchReadTensorboardTimeSeriesDataResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{35}\n}", "func (*ExportTensorboardTimeSeriesDataResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{43}\n}", "func (*GetChartReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteTensorboardTimeSeriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{33}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (x *fastReflection_FlagOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_FlagOptions\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*VodPlayInfoModel) Descriptor() ([]byte, []int) {\n\treturn file_vod_business_vod_play_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 (*BaseScore) Descriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{3}\n}", "func (*DiagOperation) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{10}\n}", "func (*ListChartReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{27}\n}", "func (*GetTensorboardTimeSeriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{29}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*UpdateTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{4}\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (*MultiTrendingMetricsViewResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{173}\n}", "func (x *fastReflection_Evidence) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Evidence\n}", "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "func (*Message6052) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{25}\n}", "func (*LabelledPayload) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{59}\n}", "func (*ListTensorboardTimeSeriesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{31}\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 (*GetTensorboardRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{1}\n}", "func (*MetricsServing) Descriptor() ([]byte, []int) {\n\treturn file_pkg_webview_view_proto_rawDescGZIP(), []int{9}\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func (*XyChart_DataSet) Descriptor() ([]byte, []int) {\n\treturn file_google_monitoring_dashboard_v1_xychart_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Message10319) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{6}\n}", "func (*Draw) Descriptor() ([]byte, []int) {\n\treturn file_public_rules_rules_proto_rawDescGZIP(), []int{2}\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\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 (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Forecast) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{18}\n}", "func (*GenerateProductMixIdeasRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{7}\n}", "func (*BatchReadTensorboardTimeSeriesDataRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{34}\n}", "func (*ListTensorboardTimeSeriesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{30}\n}", "func (*GetBalancerBandwidthResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{19}\n}", "func (*FeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{10}\n}", "func (*Message5907) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{32}\n}", "func (*CSVCMsg_PaintmapData) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{42}\n}", "func (*CSVCMsg_SetView) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{29}\n}", "func (*MetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{11}\n}", "func (*QueryDatasetComponentDiff) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_Dataset_proto_rawDescGZIP(), []int{8}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*BatchCreateTensorboardTimeSeriesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{27}\n}", "func (*GetDatanodeInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{13}\n}", "func (*GenerateProductMixIdeasResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{9}\n}", "func (*Preferences) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{8}\n}", "func (*CLRMetric) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{1}\n}", "func (*CodeLens) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{164}\n}", "func (*Message3850) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{14}\n}", "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "func (*SubmitDiskBalancerPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{21}\n}", "func (*CMsgHideToolTip) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{64}\n}", "func (*VectorClock) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_l3_proto_rawDescGZIP(), []int{3}\n}", "func (*Example) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{4}\n}", "func (*ConsumableTrafficPolyline) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_fleetengine_v1_traffic_proto_rawDescGZIP(), []int{1}\n}", "func (*Tensorboard) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_proto_rawDescGZIP(), []int{0}\n}", "func (*CSVCMsg_PaintmapData) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{42}\n}", "func (*ListMetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{1}\n}", "func (*DisplayData) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{60}\n}", "func (*ExportTensorboardTimeSeriesDataRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{42}\n}", "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "func (*StandardCoders) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{29}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*DatasetDiff) Descriptor() ([]byte, []int) {\n\treturn file_modeldb_versioning_Dataset_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 (*ReadTensorboardUsageResponse_PerUserUsageData) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_tensorboard_service_proto_rawDescGZIP(), []int{7, 0}\n}" ]
[ "0.65494704", "0.6429943", "0.63701975", "0.6346591", "0.6337553", "0.62929755", "0.6288999", "0.62860525", "0.6271876", "0.6259072", "0.6255981", "0.6247951", "0.6228296", "0.6202115", "0.6201875", "0.6154162", "0.61452585", "0.6145207", "0.61450595", "0.61404777", "0.61375725", "0.61119765", "0.6111276", "0.6103721", "0.6097426", "0.60960966", "0.60947895", "0.60924107", "0.6092196", "0.60900444", "0.60889894", "0.6084264", "0.6081079", "0.6079819", "0.6076615", "0.6064916", "0.60608596", "0.60604376", "0.6055613", "0.6052481", "0.6050425", "0.6049879", "0.60419905", "0.60413665", "0.6038328", "0.60309374", "0.6029024", "0.6027254", "0.60258645", "0.60242593", "0.60228074", "0.6016516", "0.6015802", "0.60132575", "0.6011468", "0.60099083", "0.60091114", "0.6008845", "0.60075396", "0.60066", "0.60019684", "0.6000723", "0.599948", "0.5997407", "0.5993053", "0.5990179", "0.59901476", "0.59872574", "0.5986467", "0.59806556", "0.59724504", "0.5971712", "0.5970583", "0.59646773", "0.59562427", "0.5952351", "0.59511304", "0.5950511", "0.5950151", "0.59488773", "0.59461516", "0.5944357", "0.594431", "0.5942905", "0.5941601", "0.59404707", "0.59392697", "0.5937463", "0.593651", "0.5936062", "0.59337306", "0.59289783", "0.59282625", "0.5927599", "0.5923738", "0.5920761", "0.5918468", "0.59171265", "0.59131384", "0.590532" ]
0.7641592
0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AESConfiguration.
DeepCopy — это автоматически сгенерированная функция глубокого копирования, копирующая получатель, создавая новый объект AESConfiguration.
func (in *AESConfiguration) DeepCopy() *AESConfiguration { if in == nil { return nil } out := new(AESConfiguration) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *EncryptionConfiguration) DeepCopy() *EncryptionConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EncryptionConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EncryptionConfig) DeepCopy() *EncryptionConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EncryptionConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretEngineConfiguration) DeepCopy() *SecretEngineConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretEngineConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AutoMLSecurityConfig) DeepCopy() *AutoMLSecurityConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AutoMLSecurityConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretboxConfiguration) DeepCopy() *SecretboxConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretboxConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAES(aesKey, hmacKey []byte) (*AESCTREncryptor, error) {\n\tif len(hmacKey) == 0 {\n\t\treturn nil, ErrHmacKeyTooShort\n\t}\n\n\tblock, err := aes.NewCipher(aesKey)\n\tif err != nil {\n\t\treturn nil, ErrKeyTooShort\n\t}\n\n\treturn &AESCTREncryptor{\n\t\taesKey: aesKey,\n\t\thmacKey: hmacKey,\n\t\tblock: block,\n\t}, nil\n}", "func (in *AWSConfiguration) DeepCopy() *AWSConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAESCrypto(key []byte, iv ...byte) (*AESCrypto, error) {\n\tb, err := aes.NewCipher(key)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := &AESCrypto{\n\t\tblock: b,\n\t\tkey: key,\n\t\tiv: iv,\n\t}\n\n\tif len(iv) == 0 {\n\t\tr.iv = key[:b.BlockSize()]\n\t}\n\n\treturn r, nil\n}", "func (in *DataEncryption) DeepCopy() *DataEncryption {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DataEncryption)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSCFConfiguration) DeepCopy() *EKSCFConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSCFConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EncryptionProperties) DeepCopy() *EncryptionProperties {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EncryptionProperties)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AzureConfiguration) DeepCopy() *AzureConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAES(\n\tmode modeType,\n\tkey string,\n\tpassword string,\n\tencoding encodingType,\n) (AES, error) {\n\n\tif mode == \"\" {\n\t\tmode = ModeGCM\n\t}\n\tif mode == ModeGCM && password == \"\" {\n\t\treturn nil, errors.New(\"password is required in gcm mode\")\n\t}\n\tif mode != ModeGCM && mode != ModeCBC {\n\t\treturn nil, errors.New(\"only support gcm and cbc mode\")\n\t}\n\n\tif key == \"\" {\n\t\tkey = DefaultKey\n\t}\n\tkeyBuf, err := base64.StdEncoding.DecodeString(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkeySize := len(keyBuf) * 8\n\tif keySize != 256 {\n\t\tif mode == ModeCBC {\n\t\t\treturn nil, errors.New(\"key requires a 256-bit base64 encoded string with cbc mode\")\n\t\t}\n\t\tif keySize != 128 && keySize != 192 {\n\t\t\treturn nil, errors.New(\"key requires a 128-bit, 192-bit or 256-bit base64 encoded string\")\n\t\t}\n\t}\n\n\tif encoding == \"\" {\n\t\tencoding = Base64\n\t}\n\n\tif mode == ModeGCM {\n\t\treturn &GCM{\n\t\t\tKey: keyBuf,\n\t\t\tPassword: password,\n\t\t\tVersion: []byte{0x01, 0x03},\n\t\t\tEncoding: encoding,\n\t\t}, nil\n\t}\n\treturn &CBC{\n\t\tKey: keyBuf,\n\t\tVersion: []byte{0x01, 0x04},\n\t\tEncoding: encoding,\n\t}, nil\n}", "func (in *ApplicationConfiguration) DeepCopy() *ApplicationConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdvancedConfig) DeepCopy() *AdvancedConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdvancedConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAES128Cipher(mode cipherMode) Cipher {\n\tencryptor := aesEncryptor()\n\tencryptor.keylen = 16 // AES128\n\n\treturn getCipher(mode, encryptor)\n}", "func (in *DatabaseEncryption) DeepCopy() *DatabaseEncryption {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatabaseEncryption)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KMSConfiguration) DeepCopy() *KMSConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KMSConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DatabaseSecretEngineConfig) DeepCopy() *DatabaseSecretEngineConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatabaseSecretEngineConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAES192Cipher(mode cipherMode) Cipher {\n\tencryptor := aesEncryptor()\n\tencryptor.keylen = 24 // AES192\n\n\treturn getCipher(mode, encryptor)\n}", "func (in *MariaDBConfiguration) DeepCopy() *MariaDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MariaDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SharedMemoryStoreConfig) DeepCopy() *SharedMemoryStoreConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SharedMemoryStoreConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShuffleConfig) DeepCopy() *ShuffleConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShuffleConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ElasticsearchConfiguration) DeepCopy() *ElasticsearchConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ElasticsearchConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (ob *AESCipher) Encrypt(plaintext []byte) (ciphertext []byte, err error) {\n\tif len(ob.cryptoKey) != 32 {\n\t\treturn nil, logError(0xE64A2E, errKeySize)\n\t}\n\t// nonce is a byte array filled with cryptographically secure random bytes\n\tn := ob.gcm.NonceSize()\n\tnonce := make([]byte, n)\n\t_, err = io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tciphertext = ob.gcm.Seal(\n\t\tnonce, // dst []byte,\n\t\tnonce, // nonce []byte,\n\t\tplaintext, // plaintext []byte,\n\t\tnil, // additionalData []byte) []byte\n\t)\n\treturn ciphertext, nil\n}", "func (in *RedisConfiguration) DeepCopy() *RedisConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationConfigurationList) DeepCopy() *ApplicationConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewConfiguration(authKeySize int, encryptEnabled bool, encapEnabled bool, wireguardEnabled bool, hsIpcacheDSRenabled bool, mtu int, mtuDetectIP net.IP) Configuration {\n\tencryptOverhead := 0\n\n\tif mtu == 0 {\n\t\tvar err error\n\n\t\tif mtuDetectIP != nil {\n\t\t\tmtu, err = getMTUFromIf(mtuDetectIP)\n\t\t} else {\n\t\t\tmtu, err = autoDetect()\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Warning(\"Unable to automatically detect MTU\")\n\t\t\tmtu = EthernetMTU\n\t\t}\n\t}\n\n\tif encryptEnabled {\n\t\t// Add the difference between the default and the actual key sizes here\n\t\t// to account for users specifying non-default auth key lengths.\n\t\tencryptOverhead = EncryptionIPsecOverhead + (authKeySize - EncryptionDefaultAuthKeyLength)\n\t}\n\n\tfullTunnelOverhead := TunnelOverhead\n\tif hsIpcacheDSRenabled {\n\t\tfullTunnelOverhead += DsrTunnelOverhead\n\t}\n\n\tconf := Configuration{\n\t\tstandardMTU: mtu,\n\t\ttunnelMTU: mtu - (fullTunnelOverhead + encryptOverhead),\n\t\tpostEncryptMTU: mtu - TunnelOverhead,\n\t\tpreEncryptMTU: mtu - encryptOverhead,\n\t\tencapEnabled: encapEnabled,\n\t\tencryptEnabled: encryptEnabled,\n\t\twireguardEnabled: wireguardEnabled,\n\t}\n\n\tif conf.tunnelMTU < 0 {\n\t\tconf.tunnelMTU = 0\n\t}\n\n\treturn conf\n}", "func (in *IsoConfiguration) DeepCopy() *IsoConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IsoConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAESCBC(key, iv []byte) AESCBC {\n\t// If the key is nil, we create a random one.\n\tif key == nil {\n\t\tkey = RandomBytes(aes.BlockSize)\n\t}\n\t// If the IV is nil, then we create a random one.\n\tif iv == nil {\n\t\tiv = RandomBytes(len(key))\n\t}\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn AESCBC{block: block, key: key, iv: iv}\n}", "func (in *EKSManagedConfiguration) DeepCopy() *EKSManagedConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSManagedConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubebenchConfig) DeepCopy() *KubebenchConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubebenchConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MSSQLServerTransparentDataEncryption) DeepCopy() *MSSQLServerTransparentDataEncryption {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MSSQLServerTransparentDataEncryption)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (conf *Configuration) Copy() *Configuration {\n\tvar dup Configuration\n\n\t_ = Copy(&dup, conf)\n\n\tdup.TestMode = conf.TestMode\n\n\treturn &dup\n}", "func AESDecrypt(src []byte, key []byte, padding paddingMode) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn make([]byte, 0), err\n\t}\n\tvar blockMode = cipher.NewCBCDecrypter(block, key[:block.BlockSize()])\n\tvar result = make([]byte, len(src))\n\tblockMode.CryptBlocks(result, src)\n\tunpaddingFunc, err := GetUnpadding(padding)\n\tif err != nil {\n\t\treturn make([]byte, 0), err\n\t}\n\treturn unpaddingFunc(result), nil\n}", "func (in *AWSConfig) DeepCopy() *AWSConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAesWithKey() *Aes {\n\treturn &Aes{Key: defaultKey}\n}", "func (in *AutoscaleConfig) DeepCopy() *AutoscaleConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AutoscaleConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func EnAES(in, key, iv []byte) ([]byte, error) {\n\tcip, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := make([]byte, len(in))\n\tcipher.NewCFBEncrypter(cip, iv).XORKeyStream(out, in)\n\treturn out, nil\n}", "func (c *AIAConfig) Copy() *AIAConfig {\n\treturn &AIAConfig{\n\t\tc.AiaURL,\n\t\tc.OcspURL,\n\t\tc.CrlURL,\n\t\tc.CRLExpiry,\n\t\tc.OCSPExpiry,\n\t\tc.CRLRenewal,\n\t}\n}", "func AESCBCEncryptWithMAC(key []byte, input []byte) ([]byte, error) {\n\taesKey := key[:32]\n\thmacKey := key[32:]\n\n\tencrypted, err := AESCBCEncrypt(aesKey, input)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmac := HMACSHA256(hmacKey, encrypted)\n\tencrypted = append(encrypted, mac...)\n\treturn encrypted, nil\n}", "func AESEncrypt(src []byte, key []byte, padding paddingMode) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn make([]byte, 0), err\n\t}\n\tvar blockMode = cipher.NewCBCEncrypter(block, key[:block.BlockSize()])\n\tpaddingFunc, err := GetPadding(padding)\n\tif err != nil {\n\t\treturn make([]byte, 0), err\n\t}\n\tsrc = paddingFunc(src, block.BlockSize())\n\tvar result = make([]byte, len(src))\n\tblockMode.CryptBlocks(result, src)\n\treturn result, nil\n}", "func (in *AdmissionWebhookConfiguration) DeepCopy() *AdmissionWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CASignedConfig) DeepCopy() *CASignedConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CASignedConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func decryptAES(ciphertext []byte, Key []byte) (plaintext []byte, err error){\n\tif(len(ciphertext)<=userlib.BlockSize){\n\t\treturn nil,errors.New(strings.ToTitle(\"Invalid Ciphertext\"))\n\t}\n\tiv := ciphertext[:userlib.BlockSize]\n\tcipher := userlib.CFBDecrypter(Key, iv)\n\tcipher.XORKeyStream(ciphertext[userlib.BlockSize:], ciphertext[userlib.BlockSize:])\n\tplaintext = ciphertext[userlib.BlockSize:]\n\treturn plaintext,nil\n}", "func Encrypt_AES_CBC(plaintext, key []byte) (ciphertext []byte, err error) {\n\tif len(plaintext)%aes.BlockSize != 0 {\n\t\tplaintext = PKCS5Padding(plaintext, aes.BlockSize)\n\t}\n\n\tvar block cipher.Block\n\tif block, err = aes.NewCipher(key); err != nil {\n\t\treturn\n\t}\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tciphertext = make([]byte, aes.BlockSize+len(plaintext))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err = io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn\n\t}\n\n\tstream := cipher.NewCBCEncrypter(block, iv)\n\tstream.CryptBlocks(ciphertext[aes.BlockSize:], plaintext)\n\treturn\n}", "func (conf *Config) Equals(other *Config) bool {\n\tif !conf.UnicastConfig.Equals(other.UnicastConfig) {\n\t\treturn false\n\t}\n\tif !conf.ExtensionConfig.Equals(other.ExtensionConfig) {\n\t\treturn false\n\t}\n\treturn true\n}", "func EncryptAES(src string) (based string, err error) {\n\t//Initial []byte token\n\ttoken, err := hex.DecodeString(\"46356afe55fa3cea9cbe73ad442cad47\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// Block from Cipher\n\tblock, err := aes.NewCipher(token)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tblockSize := block.BlockSize()\n\tecbe := cipher.NewCBCEncrypter(block, token[:blockSize])\n\tcontent := PKCS5Padding([]byte(src), blockSize)\n\t// Initial crypt value\n\tcrypted := make([]byte, len(content))\n\tecbe.CryptBlocks(crypted, content)\n\tbased = base64.StdEncoding.EncodeToString(crypted)\n\treturn\n}", "func (in *AzureConfig) DeepCopy() *AzureConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *DataLakeResource) SetEncryptionConfiguration(v *DataLakeEncryptionConfiguration) *DataLakeResource {\n\ts.EncryptionConfiguration = v\n\treturn s\n}", "func (in *AutoscalerConfig) DeepCopy() *AutoscalerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AutoscalerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DatabaseSecretEngineConfigList) DeepCopy() *DatabaseSecretEngineConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatabaseSecretEngineConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthenticationOperatorConfig) DeepCopy() *AuthenticationOperatorConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationOperatorConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AESConfiguration) DeepCopyInto(out *AESConfiguration) {\n\t*out = *in\n\tif in.Keys != nil {\n\t\tin, out := &in.Keys, &out.Keys\n\t\t*out = make([]Key, len(*in))\n\t\tcopy(*out, *in)\n\t}\n\treturn\n}", "func EncryptAES(b, key, iv []byte) []byte {\n\tcipher, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tbs := cipher.BlockSize()\n\n\tif iv != nil && len(iv) != bs {\n\t\tpanic(fmt.Sprintf(\"IV size is %v; need %v\", len(iv), bs))\n\t}\n\tprev := iv\n\n\tif len(b)%bs != 0 {\n\t\tpanic(fmt.Sprintf(\"buffer size %v isn't multiple of block size %v\", len(b), bs))\n\t}\n\n\tvar enc []byte\n\tfor i := 0; i < len(b); i += bs {\n\t\t// Get the source block, padding it if needed.\n\t\tn := bs\n\t\tif rem := len(b) - i; rem < bs {\n\t\t\tn = rem\n\t\t}\n\t\tsrc := b[i : i+n]\n\n\t\t// If using CBC, XOR with the previous ciphertext block (or the initialization vector).\n\t\tif iv != nil {\n\t\t\tsrc = XOR(src, prev)\n\t\t}\n\n\t\t// Encrypt the block and save it to XOR against the next plaintext block (for CBC).\n\t\tdst := make([]byte, bs)\n\t\tcipher.Encrypt(dst, src)\n\t\tenc = append(enc, dst...)\n\t\tprev = dst\n\t}\n\treturn enc\n}", "func (in *AvailabilityConfig) DeepCopy() *AvailabilityConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AvailabilityConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAEADCipher(key []byte) (cipher.AEAD, error) {\n\tvar (\n\t\tkeyval []byte\n\t\tcipherBlock cipher.Block\n\t\taeadCipher cipher.AEAD\n\t\terr error\n\t)\n\n\t//If no key is provided, generate one.\n\tif key == nil {\n\t\tkeyval = make([]byte, 32)\n\t\t_, err = rand.Read(keyval)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tswitch len(key) {\n\t\tcase 16, 24, 36:\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"An aead key must be of length 16. 24, or 32. This key is of length: \", len(key))\n\t\t}\n\t\tkeyval = key\n\t}\n\n\t//The key is used to create an AES Cipher Block\n\tcipherBlock, err = aes.NewCipher(keyval)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//The AES Cipher Block is used to create an AEAD GCM which is a 128-bit, block cipher wrapped\n\t//in a Galois Counter Mode with the standard nonce length.\n\t//This is used to encrypt/decrypt all subscriber identifiers in the hidden fields of TBD 2nd Factor Selection Forms.\n\taeadCipher, err = cipher.NewGCM(cipherBlock)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn aeadCipher, nil\n}", "func AESCBCEncrypt(key []byte, input []byte) ([]byte, error) {\n\tpaddedInput := pad(input)\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toutput := make([]byte, aes.BlockSize+len(paddedInput))\n\tiv := output[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmode := cipher.NewCBCEncrypter(block, iv)\n\tmode.CryptBlocks(output[aes.BlockSize:], paddedInput)\n\n\treturn output, nil\n}", "func NewCipher(key []byte) cipher.Block {\n\texpkey := keyExpansion(key)\n\treturn cipherAES{expkey}\n}", "func (in *ObjectStorageConfig) DeepCopy() *ObjectStorageConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectStorageConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CassandraConfig) DeepCopy() *CassandraConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CassandraConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func encryptAES(data []byte, key []byte) (ciphertext []byte){\n\tciphertext = make([]byte, userlib.BlockSize+len(data))\n\tiv := ciphertext[:userlib.BlockSize]\n\tcopy(iv, userlib.RandomBytes(userlib.BlockSize))\n\tcipher := userlib.CFBEncrypter(key, iv)\n\tcipher.XORKeyStream(ciphertext[userlib.BlockSize:], data)\n\treturn\n}", "func (in *AzureConfigList) DeepCopy() *AzureConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthenticatorGroupsConfig) DeepCopy() *AuthenticatorGroupsConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticatorGroupsConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func AESEncrypt(message, AESKey []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(AESKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tciphertext := make([]byte, aes.BlockSize+len(message))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\tstream := cipher.NewCFBEncrypter(block, iv)\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], message)\n\n\treturn ciphertext, nil\n}", "func (in *IdentityConfiguration) DeepCopy() *IdentityConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *DataLakeConfiguration) SetEncryptionConfiguration(v *DataLakeEncryptionConfiguration) *DataLakeConfiguration {\n\ts.EncryptionConfiguration = v\n\treturn s\n}", "func (in *ShieldedInstanceConfig) DeepCopy() *ShieldedInstanceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShieldedInstanceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfig) DeepCopy() *LoggingConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func AesEncrypt(source []byte, keyStr string) ([]byte, error) {\n\tsrcLength := len(source)\n\tvar usize uint64\n\theadSize := int(unsafe.Sizeof(usize))\n\thead := make([]byte, headSize, headSize+len(source))\n\tsource = append(head, source...)\n\tlen0 := len(source)\n\tif r := len0 % aes.BlockSize; r > 0 {\n\t\tlen0 += aes.BlockSize - r\n\t\tpadding := make([]byte, aes.BlockSize-r)\n\t\tif _, err := io.ReadFull(rand.Reader, padding); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsource = append(source, padding...)\n\t}\n\tbuffer := make([]byte, len0+aes.BlockSize)\n\n\tiv := buffer[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\tusize = uint64(srcLength)\n\tbinary.BigEndian.PutUint64(source, usize)\n\tblock, ec := aes.NewCipher(padKey([]byte(keyStr)))\n\tif ec != nil {\n\t\treturn nil, ec\n\t}\n\tmode := cipher.NewCBCEncrypter(block, iv)\n\tmode.CryptBlocks(buffer[aes.BlockSize:], source)\n\treturn buffer, nil\n}", "func (in *AssociatedAlertsConfig) DeepCopy() *AssociatedAlertsConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AssociatedAlertsConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubeadmConfig) DeepCopy() *KubeadmConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeadmConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationList) DeepCopy() *ConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthenticationOperatorConfigList) DeepCopy() *AuthenticationOperatorConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationOperatorConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ContextConfigs) DeepCopy() *ContextConfigs {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContextConfigs)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func DeserializeConfiguration(encoded []byte) (*Configuration, error) {\n\tif len(encoded) != confLength {\n\t\treturn nil, internal.ErrConfigurationInvalidLength\n\t}\n\n\treturn &Configuration{\n\t\tGroup: Group(encoded[0]),\n\t\tKDF: hash.Hashing(encoded[1]),\n\t\tMAC: hash.Hashing(encoded[2]),\n\t\tHash: hash.Hashing(encoded[3]),\n\t\tMHF: mhf.Identifier(encoded[4]),\n\t\tMode: Mode(encoded[5]),\n\t\tNonceLen: encoding.OS2IP(encoded[6:]),\n\t}, nil\n}", "func (in *ApplyConfig) DeepCopy() *ApplyConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplyConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ProviderConfiguration) DeepCopy() *ProviderConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAesStream(readWriter io.ReadWriter, aesKey, iv []byte) (*AesStream, error) {\n\tif len(iv) != aes.BlockSize {\n\t\tpanic(\"Length of iv in NewAesCrypter does not match the AES block size\")\n\t}\n\t// Create the AES cipher\n\taesCipher, err := aes.NewCipher(aesKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// TODO: Is it safe to initialize both the encrypter and the decrypter to the same IV?\n\taesStream := &AesStream{\n\t\treadWriter: readWriter,\n\t\tcfbEncrypter: cipher.NewCFBEncrypter(aesCipher, iv),\n\t\tcfbDecrypter: cipher.NewCFBDecrypter(aesCipher, iv),\n\t}\n\treturn aesStream, nil\n}", "func (in *KubemanagerConfig) DeepCopy() *KubemanagerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubemanagerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RedisConfig) DeepCopy() *RedisConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func AESEnccrypt(plaintext []byte, key string) []byte {\n\tcipher, err := aes.NewCipher([]byte(key))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tbs := cipher.BlockSize()\n\tif len(plaintext)%bs != 0 {\n\t\tpanic(\"Need a multiple of the blocksize\")\n\t}\n\n\tciphertext := make([]byte, len(plaintext))\n\tfor len(plaintext) > 0 {\n\t\tcipher.Encrypt(ciphertext, plaintext)\n\t\tplaintext = plaintext[bs:]\n\t\tciphertext = ciphertext[bs:]\n\t}\n\n\treturn ciphertext\n}", "func (in *MSSQLServerTransparentDataEncryptionList) DeepCopy() *MSSQLServerTransparentDataEncryptionList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MSSQLServerTransparentDataEncryptionList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShuffleServerConfig) DeepCopy() *ShuffleServerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShuffleServerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func AESDecrypt(encrypted, key []byte) ([]byte, error) {\n\tvar err error\n\tvar block cipher.Block\n\tvar iv = key[:aes.BlockSize]\n\tdecrypted := make([]byte, len(encrypted))\n\tif block, err = aes.NewCipher(key); err != nil {\n\t\treturn nil, err\n\t}\n\tdecrypter := cipher.NewCFBDecrypter(block, iv)\n\tdecrypter.XORKeyStream(decrypted, encrypted)\n\treturn decrypted, nil\n}", "func NewAes(key string) *Aes {\n\treturn &Aes{Key: key}\n}", "func (in *GKEMasterAuthorizedNetworksConfig) DeepCopy() *GKEMasterAuthorizedNetworksConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GKEMasterAuthorizedNetworksConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MSSQLServerTransparentDataEncryptionParameters) DeepCopy() *MSSQLServerTransparentDataEncryptionParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MSSQLServerTransparentDataEncryptionParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSConfigList) DeepCopy() *AWSConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSAccessRequestConfiguration) DeepCopy() *AWSAccessRequestConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSAccessRequestConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func AESDecrypt(cipherkey, ciphertext []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(cipherkey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsrc := make([]byte, hex.DecodedLen(len(ciphertext)))\n\t_, err = hex.Decode(src, ciphertext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbs := block.BlockSize()\n\tr := make([]byte, len(src))\n\tdst := r\n\tfor len(src) > 0 {\n\t\tblock.Decrypt(dst, src)\n\t\tsrc = src[bs:]\n\t\tdst = dst[bs:]\n\t}\n\treturn removePad(r)\n}", "func DecryptAES(enc, key, iv []byte) []byte {\n\tcipher, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tbs := cipher.BlockSize()\n\n\tif iv != nil && len(iv) != bs {\n\t\tpanic(fmt.Sprintf(\"IV size is %v; need %v\", len(iv), bs))\n\t}\n\tprev := iv\n\n\tdec := make([]byte, 0, len(enc))\n\tfor i := 0; i < len(enc); i += bs {\n\t\tsrc := make([]byte, bs)\n\t\tdst := make([]byte, bs)\n\t\tn := copy(src, enc[i:])\n\t\tcipher.Decrypt(dst, src)\n\n\t\tif iv != nil {\n\t\t\tdst = XOR(dst, prev)\n\t\t}\n\n\t\tdec = append(dec, dst[:n]...)\n\t\tprev = src\n\t}\n\treturn dec\n}", "func (in *BootConfiguration) DeepCopy() *BootConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BootConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewAESOpt(secret string) (*AESOpt, error) {\n\tif len(secret) != 64 {\n\t\treturn nil, errors.New(\"Secret must be 64 character\")\n\t}\n\tkey, err := hex.DecodeString(secret)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"NewAESOpt.hex.DecodeString\")\n\t}\n\n\t//Create a new Cipher Block from the key\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"NewAESOpt.aes.NewCipher\")\n\t}\n\n\t//Create a new GCM - https://en.wikipedia.org/wiki/Galois/Counter_Mode\n\t//https://golang.org/pkg/crypto/cipher/#NewGCM\n\taesGCM, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"NewAESOpt.cipher.NewGCM\")\n\t}\n\n\treturn &AESOpt{\n\t\taesGCM: aesGCM,\n\t}, nil\n}", "func (in *MasterAuthorizedNetworksConfig) DeepCopy() *MasterAuthorizedNetworksConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MasterAuthorizedNetworksConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.6966809", "0.64778304", "0.5603832", "0.53495884", "0.53042156", "0.52616113", "0.5155239", "0.5146213", "0.51294535", "0.5119548", "0.5056005", "0.4989806", "0.49877337", "0.49724552", "0.49615574", "0.49553683", "0.4941303", "0.49344137", "0.48960802", "0.4832625", "0.4827364", "0.48179698", "0.47963744", "0.47851822", "0.47366694", "0.4706727", "0.4691784", "0.46696088", "0.46656266", "0.46439534", "0.46439534", "0.4632355", "0.46079278", "0.46076107", "0.46076107", "0.46076107", "0.45989886", "0.4598223", "0.45974976", "0.4554455", "0.45493475", "0.45478", "0.45364144", "0.4533185", "0.45273444", "0.45240578", "0.4521409", "0.4517186", "0.4514158", "0.4494403", "0.44805065", "0.44793257", "0.44785288", "0.44740903", "0.44668213", "0.44590485", "0.44535285", "0.44519153", "0.444576", "0.44448784", "0.44413248", "0.4439484", "0.4426765", "0.4423864", "0.44213775", "0.44206014", "0.44161457", "0.4411676", "0.43993694", "0.43799916", "0.43752164", "0.435681", "0.43454686", "0.43313637", "0.4326619", "0.43239734", "0.43125653", "0.43101257", "0.43081674", "0.43037108", "0.43023223", "0.42946145", "0.42822775", "0.42757452", "0.42721495", "0.42712998", "0.42692685", "0.42687812", "0.426517", "0.42644364", "0.42620978", "0.42601165", "0.425922", "0.42574707", "0.4250499", "0.4242166", "0.42351356", "0.4233664", "0.42330053", "0.42325997" ]
0.89656043
0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EncryptionConfiguration.
DeepCopy — это автоматически сгенерированная функция глубокого копирования, копирующая получателя, создавая новый объект EncryptionConfiguration.
func (in *EncryptionConfiguration) DeepCopy() *EncryptionConfiguration { if in == nil { return nil } out := new(EncryptionConfiguration) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *EncryptionConfig) DeepCopy() *EncryptionConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EncryptionConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *DataLakeResource) SetEncryptionConfiguration(v *DataLakeEncryptionConfiguration) *DataLakeResource {\n\ts.EncryptionConfiguration = v\n\treturn s\n}", "func (in *EncryptionProperties) DeepCopy() *EncryptionProperties {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EncryptionProperties)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o BucketReplicationConfigRuleDestinationOutput) EncryptionConfiguration() BucketReplicationConfigRuleDestinationEncryptionConfigurationPtrOutput {\n\treturn o.ApplyT(func(v BucketReplicationConfigRuleDestination) *BucketReplicationConfigRuleDestinationEncryptionConfiguration {\n\t\treturn v.EncryptionConfiguration\n\t}).(BucketReplicationConfigRuleDestinationEncryptionConfigurationPtrOutput)\n}", "func (s *DataLakeConfiguration) SetEncryptionConfiguration(v *DataLakeEncryptionConfiguration) *DataLakeConfiguration {\n\ts.EncryptionConfiguration = v\n\treturn s\n}", "func (in *AESConfiguration) DeepCopy() *AESConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AESConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DataEncryption) DeepCopy() *DataEncryption {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DataEncryption)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DatabaseEncryption) DeepCopy() *DatabaseEncryption {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatabaseEncryption)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o InstanceOutput) EncryptionConfig() InstanceEncryptionConfigOutput {\n\treturn o.ApplyT(func(v *Instance) InstanceEncryptionConfigOutput { return v.EncryptionConfig }).(InstanceEncryptionConfigOutput)\n}", "func (s *KinesisVideoStreamConfig) SetEncryptionConfig(v *EncryptionConfig) *KinesisVideoStreamConfig {\n\ts.EncryptionConfig = v\n\treturn s\n}", "func (s *S3Config) SetEncryptionConfig(v *EncryptionConfig) *S3Config {\n\ts.EncryptionConfig = v\n\treturn s\n}", "func (in *SecretEngineConfiguration) DeepCopy() *SecretEngineConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretEngineConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NetworkConfiguration) DeepCopy() *NetworkConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o JobCopyOutput) DestinationEncryptionConfiguration() JobCopyDestinationEncryptionConfigurationPtrOutput {\n\treturn o.ApplyT(func(v JobCopy) *JobCopyDestinationEncryptionConfiguration {\n\t\treturn v.DestinationEncryptionConfiguration\n\t}).(JobCopyDestinationEncryptionConfigurationPtrOutput)\n}", "func (in *EKSCFConfiguration) DeepCopy() *EKSCFConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSCFConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretboxConfiguration) DeepCopy() *SecretboxConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretboxConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *CreateJobOutput) SetEncryption(v *Encryption) *CreateJobOutput {\n\ts.Encryption = v\n\treturn s\n}", "func (o JobCopyPtrOutput) DestinationEncryptionConfiguration() JobCopyDestinationEncryptionConfigurationPtrOutput {\n\treturn o.ApplyT(func(v *JobCopy) *JobCopyDestinationEncryptionConfiguration {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DestinationEncryptionConfiguration\n\t}).(JobCopyDestinationEncryptionConfigurationPtrOutput)\n}", "func (in *IsoConfiguration) DeepCopy() *IsoConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IsoConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o JobLoadOutput) DestinationEncryptionConfiguration() JobLoadDestinationEncryptionConfigurationPtrOutput {\n\treturn o.ApplyT(func(v JobLoad) *JobLoadDestinationEncryptionConfiguration {\n\t\treturn v.DestinationEncryptionConfiguration\n\t}).(JobLoadDestinationEncryptionConfigurationPtrOutput)\n}", "func (s *CaptionSource) SetEncryption(v *Encryption) *CaptionSource {\n\ts.Encryption = v\n\treturn s\n}", "func (in *AWSConfiguration) DeepCopy() *AWSConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *Artwork) SetEncryption(v *Encryption) *Artwork {\n\ts.Encryption = v\n\treturn s\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *JobOutput) SetEncryption(v *Encryption) *JobOutput {\n\ts.Encryption = v\n\treturn s\n}", "func (o JobLoadPtrOutput) DestinationEncryptionConfiguration() JobLoadDestinationEncryptionConfigurationPtrOutput {\n\treturn o.ApplyT(func(v *JobLoad) *JobLoadDestinationEncryptionConfiguration {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DestinationEncryptionConfiguration\n\t}).(JobLoadDestinationEncryptionConfigurationPtrOutput)\n}", "func (o *IamLdapBasePropertiesAllOf) SetEnableEncryption(v bool) {\n\to.EnableEncryption = &v\n}", "func (o JobQueryOutput) DestinationEncryptionConfiguration() JobQueryDestinationEncryptionConfigurationPtrOutput {\n\treturn o.ApplyT(func(v JobQuery) *JobQueryDestinationEncryptionConfiguration {\n\t\treturn v.DestinationEncryptionConfiguration\n\t}).(JobQueryDestinationEncryptionConfigurationPtrOutput)\n}", "func (s *JobWatermark) SetEncryption(v *Encryption) *JobWatermark {\n\ts.Encryption = v\n\treturn s\n}", "func NewConfiguration(authKeySize int, encryptEnabled bool, encapEnabled bool, wireguardEnabled bool, hsIpcacheDSRenabled bool, mtu int, mtuDetectIP net.IP) Configuration {\n\tencryptOverhead := 0\n\n\tif mtu == 0 {\n\t\tvar err error\n\n\t\tif mtuDetectIP != nil {\n\t\t\tmtu, err = getMTUFromIf(mtuDetectIP)\n\t\t} else {\n\t\t\tmtu, err = autoDetect()\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Warning(\"Unable to automatically detect MTU\")\n\t\t\tmtu = EthernetMTU\n\t\t}\n\t}\n\n\tif encryptEnabled {\n\t\t// Add the difference between the default and the actual key sizes here\n\t\t// to account for users specifying non-default auth key lengths.\n\t\tencryptOverhead = EncryptionIPsecOverhead + (authKeySize - EncryptionDefaultAuthKeyLength)\n\t}\n\n\tfullTunnelOverhead := TunnelOverhead\n\tif hsIpcacheDSRenabled {\n\t\tfullTunnelOverhead += DsrTunnelOverhead\n\t}\n\n\tconf := Configuration{\n\t\tstandardMTU: mtu,\n\t\ttunnelMTU: mtu - (fullTunnelOverhead + encryptOverhead),\n\t\tpostEncryptMTU: mtu - TunnelOverhead,\n\t\tpreEncryptMTU: mtu - encryptOverhead,\n\t\tencapEnabled: encapEnabled,\n\t\tencryptEnabled: encryptEnabled,\n\t\twireguardEnabled: wireguardEnabled,\n\t}\n\n\tif conf.tunnelMTU < 0 {\n\t\tconf.tunnelMTU = 0\n\t}\n\n\treturn conf\n}", "func (s *JobInput) SetEncryption(v *Encryption) *JobInput {\n\ts.Encryption = v\n\treturn s\n}", "func (o JobQueryPtrOutput) DestinationEncryptionConfiguration() JobQueryDestinationEncryptionConfigurationPtrOutput {\n\treturn o.ApplyT(func(v *JobQuery) *JobQueryDestinationEncryptionConfiguration {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DestinationEncryptionConfiguration\n\t}).(JobQueryDestinationEncryptionConfigurationPtrOutput)\n}", "func (k Key) Encryption() []byte {\n\tl := len(k) / 2\n\treturn k[:l:l]\n}", "func (s *CaptionFormat) SetEncryption(v *Encryption) *CaptionFormat {\n\ts.Encryption = v\n\treturn s\n}", "func (in *EndpointConfigurationParameters) DeepCopy() *EndpointConfigurationParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EndpointConfigurationParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationSpec) DeepCopy() *ConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationSpec) DeepCopy() *ConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationConfiguration) DeepCopy() *ApplicationConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BootConfiguration) DeepCopy() *BootConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BootConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o BackupOutput) EncryptionConfigEncryptionType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Backup) pulumi.StringOutput { return v.EncryptionConfigEncryptionType }).(pulumi.StringOutput)\n}", "func (in *ProviderConfiguration) DeepCopy() *ProviderConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *ExportRevisionsToS3RequestDetails) SetEncryption(v *ExportServerSideEncryption) *ExportRevisionsToS3RequestDetails {\n\ts.Encryption = v\n\treturn s\n}", "func (in *IdentityConfiguration) DeepCopy() *IdentityConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *OCIConfiguration) DeepCopy() *OCIConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OCIConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NetworkPolicyConfig) DeepCopy() *NetworkPolicyConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkPolicyConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NetworkPolicyConfig) DeepCopy() *NetworkPolicyConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkPolicyConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerConfiguration) DeepCopy() *ControllerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KVConfiguration) DeepCopy() *KVConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSManagedConfiguration) DeepCopy() *EKSManagedConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSManagedConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *DeleteDataSourceParams) SetEncryptionKey(encryptionKey *string) {\n\to.EncryptionKey = encryptionKey\n}", "func (s *AutoExportRevisionToS3RequestDetails) SetEncryption(v *ExportServerSideEncryption) *AutoExportRevisionToS3RequestDetails {\n\ts.Encryption = v\n\treturn s\n}", "func (in *KMSConfiguration) DeepCopy() *KMSConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KMSConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o ServiceResponseOutput) EncryptionConfig() EncryptionConfigResponseOutput {\n\treturn o.ApplyT(func(v ServiceResponse) EncryptionConfigResponse { return v.EncryptionConfig }).(EncryptionConfigResponseOutput)\n}", "func (o *UcsdBackupInfoAllOf) GetEncryptionKey() string {\n\tif o == nil || o.EncryptionKey == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.EncryptionKey\n}", "func (in *IpConfiguration) DeepCopy() *IpConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IpConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ElasticsearchConfiguration) DeepCopy() *ElasticsearchConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ElasticsearchConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *VolumeConfig) DeepCopy() *VolumeConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CertificateRenewalConfig) DeepCopy() *CertificateRenewalConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateRenewalConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *ExportAssetsToS3RequestDetails) SetEncryption(v *ExportServerSideEncryption) *ExportAssetsToS3RequestDetails {\n\ts.Encryption = v\n\treturn s\n}", "func (o *DeleteDataSourceParams) SetEncryptionMode(encryptionMode *string) {\n\to.EncryptionMode = encryptionMode\n}", "func (in *IngressTLSConfig) DeepCopy() *IngressTLSConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IngressTLSConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NetworkConfig) DeepCopy() *NetworkConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (m *ProjectionMapping) GetEncryptionConfig() conf.Encryption {\n\treturn m.Encryption\n}", "func (s *ExportRevisionsToS3ResponseDetails) SetEncryption(v *ExportServerSideEncryption) *ExportRevisionsToS3ResponseDetails {\n\ts.Encryption = v\n\treturn s\n}", "func (in *KubebenchConfig) DeepCopy() *KubebenchConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubebenchConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateconnectionVpcPeeringConfig) DeepCopy() *PrivateconnectionVpcPeeringConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateconnectionVpcPeeringConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *InputConfig) DeepCopy() *InputConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InputConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *SseConfiguration) SetKmsEncryptionConfig(v *KmsEncryptionConfig) *SseConfiguration {\n\ts.KmsEncryptionConfig = v\n\treturn s\n}", "func (in *DatabaseSecretEngineConfig) DeepCopy() *DatabaseSecretEngineConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatabaseSecretEngineConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretEngineConfiguration) DeepCopyInto(out *SecretEngineConfiguration) {\n\t*out = *in\n\tif in.AWS != nil {\n\t\tin, out := &in.AWS, &out.AWS\n\t\t*out = new(AWSConfiguration)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Azure != nil {\n\t\tin, out := &in.Azure, &out.Azure\n\t\t*out = new(AzureConfiguration)\n\t\t**out = **in\n\t}\n\tif in.GCP != nil {\n\t\tin, out := &in.GCP, &out.GCP\n\t\t*out = new(GCPConfiguration)\n\t\t**out = **in\n\t}\n\tif in.Postgres != nil {\n\t\tin, out := &in.Postgres, &out.Postgres\n\t\t*out = new(PostgresConfiguration)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.MongoDB != nil {\n\t\tin, out := &in.MongoDB, &out.MongoDB\n\t\t*out = new(MongoDBConfiguration)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.Redis != nil {\n\t\tin, out := &in.Redis, &out.Redis\n\t\t*out = new(RedisConfiguration)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.MySQL != nil {\n\t\tin, out := &in.MySQL, &out.MySQL\n\t\t*out = new(MySQLConfiguration)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.MariaDB != nil {\n\t\tin, out := &in.MariaDB, &out.MariaDB\n\t\t*out = new(MariaDBConfiguration)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\tif in.KV != nil {\n\t\tin, out := &in.KV, &out.KV\n\t\t*out = new(KVConfiguration)\n\t\t**out = **in\n\t}\n\tif in.Elasticsearch != nil {\n\t\tin, out := &in.Elasticsearch, &out.Elasticsearch\n\t\t*out = new(ElasticsearchConfiguration)\n\t\t(*in).DeepCopyInto(*out)\n\t}\n\treturn\n}", "func (o *StorageNetAppCifsShareAllOf) SetEncryption(v string) {\n\to.Encryption = &v\n}", "func (in *AdvancedConfig) DeepCopy() *AdvancedConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdvancedConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o InventoryDestinationBucketPtrOutput) Encryption() InventoryDestinationBucketEncryptionPtrOutput {\n\treturn o.ApplyT(func(v *InventoryDestinationBucket) *InventoryDestinationBucketEncryption {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Encryption\n\t}).(InventoryDestinationBucketEncryptionPtrOutput)\n}", "func (o *Wireless) SetEncryption(v string) {\n\to.Encryption = &v\n}", "func (in *ContainerImageConfiguration) DeepCopy() *ContainerImageConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerImageConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdmissionWebhookConfiguration) DeepCopy() *AdmissionWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MSSQLServerTransparentDataEncryption) DeepCopy() *MSSQLServerTransparentDataEncryption {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MSSQLServerTransparentDataEncryption)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o AsymmetricEncryptedSecretOutput) EncryptionAlgorithm() EncryptionAlgorithmOutput {\n\treturn o.ApplyT(func(v AsymmetricEncryptedSecret) EncryptionAlgorithm { return v.EncryptionAlgorithm }).(EncryptionAlgorithmOutput)\n}", "func (in *AuthenticationOperatorConfig) DeepCopy() *AuthenticationOperatorConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationOperatorConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *StartBotRecommendationInput) SetEncryptionSetting(v *EncryptionSetting) *StartBotRecommendationInput {\n\ts.EncryptionSetting = v\n\treturn s\n}", "func (in *DeploymentConfiguration) DeepCopy() *DeploymentConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DeploymentConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *StartBotRecommendationOutput) SetEncryptionSetting(v *EncryptionSetting) *StartBotRecommendationOutput {\n\ts.EncryptionSetting = v\n\treturn s\n}", "func (in *KubeadmConfig) DeepCopy() *KubeadmConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeadmConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *ExportAssetsToS3ResponseDetails) SetEncryption(v *ExportServerSideEncryption) *ExportAssetsToS3ResponseDetails {\n\ts.Encryption = v\n\treturn s\n}", "func (constr Construction) Encrypt(dst, src []byte) {\n\ttemp := [16]byte{}\n\tcopy(temp[:], src)\n\n\ttemp = encoding.ComposedBlocks(constr).Encode(temp)\n\n\tcopy(dst, temp[:])\n}", "func (g *GenericVaultBackend) EncryptionConfigPath() string {\n\treturn filepath.Join(g.Path(), \"encryption-config\")\n}", "func (in *EncryptionConfiguration) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *NetDeviceConfig) DeepCopy() *NetDeviceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetDeviceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *StorageNetAppCifsShareAllOf) GetEncryption() string {\n\tif o == nil || o.Encryption == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Encryption\n}", "func (in *RedisConfiguration) DeepCopy() *RedisConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationList) DeepCopy() *ConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c Configuration) Clone() Configuration {\n\treturn Configuration{\n\t\tEDATool: c.EDATool,\n\t\tInputFile: c.InputFile,\n\t\tOutputFile: c.OutputFile,\n\t\tLastUpdated: c.LastUpdated,\n\t}\n}", "func (o *IamLdapBasePropertiesAllOf) GetEnableEncryption() bool {\n\tif o == nil || o.EnableEncryption == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.EnableEncryption\n}", "func (c *Config) DeepCopy() *Config {\n\tif c == nil {\n\t\treturn &Config{}\n\t}\n\tcfg := *c\n\treturn &cfg\n}", "func (in *ApplicationConfigurationSpec) DeepCopy() *ApplicationConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o InventoryDestinationBucketOutput) Encryption() InventoryDestinationBucketEncryptionPtrOutput {\n\treturn o.ApplyT(func(v InventoryDestinationBucket) *InventoryDestinationBucketEncryption { return v.Encryption }).(InventoryDestinationBucketEncryptionPtrOutput)\n}" ]
[ "0.81821805", "0.69133514", "0.67663676", "0.6730935", "0.6721722", "0.6714277", "0.65690655", "0.6349009", "0.6184369", "0.60215807", "0.59392107", "0.5796518", "0.56959784", "0.5585565", "0.5557125", "0.5539182", "0.5539182", "0.5539182", "0.55084985", "0.54757833", "0.54676163", "0.5440936", "0.5420741", "0.5409741", "0.5374624", "0.53595287", "0.53588474", "0.53588474", "0.5349624", "0.53295153", "0.5291965", "0.52844894", "0.52609766", "0.5248489", "0.5244222", "0.52323616", "0.52308196", "0.52153087", "0.5196572", "0.5184887", "0.5184887", "0.5168087", "0.51653224", "0.5152831", "0.5147331", "0.5133785", "0.51305395", "0.51279354", "0.5125688", "0.5125688", "0.51116973", "0.510776", "0.50861406", "0.5081224", "0.5077895", "0.5054636", "0.5049154", "0.5033954", "0.5029655", "0.5020012", "0.5005512", "0.50011605", "0.4978785", "0.49718893", "0.493431", "0.49312368", "0.4930719", "0.4916804", "0.49145666", "0.49120423", "0.49064898", "0.490469", "0.48939458", "0.48894572", "0.48880678", "0.48824966", "0.4880412", "0.48755142", "0.48576957", "0.48546055", "0.48528993", "0.4849519", "0.48361003", "0.48281524", "0.48123592", "0.48048753", "0.47914922", "0.47900325", "0.4785608", "0.47787935", "0.47775367", "0.47737807", "0.47735175", "0.47728443", "0.4770085", "0.47689664", "0.47677588", "0.47664142", "0.4763375", "0.47545955" ]
0.895874
0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IdentityConfiguration.
DeepCopy — это автоматически сгенерированная функция глубокого копирования, копирующая получателя, создавая новый IdentityConfiguration.
func (in *IdentityConfiguration) DeepCopy() *IdentityConfiguration { if in == nil { return nil } out := new(IdentityConfiguration) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *WorkloadIdentityConfig) DeepCopy() *WorkloadIdentityConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WorkloadIdentityConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Identity) DeepCopy() *Identity {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Identity)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityParameters) DeepCopy() *IdentityParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IsoConfiguration) DeepCopy() *IsoConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IsoConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IpConfiguration) DeepCopy() *IpConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IpConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityProvider) DeepCopy() *IdentityProvider {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProvider)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IstioConfig) DeepCopy() *IstioConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IstioConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PKIConfig) DeepCopy() *PKIConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PKIConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *OCIConfiguration) DeepCopy() *OCIConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OCIConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityProviderParameters) DeepCopy() *IdentityProviderParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProviderParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *DatastoreProperties) SetIdentityProviderConfiguration(v *IdentityProviderConfiguration) *DatastoreProperties {\n\ts.IdentityProviderConfiguration = v\n\treturn s\n}", "func (in *LabelIdentity) DeepCopy() *LabelIdentity {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LabelIdentity)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Provider) IdentityConfig() msp.IdentityConfig {\n\treturn c.identityConfig\n}", "func (in *ContainernodepoolShieldedInstanceConfig) DeepCopy() *ContainernodepoolShieldedInstanceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainernodepoolShieldedInstanceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *InputConfig) DeepCopy() *InputConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InputConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityProviderDetails) DeepCopy() *IdentityProviderDetails {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProviderDetails)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSManagedConfiguration) DeepCopy() *EKSManagedConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSManagedConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityObservation) DeepCopy() *IdentityObservation {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityObservation)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *UserAssignedIdentityDetails) DeepCopy() *UserAssignedIdentityDetails {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UserAssignedIdentityDetails)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *UserAssignedIdentityDetails) DeepCopy() *UserAssignedIdentityDetails {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UserAssignedIdentityDetails)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *CreateFHIRDatastoreInput) SetIdentityProviderConfiguration(v *IdentityProviderConfiguration) *CreateFHIRDatastoreInput {\n\ts.IdentityProviderConfiguration = v\n\treturn s\n}", "func (c *IssuerConfig) Copy() *IssuerConfig {\n\td := new(IssuerConfig)\n\tcopier.Copy(d, c)\n\treturn d\n}", "func (in *AuthenticationOperatorConfig) DeepCopy() *AuthenticationOperatorConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthenticationOperatorConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EncryptionConfiguration) DeepCopy() *EncryptionConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EncryptionConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityProviderType) DeepCopy() *IdentityProviderType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProviderType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ContainerImageConfiguration) DeepCopy() *ContainerImageConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainerImageConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NotificationsConfig) DeepCopy() *NotificationsConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationsConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LabelIdentityList) DeepCopy() *LabelIdentityList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LabelIdentityList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CASignedConfig) DeepCopy() *CASignedConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CASignedConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ContainernodepoolSandboxConfig) DeepCopy() *ContainernodepoolSandboxConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainernodepoolSandboxConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ImageConfig) DeepCopy() *ImageConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ImageConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NotificationConfig) DeepCopy() *NotificationConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NotificationConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSCFConfiguration) DeepCopy() *EKSCFConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSCFConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityConfiguration) DeepCopyInto(out *IdentityConfiguration) {\n\t*out = *in\n\treturn\n}", "func (in *Configurator) DeepCopy() *Configurator {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configurator)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityProviderList) DeepCopy() *IdentityProviderList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProviderList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfig) DeepCopy() *LoggingConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AutoscaleConfig) DeepCopy() *AutoscaleConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AutoscaleConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NamespaceConfig) DeepCopy() *NamespaceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NamespaceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DiamondConfig) DeepCopy() *DiamondConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DiamondConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityProviderObservation) DeepCopy() *IdentityProviderObservation {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProviderObservation)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LabelIdentitySpec) DeepCopy() *LabelIdentitySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LabelIdentitySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IngressConfig) DeepCopy() *IngressConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IngressConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NetworkConfiguration) DeepCopy() *NetworkConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationConfiguration) DeepCopy() *ApplicationConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IdentityProviderSpec) DeepCopy() *IdentityProviderSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IdentityProviderSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o ClusterOutput) WorkloadIdentityConfig() ClusterWorkloadIdentityConfigOutput {\n\treturn o.ApplyT(func(v *Cluster) ClusterWorkloadIdentityConfigOutput { return v.WorkloadIdentityConfig }).(ClusterWorkloadIdentityConfigOutput)\n}", "func (in *MongoDBConfiguration) DeepCopy() *MongoDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MongoDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AutoMLSecurityConfig) DeepCopy() *AutoMLSecurityConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AutoMLSecurityConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSAccessRequestConfiguration) DeepCopy() *AWSAccessRequestConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSAccessRequestConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *UsernameConfigurationType) DeepCopy() *UsernameConfigurationType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(UsernameConfigurationType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ProviderConfiguration) DeepCopy() *ProviderConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EmailConfigurationType) DeepCopy() *EmailConfigurationType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EmailConfigurationType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ServerIdentityParameters) DeepCopy() *ServerIdentityParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServerIdentityParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o ClusterOutput) IdentityServiceConfig() ClusterIdentityServiceConfigOutput {\n\treturn o.ApplyT(func(v *Cluster) ClusterIdentityServiceConfigOutput { return v.IdentityServiceConfig }).(ClusterIdentityServiceConfigOutput)\n}", "func (in *BaseKubernetesContainerConfiguration) DeepCopy() *BaseKubernetesContainerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseKubernetesContainerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretboxConfiguration) DeepCopy() *SecretboxConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretboxConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigFile) DeepCopy() *ConfigFile {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigFile)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AESConfiguration) DeepCopy() *AESConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AESConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BatchAccountIdentity) DeepCopy() *BatchAccountIdentity {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BatchAccountIdentity)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObjectStorageConfig) DeepCopy() *ObjectStorageConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectStorageConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mr *MockClientMockRecorder) IdentityConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityConfig\", reflect.TypeOf((*MockClient)(nil).IdentityConfig))\n}", "func identityConfig(nbits int) (native.Identity, error) {\n\t// TODO guard higher up\n\tident := native.Identity{}\n\tif nbits < 1024 {\n\t\treturn ident, errors.New(\"bitsize less than 1024 is considered unsafe\")\n\t}\n\n\tlog.Infof(\"generating %v-bit RSA keypair...\", nbits)\n\tsk, pk, err := ci.GenerateKeyPair(ci.RSA, nbits)\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\n\t// currently storing key unencrypted. in the future we need to encrypt it.\n\t// TODO(security)\n\tskbytes, err := sk.Bytes()\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PrivKey = base64.StdEncoding.EncodeToString(skbytes)\n\n\tid, err := peer.IDFromPublicKey(pk)\n\tif err != nil {\n\t\treturn ident, err\n\t}\n\tident.PeerID = id.Pretty()\n\tlog.Infof(\"new peer identity: %s\\n\", ident.PeerID)\n\treturn ident, nil\n}", "func (in *MultiClusterConfig) DeepCopy() *MultiClusterConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MultiClusterConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MariaDBConfiguration) DeepCopy() *MariaDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MariaDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EncryptionConfig) DeepCopy() *EncryptionConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EncryptionConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateEndpointIPConfiguration) DeepCopy() *PrivateEndpointIPConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateEndpointIPConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSConfiguration) DeepCopy() *AWSConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConnectionprofileSslConfig) DeepCopy() *ConnectionprofileSslConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConnectionprofileSslConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GcePersistentDiskCsiDriverConfig) DeepCopy() *GcePersistentDiskCsiDriverConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GcePersistentDiskCsiDriverConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LabelingJobAlgorithmsConfig) DeepCopy() *LabelingJobAlgorithmsConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LabelingJobAlgorithmsConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IngressTLSConfig) DeepCopy() *IngressTLSConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IngressTLSConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func LDAPIdentityProvider() *LDAPIdentityProviderApplyConfiguration {\n\treturn &LDAPIdentityProviderApplyConfiguration{}\n}", "func (in *RedisConfiguration) DeepCopy() *RedisConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggerConfig) DeepCopy() *LoggerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MetricsConfiguration) DeepCopy() *MetricsConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MetricsConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IngressShimConfig) DeepCopy() *IngressShimConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IngressShimConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Config) DeepCopy() *Config {\n\tif c == nil {\n\t\treturn &Config{}\n\t}\n\tcfg := *c\n\treturn &cfg\n}", "func (in *OCICacheConfiguration) DeepCopy() *OCICacheConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OCICacheConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *FrontendIPConfig) DeepCopy() *FrontendIPConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FrontendIPConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerLoggerConfiguration) DeepCopy() *ControllerManagerLoggerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerLoggerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DeviceSecretVerifierConfigType) DeepCopy() *DeviceSecretVerifierConfigType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DeviceSecretVerifierConfigType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NetworkPolicyConfig) DeepCopy() *NetworkPolicyConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkPolicyConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NetworkPolicyConfig) DeepCopy() *NetworkPolicyConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkPolicyConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShieldedInstanceConfig) DeepCopy() *ShieldedInstanceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShieldedInstanceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewConfiguration(authKeySize int, encryptEnabled bool, encapEnabled bool, wireguardEnabled bool, hsIpcacheDSRenabled bool, mtu int, mtuDetectIP net.IP) Configuration {\n\tencryptOverhead := 0\n\n\tif mtu == 0 {\n\t\tvar err error\n\n\t\tif mtuDetectIP != nil {\n\t\t\tmtu, err = getMTUFromIf(mtuDetectIP)\n\t\t} else {\n\t\t\tmtu, err = autoDetect()\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Warning(\"Unable to automatically detect MTU\")\n\t\t\tmtu = EthernetMTU\n\t\t}\n\t}\n\n\tif encryptEnabled {\n\t\t// Add the difference between the default and the actual key sizes here\n\t\t// to account for users specifying non-default auth key lengths.\n\t\tencryptOverhead = EncryptionIPsecOverhead + (authKeySize - EncryptionDefaultAuthKeyLength)\n\t}\n\n\tfullTunnelOverhead := TunnelOverhead\n\tif hsIpcacheDSRenabled {\n\t\tfullTunnelOverhead += DsrTunnelOverhead\n\t}\n\n\tconf := Configuration{\n\t\tstandardMTU: mtu,\n\t\ttunnelMTU: mtu - (fullTunnelOverhead + encryptOverhead),\n\t\tpostEncryptMTU: mtu - TunnelOverhead,\n\t\tpreEncryptMTU: mtu - encryptOverhead,\n\t\tencapEnabled: encapEnabled,\n\t\tencryptEnabled: encryptEnabled,\n\t\twireguardEnabled: wireguardEnabled,\n\t}\n\n\tif conf.tunnelMTU < 0 {\n\t\tconf.tunnelMTU = 0\n\t}\n\n\treturn conf\n}", "func (in *DebugRuleConfiguration) DeepCopy() *DebugRuleConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DebugRuleConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewIdentityBuilder() *IdentityBuilder {\n\treturn &IdentityBuilder{}\n}", "func (in *GitPipelineInputConfig) DeepCopy() *GitPipelineInputConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitPipelineInputConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in Config) DeepCopy() Config {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Config)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "func (in *SecretAccessRequestConfiguration) DeepCopy() *SecretAccessRequestConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretAccessRequestConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RootCredentialConfig) DeepCopy() *RootCredentialConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RootCredentialConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mr *MockProvidersMockRecorder) IdentityConfig() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"IdentityConfig\", reflect.TypeOf((*MockProviders)(nil).IdentityConfig))\n}", "func DeepCopy_v1_ImagePolicyConfig(in interface{}, out interface{}, c *conversion.Cloner) error {\n\t{\n\t\tin := in.(*ImagePolicyConfig)\n\t\tout := out.(*ImagePolicyConfig)\n\t\t*out = *in\n\t\tif in.ResolutionRules != nil {\n\t\t\tin, out := &in.ResolutionRules, &out.ResolutionRules\n\t\t\t*out = make([]ImageResolutionPolicyRule, len(*in))\n\t\t\tcopy(*out, *in)\n\t\t}\n\t\tif in.ExecutionRules != nil {\n\t\t\tin, out := &in.ExecutionRules, &out.ExecutionRules\n\t\t\t*out = make([]ImageExecutionPolicyRule, len(*in))\n\t\t\tfor i := range *in {\n\t\t\t\tif err := DeepCopy_v1_ImageExecutionPolicyRule(&(*in)[i], &(*out)[i], c); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func (in *JobConfig) DeepCopy() *JobConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(JobConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.7011574", "0.6334423", "0.60347545", "0.57493186", "0.571666", "0.56987476", "0.5546887", "0.5438429", "0.5377126", "0.5345208", "0.5251954", "0.5242645", "0.523284", "0.510815", "0.5105444", "0.50964445", "0.50964445", "0.5054068", "0.5006278", "0.50049424", "0.49703652", "0.49703652", "0.4963517", "0.4949122", "0.49209714", "0.49170834", "0.49078172", "0.4821004", "0.4818515", "0.4816502", "0.4815983", "0.4815983", "0.4815983", "0.4808762", "0.48078445", "0.47874022", "0.47645986", "0.47441095", "0.47425395", "0.4732507", "0.47275105", "0.47136685", "0.47065902", "0.46757588", "0.4670484", "0.46699986", "0.4669732", "0.46661282", "0.4661819", "0.46588525", "0.46502912", "0.46201393", "0.46199834", "0.4607506", "0.4587328", "0.4585849", "0.45780692", "0.45577076", "0.45507148", "0.4530932", "0.4509271", "0.4508524", "0.45001006", "0.44976774", "0.44867283", "0.446962", "0.44671455", "0.4445113", "0.44442797", "0.44417033", "0.44352448", "0.44248304", "0.4423414", "0.44067353", "0.44055554", "0.44043252", "0.43862972", "0.43669933", "0.43667287", "0.4362432", "0.43609518", "0.4349862", "0.4348224", "0.4341806", "0.43393987", "0.43318668", "0.433093", "0.43298262", "0.43298262", "0.43296975", "0.43184915", "0.43184307", "0.43184003", "0.43026546", "0.43015775", "0.4295964", "0.42925015", "0.42913282", "0.4283049", "0.4278405" ]
0.84669703
0